Skip to content

Commit

Permalink
Added true? and false?
Browse files Browse the repository at this point in the history
  • Loading branch information
skx committed Oct 1, 2022
1 parent 3a6c153 commit bf7c73f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ We have a reasonable number of functions implemented, either in our golang core

Building upon those primitives we have a larger standard-library of functions written in Lisp such as:

* `abs`, `apply`, `append`, `cond`, `count`, `filter`, `lower`, `map`, `min`, `max`, `ms`, `nat`, `neg`, `now`, `nth`, `reduce`, `repeat`, `reverse`, `seq`, `strlen`, `upper`, `when`, `while`, etc.
* `abs`, `apply`, `append`, `cond`, `count`, `false?`, `filter`, `lower`, `map`, `min`, `max`, `ms`, `nat`, `neg`, `now`, `nth`, `reduce`, `repeat`, `reverse`, `seq`, `strlen`, `true?`, `upper`, `when`, `while`, etc.

Although the lists above should be up to date you can check the definitions to see what is currently available:

Expand Down
5 changes: 5 additions & 0 deletions stdlib/stdlib.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
(define even? (lambda (n) (zero? (% n 2))))
(define odd? (lambda (n) (! (even? n))))

;;
;; is the given argument "true", or "false"?
;;
(def! true? (fn* (arg) (if (eq #t arg) true false)))
(def! false? (fn* (arg) (if (eq #f arg) true false)))

;; Square root
(define sqrt (lambda (x:number) (# x 0.5)))
Expand Down

0 comments on commit bf7c73f

Please sign in to comment.