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.
Wow, I absolutely hated the C version of this.
Having the
add
function described in the AST description let me down a sidequest of trying to understand the strange structure of havingadd
nodes ANDstr
nodes. Took a while to realizeadd
is just a helper function to append to astr
linked list node.Not to mention I thought I was supposed to implement the AST myself (which you sorta have to for testing). Looking at languages like rust it is immediately clear that it is an enum. In C its not so obvious from the start.
Perhaps some of these things could be added specifically to the C version's description (as I see a few other comments reflecting this opinion too, which is really what saved me).
it's not really an "issue" but a mistake people are likely to make, and that makes one scratch their head for a moment. what caused it for me was that in prototype methods,
this
always has typeobject
, even for primitives (they are "boxed"), i.e. :and
assert.deepEqual(new String('abc'), 'abc');
fails (as it should, imo). but once stringified by chai, they look identicalWhat exactly causes the issue? Is it a type of the returned value being an iterator vs array? Maybe an explicit assertion on the expected type would help?
it'll be tough to fix since the stringification happens as one would expect, and I think
deepEqual()
failing is the right behavior. It was interesting to figure out what was happening too. I dont know what should be done here - a warning in the description ? a dedicatedit()
block with an helpful title ?To anyone experiencing this,
console.log
your values instead and you'll probably figure out the quirk that's causing the comparison to failNot true aivenaut. You can try easily for yourself:
You are correct that things are passed by value. But certain things are pointer types themselves without being a pointer. A slice is a structure with a size, a capacity, and an underlying array pointer. Even if you pass the slice as value, the underlying array is the same.
In golang when you pass a parameter to a function it will make a copy of it, unless pointer type is specified (eg
arr *[]int
). So this function is pure.I was trying to get to this! I knew there had to be a one-liner with take_while. I didn't quite achieve it. Well done.
wtf! is this
yeah no you have to implement your own
Pretty fun kata with prior knowledge in crafting interpreters
It still happens with the Java random test.
Can someone please explain me this piece of code? what is id?
Good Kata. If you don't know what to do here, check out "Simplexer" first, since it teaches you the basics of Expression Parsing.
This comment is hidden because it contains spoiler information about the solution
Loading more items...