I don't think this language is called 'chicken' but rather 'chicken chicken', which is a bit confusing. I expected some kind of extension language built on top of chicken scheme but no, just no scheme and way more chicken.
It might be funny to also have a 2 symbol language called 'duck duck goose' where statements are terminated by 'goose' or something. I can't see any confusion between that and, say, duck duck go either!
I was also dismayed to find out that rather than being a mainstream post about my favorite little scheme... I'm greeted by an esoteric language of the same name.
It depends on how you use Racket, since it is actually a family of languages, but if you use R5RS I would say it should be really easy to port apps between them. And the community is great so I don't think you would have problem picking it up
Do check out the presentation (http://youtu.be/yL_-1d9OSdk) as he goes into a fairy bit of detail on the motivations and implementation of the project. Fairly moving actually
I've never been so amused by source code as I was reading that. I particularly enjoyed how he used spaces after dots and question marks, making it read like punctuation.
My JavaScript is a bit fuzzy, but I think those last two lines actually parse as `return chicken.Chicken;`, so the last Chicken is actually significant.
Furthermore, when this is implemented in ObjectiveC, the Apple app store will require all chicken-chicken-based apps to be fully cooked (and all eggs hard boiled).
It doesn't stand for anything - it's the company that Wile E. Coyote orders wacky equipment from in the cartoons in order to defeat the Road Runner. It's the namespace in CPAN for joke modules.
There are four statements:
1. Initialization
2. Read next character or bytecode
3. Conditional, first leg is parsing and second intepretation.
4. Return
When parsing, the function will call itself recursively as chicken(linenumber, 0). When interpreting, it calls itself as chicken(undefined, undefined). With the second parameter 0 or undefined, the initialization code will not run again. With the first parameter undefined, it will run the interpreter instead of the parser. (It is important that the line number is non-zero.)
This is where the implementation gets a bit ugly. There's no way of preventing the interpreter from running. That means the error message must form valid bytecode. It does this by setting the stack pointer to -1 and returning an array of length two. The interpretation starts at index 2, which will be read as undefined and thus interpreted as the axe instruction (halting the program). sp will have been increased to 0 by the initialization and thus points to the error message at index 0 in the array, which will be returned as the result. (The second value in the array is unused, and was only inserted to avoid using a parenthesis.)
That should hopefully clear up the big picture. Some small notes:
Comparing input and code during initialization should always be false. When negated, it produces the value 0.
The value after && that follows the comparison with "n" is always true. It was just a way to avoid a parenthesis.
CHICKEN ++- CHICKEN produces -1. The side effect isn't used.
google search: "chicken programming language" returns:
#1 Chicken (scheme implementation) http://en.wikipedia.org/wiki/Chicken_%28scheme_implementatio...
#2 CHICKEN Scheme http://www.call-cc.org/