This file contains 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
function array_union(a, b) { | |
var cache = {}; | |
function store(item) { | |
cache[item] = item; | |
} | |
a.forEach(store); | |
b.forEach(store); | |
return Object.keys(cache).map(function(key) { return cache[key]; }); |
This file contains 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
def var(name): | |
return (0, name) | |
def abs(name, body): | |
return (1, (name, body)) | |
def app(callee, argument): | |
return (2, (callee, argument)) | |
This file contains 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
((lambda (zero) | |
((lambda (inc) | |
(inc zero)) | |
(lambda (nat next init) | |
(next | |
(nat next init))))) | |
(lambda (next init) | |
init)) |
This file contains 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
module Pair exposing (..) | |
type alias Pair1 first second pair = | |
((first -> second -> pair) -> pair) | |
type Pair2 first second pair = | |
Pair2 ((first -> second -> pair) -> pair) |
This file contains 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
((@fun (zero) | |
((@fun (inc) | |
(inc zero)) | |
(@fun (nat next init) | |
(next | |
(nat next init))))) | |
(@fun (_next init) | |
init)) |
This file contains 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
zayoba : Decode.Value -> String | |
zayoba value = | |
let | |
decoder = Decode.map (Encode.encode 0) Decode.value | |
in | |
case Decode.decodeValue decoder value of | |
Ok result -> | |
result | |
_ -> |
This file contains 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
module.exports = { | |
identity: x => x | |
} |
This file contains 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
(((lambda (zero inc) (inc (inc zero))) | |
(lambda (next zero) zero)) | |
(lambda (num next zero) (next (num next zero)))) |
This file contains 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* ((inc (lambda (num succ zero) (succ (num succ zero)))) | |
(+ (lambda (num1 num2 succ zero) (num1 succ (num2 succ zero)))) | |
(* (lambda (num1 num2 succ zero) (num1 (num2 succ) zero))) | |
(0 (lambda (succ zero) zero)) | |
(1 (inc 0)) | |
(2 (+ 1 1)) | |
(4 (* 2 2))) | |
(* 4 4)) |
This file contains 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
term/fold var abs app term = | |
cond | |
var? term -> | |
var (var/get-id term) | |
abs? term -> | |
abs (abs/get-id term) (abs/get-body term) | |
app? term -> | |
app (app/get-abs term) (app/get-arg term) |
NewerOlder