Which version of newLisp are you using? Because in my Linux environment:
peter[~]$ echo $USER
peter
peter[~]$ echo $HOSTNAME
solarstriker.thuis.nl
peter[~]$ newlisp
newLISP v.9.4.5 on Linux IPv4, execute 'newlisp -h' for more info.
cormullion wrote:I don't think it works on all platforms...
It's probably not a matter of not "working", but simply not being defined on all platforms. HOSTNAME is not a default environment variable on WIN XP, for example.
But if your platform doesn't have it, you can always define it yourself.
...it is better to first strive for clarity and correctness and to make programs efficient only if really needed.
"Getting Started with Erlang" version 5.6.2
Its also a matter of what is passed on from the environment to the newLISP process. E.g. on Mac OS X HOSTNAME is defined when in the shell but not inside newLISP. But 'exec' can be used to still retrieve it on Unix: