Skip to content

Instantly share code, notes, and snippets.

@shirok
Created December 16, 2021 01:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shirok/63b01e3638b838aa6fd1817198b22fc3 to your computer and use it in GitHub Desktop.
Save shirok/63b01e3638b838aa6fd1817198b22fc3 to your computer and use it in GitHub Desktop.
(define (filter pred xs)
(define (skip xs)
(cond [(null? xs) xs]
[(pred (car xs)) xs]
[else (skip (cdr xs))]))
(unfold null?
(^[xs] (car xs))
(^[xs] (skip (cdr xs)))
(skip xs)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment