Added list comprehensions and standard List, Option, Func, Pair, and Triple library #596

Merged
zxq9 merged 19 commits from github/fork/radrow/list-comprehension into master 2019-08-14 20:53:58 +09:00
Showing only changes of commit 8d4e246686 - Show all commits

View File

@ -38,9 +38,7 @@ namespace Func =
private function iter_(n : int, f : 'a => 'a, acc : 'a => 'a) : 'a => 'a = private function iter_(n : int, f : 'a => 'a, acc : 'a => 'a) : 'a => 'a =
if(n == 0) acc if(n == 0) acc
elif(n == 1) comp(f, acc) elif(n == 1) comp(f, acc)
else iter_(n / 2, f, if(n mod 2 == 0) comp(acc, acc) else comp(f, comp(acc, acc))) else else iter_(n / 2, comp(f, f), if(n mod 2 == 0) acc else comp(f, acc))
function z(f : ('a => 'a, 'a) => 'a) : 'a => 'a = (x) => f(z(f), x)
function curry2(f : ('a, 'b) => 'c) : 'a => ('b => 'c) = function curry2(f : ('a, 'b) => 'c) : 'a => ('b => 'c) =
(x) => (y) => f(x, y) (x) => (y) => f(x, y)