Take notes on the command line: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: changed/added comments and whitespace, changed indentations.)
(Add Common Lisp implementation.)
Line 533: Line 533:
GOBACK
GOBACK
.</lang>
.</lang>

=={{header|Common Lisp}}==
<lang lisp>(defparameter *notes* "NOTES.TXT")

(defun format-date-time (stream)
(multiple-value-bind (second minute hour date month year) (get-decoded-time)
(format stream "~D-~2,'0D-~2,'0D ~2,'0D:~2,'0D:~2,'0D"
year month date hour minute second)))

(defun notes (args)
(if args
(with-open-file (s *notes* :direction :output
:if-exists :append
:if-does-not-exist :create)
(format-date-time s)
(format s "~&~A~{~A~^ ~}~%" #\Tab args))
(with-open-file (s *notes* :if-does-not-exist nil)
(when s
(loop for line = (read-line s nil)
while line
do (write-line line))))))

(defun main ()
(notes (uiop:command-line-arguments)))</lang>


=={{header|D}}==
=={{header|D}}==