~jojo/Carth

90ccdf348077c4cc7381c1b01ce141ef6c4a848d — JoJo 1 year, 1 month ago bc0644a
std: Woops forgot to commit these a couple ago
2 files changed, 8 insertions(+), 2 deletions(-)

M std/iter.carth
M std/math.carth
M std/iter.carth => std/iter.carth +3 -2
@@ 88,8 88,9 @@
    (maybe a (fun ([x xs']) (rev xs' (iter/cons x a))) (next xs)))
  (rev xs iter/nil))

(define (iter/length xs)
  (foldl (<o const inc) 0 xs))
(define: (count xs)
    (forall (a) (Fun (Iter a) Nat))
  (foldl (<o const inc) (cast 0) xs))

(define enumerate (zip (range-from (: (cast 0) Nat))))


M std/math.carth => std/math.carth +5 -0
@@ 8,6 8,11 @@
(define (inc n) (+ n (cast 1)))
(define (dec n) (- n (cast 1)))

(define (neg x) (- 0 x))

(define (min a b) (if (< a b) a b))
(define (max a b) (if (> a b) a b))

(define (square x) (* x x))

(define (and p q) (if p q    False))