Support proper cons cells (dotted pairs) #60
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
seq-lisp-2-backport
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/seq-lisp#60
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Relax the
consconstraint to allow any value as the second argument, enabling proper dotted pairs and improper lists.Motivation
Currently seq-lisp's
consrequires a list as the second argument. This is non-standard — in Scheme/Common Lisp,(cons 1 2)produces the dotted pair(1 . 2).We hit this exact limitation during the document symbols LSP work, where
(cons #f pos)failed becauseposis a number. We had to uselistas a workaround.seq-lisp-2 implements this correctly with
SCons { car, cdr }wherecdrcan be any value.Scope
consinsrc/eval.seqto accept any value as second argument(1 . 2))car/cdrto work on dotted pairsmap,filter,length, etc.) handle improper lists gracefullyNotes
This makes the Lisp more standard and eliminates a class of surprising runtime errors.
Inspired by
seq-lisp-2/src/types.seqSConstype.