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 iono str chr_tokens = | |
String.msplit {Haystack = str, Needle = chr_tokens} | |
fun iono_all str chr_tokens = | |
let fun iono_all' str chr_tokens memo = | |
case (iono str chr_tokens) of | |
Some("",c,s) => iono_all' s chr_tokens ((str1 c) :: memo) | |
| Some(p,c,s) => iono_all' s chr_tokens ((str1 c) :: p :: memo) | |
| None => List.rev (str :: memo) | |
in |
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
signature AUTHORITY_CONF = sig | |
val hash_length : int | |
val iterations : int | |
val derive_salt : int -> string -> string -> transaction int | |
end | |
signature AUTHORITY = sig | |
val auth_user : string -> string -> transaction (option int) | |
val add_user : string -> string -> transaction (option int) | |
end |
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
#lang racket | |
(define bound-prims '(+ - *)) | |
(define foo-list (gensym)) | |
(define foo-closure 'vector) | |
(define (foo exp [bound bound-prims] [c 0] [frees '()] [self (gensym "SELF_")]) | |
(match exp | |
;; auxilary to build lists | |
[`(,(== foo-list)) (list '() c frees)] |
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 Pair(car, cdr) { | |
this.car = car; | |
this.cdr = cdr; | |
} | |
function pairp(x) { return x instanceof Pair } | |
function cons(car,cdr) { return new Pair(car,cdr); } | |
function procedurep(x) { return x instanceof Function; } | |
function Var(c) { this.c = c } |
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 rec a_sock v vars vals = match (vars, vals) with | |
| (x :: xs, y :: ys) -> if v = x then Some y else a_sock v xs ys | |
| ([], []) -> None | |
| _ -> failwith "malformed environment" | |
module Eval = struct | |
type repr = string list -> int list -> int | |
let var v = fun vars vals -> match a_sock v vars vals with | |
| Some x -> x | |
| None -> failwith "var not found" |
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
cat reader.js eval.js base.js mk.js test.js | node |