Input and output
LabLISP in the present state is somewhat limited when it comes to input and output. It is developed as scripting language for other programs and most of its iteractions with outside world are done through the LabLispHost system.
READ
Takes one string argument and passes it to the reader algorithm. Produces Lisp objects. Without having explicit EVAL
function, the READ
is just good for testing the reader behavior.
>(read "`(+ ,a ,b)") (BACKQUOTE (+ (UNQUOTE A) (UNQUOTE B)))
see also LOAD
PRINT
Takes one argument and passes it to the printer algorithm. Returns the argument back, but as a side effect, also prints it.
>(progn (print 'a) (print 'b) (print 'c)) A B C C ; return from the last PRINT
WRITE-TO-STRING
Takes one argument and passes it to printer. Returns the string representation of the object.
>(write-to-string '(+ 1 3)) "(+ 1 3)"
CONCATENATE
Takes any number of arguments, at least one. Converts them to strings as with WRITE-TO-STRING
and concatenates to one string.
>(concatenate 'id (+ 1 2) " tag") "ID3 tag"
TIME-STAMP
Produces string with actual date and time. Takes zero or one argument, the argument is optional formatting string, passed directly to QDateTime::toString()
. Use yy or yyyy for year, MM for month number, or MMM for month name, dd for day number, and hh:mm:ss.zzz for hours, minutes, seconds and milliseconds. Single t shows the time-zone.
>(time-stamp) "2024-05-04 19:18:41" ; standard date time format >(time-stamp "hh:mm:ss.zzz t") "19:28:37.412 W. Europe Summer Time" ; time including milliseconds, timezone >(time-stamp "MMM-dd") "May-04" ; may the fourth ....