HP Forums
Can a program take in an expression unevaluated? - 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: Can a program take in an expression unevaluated? (/thread-7051.html)



Can a program take in an expression unevaluated? - CH3791 - 10-16-2016 05:54 AM

Hi guys,

Is there a way to get a CAS program, after it accepts an expression, to not evaluate it?

For example, say this is the program:
Code:
#cas
prg1(expression1):=
BEGIN
  return subst(expression1,'X=x');
END;
#end
Let's say that expression1 is equal to X^2. By the time expression1 is used in my code, the calc would already have evaluated X^2 using whatever value X has.

So I was wondering if there was something like this:
Code:
#cas
prg1(QUOTE(expression1)):=
BEGIN
  return subst(expression1,'X=x');
END;
#end
to tell the calculator not to evaluate the argument. Cos I honestly can't be bothered typing single quotes each time.


RE: Can a program take in an expression unevaluated? - parisse - 10-16-2016 07:15 AM

No. But you can subst once your expression quoted with X=a_free_identifier.


RE: Can a program take in an expression unevaluated? - CH3791 - 10-16-2016 07:46 AM

Ok, but would there be another way to convert lowercase to Uppercase and vice versa? Because that would help heaps with switching between modes i.e. going from CAS to Function Symbolic View or Home etc.