- Ioの普及のために入門サイト的ブログが作りたかった
- どうせならブログもIoで書きたい
- インスパイア元 [http://tanakh.jp/posts/2011-11-05-haskell-infra.html]
##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")) | |
| ) |
| 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 |
| 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) { ... } |
| 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 ; |