F-Flat

F♭ (pronounced F-flat) is a toy language.


Project maintained by Hypercubed Hosted on GitHub Pages — Theme by mattgraham

Internal Base Words

[src]

+ (plus, or, concat)

a b -> c

[src]
f♭> [ 1 2 ] [ 3 ] +
[ [ 1 2 3 ] ]
[src]
f♭> true false +
[ true ]
[src]

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)/ ]
[src]
f♭> 0.1 0.2 +
[ 0.3 ]
[src]

Shallow merges two maps

f♭> { first: 'Manfred' } { last: 'von Thun' } +
[ { first: 'Manfred' last: 'von Thun' } ]
[src]
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) ]
[src]
f♭> "abc" "xyz" +
[ "abcxyz" ]
[src]

- (minus, nor)

a b -> c

[src]
f♭> true true -
[ false ]
[src]

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)/ ]
[src]
f♭> 2 1 -
[ 1 ]
[src]
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) ]
[src]

* (times, and, join)

a b -> c

[src]
f♭> [ 'a' ] [ 'b' ] *
[ [ 'a' 'b' ] ]
[src]
f♭> [ 'a' 'b' ] ';' *
[ 'a;b' ]
[src]
f♭> 'xyz' ';'
[ [ 'x;y;z' ] ]
[src]
f♭> true true *
[ true ]
[src]

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' } ]
[src]

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)/ ]
[src]

Return a Regexp object that matches n repeats of the given pattern

f♭> "skiing" regexp 3 *
[ /(?:skiing){3}/ ]
[src]
f♭> 'abc' 3 *
[ 'abcabcabc' ]
[src]
f♭> 2 3 *
[ 6 ]
[src]

/ (forward slash, div)

a b -> c

[src]
f♭> [ 'a' ] [ 'b' ] /
[ [ 'a' 'b' ] ]
[src]

p but not q

f♭> true true /
[ false ]
[src]

Split a string into substrings using the specified a string or regexp seperator

f♭> 'a;b;c' ';' /
[ [ 'a' 'b' 'c' ] ]
[src]
f♭> 'abcdef' 3 /
[ 'abc' 'def' ]
[src]
f♭> 6 2 /
[ 3 ]
[src]

\ (backslash)

a b -> n

[src]

Largest integer less than or equal to x/y.

f♭> 7 2 \
[ 3 ]
[src]

Returns the head of string or array

f♭> 'abcdef' 3 \
[ 'abc' ]
[src]

Split a string into substrings using the specified a string or regexp seperator Returns the first

f♭> 'a;b;c' ';' \
[ 'a' ]
[src]
f♭> true true \
[ false ]
[src]

% (modulo)

a b -> n

[src]
f♭> 7 2 %
[ 1 ]
[src]

Returns tail of a string or array

f♭> 'abcdef' 3 /
[ 'def' ]
[src]

Split a string into substrings using the specified a string or regexp seperator Returns the rest

f♭> 'a;b;c' ';' %
[ [ 'b' 'c' ] ]
[src]

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))/ ]
[src]
f♭> true false %
[ true ]
[src]

>>

a b -> c

[src]
f♭> 1 [ 2 3 ] >>
[ 1 2 3 ]
[src]
f♭> 'dead' 'beef' >>
'deadbeef'
[src]
f♭> 'abcdef' 3 >>
'abc'
[src]

Deeply merge a lhs into the rhs

f♭> { first: 'Manfred' } { last: 'von Thun' } >>
[ { last: 'von Thun', first: 'Manfred' } ]
[src]
f♭> 64 2 >>
[ 16 ]
[src]
f♭> true true >>
[ true ]
[src]

Return a Regexp that sequentially matchs the input Regexps And uses the right-hand-side flags

f♭> "/skiing/i" regexp "sledding" regexp >>
[ /skiingsledding/ ]
[src]

<<

Left shift

a b -> c

[src]
f♭> [ 1 2 ] 3 <<
[ [ 1 2 3 ] ]
[src]
f♭> 'dead' 'beef' <<
'deadbeef'
[src]
f♭> 'abcdef' 3 <<
'def'
[src]
f♭> true true <<
[ true ]
[src]

Deeply merge a rhs into the lhs

f♭> { first: 'Manfred' } { last: 'von Thun' } <<
[ { first: 'Manfred' last: 'von Thun' } ]
[src]
f♭> 64 2 <<
[ 256 ]
[src]

Return a Regexp that sequentially matchs the input Regexps And uses the left-hand-side flags

f♭> "/skiing/i" regexp "sledding" regexp <<
[ /skiingsledding/i ]
[src]

^ (pow)

a b -> c

[src]
f♭> 7 2 %
[ 49 ]
[src]
[src]
[src]
f♭> true false ^
[ true ]
[src]

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)))/ ]
[src]

ln

a b -> n

[src]
[src]
> [ 1 2 3 ] length
[ 3 ]
[src]
> { x: 1, y: 2, z: 3 } length
[ 3 ]
[src]
> true length
[ 0 ]
[src]

~ (not)

a -> b

[src]
f♭> 5 ~
[ -5 ]
[src]
f♭> true ~
[ false ]
f♭> NaN ~
[ NaN ]
[src]
[src]

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' } ]
[src]

empty

a b -> c

Returns an empty value of the same type

[src]

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 ]
[src]

give results of either 1, 0 or -1

f♭> 1 0 <=>
[ 1 ]
[src]

the longer vector is always “greater” regardless of contents

f♭> [1 2 3 4] [4 5 6] <=>
[ 1 ]
[src]

compare strings in alphabetically

f♭> "abc" "def" <=>
[ -1 ]
[src]
f♭> false true <=>
[ -1 ]
[src]
f♭> now now <=>
[ -1 ]
[src]

compares number of keys, regardless of contents

f♭> { x: 123, z: 789 } { y: 456 } <=>
[ 1 ]
[src]

= equal

Pushes true if x is equal to y.

a b -> bool

f♭> 1 2 =
[ false ]
[src]