mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-08 05:27:33 +02:00
Added list-index2
This commit is contained in:
parent
b918770827
commit
b1091aabd6
1 changed files with 12 additions and 0 deletions
|
@ -40,6 +40,7 @@
|
|||
delete
|
||||
delete-duplicates
|
||||
list-insert-at!
|
||||
list-index2
|
||||
filter)
|
||||
(begin
|
||||
|
||||
|
@ -112,6 +113,17 @@
|
|||
(else
|
||||
(list-insert-at! (cdr lis) obj (- k 1)))))
|
||||
|
||||
;; Find index of element in list, or -1 if not found
|
||||
(define list-index2
|
||||
(lambda (e lst)
|
||||
(if (null? lst)
|
||||
-1
|
||||
(if (eq? (car lst) e)
|
||||
0
|
||||
(if (= (list-index2 e (cdr lst)) -1)
|
||||
-1
|
||||
(+ 1 (list-index2 e (cdr lst))))))))
|
||||
|
||||
; gensym-count : integer
|
||||
(define gensym-count 0)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue