From 3d119f8c87ebb54e0b137fc9bacc6661c46789b2 Mon Sep 17 00:00:00 2001 From: VaclavT Date: Thu, 11 Feb 2021 23:37:57 +0100 Subject: [PATCH] stdlib dir created --- tmp/example.lisp => stdlib/stdlib.lisp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) rename tmp/example.lisp => stdlib/stdlib.lisp (80%) diff --git a/tmp/example.lisp b/stdlib/stdlib.lisp similarity index 80% rename from tmp/example.lisp rename to stdlib/stdlib.lisp index c481377..149eff4 100644 --- a/tmp/example.lisp +++ b/stdlib/stdlib.lisp @@ -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))) - )) +