Re:Show HN: Arturo – REBOL-inspired programming language and...
by stchacademy on Tuesday October 20, 2020 @05:14AM
(#24835318)
Well, you have a point here: even? (and odd?) is somehow missing from the (auto-)generate docs at the wiki. I'll fix it asap. Thanks for letting me know.
Regarding the syntax:
every "function" in Arturo takes a specific number of arguments. in that case: loop, if?, even? else are ALL functions (there are no special constructs in Arturo, nor reserved keywords).
Regarding your second example/question: you could have written it like that, but it wouldn't do as you expect.
What can be done though is using the 'case function.
For any other questions, doubts, ideas or even code contribution, you're welcome to post anything at Github or via our Gitter community: https://gitter.im/arturo-lang/community or Discord: https://discord.gg/YdVK2CB
Re:Show HN: Arturo – REBOL-inspired programming language and...
by stchacademy on Monday October 26, 2020 @07:19AM
(#24894913)
FYI, I've just published the first complete reference (language reference + full library reference, with tons of examples): https://github.com/arturo-lang/arturo/wiki
Let me know what you think! :)
if? even? x -> print [x "is even"]
but I couldn't find it in Arithmetic, Comparison, Core, Logic, or Numbers - I figured those were the most obvious places to look.
I was wondering specifically if this example
loop 1..10 'x [ if? even? x -> print [x "is even"] else -> print [x "is odd"] ]
could be rewritten
loop 1..10 'x [ even? x -> print [x "is even"] odd? x -> print [x "is odd"] ]
and what other number checking things one could do - like decimal?, positive? negative?