summary refs log tree commit diff stats
path: root/lib.lith
diff options
context:
space:
mode:
authorSudipto Mallick <smallick.dev+lith@gmail.com>2020-07-06 19:18:09 +0000
committerSudipto Mallick <smallick.dev+lith@gmail.com>2020-07-07 13:52:17 +0000
commit5a8c3e315ef9892dfb6e23ade18955b26d58643c (patch)
tree2047965ff7084ddb0e25df18abbe6bec0c3baf67 /lib.lith
parentf843bdcb2e97a330cd72f91173895b0b37bb3dd8 (diff)
downloadlith-master.tar.gz
some more reformattings, library support master
Diffstat (limited to 'lib.lith')
-rw-r--r--lib.lith9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib.lith b/lib.lith
index 3a66062..4cd5591 100644
--- a/lib.lith
+++ b/lib.lith
@@ -15,6 +15,10 @@
     (eq? (typeof i) 'integer))
 (define (number? n)
     (eq? (typeof n) 'number))
+(define (boolean? n)
+    (eq? (typeof n) 'boolean))
+(define (string? s)
+    (eq? (typeof s) 'string))
 
 (define (foldl f init lst)
     (if (nil? lst)
@@ -38,8 +42,6 @@
             (car lst)
             (last (cdr lst)))))
 
-(define (begin . body) (last body))
-
 (define (reverse lst)
     (foldl (lambda (a x) (cons x a)) () lst))
 
@@ -126,6 +128,9 @@
 
 (define (mod a b) (:% a b))
 
+(define-macro (begin a . body)
+    `((lambda () ,a . ,body)))
+
 (define-macro (cond . body)
     (if (nil? body)
         (error "cond: no else clause")