diff options
author | Ben Sima <ben@bsima.me> | 2020-05-09 20:02:55 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-05-09 20:19:44 -0700 |
commit | 1542c85458dcd58bb6d40f1f8d3917f80298ddd2 (patch) | |
tree | fe83f9019c9f7fccaa72801c90d7731b3b736a00 /Alpha/Core.scm | |
parent | fe73a3bae04f01d3aafdc3d926b37017fce6bf40 (diff) |
Remove my nil thing
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)) |