HP Forums

Full Version: Just a simple question about "quote()".
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Could 'quote()' behave the same way on list's elements as "" does. What I mean when you do {a,b,c}.+"" you get {"a","b","c"} I would like to have when doing on list {a,b}.+quote() I would like to get {'a','b'}.
Thank you very much.
Hello,

What you seem to want to do is apply quote to each element of the list.
I have not tested it, but EXECON("quote(&1)", list); might do what you want.

Cyrille
(04-03-2018 06:23 AM)cyrille de brébisson Wrote: [ -> ]Hello,

What you seem to want to do is apply quote to each element of the list.
I have not tested it, but EXECON("quote(&1)", list); might do what you want.

Cyrille

Thank you Cirill,
I tried it in CAS history and i program and EXECON only works when the list has numerical elements as in {1,2,3}. When I wont to use a list with symbolic elements, {a,b,c}, EXECON does not work and gives me the error: "Error: Syntax Error".

Cheers
hello,

EXECON is a home command. I assumed that you were in home.
In cas, there is a similar command called zip if my memory serves me well.
But I do not know if it can do what you want as, from memory, it is designed for 2 operands operators.

apply might be worth looking at also as it might be a single operand based version of zip.

Cyrille
(04-04-2018 06:00 AM)cyrille de brébisson Wrote: [ -> ]hello,

EXECON is a home command. I assumed that you were in home.
In cas, there is a similar command called zip if my memory serves me well.
But I do not know if it can do what you want as, from memory, it is designed for 2 operands operators.

apply might be worth looking at also as it might be a single operand based version of zip.

Cyrille
I tried that with apply, it does not do what is wanted, at least with quote, squaring elements in a list works - as I had expected.
Arno
Since quote() prevents evaluation of its argument, it's not possible to use it inside a program or functional construction like in apply/map. Maybe you can quote objects in a list with the parser, but not sure...
Thank you all.

John
Reference URL's