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
(* basic functions *) | |
let id x = x | |
let const x y = x | |
let compose f g = fun x -> f (g x) | |
let flip f = fun x y -> f y x | |
let fix f = (fun x -> f (fun y -> x x y)) (fun x -> f (fun y -> x x y)) | |
let void = fix (fun void x -> void) | |
(* data types *) | |
let match = id |
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 (generator func) | |
(define done #f) | |
(define res '()) | |
(define return '()) | |
(define next (lambda (val) | |
(func yield) | |
)) | |
(define (yield val) | |
(if done | |
(error "generator already closed") |
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
wvwwWWWwwvwvwwwWWWWWwWWWWwwwWwwWwwwwwwwvwvwwwWWwwwWWwvwwWWWwWWWwWWWWWWwvwvwWWWWWWwWWWWwWWWWwvwwvwwwwWWWWwwWWWWwWwwwvwwwWWWwwWwwWWWWwvWwwwWWwWWWWwWwwWWWWWWwWwwwwvwwwwWWWwwWWWWWwwwWwwwWWWwvWwwWwwwWWWWWWWWWWWwWwwwwwWWWWWwwwWwwwwWWWWWWWWWWWWWWwWWWWWWWWwwWwwwwwwwwwwWWWWWWWWWWwWwwwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWwwwwwwwwwwWwwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWwWwwwwwwwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWwWwwwwwwwwwwwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWWWwWwwwwwwwwwwwwwwwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwwwwwwwwwwWwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWwWwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwwwwwwwwwwwwwwwwwwwwwwwwwWwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwwwwwwwwwwwwwwww |
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
wvwwWWWwwvwwvwwWWwwWwwvwwWWWwWWWwvwWWwWWWwwWwwvwWwvwwwWWWwwWwwWWWWWWwvwwwWWWwwWw | |
wWWWWwvwwwWWwwwWWwvwwwWWWWWWWWWWWWwWWWWwwwWwwWwwwwwwwwwwwwwwwwvwwWWWWwWWWwWWWWWW | |
WWWWWWWWWwvwWWWwWWWwWWWWWWWWWWWWWWWwvwwwwWWWwwWWWWWwwwWwwwWWWwvwwwwWWWWwwWWWWwWw | |
wwvwWWWWWWWWWWWWWWWWwwwwwwwwwwwwwwvwWwwWwwwwwwwwwwwwwwwwwvWWWWWWWWWwwwwwwwwwwwww | |
wwWWWWWWWWWWwWWWWWwWwwWWWWWWWwWwwwwWWWWWWWWWwWwwwwwwWWWWWWWWWWWwWwwwwwwwwWWWWWWW | |
WWWWWWwWwwwwwwwwwwWWWWWWWWWWWWWWWwWwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWWWWwwwwwWWWWW | |
WWWWWWWWWWWWWWwwwwwwWwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWWwWwwwwwwwwwwwwwwwwwWWWWWWWW | |
WWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWWW | |
WwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwWWWWWWWWWWWWWWWWWWWWWWWWWWWwwwwwwwwwwwwwwWwwww | |
wwwwwwwwwwwwwWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwWwwwwwwwwwwwwwwwwwwwwwWWWWWWWWWWWWWWW |
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
let n0 = \f x -> x | |
let succ n = \f x -> f (n f x) | |
let add n m = \f x -> m f (n f x) | |
let mul n m = \f x -> m (n f) x | |
let n1 = succ n0 | |
let n2 = succ n1 | |
let n4 = mul n2 n2 | |
let n8 = mul n4 n2 | |
let n16 = mul n8 n2 |
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
package { | |
import flash.display.Sprite; | |
import flash.text.TextField; | |
public class Main extends Sprite { | |
public function Main() { | |
var tf : TextField = new TextField(); | |
this.addChild(tf); | |
var foo : Foo = new Foo("Alice", function (f : Function) : void { | |
tf.text = f(); // ok |
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
"use strict"; | |
/* | |
type schemes | |
TyScheme = | |
TyVar | |
| TyInt | |
| TyBool | |
| TyProd | |
| TyArrow |
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
"use strict"; | |
function ng(gf) { | |
let gen = gf(); | |
let it = gen.next(); | |
while (!it.done) { | |
if (it.value === null || it.value === undefined) { | |
return it.value; | |
} | |
it = gen.next(it.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
/* | |
* 簡単な言語処理系の実装 | |
* | |
* copyright (c) 2015 Susisu | |
*/ | |
"use strict"; | |
// AST | |
// 式 = プログラム の基底クラス |
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
package | |
{ | |
import flash.display.Sprite; | |
import flash.events.MouseEvent; | |
import flash.text.TextField; | |
import flash.text.TextFieldType; | |
import flash.net.navigateToURL; | |
import flash.net.URLRequest; |