there should be a function in SExpression that returns the empty list

12 views
Skip to first unread message

Qian Yun

unread,
May 1, 2026, 6:33:42 AMMay 1
to fricas-devel
There is function "null?" in SExpression, that checks for '(), aka NIL.

Currently the most simple way I can think of to get the empty
SExpression is: "[]::List SExpression::SExpression".
(Without using pretend.)

There should be a function
empty : () -> SExpression == NIL$Lisp
added.

- Qian

Martin R

unread,
May 2, 2026, 6:43:30 AMMay 2
to FriCAS - computer algebra system
convert([])@SEX works.

Waldek Hebisch

unread,
May 2, 2026, 10:33:04 AMMay 2
to fricas...@googlegroups.com
I used 'convert([])@SExpression'. In proper context (that is when
SExpression is the expected type) it is only marginally longer than
'empty()'.

I am not sure what is worth adding to SExpression. When working on
HyperDoc probably most notable thing was lack of convertion from
Boolean to SExpression. The second one was probably lack of 'cons'.

In general, one could try to add much more to SExpression. OTOH
we would like to have proper types for various things. SExpression
is mainly for low level code interfacing with Boot. Such low
level code by neccesity can not have proper static types, so
using 'pretend' for in such cases does not look too bad for me.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages