|
I've been trying to go through Project Euler using K as it seemed like a good way to practice this language. However, I'm on problem 2 and have already run into a wall. I'm trying to separate the evens so that I can add them up, as the problem states, but I'm not quite sure how to go about the conditionals for K despite reading the reference manual. Here's what I've got so far: code:
|
# ¿ Jan 23, 2016 00:15 |
|
|
# ¿ May 10, 2024 13:29 |
|
Internet Janitor posted:I think the operator you're looking for is &- "where". Ah I had forgotten about where, but I read through your documentation again and saw the overload for # was what I was going for. Unfortunately I'm testing this using kona, so the version of K is a bit older. As a result this is what I have now: code:
Because while the above works, it feels very ugly to do. Also, one of the first things I did when looking at this language was go through your sample codes and tried to figure out how they worked. Although I wasn't sure how draw looped until I read the paper you wrote, so thanks for that!
|
# ¿ Jan 23, 2016 17:39 |
|
At your suggestion, I've got another question. Today I tried to define this function:code:
When I put it in oK, it will take the assignment, but calling the function will give "n is undefined". Running the above with ints in the cli works just fine, so I think it's something to do with how variable definitions are handled when declaring a function? This error wasn't one I could find in the reference book, nor on the google groups suggested on the kona github. mekkanare fucked around with this message at 17:55 on Jan 24, 2016 |
# ¿ Jan 24, 2016 17:45 |