1.6 Update

General Discussions about ND1

1.6 Update

Postby oliver » Sun Oct 30, 2016 10:35 pm

This update introduces a major new feature: Calculators, a section that allows you to upload, download, and switch between calculators. It functions just like the Data section, that you're familiar with.

You can now create your own calculators and interactive tools. See http://forums.naivedesign.com/viewforum.php?f=18 for more info. The release comes with a few example tools and "XL" versions of ND1 and ND1 Classic (which simply add a row of soft-keys).

The following new functions and abilities have been added:

Array
- any, every
- count

Integer
- omega, Omega

Program Fragments
- can now be a literal, resulting in test for literal

JS Objects
- (stringified) display in stack
- property access
- used as optional return value by various functions (any, every)

Here're some usage examples:
Code: Select all
Obj property access:
≪ { a: 5, s: "hi"} =o o.a o.s ≫ evals to 5 hi

Obj display:
≪ { a: 5, s: "hi"} ≫ evals to {"a":5,"s":"hi"}

any:
≪ 1..5 [isPrime] any result ≫ => true {"input":2,"index":1}
≪ 20..25 [isSquare] any result.input result.index ≫ => true 25 5
≪ 20..24 [isSquare] any result.input result.index ≫ => false undefined undefined

every:
≪ 20..24 [isSquare not] every result ≫ => true {}
≪ 20..25 [isSquare not] every result ≫ => false {"input":25,"index":5}

join:
≪ 1..5 join ≫ => "1,2,3,4,5"
≪ 1..[i]5[/i] { separator: "." } =options join ≫ => "1.2.3.4.5"
≪ 1..5 { separator: "" } =options join ≫ => "12345"

find:
≪ [1 3 5 7 9 11 13] { √ isInt } find ≫ => 3, true
≪ [1 2 3 4 5 9 10] { phi 3 == } find hasResult ≫ => false
≪ 1..100 Omega 6 find N ≫ => 64

count:
≪ 1..10 omega 1 count ≫ => 7


Note: new (and updated) commands may support optional arguments, as in this example:
Code: Select all
≪ 1..5 { separator: "." } =options join ≫ evals to "1.2.3.4.5"

Basically, in RPL there're no optional arguments: every function expects a fixed number of arguments.
A global options JavaScript object is RPL+'s method to work around this. I hope you like how this reads.
You can easily support the options global in your own functions: in a RPL function, just use options; in a JavaScript function, use vars.options.

Enjoy!
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron