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.Linq; | |
class Program | |
{ | |
sealed class EscapeContinuation<T> : Exception | |
{ | |
public T Value { get; private set; } | |
public void Raise(T 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
(define (>> n i) (bitwise-arithmetic-shift n (- i))) | |
(define << bitwise-arithmetic-shift-left) | |
(define & bitwise-and) | |
(define (split n p) | |
(let* ((bc (bitwise-length n)) | |
(mid (div bc 2))) | |
(define (get-bit-seq s c) | |
(let ((rs (- bc s c)) | |
(m (- (<< 1 c) 1))) |
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.Text.RegularExpressions; | |
class Program | |
{ | |
static int Main(string[] args) | |
{ | |
string line = null; | |
while ((line = Console.ReadLine()) != 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
var ast = SyntaxTree.ParseText(@" | |
namespace Foo { | |
#define MyIf = if | |
#define MyElse = else | |
public class some | |
{ | |
public void someMethod() | |
{ | |
MyFor(int i = 0; i < 10; i++) |
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 IronScheme; | |
using System; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var kk = "'hello".Eval(); | |
Console.WriteLine(kk); |
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
static IEnumerable<T> Map<T>(this Func<IEnumerable<T>, T> f, params IEnumerable<T>[] arr) | |
{ | |
var enums = Array.ConvertAll(arr, x => x.GetEnumerator()); | |
try | |
{ | |
while (enums.All(x => x.MoveNext())) | |
{ | |
yield return f(enums.Select(x => x.Current)); | |
} | |
} |
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 re = new Regex(string.Format(@" | |
(({0} # switch | |
(?<name>[_A-Za-z][_\w]*) # name (any legal C# name) | |
({1} # sep + optional space | |
(((""(?<value>((\\"")|[^""])*)"")| # match a double quoted value (escape "" with \) | |
('(?<value>((\\')|[^'])*)'))| # match a single quoted value (escape ' with \) | |
(\{{(?<arrayval>[^\}}]*)\}})| # list value (escaped for string.Format) | |
(?<value>\S+)) # any single value | |
)?)| # sep option + list | |
(((""(?<value>((\\"")|[^""])*)"")| # match a double quoted value (escape "" with \) |
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
private static bool IsLetterOrUnicodeSchemeIdentifier(char num) | |
{ | |
if (num < '\x0080') | |
{ | |
return char.IsLetter(num); | |
} | |
switch (char.GetUnicodeCategory(num)) | |
{ | |
case UnicodeCategory.UppercaseLetter: | |
case UnicodeCategory.LowercaseLetter: |
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 Foo | |
{ | |
static string bar; | |
internal static readonly Random RANDOM = new Random(); | |
internal const int SLEEP1 = 10; | |
internal const int SLEEP2 = 25; | |
public void Baz(string value) | |
{ | |
bar = "#1: " + 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 Cons<Car, Cdr> | |
{ | |
public Car Car { get; set; } | |
public Cdr Cdr { get; set; } | |
} | |
class List<T> : Cons<T, List<T>> | |
{ | |
} |
OlderNewer