Im learning Racket and have some troubles.
I want to iterate over a list and find the index of some value. I have the following code:
(define (index list entry)
(define index 0)
(for ([i list])
#:break (equal? i entry)
(+ index 1))
index)
Run Code Online (Sandbox Code Playgroud)
But the function always returns 0. Can anyone point out my mistake?
I know that there are functions for that, but I want to learn the syntax.