This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| Func<int, int, int> addImpl = (a, b) => a + b; | |
| var add = Infix.Create(addImpl); | |
| Console.WriteLine(41 |add| 1); | |
| public class Infix<T1, T2, TResult> { | |
| public Func<T1, T2, TResult> Op; | |
| public static Infix<T2, TResult> operator | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Grid | |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| xmlns:filters="clr-namespace:LostTech.Stack.Extensibility.Filters;assembly=LostTech.Stack.Extensibility" | |
| xmlns:stack="https://schemas.losttech.software/stack/2022/xaml/all" | |
| stack:Layout.Version="2" | |
| > | |
| <Grid.RowDefinitions> | |
| <RowDefinition Height="Auto"/> | |
| <RowDefinition Height="*"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Diagnostics; | |
| using System.Runtime.InteropServices; | |
| using System.Runtime.Serialization; | |
| using System.Runtime.Serialization.Formatters.Binary; | |
| unsafe { | |
| IntPtr resource1 = Marshal.AllocHGlobal(sizeof(FakeUnmanagedRefcountedObject)); | |
| *(FakeUnmanagedRefcountedObject*)resource1 = default; // zero memory | |
| var i1 = new UnmanagedRefcountWrapper(resource1); | |
| i1.Value = 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // <PackageReference Include="ILGPU" Version="1.0.0-beta3" /> | |
| // <PackageReference Include="TypeNum" Version="0.2.0-CI-20210909-064812" /> | |
| using System.Runtime.InteropServices; | |
| using ILGPU; | |
| using ILGPU.Runtime; | |
| using ILGPU.Runtime.CPU; | |
| using TypeNum; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Grid | |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| xmlns:zones="clr-namespace:LostTech.Stack.Zones;assembly=Stack" | |
| xmlns:system="clr-namespace:System;assembly=mscorlib" | |
| mc:Ignorable="d" | |
| zones:Layout.Version="2" | |
| Width="1024" Height="576" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Grid | |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| xmlns:zones="clr-namespace:LostTech.Stack.Zones;assembly=Stack" | |
| mc:Ignorable="d" | |
| Width="1024" Height="576" | |
| d:DesignWidth="1024" | |
| d:DesignHeight="576" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <zones:Zone.Style> | |
| <Style> | |
| <Style.Triggers> | |
| <DataTrigger Binding="{Binding IsChecked, ElementName=StackLeftSide}" Value="True"> | |
| <Setter Property="zones:Zone.Layout"> | |
| <Setter.Value> | |
| <ItemsPanelTemplate> | |
| <UniformGrid Columns="1" /> | |
| </ItemsPanelTemplate> | |
| </Setter.Value> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <zones:Zone.Style> | |
| <Style> | |
| <Style.Triggers> | |
| <DataTrigger Binding="{Binding IsChecked, ElementName=StackLeftSide}" Value="True"> | |
| <Setter Property="zones:Zone.Layout"> | |
| <Setter.Value> | |
| <ItemsPanelTemplate> | |
| <UniformGrid Columns="1" /> | |
| </ItemsPanelTemplate> | |
| </Setter.Value> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> class MyList(list): | |
| ... def __getitem__(self, idx): | |
| ... print('hello') | |
| ... return super().__getitem__(idx) | |
| ... | |
| >>> l = MyList() | |
| >>> l.append(42) | |
| >>> l[0] | |
| hello | |
| 42 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class List: | |
| def add(self, item): ... | |
| class ListMixin: | |
| def append(self, item): return self.add(item) | |
| def mix_in(target_type, mixin): | |
| ??? | |
| mix_in(List, ListMixin) |