1 (in-package :lambda-utils
)
3 (defparameter *default-external-format
* :utf-8
)
6 ;;; Line oriented Processing
9 (defmacro each-line
((var stream
) &body body
)
10 "Execute body for each line of stream"
11 `(loop for
,var
= (read-line ,stream nil nil
)
15 (defun collect-lines (stream f
)
16 "Collect (f line) for the lines of stream"
17 (loop for line
= (read-line stream nil nil
)
19 collect
(funcall f line
)))
26 (def-input-fun slurp
(stream)
27 (let ((seq (make-string (file-length stream
))))
28 (read-sequence seq stream
)
33 ;;; *standard-output* and *standard-input*
36 (defmacro redirect
(file &body body
)
37 `(with-open-file (*standard-output
* ,file
:direction
:output
:if-exists
:supersede
)