Welcome to the CHICKEN Scheme pasting service

newline-counting port added by evhan on Tue Nov 6 04:39:02 2012

(define newlines 0) ; Should be encapsulated somehow.

(define (make-newline-counting-input-port port)
  (make-input-port
   (lambda ()                                   ; read-char
     (let ((c (read-char port)))
       (if (not (eq? c #\newline))
           c
           (begin
             (set! newlines (add1 newlines))
             c))))
   char-ready?                                  ; char-ready?
   (lambda ()                                   ; close
     (close-input-port port))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `foreign-declare'?
Visually impaired? Let me spell it for you (wav file) download WAV