SysRPL and ML

Discussions about the RPL and RPL+ programming languages

SysRPL and ML

Postby oliver » Wed Jan 19, 2011 5:15 am

MorphEngine does not implement any of HP's (sort of private/inofficial) SysRPL and ML languages and it's unlikely that this will ever happen (*).

However, you can achieve the objectives that made people use these languages--getting greater access to the machine and getting greater speed--in MorphEngine through another means: JavaScript.

The execution environment of MorphEngine is JavaScript, and through an "officially" supported injection mechanism, the system is open to any kind of modification/extension. This is accomplished much more easily than with SysRPL/ML, which requires very specific expert knowledge.

If you're interested in extending the calculator, read http://naivedesign.com/ND1/ND1_Reference__JavaScript_API.html.

If it's "just" speed you're after, you may not have to do anything, as your UserRPL is probably already fast enough under MorphEngine. If it isn't, identify where your code is spending most of the time, and selectively replace this code with JavaScript.
RPL can call JavaScript just as if it were an RPL command.

Mini-case study:

You need a function to remove an individual element from a list.
You want something faster than the rather slow RPL code for this task:
Code: Select all
≪ SWAP LIST→ 2 + DUP ROLL OVER SWAP - ROLL DROP 3 - →LIST ≫


Here's the injection code that accomplishes what you want:
Code: Select all
calculator.functions.vector.remove = function(x, n) { x = x.slice(0); x.splice(n-1, 1); return x; };


That's it. This enables RPL like this
Code: Select all
≪ { 1 2 3 } 2 remove ≫

and runs approx. 100x faster than the RPL code.

For deployment by others, you can ship this injection code together with the rest of your folder, and either temporarily install with every run of your overall solution (without user assistance), or, if your solution is a system extension, give the user the option of a one-tap install.


(*) unlikely, but possible for a 3rd party through the extension mechanism
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Return to RPL / RPL+

Who is online

Users browsing this forum: No registered users and 1 guest

cron