Skip to content

Instantly share code, notes, and snippets.

@indraniel
Created July 17, 2017 16:49
Show Gist options
  • Save indraniel/7ddde0804280465a4e92f890dbbf348c to your computer and use it in GitHub Desktop.
Save indraniel/7ddde0804280465a4e92f890dbbf348c to your computer and use it in GitHub Desktop.
An example file reading script with chicken scheme
#!/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)))
@indraniel
Copy link
Author

@markjfisher : A belated thank you for the chicken 5 update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment