aboutsummaryrefslogtreecommitdiff
path: root/2022/template.cl
blob: 285e5b54c8e173dcaf5b50717e02a35b05aff8e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(defvar *prog-input*)

;;; After running file, if you enter a blank line, code will work on each
;;; line of input, until "end" is typed.
;;; Otherwise, the input is taken as a filename and code will be executed
;;; over each line in the file until EOF.
(let ((ui (read-line)))
  (if (equal ui "")
    (setq *prog-input* *standard-input*)
    (setq *prog-input* (open ui))))

(let
  ((inpt (read-line *prog-input* NIL)) )

  (loop until (or (string= inpt "end") (not inpt)) do
    (setq inpt (read-line *prog-input* NIL)))

  (print 1))

(if (not (eq *prog-input* *standard-input*))
  (close *prog-input*))