[Xpath-ng] List constructor syntax
David Carlisle
davidc at nag.co.uk
Mon Dec 2 09:02:31 MST 2002
> I withdrew my
> objection to treating them the same -- did anyone else have one?
me, I think.
If I have a list of lists
(list (list 1 2) (list 3 4))
Then I can make a list of all their first elements, something like
(mapcar 'car (list (list 1 2) (list 3 4)))
(1 3)
(It's useful if your mail client has a built in lisp system:-)
But how's the (mapcar 'car function supposed to work if one of the
child lists was a singleton, it gets automatically flattened and then
presumably errors as you can't apply car to a non list.
So a simpler example: Is
(car (list 1))
which I'd expect to be 1
the same as
(car 1)
which is
Wrong type argument: listp, 1 ??
I'd have no problem with it being part of the function call semantics
that any function expecting a value can be passed a singleton list,
but I don't think I'd like to see singleton lists actually flattened in
the data model.
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
More information about the Xpath-ng
mailing list