Created
June 9, 2012 13:40
-
-
Save omegatakuma/2901014 to your computer and use it in GitHub Desktop.
position-lst.scm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (position key lst) | |
(let loop ((lst lst)(n 0)(result '())) | |
(cond | |
((null? lst) (reverse result)) | |
((eq? key (car lst))(loop (cdr lst) (+ n 1) (cons n result))) | |
(else (loop (cdr lst) (+ n 1) result))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment