README.md (3506B)
1 bg 2 === 3 4 mlish tests by Ben 5 6 `basics-general` 7 --- 8 ``` 9 (map [f : (→ A B)] [x* : (List A)] → (List B)) 10 (append [x* : (List A)] [y* : (List A)] → (List A)) 11 (fst [xy : (** A B)] → A) 12 (snd [xy : (** A B)] → B) 13 (member [x* : (List A)] [y : A] → Bool) 14 (foldl [f : (→ A B A)] [acc : A] [x* : (List B)] → A) 15 (foldr [f : (→ A B B)] [x* : (List A)] [acc : B] → B) 16 (filter [f : (→ A Bool)] [x* : (List A)] → (List A)) 17 (sum [x* : (List Float)] → Float) 18 (reverse [x* : (List A)] → (List A)) 19 ``` 20 21 `basics` 22 --- 23 ``` 24 (fn-list [f* : (List (→ A A))] [a : A] → A) 25 (count-letters/one [s : String] [c : Char] → Int) 26 (count-letters [s* : (List String)] [c : Char] → Int) 27 (flatten [x** : (List (List A))] → (List A)) 28 (insert [x : A] → (→ (List A) (List (List A)))) 29 (permutations [x* : (List A)] → (List (List A))) 30 (split [ab* : (List (** A B))] → (** (List A) (List B))) 31 (combine [a*b* : (** (List A) (List B))] → (List (** A B))) 32 (convolve [x* : (List Float)] [y* : (List Float)] → Float) 33 (mc [n : Int] [f : (→ A A)] [x : A] → A) 34 (square [n : Int] → Int) 35 (successor [mcn : (→ (→ A A) A A)] → (→ (→ A A) A A)) 36 (split2 [x* : (List A)] → (** (List A) (List A))) 37 (merge [x*+y* : (** (List Int) (List Int))] → (List Int)) 38 (mergesort {x* : (List Int)} → (List Int)) 39 (quicksort [x* : (List Int)] → (List Int)) 40 (fact [n : Int] → Int) 41 (range-aux [n : Int] → (List Int)) 42 (range [n : Int] → (List Int)) 43 (fact-acc [n : Int] → Int) 44 (fact-cps-aux [n : Int] [k : (→ Int Int)] → Int) 45 (fact-cps [n : Int] → Int) 46 (map-cps-aux [f : (→ A B)] [x* : (List A)] [k : (→ (List B) (List B))] → (List B)) 47 (map-cps [f : (→ A B)] [x* : (List A)] → (List B)) 48 ``` 49 50 `basics2` 51 --- 52 ``` 53 (map-index [is* : (List (** Int (List String)))] → (List (** String Int))) 54 (reduce-index [si* : (List (** String Int))] → (List (** String (List Int)))) 55 (make-index [is* : (List (** Int (List String)))] → (List (** String (List Int)))) 56 ``` 57 58 `huffman` 59 --- 60 ``` 61 (empty → Symbol*) 62 (singleton [s : String] → Symbol*) 63 (insert [s* : Symbol*] [s1 : String] → Symbol*) 64 (union [s1 : Symbol*] [s2 : Symbol*] → Symbol*) 65 (contains [s* : Symbol*] [s : Symbol] → Bool) 66 (list [x : A] → (List A)) 67 (append [x* : (List A)] [y* : (List A)] → (List A)) 68 (length [x* : (List A)] → Int) 69 (symbols [h : HTree] → Symbol*) 70 (weight [h : HTree] → Int) 71 (make-code-tree [left : HTree] [right : HTree] → HTree) 72 (decode-aux [bits : Bit*] [root : HTree] [current-branch : HTree] → SymbolList) 73 (decode [bits : Bit*] [tree : HTree] → SymbolList) 74 (choose-branch [bit : Bit] [branch : HTree] → HTree) 75 (adjoin-set [x : HTree] [set : HTreeSet] → HTreeSet) 76 (make-leaf-set [pair* : (List (× Symbol Int))] → HTreeSet) 77 sample-tree 78 sample-message 79 (encode [message : SymbolList] [tree : HTree] → Bit*) 80 (contains-symbol [s : Symbol] [tree : HTree] → Bool) 81 (encode-symbol [s : Symbol] [tree : HTree] → Bit*) 82 (generate-huffman-tree [pair* : (List (× Symbol Frequency))] → HTree) 83 (successive-merge [tree* : HTreeSet] → HTree) 84 rock-pair* 85 rock-tree (generate-huffman-tree rock-pair*)) 86 rock-message 87 rock-bit* (encode rock-message rock-tree)) 88 ``` 89 90 91 `lambda` 92 --- 93 ``` 94 (fresh [e : Λ] → Int) 95 (subst [e : Λ] [i : Int] [v : Λ] → Λ) 96 (simpl-aux [e : Λ] [i : Int] → (× Int Λ)) 97 (simpl [e : Λ] → Λ) 98 (eval [e : Λ] → Λ) 99 I (Lambda 0 (Var 0)) 100 K (Lambda 0 (Lambda 1 (Var 0))) 101 S (Lambda 0 (Lambda 1 (Lambda 2 (App (App (Var 0) (Var 2)) (App (Var 1) (Var 2)))))) 102 false (App S K) 103 ```