|
|
|
|
|
by pron
3661 days ago
|
|
I'll quote my own: Reduce(Op(_, _), x, seq) ==
LET RECURSIVE Helper(_, _)
Helper(i, y) ==
IF i > Len(seq) THEN y
ELSE Helper(i + 1, Op(y, seq[i]))
IN Helper(1, x)
A couple of things. First, the need for the helper is just a limitation of the language that doesn't allow recursive operators to take operators as arguments. Second, I used indexing, but you can use the Head and Tail operators. It's just that I use this often, and I care about the model-checking performance. Finally, Reduce is an operator not a function (it is not a function in the theory). Hence, its domain (for all arguments that aren't operators) is "all sets" something that would be illegal as a "proper" function (Russel's paradox). Operators, like functions, can be higher order, but they're not "first-class", i.e., they can't be considered "data". Functions require a proper domain (a set). |
|
Thanks
> Operators, like functions, can be higher order, but they're not "first-class", i.e., they can't be considered "data".
Do you mean you can't pass an operator to a function (or make it the argument of a computation)?
EDIT: Or more generally, what are the consequences of it not being "first-class", i.e., not being considered "data"?