HP Forums
prevent list evaluation - 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: prevent list evaluation (/thread-4821.html)



prevent list evaluation - ji3m - 09-28-2015 04:17 AM

Is there any way to prevent a list from being evaluated when copied.?

e.g. fun1() and fun2() are compiled pgms.

then

a := { QUOTE (fun1),QUOTE (fun2) };

results in

a:= {fun1,fun2} unevaluated.

good so far. I use a as a function vector table.

But then

b := a; evaluates fun1 and fun2

I guess what i want is

b := rcl (a) or something that just retrieves the value of a.

I would like to prevent such evaluation while mechanically
manipulating such lists.


RE: prevent list evaluation - cyrille de brébisson - 09-28-2015 05:32 AM

Hello,


Is that in CAS or numerical?

Cyrille


RE: prevent list evaluation - ji3m - 09-28-2015 11:50 AM

Cas mode.

Home makes everthing numerical.

I trying to manipulate objects rpl style.


RE: prevent list evaluation - ji3m - 09-28-2015 03:31 PM

Much confusion on my part.

If im in the cas window and type b :=a
i get a bonus evaluation.

But in home view this does not happen. a is copied to b.

So in a program i dont get the extra evaluation.
I read somewhere programs execute in the home mode.

What does this mean?

Is cas vs home only different in the command line parser?
Its all very confusing.


RE: prevent list evaluation - ji3m - 09-28-2015 04:41 PM

So maybe I answered my own question

make a func
export rust () begin 5959 end;

Then in the cas window type

a := {rust};

then type a which returns 5959
it evaluate rust.

so I defined a general function
export rcl (v) begin v end;

So now rcl (a) returns 5959 as expected
but. rcl('a') returns {rust} as desired


RE: prevent list evaluation - xset - 09-28-2015 07:40 PM

(09-28-2015 04:41 PM)ji3m Wrote:  ...
So now rcl (a) returns 5959 as expected
but. rcl('a') returns {rust} as desired

So. How to prevent list evaluation ??? I hate this PPL, it is so weird and inconsistent :-(
quote(Symbol) - cannot be evaluated during copying in normal languages !


RE: prevent list evaluation - ji3m - 09-28-2015 08:16 PM

So the the cas command line parser thinks a list is not just a collection of objects (which it should be) but something with semantic meaning. (i dont know what that is)
But it is bent on evaluating all the elements in it .

I dont know much about xcas

So my function rcl ('a') does the job nicely.

In rpl a stored list is not a program , but a data structure.
There are also functions to evaluate element by element but its not automatic.


A deeper flaw in ppl is the inability to nest blocks (and create locals)
so it is not like any other language i know . Definitly not lisp,c,pascal,etc.

I thought at first i might be able translate rpl to ppl (since i can now write programs
from a program). But alas ppl is a weaker language than rpl.

At this point my prime sysrpl emulator runs abot 10 times faster than on my hp50
emulator.

Both Prime and HP50 Are running on Samsung Tab pro.

There is a template for a block so i thought maybe it would work. But no.


RE: prevent list evaluation - cyrille de brébisson - 09-29-2015 06:25 AM

Hello,

I believe that you can do anything in PPL that you can do in RPL, BUT NOT AS EASILY!

RPL has much higher self referencing ability than PPL which gives it that extra power.

Lambda functions would be nice :-)

Cyrille