#1909 Fantom Puzzlers

kaushik Mon 11 Jun 2012

Here are 6 simple but slightly tricky fantom questions.

http://ksat.me/fantom-puzzlers/

See how much can you get right and comment here or on the blog :)

DanielFath Mon 11 Jun 2012

Those are some damn puzzlers. I only got one of six. I think it was the first one.

kaushik Mon 11 Jun 2012

Thanks Daniel. For the first one, I almost filed a ticket then on preview went like "Wait a minute, that's why. How silly was I!".

qualidafial Mon 11 Jun 2012

2 out of 6. ..except I have no idea which ones I got right.

kaushik Mon 11 Jun 2012

Here's the cheat sheet: 1-3, 2-2, 3-4, 4-1, 5-4, 6-3 :)

qualidafial Mon 11 Jun 2012

I got questions 1 and 3.

Question 4 is just mean.

kaushik Mon 11 Jun 2012

:)

Yeah, once spent like an hour on that one. Maybe fantom should warn or something, otherwise it's too easy to miss.

qualidafial Mon 11 Jun 2012

@brian, the error in question is:

class Foo {
  Int a := 0;
}

...

foo := Foo { a := 10 }

..which of course assigns to a local variable a inside the closure, instead of to the field a in class Foo.

Maybe this should flag a compiler warning (error?) for assigning an unused value to a local variable?

tcolar Tue 12 Jun 2012

5 out of 6 ... but would be nice to know which I failed !

tcolar Tue 12 Jun 2012

Hey Kaushik you sure about question 2 answer 2 ?? What is the --> operator, can't remember that being a valid operator.

qualidafial Tue 12 Jun 2012

--> is a post-decrement followed by greater than comparison.

tcolar Tue 12 Jun 2012

Ha duh ... kind of sad I failed that one :)

That's ugly looking though ;)

kaushik Tue 12 Jun 2012

@tcolar 5 out of 6 is really awesome though :) : Brian said he got 2 or 3 right on the first go: https://twitter.com/briansfrank/status/212296332684173312

tcolar Tue 12 Jun 2012

Thanks, I think I got lucky on a couple to be honest.

Writing the ide/parser grammar made me learn a lot of the little syntactic details the hard way !

And things like question 4 ( := ) after you get burned a few times on it you remember ... I know I've wasted time on that one before. I think a compiler warning would probably be good.

katox Tue 12 Jun 2012

3/6 - missed #3, #4 ( := ) whoo and #6 "c" breaks ;)

Login or Signup to reply.