Skip to content

Instantly share code, notes, and snippets.

@catharinejm
Last active December 31, 2015 01:48
Show Gist options
  • Select an option

  • Save catharinejm/7916223 to your computer and use it in GitHub Desktop.

Select an option

Save catharinejm/7916223 to your computer and use it in GitHub Desktop.
(define (read-vec port)
(if (eq? (peek-char port) #\])
(begin (read-char port) '())
(cons (read) (read-vec port))))
(set-read-syntax! #\[ (lambda (port)
(cons 'vector (read-vec port))))
;; REPL
#1> [1 2 [3 4]]
#(1 2 #(3 4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment