Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Help [scheme]

Name: Anonymous 2008-01-27 7:29


(define (read-file port)
  (lambda (line)
    (if line
        (begin
        (display line)
        (read-file port))))
  (read-line port))

(call-with-input-file 'file read-file) ; doesnt work


y doesnt work ;_;

Name: Anonymous 2008-01-29 14:01

(define (read-file port)
  ((lambda (line)
     (if (not (eof-object? line))
         (begin
           (display line)
           (newline)
           (read-file port))))
   (read-line port)))

(call-with-input-file "/etc/hosts" read-file)
##
# Host Database
##
127.0.0.1    localhost
255.255.255.255    broadcasthost
::1             localhost
fe80::1%lo0    localhost

There, fixed your shitty code. Could be better, but I wanted to be as close to you FAIL code as possible.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List