Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,26 @@
|
|||
fun isNumeric = logic by text value
|
||||
try
|
||||
^|So funny:
|
||||
|a) we check if it's castable to a real
|
||||
|b) we obtain the real 0.0
|
||||
|c) conversion from real to int to get 0
|
||||
|d) int can be converted to logical to get ⊥
|
||||
|e) we can negate the result
|
||||
|^
|
||||
return not when(value.contains("."), logic!int!(real!value * 0), logic!(int!value * 0))
|
||||
remedy
|
||||
return false
|
||||
end
|
||||
end
|
||||
fun main = int by List args
|
||||
if args.length == 1
|
||||
writeLine(isNumeric(args[0]))
|
||||
else
|
||||
writeLine("value".padEnd(8, " ") + " " + "numeric")
|
||||
for each text value in text["0o755", "thursday", "3.14", "0b1010", "-100", "0xff"]
|
||||
writeLine(value.padEnd(8, " ") + " " + isNumeric(value))
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
||||
exit main(Runtime.args)
|
||||
Loading…
Add table
Add a link
Reference in a new issue