I am using icr about a year now and its really a good tool.
Here i wrote a small description what can be done with my small scripting environment called tree.
Its more about real time testing of already working functions and not about evaluating single crystal commands. I wanted to have an environment a bit like the Python shell where i can set vars and inspect functions at runtime.
ls
builtin vars: {“started” => false, “debug” => false, “filename” => “”, “lines” => 0}
user vars:
vars_int32: {“num” => 1, “size” => 99}
vars_string: {“weather” => “cold”, “day” => “monday”}
functions:
{“run”, #<Proc(String, Int32, Int32):0x56148908bbd0>}
{“list”, #<Proc(String, Int32, Int32):0x56148908ccb0>}
{“print”, #<Proc(String, Int32, Int32):0x561489070540>}
{“load”, #<Proc(String, Int32, Int32):0x5614890705e0>}
{“eval”, #<Proc(String, Int32, Int32):0x5614890716e0>}
{“after”, #<Proc(String, Int32, Int32):0x5614890751a0>}
{"+", #<Proc(String, Int32, Int32):0x561489075900>}
{"<", #<Proc(String, Int32, Int32):0x561489076c60>}
{“while”, #<Proc(String, Int32, Int32):0x561489076d60>}
{“every”, #<Proc(String, Int32, Int32):0x561489077100>}
{“split”, #<Proc(String, Int32, Int32):0x5614890778f0>}
{“ls”, #<Proc(String, Int32, Int32):0x56148908b560>}
{“let”, #<Proc(String, Int32, Int32):0x561489078580>}
{“p”, #<Proc(String, Int32, Int32):0x561489079410>}
{"!", #<Proc(String, Int32, Int32):0x561489079cb0>}
{“now”, #<Proc(String, Int32, Int32):0x56148907e8b0>}
{“help”, #<Proc(String, Int32, Int32):0x56148908b310>}
{“debug”, #<Proc(String, Int32, Int32):0x56148908b810>}
{“test”, #<Proc(String, Int32, Int32):0x56148908ba00>}
{“pass”, #<Proc(String, Int32, Int32):0x56148908bb50>}
{“end”, #<Proc(String, Int32, Int32):0x56148908bb60>}
{“exit”, #<Proc(String, Int32, Int32):0x56148908bbc0>}
The first idea was to use procs to build a fast as possible text interpreter environment and see how it performs.
def procloop
puts(Time.local.to_s("%H:%M:%S.%6N"))
10.times {
procs = {->foo, ->pass, ->bar}
procs.each do |p|
p.call
end
}
puts(Time.local.to_s("%H:%M:%S.%6N"))
end
ICR is the best tool i now for inspecting single crystal commands.
tree and some other small scripts can be checked out here:
git clone https://github.com/pebauer68/crystal.git