Created
July 17, 2017 16:49
-
-
Save indraniel/7ddde0804280465a4e92f890dbbf348c to your computer and use it in GitHub Desktop.
An example file reading script with chicken scheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env csi -ss | |
;; An example file reading script with chicken scheme | |
(use extras) | |
(define (read-it file) | |
(let ((fh (open-input-file file))) | |
(let loop((c (read-line fh))) | |
(if (eof-object? c) | |
(close-input-port fh) | |
(begin | |
(print c) | |
(loop (read-line fh))))))) | |
(define (main args) | |
(define file (if (null? args) '() (car args))) | |
(if (null? file) | |
(display "Please supply a file name to read!\n") | |
(read-it file))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A chicken 5 version on linux (env -S)