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.
best practice 🙏
I am always amazed at this genius, there are no words. Wish you success!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
For
a
it doesn't matter, I just didn't think too much when coding the formula. But forr
0 should be excluded and 1 included.This is tail recursive. However, Haskell doesn't need tail recursion to make its execution more memory-saving, due to its non-strict evaluation.
Since
randomIO
generates uniformly distributed numbers between [0,1], the(1 -) <$>
part is redundant, IMO.I'm actually more surprised that xenia managed to come up with the exact same solution I have, even naming of variables, and the error you have pointed out.
The
drop 1 res
part is incorrect. Since you append one element tores
when '(' is encountered, you should remove it from the tail ofres
when ')' is encountered, namelyinit res
.uhm.. what is the point?
You're of course right an
application
should be applied; I think I needed this to have either an unambiguous parse, or a finitely defined one. I had some problems there at first. This is the BNF I ended up implementing; it's not necessarily a correct Lambda Calculus. It is correct for the tests, however.My problem, and the suggestion part of what I wrote, is that some of your description is incorrect and/or confusing.
You can do with that, or not, what you want.
Sorry I didn't implement
sepBy
correctly. Now it works. Thank you :DYour code should report error on invalid code.
invoke(, b)
is invalid,invoke(a, )
as well.Are you asking for spoiling hints?
I've clicked "Run sample tests" hundreds of times and the results were all green. But "Attempt" just gives me the error message. Shouldn't the test case
Should work when there're multiple parameters
in sectionWhen there's no lambda
beinvoke(a, b)
? How can the error message requires me returnLeft "Hugh?"
?Loading more items...