Skip to content

Instantly share code, notes, and snippets.

View takahisa's full-sized avatar

Takahisa Watanabe takahisa

  • Cybozu, Inc
  • Tokyo, Japan
View GitHub Profile

Ioでブログ的なものが作りたかった

##Io向けのフレームワーク

let ws = [' ' '\t' '\r' '\n']
let digit = ['0'-'9']
let lower = ['a'-'z']
let upper = ['A'-'Z']
let letter = lower | upper
let newline = "\r\n" | ['\r' '\n']
Enumerator := Object clone do(
current := method(Exception raise("not implemented"))
moveNext := method(Exception raise("not implemented"))
reset := method(Exception raise("not implemented"))
)
Enumerable := Object clone do(
enumerator := method(Exception raise("not implemented"))
)
Enumerator := Object clone do(
current := method(Exception raise("not implemented"))
moveNext := method(Exception raise("not implemented"))
reset := method(Exception raise("not implemented"))
)
Enumerable := Object clone do(
enumerator := method(Exception raise("not implemented"))
)
@takahisa
takahisa / gist:1858379
Created February 18, 2012 09:11
YacqReader(Parseq版)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XSpect.Yacq.Expressions;
using Parseq;
using Parseq.Combinators;
module Esolang
open System
open System.IO
open FParsec
open FParsec.CharParsers
open FParsec.Primitives
open FParsec.Error
type Pattern =
| As of Pattern * Pattern
class Parser
rule
target : unit
| { result = 0 }
unit : stat
| unit stat
stat : expr SEMICOLON
@takahisa
takahisa / a.cs
Created November 2, 2011 11:49 — forked from takeshik/a.cs
abstract class X
{
public abstract T Get<T>();
public object P { get { return this.Get<Object>(); } }
}
class X<T> : X
{
public override T Get<T>() { return default(T); }
public T Get() { return this.Get<T>(); }
// こんな感じのクラスを作って
abstract class Super<T> {
public abstract Super<U> Foo<U>(Func<T,U> map);
}
// Super<T>を継承したSub<T>を作って、それを実装する時
class Sub<T> : Super<T> {
   // ↓こうなるのを
public override Super<U> Foo<U>(Func<T,U> map) { ... }
@takahisa
takahisa / gist:1193486
Created September 4, 2011 20:47
HeadacheでFizzBuzz
let fizz_buzz : \n ->
let fizz_buzz : \i -> \n ->
( let m : ( + i 1 ) ->
( cond ( > i n ) ()
( cond ( = ( % i 15 ) 0 ) ( >>= ( puts "fizzbuzz" ) ( fizz_buzz m n ) )
( cond ( = ( % i 3 ) 0 ) ( >>= ( puts "fizz" ) ( fizz_buzz m n ) )
( cond ( = ( % i 5 ) 0 ) ( >>= ( puts "buzz" ) ( fizz_buzz m n ) )
( >>= ( puts i ) ( fizz_buzz m n ) ) ) ) ) ) ) -> fizz_buzz 1 n ;