Changed to using to_string as dispatch instead of print and puts
This commit is contained in:
@@ -5,19 +5,17 @@
|
||||
#define CHAISCRIPT_PRELUDE_HPP_
|
||||
|
||||
const char *chaiscript_prelude = " \n\
|
||||
def puts(x) : call_exists(range, x) { \n\
|
||||
puts(\"[ \") \n\
|
||||
x.for_each(fun(x) { puts(x); puts(\" \") }) \n\
|
||||
puts(\"]\") \n\
|
||||
def to_string(x) : call_exists(range, x) { \n\
|
||||
var outstr = \"[\" + x.join(\", \") + \"]\"\n\
|
||||
outstr \n\
|
||||
}\n\
|
||||
def to_string(x) { \n\
|
||||
var outstr = x.internal_to_string()\n\
|
||||
outstr \n\
|
||||
}\n\
|
||||
def puts(x) { \n\
|
||||
print_string(x.to_string()) \n\
|
||||
}; \n\
|
||||
def print(x) : call_exists(range, x) { \n\
|
||||
puts(\"[ \") \n\
|
||||
x.for_each(fun(x) { puts(x); puts(\" \") }) \n\
|
||||
print(\"]\") \n\
|
||||
} \n\
|
||||
def print(x) { \n\
|
||||
println_string(x.to_string()) \n\
|
||||
}; \n\
|
||||
|
||||
Reference in New Issue
Block a user