I'll look into this some more when I have more time, but that might be the correct behavior; it's what I fixed in bug #589. ? is a procedure that takes 0 or 1 inputs. By adding the parens, you're saying "I want ? to be given - 1 as input". ? requires a positive number that is an index into an argument list, so negative or zero gives a "does not like" error.
After some reflection, I consider the new behavior to be an undesirable compatibility risk. I will restore the previous behavior for this narrow case if I am able to do so without undoing the fix for Bug #589. While ? is documented as procedure, most of the examples make it look like a variable. The error for [(? - 1)] is perhaps a learning moment, but the lesson learned is mostly unenlightening for programming in general.
I looked briefly at fixing this and concluded that there's no simple fix. I'll have to build a new information channel so that the logic which converts the minus to negation when it's the first token in an instruction/expression has a special exception for when it immediately follows a question mark. This will make ? a special form.
The thing which convinced me is that parens are used to control the order of operations for infix operators. For example, consider something that subtracts one then multiples by two. The following is a natural way to want to write it:
SHOW MAP [2 * (? - 1)] [1 2 3 4]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have added a special case to retain the previous behavior of "-" when it follows a "?". This is fixed by [r6071]. As far as I know, this bug was never part of a public release.
I'll look into this some more when I have more time, but that might be the correct behavior; it's what I fixed in bug #589.
?is a procedure that takes 0 or 1 inputs. By adding the parens, you're saying "I want ? to be given - 1 as input". ? requires a positive number that is an index into an argument list, so negative or zero gives a "does not like" error.There are other ways write this
Related
Bugs:
#589thanks for those other ways and the explanation given for the behavior.
After some reflection, I consider the new behavior to be an undesirable compatibility risk. I will restore the previous behavior for this narrow case if I am able to do so without undoing the fix for Bug #589. While
?is documented as procedure, most of the examples make it look like a variable. The error for[(? - 1)]is perhaps a learning moment, but the lesson learned is mostly unenlightening for programming in general.I looked briefly at fixing this and concluded that there's no simple fix. I'll have to build a new information channel so that the logic which converts the minus to negation when it's the first token in an instruction/expression has a special exception for when it immediately follows a question mark. This will make
?a special form.The thing which convinced me is that parens are used to control the order of operations for infix operators. For example, consider something that subtracts one then multiples by two. The following is a natural way to want to write it:
I have added a special case to retain the previous behavior of "-" when it follows a "?". This is fixed by [r6071]. As far as I know, this bug was never part of a public release.
Related
Commit: [r6071]