In CL and scheme empty version of values and void are used to indicate nothing is returned.
(define (f)
(print 5)
(newline)
(void))
or
(defun f ()
(format #t "~d~%" 5)
(values))
Is there a newLISP equivalent? If not could there be?
--hsm
Something is always returned, but there is 'silent' function to suppress the return value being sent to the console.
Of course. So could we have one--- pretty please?
--hsm
use this one:
http://www.newlisp.org/downloads/newlisp_manual.html#silent
Ah! Bad me for not RTFM-ing!! 'silent' will do quite nicely. Thanks!
--hsm
But don't forget that (silent) has a strange side-effect: it will ask to press enter key to "finalize" the output, if used in the console (I didn't check the most recent version, but older newLisp versions do that).
Try this:
> (silent (println "ok"))
ok
>
After the output test "ok" there is an empty line: it is similar a (read-line).
I usually always end my silent expressions this way:
> (silent (println "ok?") (print "> ")) ; notice the space after '>'
ok?
> _
silent is merely suppressing the prompt newlisp usually prints. Hitting enter on an empty line prints the prompt again (what you are experiencing). (print "> ") at the end of a silent expression restores the normal prompt.
Or if you get tired of doing that every time, you could put this in your init.lsp file:
(set (global 'quiet) (fn ()
(eval (cons silent (args)))
(print "> ")
))
And use it like this:
> (quiet (println "ok"))
ok
> _
This still won't fool readline, but it does the job.
m i c h a e l
wow, this is a news for me, since I didn't notice that, even if prompt is suppressed, it is ready to accept new commands! Thank you for this trick!!
You're welcome. Glad I could be of help.
m i c h a e l