Created
July 9, 2009 14:10
-
-
Save shelling/143696 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 push | |
;; (lambda (array scalar) | |
;; '(array . scalar))) | |
(define puts | |
(lambda (text) | |
(display text)(newline))) | |
(define print | |
(lambda (content) | |
(if (list? content) | |
(for content display) | |
(display content)))) | |
;; this is a for loop like ruby | |
(define for | |
(lambda (enum proc) | |
(proc (car enum)) | |
(if (not (null? (cdr enum))) | |
(for (cdr enum) proc)))) | |
(define range | |
(lambda (body end) | |
(if (list? body) | |
(if (> (+ 1 (- end (car body))) (length body)) | |
(range (append! body (list (+ (car body) (length body)))) end) | |
(cdr (cons 'nil body))) | |
(range (list body) end)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment