As always, commands work when directly entered, in RPL+ and in JavaScript. In JavaScript you need to know which function collection commands are in. The examples are given mainly as simple sequences in RPL+, which are exactly equivalent to directly entering the arguments and commands one by one.

match

(Provides very versatile regular expression matching on strings and arrays. For the exact syntax of the regular expressions, see JavaScript RegExp documentation. For example, see http://www.visibone.com/regular-expressions/)

- Code: Select all
`≪ "Hallo" ".al" match ≫ => "Hal"`

≪ "Hallo" ".a(.+)" match ≫ => ["Hallo", "llo"]

≪ "Hallo" "^a." match hasResult ≫ => false

JavaScript: ME.string.match('"Hallo"', '"^a."'); vars.hasResult /* false */

≪ 1..40 ".3" match ≫ => [13 23 33]

≪ 1..40 "(.)3" match ≫ => [[13 1] [23 2] [33 3]]

≪ 1..40 [@toString] map ".3" match ≫ => ["13" "23" "33"]

≪ 1..40 [@toString] map "(.)3" match ≫ [["13" "1"]["23" "2"]["33" "3"]]

≪ 1e6 primes [real 1e5 >] filter ".2.2.3" match ≫ [120223 120233 ...]

right

- Code: Select all
`≪ 'y+5=1+x^2' right ≫ => '1+x^2'`

≪ [ 'x=0' 'y=1+x^2' ] right ≫ => [ '0' '1+x^2' ]

≪ [[ 'x=0' 'y=1+x^2' ][ 'x=4/5' 'y=-3/5' ]] right ≫ => [[ '0' '1+x^2' ][ '4/5' '3/5' ]]

toName

- Code: Select all
`≪ "myvar" toName ≫ => 'myvar'`

subst

- Code: Select all
`≪ 'tan(x)+x' 'x=1' ≫ => 'tan(1)+1'`

JavaScript: ME.expr["subst"]("'tan(x)+x'", "'x=1'") => "'tan(1)+1'"

zip, unzip

- Code: Select all
`≪ [1 2 3] [4 5 6] zip ≫ => [ 1 4 2 5 3 6 ]`

≪ [ 1 4 2 5 3 6 ] unzip ≫ => [1 2 3] [4 5 6]

augment & co.

- Code: Select all
`≪ [1 2 3] [4 5 6] append ≫ => [ 1 2 3 [ 4 5 6 ] ]`

≪ [1 2 3] [4 5 6] concat ≫ => [ 1 2 3 4 5 6 ]

≪ [1 2 3] [4 5 6] add ≫ => [ 5 7 9 ]

≪ [1 2 3] [4 5 6] + ≫ => [ 5 7 9 ]

≪ [1 2 3] [4 5 6] augment ≫ => [[ 1 2 3 ] [ 4 5 6 ]]

≪ [1 2] 3 augment ≫ => [ 1 2 3 ]

convergent

- Code: Select all
`≪ showImproper 2 toSqrtCF 25 convergent ≫ => 4478554083/3166815962`

≪ showImproper π toCF 3 convergent ≫ => 355/113

convergents

- Code: Select all
`≪ showImproper 2 toSqrtCF 5 convergents ≫ => [ 3/2 7/5 17/12 41/29 99/70 ]`

≪ showImproper π toCF 3 convergents ≫ => [ 3/1, 22/7, 355/113 ]

squareFree, squareFreePart, isSquareFree

- Code: Select all
`≪ 1..20 squareFree ≫ => [ 1 2 3 5 6 7 10 11 13 14 15 17 19 ]`

≪ 1..20 squareFreePart ≫ => [ 1 2 3 1 5 6 7 2 1 10 11 3 13 14 15 1 17 2 19 5 ]

≪ 17..20 isSquareFree ≫ => [ true false true false ]

moebius

- Code: Select all
`≪ 1..25 moebius ≫ => [ 1 -1 -1 0 -1 1 -1 0 0 1 -1 0 -1 1 1 0 -1 0 -1 0 1 1 -1 0 0 ]`