__scope__ import io
( io . print ) => print
99 => n
(current in (1 .. (n + 1))) foreach {
n - current + 1 => current
str % current => cur_str
(current > 0) then {
print % ( cur_str + " bottles of beer on the wall" )
} else {
print % "1 bottle of beer on the wall"
}
}
edit:
so now it's scheme without parenthesis. the core is currently 433 lines of code and I also got a way to create lists, functions and infixes in infix itself. Next I have to think about rewriting as much as possible in infix itself, so I got only the minimal barebone coded in python.
2 => a
3 => a
does not work, because in the first time a reference is returned, because a isn't defined, the second time a was defined and it's value is directly returned, so it turns into (3 => 2).
I will rewrite the core tomorrow to return allways references, if I'm not too busy learning math.
btw.: If's and Loops are implemented now.
]]>cmp: Looks interesting, even if I don't have too much programing experience..
]]>no... lispish without the brackets would be whitespace...
Dusty
]]> · import and usage of python modules
· blocks (kind of lambdas)
· scopes and variables
It is actually an experiment to test how far you can push a language with only infix operators, so there is no real function invocation but only infix operators (hence the name infix), to call a function you would apply it to a tuple:
do_sth % ( a , b , c )
And the tuple creating part "( a , b , c )" is not built into the language but rather using the tuple creation operator ",".
There are only 4 preused characters (){}. () are used to create some kind of precedenc in expression evaluation (everything else goes just from left to right) and {} are used to create blocks, which are just expression lists which run in a scope and return the result of the last expression in them.
Every function / variable name is freeformed and may use any non-whitespace-characters.
As I said it's a pure experiment, but still kind of fun:
__scope__ import io
( clone % __scope__ ) => my_scope
io . print => print
{
print % a
print % b
} => my_block
{
2 => a
"hello world" => b
} % my_scope
my_block % my_scope
output:
2
hello world
btw. note that the io module is real python module.
]]>