egison 3.5.8 → 3.5.9
raw patch · 4 files changed
+33/−10 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- egison.cabal +1/−1
- lib/core/collection.egi +17/−8
- lib/core/io.egi +6/−0
- lib/core/number.egi +9/−1
egison.cabal view
@@ -1,5 +1,5 @@ Name: egison-Version: 3.5.8+Version: 3.5.9 Synopsis: Programming language with non-linear pattern-matching against non-free data Description: An interpreter for Egison, a **pattern-matching-oriented**, purely functional programming language.
lib/core/collection.egi view
@@ -91,41 +91,50 @@ {[<cons _ $xs> (drop (- n 1) xs)] [<nil> {}]})))) -(define $while+(define $take-while (lambda [$pred $xs] (match xs (list something) {[<nil> {}] [<cons $x $rs> (if (pred x)- {x @(while pred rs)}+ {x @(take-while pred rs)} {})]}))) -(define $while-by+(define $take-while-by (lambda [$pred $xs] (match xs (list something) {[<nil> {}] [<cons $x $rs> (if (pred x)- {x @(while-by pred rs)}+ {x @(take-while-by pred rs)} {x})]}))) -(define $until+(define $taile-until (lambda [$pred $xs] (match xs (list something) {[<nil> {}] [<cons $x $rs> (if (not (pred x))- {x @(until pred rs)}+ {x @(take-until pred rs)} {})]}))) -(define $until-by+(define $take-until-by (lambda [$pred $xs] (match xs (list something) {[<nil> {}] [<cons $x $rs> (if (not (pred x))- {x @(until-by pred rs)}+ {x @(take-until-by pred rs)} {x})]})))++(define $drop-while+ (lambda [$pred $xs]+ (match xs (list something)+ {[<nil> {}]+ [<cons $x $rs>+ (if (pred x)+ (drop-while pred rs)+ xs)]}))) ;; ;; cons, car, cdr
lib/core/io.egi view
@@ -20,6 +20,12 @@ [(write-to-port port "\n")] }))) +(define $display (compose show print))++(define $display-to-port+ (lambda [$port $x]+ (print-to-port port $ (show x))))+ (define $each-line (lambda [$proc] (do {[$eof (eof?)]}
lib/core/number.egi view
@@ -44,7 +44,7 @@ (define $find-factor (memoized-lambda [$n]- (match (while (lte? $ (floor (sqrt (itof n)))) primes) (list integer)+ (match (take-while (lte? $ (floor (sqrt (itof n)))) primes) (list integer) {[<join _ <cons (& ?(divisor? n $) $x) _>> x] [_ n]}))) @@ -55,6 +55,14 @@ {p @(prime-factorization (quotient n p))})]})) (define $p-f prime-factorization)++(define $n-adic+ (lambda [$n $x]+ (if (eq? x 0)+ {}+ (let {[$q (quotient x n)]+ [$r (remainder x n)]}+ {@(n-adic n q) r})))) (define $even? (lambda [$n]