Created
December 16, 2021 01:39
-
-
Save shirok/19953e667a1084918b0e49b52fbad623 to your computer and use it in GitHub Desktop.
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 (filter pred xs) | |
(define (skip xs) | |
(cond [(null? xs) xs] | |
[(pred (car xs)) xs] | |
[else (skip (cdr xs))])) | |
(unfold (^[xs] (null? (skip xs))) | |
(^[xs] (car (skip xs))) | |
(^[xs] (cdr (skip xs))) | |
xs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment