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; | |
namespace Crash | |
{ | |
public record class Test | |
{ | |
public override string ToString() | |
{ | |
return "Crash"; | |
} |
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; | |
namespace Option | |
{ | |
public abstract class Option | |
{ | |
public static Option Wrap<T>(T value) | |
where T : class | |
{ | |
if(ReferenceEquals(value, null)) |
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; | |
namespace Test | |
{ | |
public abstract class Expr {} | |
public record class Add(Expr left, Expr right) : Expr {} | |
public record class Sub(Expr left, Expr right) : Expr {} | |
public record class Mul(Expr left, Expr right) : Expr {} | |
public record class Div(Expr left, Expr right) : Expr {} | |
public record class Val(decimal value) : Expr {} |
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
var xs = from y in ys | |
where y % 2 == 0 | |
let x = y * 2 + 1 | |
select y; | |
var someResult = builder.AppendLine("Hello, world!") | |
.AppendLine("This is a test!"); |
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
var xs = from y in ys | |
where y % 2 == 0 | |
let x = y * 2 + 1 | |
select y; | |
var someResult = builder.AppendLine("Hello, world!") | |
.AppendLine("This is a test!"); |
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
Imports AW | |
Module Bot | |
' Variable to hold a reference to the bot instance. | |
Dim _instance As Instance | |
' Variable to hold a reference to avatar add handler. | |
Dim _avatarAddHandler As InstanceEventHandler | |
Sub Main() |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Math; | |
public class Point(double x, double y) | |
{ | |
public double X { get; } = x; | |
public double Y { get; } = y; | |
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
extern "C" fn foo() | |
{ | |
println("Hello, world!"); | |
} | |
struct Bar | |
{ | |
Foo: extern "C" fn() | |
} |
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
struct Blorp | |
{ | |
bar: ~int | |
} | |
impl Blorp | |
{ | |
fn wrap(value: ~int) -> Blorp | |
{ | |
Blorp { bar: 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
macro_rules! query( | |
(from $v:ident in $c:ident $(where $mw:expr)* select $ms:expr) => | |
($c.filter_mapped(|&$v| if(true $(&& $mw)*) { Some($ms) } else { None })) | |
) | |
fn main() | |
{ | |
let nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
let result1 = query!(from x in nums select x * 2); | |