[ create a new paste ] login | about

Link: http://codepad.org/KRe0Vhx1    [ raw code | fork ]

Scheme, pasted on Mar 29:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(define-module (here-strings)
  #:use-module (ice-9 match))

(define (read-here-string c port)
  (unless (and (char=? #\" (read-char port))
               (char=? #\" (read-char port)))
    (error "Invalid here-string syntax"))
  (let loop ((chars '()))
    (match chars
      ((#\" #\" #\" . chars)
       (list->string (reverse! chars)))
      (_ (let ((c (read-char port)))
           (if (eof-object? c)
               (error "EOF within here-string")
               (loop (cons c chars))))))))

(read-hash-extend #\" read-here-string)


Create a new paste based on this one


Comments: