some TODOs solved
This commit is contained in:
@@ -83,19 +83,22 @@
|
||||
; return 1 when list contains item otherwise nil
|
||||
(defn member (lst itm)
|
||||
(do
|
||||
; TODO check if is empty list
|
||||
(def found_index -1)
|
||||
(def i 0)
|
||||
(def lst_len (len lst))
|
||||
(if (list? lst)
|
||||
(do
|
||||
(def found_index -1)
|
||||
(def i 0)
|
||||
(def lst_len (len lst))
|
||||
|
||||
(while (and (< i lst_len) (= found_index -1))
|
||||
(if (= itm (index lst i))
|
||||
(set! found_index i)
|
||||
(set! i (+ i 1))
|
||||
))
|
||||
(while (and (< i lst_len) (= found_index -1))
|
||||
(if (= itm (index lst i))
|
||||
(set! found_index i)
|
||||
(set! i (+ i 1))
|
||||
))
|
||||
|
||||
(if (!= -1 found_index)
|
||||
#t
|
||||
(if (!= -1 found_index)
|
||||
#t
|
||||
nil)
|
||||
)
|
||||
nil)
|
||||
))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user