Skip to content

Instantly share code, notes, and snippets.

@tbmreza
Last active November 7, 2023 08:21
Show Gist options
  • Save tbmreza/f1d21d1c695093fcf8a7498ab3fce370 to your computer and use it in GitHub Desktop.
Save tbmreza/f1d21d1c695093fcf8a7498ab3fce370 to your computer and use it in GitHub Desktop.
a growing snippet
#lang racket
(provide (all-defined-out))
(define any? any/c)
(define (until p f)
(define (go x)
(match x
[(? p x) x]
[_ (go (f x))]))
go)
(define (split-to-pairs l)
(cond [(empty? l) empty]
[(empty? (cdr l)) (list l)]
[else (cons (list (car l) (cadr l))
(split-to-pairs (cddr l)))]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment