Created
April 15, 2019 12:13
-
-
Save christianromney/ddf14a97db4f5886124780033aa80224 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#lang racket | |
(define es (list 1 2 3)) | |
(define base | |
(lambda (k) | |
(lambda (es) | |
'()))) | |
(define step | |
(lambda (k) | |
(lambda (es) | |
(cons (first es) | |
(k (rest es)))))) | |
(define butlast | |
(lambda (es) | |
((if (empty? (rest es)) | |
(base identity) | |
(step butlast)) es))) | |
(butlast es) ;; => '(1 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment