Page 1 of 1

Invalid constants and can't use folder functions [NOT A BUG]

PostPosted: Mon Oct 21, 2013 6:38 pm
by d_motto
I installed version 1.5 on an IPod touch generation 4. I am running IOS version 6.1 on this beast, and I did the Restore after the install as directed, so I have 500 functions. However, I am experiencing an issue with some keys: if I enter i or e or the pi character and press the "enter" key, I get the character in single quotes followed by (invalid) - as shown in parentheses.
Keying the letter in from the iPod keyboard or the ND1 keyboard makes no difference - I get the error either way.

If I try to use e in a program, I get a popup message
"Program execution error
Detail: 'undefined' is not a function"

A second issue is that one of my programs refers to another one in another folder like this:
within the French quotes that we use to indicate the start and end of an RPL program. That returns
'Personal.MyBD' (invalid)

I have not checked all of the programs in my shared d_motto folder yet, but wanted to report these two issues I had.

David Motto

Re: Invalid constants and can't use another folder function.

PostPosted: Mon Oct 21, 2013 9:51 pm
by oliver
Hey Dave!

I've seen what you're describing a few times but am unable to reproduce it (using v1.5 under iOS 6). I think this may happen when there's a corrupt object somewhere on your stack. Can you please clear your stack and then try again? If that doesn't work, can you kill the app and try again? (I've less hopes about this one, but just in case.)

Oh, and one thing: a breaking change for JavaScript programs in v1.5 is that constants like 'e' or 'i' or "pi" now require you to type cons.e or cons.i or cons.pi.
This change fixed the long-standing problem that JavaScript programs could overwrite "i" (which I think you had reported).

Hope you're enjoying the big stack display on your iPod. (As mentioned elsewhere, you can insert 6 more soft-keys for 15 of them. It's quite nice.)



Re: Invalid constants and can't use another folder function.

PostPosted: Fri Oct 25, 2013 1:14 pm
by d_motto

OK, I tried to do as you suggested, but I ran into some issues.
1. Almost every time I exit ND1 and get back into it, the results from a prior stack come back into the stack, even a
If I clear it before exiting. Or, some times if I leave something else in there and exit, prior results show up as well. this occurred before I upgraded as well.

2. I tried clearing the stack as well as powering the iPod off and on again, with no change.

3. The value cons.e returns (invalid) as well, when I type it in and press the Enter key.

4. My program is an RPL+ one, not a JavaScript one. if that makes a difference.

The new larger screen? My iPod is Gen 4, not the latest.

Thanks for the ideas,

Re: Invalid constants and can't use another folder function.

PostPosted: Fri Oct 25, 2013 8:39 pm
by oliver


1. and 2.: This sounds strange and definitely doesn't reproduce on my side. Whenever you press the home button or switch tabs, the current state of the stack is persistently stored. It sounds like this doesn't happen for you when you press home (I assume this is what you mean by exiting ND1). If you "kill" the app (by double-clicking the home button and tapping the delete icon on the wobbling app icon (iOS 6), or flicking it away (iOS 7), without pressing home first, the stack would not get saved, and you'd be expected to see the last saved stack when you re-enter the app. (And it wouldn't matter whether you restarted the device or just re-launched the app.)
Try this: clear the stack, switch to another tab (Definition, Help, My Data--doesn't matter which), switch back to ND1. Does the problem you saw before still appear? Also, press home and tap the ND1 icon again. The app should come up with the cleared stack. Likewise, after a reboot. (Which should *never* be necessary. Even if the app would hang, a kill should fix it.)

3. and 4.: "cons.e" is specific for use in JavaScript. It should enter as an expression outside of JavaScript. That is, in v1.5 it should appear in italics on the stack. (Not as invalid.) "e" remains to be a valid constant in RPL+ and on the edit line. (Just like when tapping the "e" key.)

If you continue to get the "(invalid)" error, and you only got this after the update, the only other thing I can think of, is that you have an extension installed that's incompatible with v1.5. Do you have "JS Injections" enabled in the Settings app in the ND1 section? If not, enable. Switch to Definition. Tap the Injection navigation item toward the bottom of the Definition page. With a vanilla ND1, this shows an empty page. If you have extensions installed, these will be listed here. (You call tell from the comments, which ones you have installed.) Tap Edit, Select All, and Cut. Switch back to the ND1 tab. You now have a virgin ND1, and if the stack is empty, there should be no chance for anything else to interfere. I'll be *very* surprised if you're still getting the problem with "(invalid)". If this fixes the problem, you could re-install extension by extension and test between installs, to find the one that breaks it. Let me know. I'll definitely fix whatever is causing this. Just need to know what it is.


Re: Invalid constants and can't use another folder function.

PostPosted: Sat Oct 26, 2013 10:28 am
by d_motto
Oliver, thanks for looking into this, and giving me such a quick answer.

It was the Injection code - from version 1.4, patch 3 (or 1.4.1 patch 3). I removed it and all is well with e and i and pi. My RPL+ program works again (after I turned cons.e back to e).

It was treating e and i as variables, I think (I typed in a and it came up with the same (invalid) message.

As for 1 and 2, this happened in previous versions and would restore a stack from a prior time quite often, because if I cleared the stack before I exited (pressed the Home key), it would often show a prior stack (not form this session) when I started it again. I don't know why it happens, but it happened on platforms prior to iOS 6.1 (4.2, 5, 5.1 etc.). I just live with it, but I thought it might be related to my other problem.

Now, I want to give you another one (new with this release):

When I run a program in my shared folder that takes a value from the other folder, it is returning a value in italics. Is this documented somewhere (new)? Because if I run another program based on that, I have to get the eval key to get the result.

The thing I am doing is entering the thing that drags my birthdate from Personal.MyBD; that displays my birthday as "mm/dd/yyyy", and when I press AgeYou it displays AgeYou("mm/dd/yyyy"). When I press eval it displays the number of days old I am, as it should. There is that intermediate eval step. Have I discovered a new data type (unevaluated data) :) ?



Re: Invalid constants and can't use another folder function.

PostPosted: Sat Oct 26, 2013 11:08 am
by oliver

Thanks for letting me know the outcome.

So, did you not Restore Calculator after the update? Doing so will a) give you new keys and menus and b) will/should overwrite your injections. (That is, you shouldn't have the 1.4.1 patch3 stuff in there.) This is mentioned under Help | 1.5 Update, but nowhere enforced. Thank you for bringing this up, because this may well affect others. I should probably wipe injections after an update.

I'd recommend you pick up the new keys and menus. Your Definition page should say "500 Functions". (There's a new cool match function that you may like. I'll add usage examples to the 1.5 announcement page here.)

The Italics thing hasn't been documented yet but is simple: expressions are no longer displayed as 'expr' but rather expr. This only affects display on the stack. If you bring the expression down to the edit line, it will display with single quotes and entering one also, in the general case, requires them. So, it's a cosmetic change, really.

Now, the evaluation mechanism has changed quite a bit. The calculator has now three eval modes: symbolic, half-symbolic, and numerical. There's a new num function (over the new keyboard's eval key) that will perform numerical evaluation--in direct operation or in RPL+. The existing eval function runs in half-symbolic mode, which doesn't always evaluate as deeply as it would before. For example, if you have an expression 'pi * A', where 'A' is an undefined variable, you'd previously get an error if you evaluated. Now it will evaluate this to '3.1415... * A'. Symbolic mode, which you can only request in JavaScript would keep pi symbolical and evaluate A, if it's defined, and it's what Mathematica wants to see for best results. I'll describe this in a technical note at some point.

The upshot is: there's subtle differences to the eval behavior. You may have to use eval where you didn't have before, or use num where you used eval before. Sounds like you ran into the first case, and the solution would be indeed to insert an eval command into your program, as you found out.
The change should be to the better, as it gives you more control.
The new symbolic mode allows true symbolic calculations to happen, which, again, is important for the CAS.

Hope this helps and thanks for your detective work, finding the incompatibility with the patch 3 injection.