Details
-
Type:
Defect
-
Status:
Open
-
Priority:
Trivial
-
Resolution: Unresolved
-
Affects Version/s: Release 1.4
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Patch:Code and Test
Description
Function 'list?' returns sequence, but not a list.
It is a bit confusing.
user=> (list? (list* 1 '(2 3)))
false
Yep, these are all valid points, thanks! I see this as a question whether the list* function is a list constructor or not. If yes (and it would be possible to implement it in a satisfactory way), it should probably return a list.
We could avoid building a new list by sth like:
(if (list? args) args (apply list args))(btw, 'vec' also creates a new vector even when the argument itself is a vector)
The contract of next seems to be to return a seq, not a list - its docstring reads: "Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil."
Btw, in some Lisp/Scheme impls I checked, cons seems to be a list as well. E.g. in CLisp (and similar in Guile and Racket):
(if (list? args) args (apply list args))