diff options
Diffstat (limited to 'Alpha/Core.scm')
-rw-r--r-- | Alpha/Core.scm | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/Alpha/Core.scm b/Alpha/Core.scm index 6666e7d..997bc4f 100644 --- a/Alpha/Core.scm +++ b/Alpha/Core.scm @@ -4,12 +4,12 @@ #:use-module ((ice-9 rdelim) #:select (read-line)) #:use-module ((srfi srfi-1) #:select (any)) #:export (fmt printf pr prn - first ffirst second rest last butlast - true? false? nil nil? some? empty? - -> ->> fn /. curry comp - repeat - inc dec member? contains? - comment get-source* get-source source)) + first ffirst second rest last butlast + true? false? some? empty? + -> ->> fn /. curry comp + repeat + inc dec member? contains? + comment get-source* get-source source)) (define (flip f) (lambda (x y) (f y x))) (define (curry f a) (lambda (b) (apply f (cons a (list b))))) @@ -56,11 +56,6 @@ (define (true? x) (eq? #t x)) -(define nil #nil) - -(define (nil? x) - (eq? nil x)) - (define (some? a) (not (nil? a))) @@ -71,7 +66,7 @@ "Return the first item in the collection." (if (pair? a) (car a) - nil)) + '())) (define (ffirst a) (first (first a))) @@ -95,19 +90,10 @@ (let ((len (length ls))) (list-head ls (- len 1)))) -;; Ignores body, returns nil. +;; Ignores body, returns '(). (define-syntax comment (syntax-rules () - ((_ ...) nil))) - -(comment - ;; nil is different from null. nil is supposed to be more like - ;; 'Nothing' in Haskell, it is the absence of any value or type; - ;; whereas null is specifically the empty list, which still has a type - ;; of 'list'. - (null? '()) ;; => #t - (nil? '()) ;; => #f - ) + ((_ ...) '()))) (define (some pred coll) (or (pred (first coll)) |