stdlib dir created
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
; quicksort
|
||||
(defun qs (l)
|
||||
(defun quick-sort (l)
|
||||
(if (<= (len l) 1)
|
||||
l
|
||||
(do
|
||||
@@ -13,8 +13,10 @@
|
||||
|
||||
; decrement a number
|
||||
(defun dec (n) (- n 1))
|
||||
|
||||
; increment a number
|
||||
(defun inc (n) (+ n 1))
|
||||
|
||||
; not a bool
|
||||
(defun not (x) (if x 0 1))
|
||||
|
||||
@@ -23,12 +25,8 @@
|
||||
|
||||
; is a number positive?
|
||||
(defun is-pos? (n) (> n 0))
|
||||
|
||||
; is a number negative?
|
||||
(defun is-neg? (n) (< n 0))
|
||||
|
||||
; define a function `fact` that takes an argument `n`
|
||||
(defun fact (n)
|
||||
(if (<= n 1)
|
||||
1
|
||||
(* n (fact (- n 1)))
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user