newLISP Fan Club

Forum => newLISP in the real world => Topic started by: cameyo on November 17, 2018, 07:03:06 AM

Title: Apply error message
Post by: cameyo on November 17, 2018, 07:03:06 AM
The following expression give me an error:
(apply map list '((a 1) (b 2) (c 3)))
QuoteERR: list expected in function apply : list@4095B0

Instead, I wish the output was:
Quote((a b c) (1 2 3))

Can someone help me?

Thanks



cameyo
Title: Re: Apply error message
Post by: Lutz on November 17, 2018, 10:00:35 AM
Use transpose:



> (transpose '((a 1) (b 2) (c 3)))
((a b c) (1 2 3))
>


A hint will be added to the description of list in the manual.
Title: Re: Apply error message
Post by: cameyo on November 17, 2018, 12:05:49 PM
"transpose" works like i want :-)

But is the expression wrong logically or syntactically?

Why  "apply" does not receive a list?

Thanks again



cameyo
Title: Re: Apply error message
Post by: rickyboy on November 17, 2018, 03:58:46 PM
Quote from: "cameyo"But is the expression wrong logically or syntactically?

Why  "apply" does not receive a list?

This is what you had been looking for originally.


(apply map (cons list '((a 1) (b 2) (c 3))))
Title: Re: Apply error message
Post by: cameyo on November 18, 2018, 02:58:03 AM
Thanks.

A big help for me.



cameyo