summaryrefslogtreecommitdiff
path: root/not-quite-lisp/main.scm
blob: 2d54c54f395c2aad29e88683353f7a52fa8dc8a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
;; -*- compile-command: "guile -L . -e main -s main.scm < input.txt"; -*-
(use-modules (nql)
	     ((ice-9 rdelim))
	     (ice-9 binary-ports))


(define (stdin-to-str)
  (let loop ((result ""))
    (let ((line (read-line)))
      (if (eof-object? line)
	  result
	  (loop (string-append result line "\n"))))))

(define (main args)
  (let ((result
	 (if (null? (cdr args))
	     (nql (stdin-to-str) #t)
	     (nql (stdin-to-str) #f))))
    (display result))
  (newline))