HP Forums
Just a simple question about "quote()". - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Just a simple question about "quote()". (/thread-10428.html)



Just a simple question about "quote()". - John P - 04-02-2018 04:09 AM

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.


RE: Just a simple question about "quote()". - cyrille de brébisson - 04-03-2018 06:23 AM

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


RE: Just a simple question about "quote()". - John P - 04-03-2018 03:57 PM

(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


RE: Just a simple question about "quote()". - cyrille de brébisson - 04-04-2018 06:00 AM

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


RE: Just a simple question about "quote()". - Arno K - 04-04-2018 06:14 AM

(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


RE: Just a simple question about "quote()". - parisse - 04-04-2018 04:36 PM

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...


RE: Just a simple question about "quote()". - John P - 04-05-2018 07:28 PM

Thank you all.

John