Post Reply 
Just a simple question about "quote()".
04-02-2018, 04:09 AM
Post: #1
Just a simple question about "quote()".
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.
Find all posts by this user
Quote this message in a reply
04-03-2018, 06:23 AM
Post: #2
RE: Just a simple question about "quote()".
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
04-03-2018, 03:57 PM
Post: #3
RE: Just a simple question about "quote()".
(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
Find all posts by this user
Quote this message in a reply
04-04-2018, 06:00 AM
Post: #4
RE: Just a simple question about "quote()".
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
04-04-2018, 06:14 AM
Post: #5
RE: Just a simple question about "quote()".
(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
Find all posts by this user
Quote this message in a reply
04-04-2018, 04:36 PM
Post: #6
RE: Just a simple question about "quote()".
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...
Find all posts by this user
Quote this message in a reply
04-05-2018, 07:28 PM
Post: #7
RE: Just a simple question about "quote()".
Thank you all.

John
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)