Frequently Asked Questions

Programming KRL

  1. Can I loop in the prelude? No. At least not as that term is commonly applied in programming. KRL does not allow assignment in the prelude (those are declarations). While and for loops without assignment don't make much sense. Usually any looping that needs to be done in the prelude can be accomplished using the implicit loops of operators like pick(), map(), filter(), and so on. For everything else, there's always recursion. 

Parser

The parser has a few peculiarities that are known bugs.

  1. The parser complains "no viable alternative at character ' '" with an arithmetic expression on the target line for the error. Remove spaces around the minus sign. This isn't a general problem in the parser, but in the code that checks KRL into the repository.
  2. I parser complains "Invalid value [k] found should have been one of [before, after, then]" in a select statement. The parser doesn't like variables as arguments to the repeat, count, and any group event operators. A workaround is to add 0 to the variable. (e.g. count k+0 (...))