Moki is a stack-based programming language.
After dissatisfaction with my first language, Mochine, I've since turned to more golfy methods of representation.
In this aspect I've made as many functions as string-compatible as possible.
Multiplication, and even division work with strings.
Instead of erroring out I try and think of alternative uses until the logic simply breaks down and I have to issue an error.
Changelog
1.6.7
Added N, creates an array of the first n natural numbers. Changed minimum stack requirements for a few operations.
1.6.6
Added Z, which filters array using a premade filter, in preparation for my addition of f [filter function].
1.6.5
Added z, which deletes falsey values from array, in preparation for my addition of f [filter function].
1.6.4
Added m, the map function, along with ¡, which applies a function to the last element of an array, À, which rotates the last item to the beginning of the array, and Á, which does the opposite.
1.6.3
Added U. Using ^ with a string or array invokes intersection instead.
1.6.2
Baleeted string exponentiation. Soon, it will be replaced as the INTERSECTION operator.
1.6.1
Any data type can now be the name of a function.
1.6
Define functions and constants using the following syntax:
'quintuple',',5*':
2'quintuple'`
1.5.3
Added MG (gcd) and MQ (quadratic formula).
1.5.2
Added Ć (nCr) and Ṕ (nPr).
1.5.1
Some trig functions. Base n log.
1.5
Found resolutions to many errors.
1.4.4
Improved warning code.
Fixed minor bugs with multiplication and factorial.
1.4.3
I've worked out, as far as I can tell, nearly every kink in the code.
1.4.2
Added random program and error suppression.
Various minor bugfixes.
1.4.1
Added escape character \' \\.
Added stack visualization.
1.4
Arrays:
Added P, a, p.
1.3
Minor bugfixes. Cleaned code.
Added Mx, Tx, I{}, W{}.
1.2.1
Added more errors... :(
The stack now starts with 0 again... :(
1.2
Added A, G, L, M, P, S, V, e, l, m, s, t, γ, and π.
The stack now starts empty.
1.1
Added ~.
Fewer errors
1.0
Initial Release.
Upcoming Features
filter()
the upcoming filter() function will probably take the following form:
[...] 'function' f -> filter('function',[...])
Dictionary
Let Sn = the nth item in the stack (looking down, eg., top of stack = 0).
(Whitespace)
Does nothing.
!
! := S0(λx.x==0 ? 1 : 0)
"
if S0 is a Real → converts S0 from decimal to unicode
if S0 is a String → do nothing
#
Delimits comments.
$
Push next line of input to stack.
%
S1 = S1 mod S0, pop S0
&
& := (S0,S1)(λ(y,x).(x!=0 & y!=0) ? x : 0)
'
Delimits strings.
(
if S0 is a Real → decrement
if S0 is a String → decrement its decimal value, but keep it a string
)
if S0 is a Real → increment
if S0 is a String → increment its decimal value, but keep it a string
*
if S0 is a String, return as if it were S0.charCodeAt(0)
if S1 is a Real → S1 = S0S1
if S1 is a String → concatenate it S0 times
don't forget to pop S0
+
if both are reals, return their sum
else return their concatenation
don't forget to pop S0
,
push 0 onto the stack
-
subtraction - treat characters like their charcodes
.
duplicate top of stack
/
division - treat string divisors as their charcodes, split dividend strings into n parts
0-9
if S0 is a Real → multiply top of stack by 10, add n
if S0 is a String → concatenate