take functions added
This commit is contained in:
parent
d72b758c59
commit
1bbbee24fe
|
|
@ -60,7 +60,7 @@
|
||||||
(defun tenth (l) (index l 9))
|
(defun tenth (l) (index l 9))
|
||||||
(defun nth (i l) (index l (- i 1)))
|
(defun nth (i l) (index l (- i 1)))
|
||||||
|
|
||||||
; return 1 when list contains item otherwise 0
|
; return 1 when list contains item otherwise nil
|
||||||
(defun member (lst itm)
|
(defun member (lst itm)
|
||||||
(do
|
(do
|
||||||
; TODO check if is empty list
|
; TODO check if is empty list
|
||||||
|
|
@ -74,7 +74,6 @@
|
||||||
(set! i (+ i 1))
|
(set! i (+ i 1))
|
||||||
))
|
))
|
||||||
|
|
||||||
; TODO when nil will be implemented itm / nil
|
|
||||||
(if (!= -1 found_index)
|
(if (!= -1 found_index)
|
||||||
#t
|
#t
|
||||||
nil)
|
nil)
|
||||||
|
|
@ -123,6 +122,11 @@
|
||||||
rslt
|
rslt
|
||||||
))
|
))
|
||||||
|
|
||||||
|
(defun take (lst n)
|
||||||
|
(if (> (len lst) n)
|
||||||
|
(map (lambda (i) (index lst i)) (range 0 n))
|
||||||
|
lst))
|
||||||
|
|
||||||
(defun quick-sort-by (l cmp)
|
(defun quick-sort-by (l cmp)
|
||||||
(if (<= (len l) 1)
|
(if (<= (len l) 1)
|
||||||
l
|
l
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue