5 ms·
Geeks wanted (neat job application puzzle)
- dfranke 19y agoWhat language is that? It looks like the mutant offspring of C and Perl.
- benhoyt 19y agoYeah, I guess it's no real language. The if clause is the weirdest -- it had me stuck for a while.
- deleted 19y ago[deleted]
- uuilly 19y agoThey're doing a bunch of bit voodoo. The ^ operator is XOR, '<<' shifts bits left and '&' is a bitwise AND. That's what they are in C++ at least. x = a&x ? a&b : c+x is a lot like the C++ shorthand if-then-else thingamabob: x = ( 1 < 0 ) ? 10 : -10; which translates to: x = 10 if 1 < 0 else x = -10. Not sure what they mean with their thingamabob though.
- brett 19y agoTheir ternary operator is a ternary operator.
- staunch 19y agoI did a quick direct translation into Perl and got 'b', 'e', 'o', 'k', 'j', undef, 'b'. But neither of these exist: http://www.telogis.co.nz/beokjb.html http://www.telogis.co.nz/beokjb.html http://www.telogis.co.nz/beokjob.html http://www.telogis.co.nz/beokjob.html And I give up really fast on these, so ...
- lojic 19y agoLooks pretty close to Ruby: 1) remove semi-colons 2) replace a = b - - with a = b followed by b -= 1 3) while (z) { .. } with while (z) ... end However the if modifier (if it works as in Ruby) doesn't work out very well. I haven't touched Perl in 9 years, so I don't know how different the operator precedence is if at all. What's the deal with the if? Is it a regular modifier?
- lojic 19y agoOh yeah, Ruby has a slightly different interpretation of true/false, so I changed while(z) to while (z != 0) - likewise with if. No help though :(
- lojic 19y agoYeah baby! I missed one true/false Ruby idiosyncracy, and that did the trick :)
- benhoyt 19y agoThink "Forth", "RPN", that sort of thing. It got me for a while too.