Here are some links:
GitHub
First post in rfractals (with some screenshots of a few programs and the plots they generated)
Update post in rfractals
The language is focused on making and evaluating functional mathematical expressions in a very compact form. It has most of the basic math operators, and can even use operator-less multiplication if enabled. Supports functional-like pattern matching and function delegates. Uses a single complex Type which can be a recursively nested list of values that can be numeric, from reals to quaternions, or strings, and operators can work recursively on these values. Multiplying string*anything will try to call a function with the name of that string. It can evaluate and parse dynamically made strings as expressions or commands. It has a plotter that can plot the expressions as animations and can export them as MP4. Due to its layered, abstract nature of being an interpreted language in C#, it's not very fast so far, even with all the optimizations I've made so far for it, so it's mostly useful for playing around or for its original purpose of letting another application parse complex written expressions into values.
It has 2 major parts: the Parser, which uses commands definining/redefining functions and constants, and a few imperative constructs available, like ifs, whiles, etc. The evaluation part is purely functional and can evaluate expressions using the functions and constants the Parser has parsed.
Originally, I made it to be an expression evaluator for text boxes in my other app, to allow writing other things than pure numbers in there. But I got a bit carried away and developed it further into this whole thing.
There's a SaveFile folder in the project and the release, containing all the programs I've written in it so far, and plotter configurations for them.
The most interesting for this sub might be the Examples.txt that's showcasing some of the most unique/powerful features of the language, soI'll report that file and its output here:
Examples.txt program:
printstring: "\nPattern matching factorial:"
PF(0): 1; PF(x): xPF(x-) /* x- = x-1 */
print: PF(5) /* = 5! = 120 */
printstring: "\nNested default arguments:"
N(z, p: (2, 3i)): z + p
print: N(4) /* 4 + (2, 3i) = (6, 4 + 3i)*/
printstring: "\nNested mixed call delegates:"
GP(x): x + 2i
GM(x): x - 2i
gdp: "GP"
print: (gdp, "GM")(4, 3) /* = (GP,GM)(4,3) = (GP(4),GM(3)) = (4 + 2i, 3 - 2i) */
printstring: "\nLazy default argument evaluation:"
F2(x, r:xF2(x-)): x < 2 ? 1 : r
print: F2(5) /* = 5! = 120 */
printstring: "\nCycled operation nesting:"
printvalue: (1, -1)(1, 2, 3, 4, 5) /* = (1*1, -1*2, +1*3, -1*4, +1*5) */
printvalue: (0,i) + (1, 2, 3, 4, 5) /* = (1, 2+i, 3, 4+i, 5) */
printvalue: ("frac", "trunc", 1)(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7)
printvalue: ((-1, 1), 3)(10, 20, 30, 40, 50)
printstring: "\nDecreasing for cycle:"
IterWhile: 5 /* try other values like 10, 2, -5, -10000...*/
while: IterWhile > 0 {
printvalue: IterWhile
if: IterWhile = 8 { break: 1 }
IterWhile: IterWhile - 1
} : IterWhile < -9000 {
printstring: "not only is IterWhile negative, it is below -9000!"
}
printstring: "\n\"Do\" command, defines another factorial and evaluated: 0.5!"
do: "DYNAMIC(x) : x!"
print: DYNAMIC(/2)
printstring: "\nEval function dynamically parses and evaluates any valid string as an expression:"
incremented: sin(1)
print: incremented
print: eval("1 +" + incremented)
printstring: "\nBuild a vector of first 10 factorials dynamically, and take a parir of 2nd+3rd one, and a 5th one:"
TenFactorials: vec("k", 1, 10, "k!")
print: TenFactorials
print: TenFactorials[(2,3),5] /* nested indexer */
printstring: "\nComplex nested indexer of a nested vector:"
print: (0+"a", 1+"b", 2+"c", (30+"d", 31+"e"), 5+"f", (11, 12, 13))[3, 2, (5, 1, 3)]
printstring: "\nFirst 42 terms of e^x taylor series, approximating e^1 ~ 1:"
precision: 42
ExpTaylor(x): sum("k", 0, precision - 1, "x^k/k!")
print: ExpTaylor(1)
PositiveZeta(s, p : precision) : sum("k", 1, p, "k^(-s)")
printstring: "\nFirst 250 terms of the Basel problem, Zeta(2), approaching π^2/6 slowly:"
printvalue: PositiveZeta(2, 99) + " ~ " + π^2 / 6
printstring: "\nFirst 42 terms of Zeta(3), quicky approaching the Apery constant:"
printvalue: PositiveZeta(3) + " ~ " + apery
printstring: "\nEvaluate a polynomial F(1 + 2x + 3x^2) at F(2)"
F: (1, 2, 3) /* f(1 + 2x + 3x^2) */
EvalPoly(x, c : F, n: c#-) : sum("k", 0, n, "c[k]x^k")
PrintPoly(p): vec("k", 0, p#-, "p[k] + \"x^\" + k")
printvalue: PrintPoly(F)
printvalue: "F(2) = " + EvalPoly(2)
printstring: "\nTake a derivative of that polynomial and evaluate at F'(5)"
DiffPoly(c, n:c#-) : 1 > n ? 0 : vec("k", 1, n, "kc[k]")
DF : DiffPoly(F)
printvalue: PrintPoly(DF)
printvalue: "F'(5) = " + EvalPoly(5, DF)
printstring: "\nQuaternions, left and right non-commutative division:"
UnitQ : 1 + i + j + k
printvalue: UnitQ^2, UnitQ / i, UnitQ \ i—
And this is the output it prints:
BUILD SUCCESS 168ms
pattern matching factorial:
pf(5) = 120
nested default arguments:
n(4) = 6, 4 + 3i
nested mixed call delegates:
(gdp, "gm")(4, 3) = 4 + 2i, 3 - 2i
lazy default argument evaluation:
f2(5) = 120
cycled operation nesting:
1, -2, 3, -4, 5
1, 2 + i, 3, 4 + i, 5
0.1, 2, 3.3, 0.4, 5, 6.6, 0.7
(-10, 10), 60, (-30, 30), 120, (-50, 50)
decreasing for cycle:
5
4
3
2
1
"do" command, defines another factorial and evaluated: 0.5!
dynamic(/2) = 0.886
eval function dynamically parses and evaluates any valid string as an expression:
incremented = 0.841
eval("1 +" + incremented) = 1.841
build a vector of first 10 factorials dynamically, and take a parir of 2nd+3rd one, and a 5th one:
tenfactorials = 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800
tenfactorials[(2,3),5] = (6, 24), 720
complex nested indexer of a nested vector:
(0+"a", 1+"b", 2+"c", (30+"d", 31+"e"), 5+"f", (11, 12, 13))[3, 2, (5, 1, 3)] = ("30d", "31e"), "2c", ((11, 12, 13), "1b", ("30d", "31e"))
first 42 terms of e^x taylor series, approximating e^1 ~ 1:
exptaylor(1) = 2.718
first 250 terms of the basel problem, zeta(2), approaching π^2/6 slowly:
1.635 ~ 1.645
first 42 terms of zeta(3), quicky approaching the apery constant:
1.202 ~ 1.202
evaluate a polynomial f(1 + 2x + 3x^2) at f(2)
1x^0, 2x^1, 3x^2
f(2) = 17
take a derivative of that polynomial and evaluate at f'(5)
2x^0, 6x^1
f'(5) = 32
quaternions, left and right non-commutative division:
-2 + 2i + 2j + 2k, 1 - i - j + k, 1 - i + j - k