I'm making a new language. I think I have already fixed most of design flaws, but I need to check it first before writing a real interpreter.
Post your code snippets, I will translate them to my lang and we will decide whether they are beautiful enough.
Name:
Anonymous2012-12-01 2:54
>>2
## tail-recursive fibs and fact with default/optional args
fib[n, {a, 0}, {b, 1}] :- {
n => {
0 : a,
n, {#when : n > 0} : fib[n - 1, #a : b, #b : b + a]
}
},
factorial[n, {acc, 1}] :- {
n => {
0 : acc,
n, {#when : n > 0} : factorial[n - 1, #acc : n * acc]
}
},
## postfix factorial operator
(!) :: {
{{n} {} factorial[n]}
},
10 ! ## will be transformed into "factorial[10]" >>4
Complex numbers are part of the language:
z :- 1.2i3.4,
display[#format : "z = ~s, z* = ~s, |z| = ~f, arg z = ~f",
z, conjugate[z], abs[z], argument[z]]