Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Please enable newer versions of Node for the JavaScript version of this kata, as it is in Simpler Interactive Interpreter. Coming from there and then having to rewrite larger parts of the existing code, because one used features that are not available in Node 8, is an unnecessary obstacle.
No it is not. The production rule for function call is given as
That says, that the arguments of the call are
expression
s.3 + 4
is an expression, so interpreting the inputf 2 3 + 4
as equivalent tof 2 (3 + 4)
is valid according to the grammar. That the grammar listsfunction-call
(only) as an option forfactor
does not change that. The grammar is simply ambiguous. In more ways than this.I think that error message is a result of
UndecidableInstances
masking the real problem. Without that option, GHC throws an error, that it can not see, that the functional dependencyt → r
is satisfied in the second instance:Removing the functional dependency resolves that, but then GHC complains about an ambiguous type in
polyList
.I have no idea how to resolve that. I have been banging my head against the wall for a whole day trying to get a similar solution working, before settling for a less elegant solution.
All in all nice, but there is a much simpler definition for
false
, that also only relies on the primitive combinators.I really like the use of the
Void
type incoerce
here. Really drives home the fact that the inner value can not actually exist and the whole thing is, well, absurd.While this solution is simple and looks nice, it is not portable because of a byte order problem.
On a machine with big-endian byte order, this formats the IP the wrong way around.
It's a shame, much software out there is not really portable because of little assumptions like that.
Hmm, I don't think this qualifies as "[...] contains code within it that might give the solution away to other users."
But thanks anyway. I will remember to do it next time :)
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution