Skip to content

Instantly share code, notes, and snippets.

@shelling
Created July 9, 2009 14:10
Show Gist options
  • Save shelling/143696 to your computer and use it in GitHub Desktop.
Save shelling/143696 to your computer and use it in GitHub Desktop.
;; (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