Welcome to the CHICKEN Scheme pasting service

crasher added by sethalves on Sat May 17 05:23:08 2014

#! /bin/sh
#| -*- scheme -*-
exec csi -s $0 "$@"

;; dd if=/dev/zero of=/tmp/ok bs=3075 count=1

(use srfi-4)
(use ports)

(define (make-delimited-textual-input-port port len)
  (let loop ((i 0)
             (segments '()))
    (define (return-result)
      ;; (display "len=")
      ;; (write (length segments))
      ;; (newline)
      (open-input-string (apply string-append (reverse segments))))
    (if (= i len)
        (let* ((to-read (if (> (+ i 25) len) (- len i) 25))
               (seg (read-string to-read port)))
          (cond ((eof-object? seg) (return-result))
                 (loop (+ i (string-length seg))
                       (cons seg segments))))))))

(let* ((bv (make-u8vector 1024))
       (read-port (open-input-file "/tmp/ok"))
       (pd (make-delimited-textual-input-port read-port 3075)))

  (let loop ()
    (let ((got (read-u8vector! #f bv pd)))
      (display got)
      (if (> got 0) (loop)))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Given a list, which one-argument R5RS procedure returns the element at index 0?
Visually impaired? Let me spell it for you (wav file) download WAV