F♭ (pronounced F-flat) is a toy language.
+
(plus, or, concat)a b -> c
f♭> [ 1 2 ] [ 3 ] +
[ [ 1 2 3 ] ]
f♭> true false +
[ true ]
Return a Regexp object that is the union of the given patterns. That is the regexp matches either input regex
f♭> "skiing" regexp "sledding" regexp +
[ /(?:skiing)|(?:sledding)/ ]
f♭> 0.1 0.2 +
[ 0.3 ]
Shallow merges two maps
f♭> { first: 'Manfred' } { last: 'von Thun' } +
[ { first: 'Manfred' last: 'von Thun' } ]
f♭> '3/17/2003' date dup 1000 +
[ Mon Mar 17 2003 00:00:00 GMT-0700 (MST)
Mon Mar 17 2003 00:00:01 GMT-0700 (MST) ]
f♭> "abc" "xyz" +
[ "abcxyz" ]
-
(minus, nor)a b -> c
f♭> true true -
[ false ]
Return a Regexp object that is the joint denial of the given patterns. That is the regexp matches neither
f♭> "skiing" regexp "sledding" regexp -
[ /(?!skiing|sledding)/ ]
f♭> 2 1 -
[ 1 ]
f♭> '3/17/2003' date dup 1000 +
[ Mon Mar 17 2003 00:00:00 GMT-0700 (MST)
Sun Mar 16 2003 23:59:59 GMT-0700 (MST) ]
*
(times, and, join)a b -> c
f♭> [ 'a' ] [ 'b' ] *
[ [ 'a' 'b' ] ]
f♭> [ 'a' 'b' ] ';' *
[ 'a;b' ]
f♭> 'xyz' ';'
[ [ 'x;y;z' ] ]
f♭> true true *
[ true ]
Returns a new object containing keys contained in both objects with values from the rhs
f♭> { first: 'James' } { first: 'Manfred', last: 'von Thun' } *
[ { first: 'Manfred' } ]
Return a Regexp object that is the join of the given patterns. That is the regexp matches both inputs
f♭> "skiing" regexp "sledding" regexp *
[ /(?=skiing)(?=sledding)/ ]
Return a Regexp object that matches n repeats of the given pattern
f♭> "skiing" regexp 3 *
[ /(?:skiing){3}/ ]
f♭> 'abc' 3 *
[ 'abcabcabc' ]
f♭> 2 3 *
[ 6 ]
/
(forward slash, div)a b -> c
f♭> [ 'a' ] [ 'b' ] /
[ [ 'a' 'b' ] ]
p but not q
f♭> true true /
[ false ]
Split a string into substrings using the specified a string or regexp seperator
f♭> 'a;b;c' ';' /
[ [ 'a' 'b' 'c' ] ]
f♭> 'abcdef' 3 /
[ 'abc' 'def' ]
f♭> 6 2 /
[ 3 ]
\
(backslash)a b -> n
Largest integer less than or equal to x/y.
f♭> 7 2 \
[ 3 ]
Returns the head of string or array
f♭> 'abcdef' 3 \
[ 'abc' ]
Split a string into substrings using the specified a string or regexp seperator Returns the first
f♭> 'a;b;c' ';' \
[ 'a' ]
f♭> true true \
[ false ]
%
(modulo)a b -> n
f♭> 7 2 %
[ 1 ]
Returns tail of a string or array
f♭> 'abcdef' 3 /
[ 'def' ]
Split a string into substrings using the specified a string or regexp seperator Returns the rest
f♭> 'a;b;c' ';' %
[ [ 'b' 'c' ] ]
Return a Regexp object that is the inverse join of the given patterns. That is the regexp does not match both inputs
f♭> "skiing" regexp "sledding" regexp /
[ /(?!(?=skiing)(?=sledding))/ ]
f♭> true false %
[ true ]
>>
a b -> c
f♭> 1 [ 2 3 ] >>
[ 1 2 3 ]
f♭> 'dead' 'beef' >>
'deadbeef'
f♭> 'abcdef' 3 >>
'abc'
Deeply merge a lhs into the rhs
f♭> { first: 'Manfred' } { last: 'von Thun' } >>
[ { last: 'von Thun', first: 'Manfred' } ]
f♭> 64 2 >>
[ 16 ]
f♭> true true >>
[ true ]
Return a Regexp that sequentially matchs the input Regexps And uses the right-hand-side flags
f♭> "/skiing/i" regexp "sledding" regexp >>
[ /skiingsledding/ ]
<<
Left shift
a b -> c
f♭> [ 1 2 ] 3 <<
[ [ 1 2 3 ] ]
f♭> 'dead' 'beef' <<
'deadbeef'
f♭> 'abcdef' 3 <<
'def'
f♭> true true <<
[ true ]
Deeply merge a rhs into the lhs
f♭> { first: 'Manfred' } { last: 'von Thun' } <<
[ { first: 'Manfred' last: 'von Thun' } ]
f♭> 64 2 <<
[ 256 ]
Return a Regexp that sequentially matchs the input Regexps And uses the left-hand-side flags
f♭> "/skiing/i" regexp "sledding" regexp <<
[ /skiingsledding/i ]
^
(pow)a b -> c
f♭> 7 2 %
[ 49 ]
f♭> true false ^
[ true ]
Return a Regexp object that is the exclsive or of the given patterns. That is the regexp that matches one, but not both patterns
f♭> "skiing" regexp "sledding" regexp ^
[ /(?=skiing|sledding)(?=(?!(?=skiing)(?=sledding)))/ ]
ln
a b -> n
> [ 1 2 3 ] length
[ 3 ]
> { x: 1, y: 2, z: 3 } length
[ 3 ]
> true length
[ 0 ]
~
(not)a -> b
f♭> 5 ~
[ -5 ]
f♭> true ~
[ false ]
f♭> NaN ~
[ NaN ]
Returns a new object with the keys of the given object as values, and the values of the given object
f♭> { first: 'Manfred', last: 'von Thun' } ~
[ { Manfred: 'first' von Thun: 'last' } ]
f♭> [ 'a' 'b' 'c' ] ~
[ { a: '0' b: '1' c: '2' } ]
empty
a b -> c
Returns an empty value of the same type
cmp
Pushes a -1, 0, or 1 when x is logically ‘less than’, ‘equal to’, or ‘greater than’ y. Push null if sort order is unknown
a b -> n
f♭> 1 2 <=>
[ -1 ]
give results of either 1, 0 or -1
f♭> 1 0 <=>
[ 1 ]
the longer vector is always “greater” regardless of contents
f♭> [1 2 3 4] [4 5 6] <=>
[ 1 ]
compare strings in alphabetically
f♭> "abc" "def" <=>
[ -1 ]
f♭> false true <=>
[ -1 ]
f♭> now now <=>
[ -1 ]
compares number of keys, regardless of contents
f♭> { x: 123, z: 789 } { y: 456 } <=>
[ 1 ]
=
equalPushes true if x is equal to y.
a b -> bool
f♭> 1 2 =
[ false ]