My Contributions
|
Task
|
Language
|
Contribution
|
Notes
|
Casting out nines
|
Common Lisp
|
First contributor
|
- I used a macro to ensure that the filter would be inlined
- Possible implementations: C, C#, Java, Haskell, R
|
Compound data type
|
Common Lisp
|
First contributor
|
- I demonstrate how the defstruct macro creates a default constructor w/ accessor functions for each slot
- I should add some comments on integration with the printer and a list iteration example like F#
- The task description should include easy, medium, and hard variations:
- construction, data typing, assignment, printing, equality
- Use the point type w/ something like the Haversine formula
- Possible changes: C# should include more output; Haskell better comments; R better comments & examples
|
Function composition
|
Common Lisp
|
Added the compose macro
|
- I wrote the compose macro for a couple of reasons:
- To provide an elegant means of function composition w/ three or more functions
- To hide funcall which is a by-product of CL being a Lisp-2 and somewhat inelegant
- The most elegant solutions: Haskell, Mathematica, OCaml, Scheme, and Common Lisp (via macro-cheating)
- The Ada implementation is practically a 'proof' that over-use of syntax inevitably leads to inelegant code
- Let's be realistic... Nobody has ever done function composition at work in C, C++, Obj-C, C# or Java. Ever.
|
Guess the number
|
Common Lisp
|
First contributor
|
- The C, C++ and R versions don't appear to be very robust
- Why does the Java version use Math.random, then caste to an int, instead of using java.util.Random
|
Guess the number/With feedback
|
Common Lisp
|
First contributor
|
- The current task lacks any meaningful difference from the original.
- Possible change: require implementations to extend the Guess the number code in order to demonstrate how each language handles changes in requirements, modularity, etc.
|
Haversine formula
|
Common Lisp
|
First contributor
|
- I really appreciate how elegantly the Haskell distRad function 'destructures' function parameters
- I might add a CL implementation that demonstrates the destructing-bind macro
- A version of this task using points in multiple higher-dimensions would be interesting
- The current task that would probably benefit from some additional examples and/or unit tests
- There should probably be some kind of automated unit test task
|
Higher-order functions
|
Common Lisp
|
Added the CL library examples
|
- This is another task that would really benefit from more concrete task examples.
- Possible changes:
- Clojure, Haskell & Scheme should have better comments and examples
- "A function is just a value that wants arguments" ... really?!
|
Kaprekar numbers
|
Common Lisp
|
Added a 2nd implementation
|
Reasons for the addition:
- The original implementation didn't take advantage of several Lisp forms which improve readability
- The new version had significantly better performance
- However, the new version is limited to base 10 numbers
|
Pancake sort
|
Common Lisp
|
First contributor
|
- This is another task that would benefit from multiple versions:
- Easy - implement the 2n-3 pancake sort algorithm
- Medium - implement the 5/3*n pancake sort algorithm
- Hard - implement the 18/11*n pancake sort algorithm
- I'm considering improving the current code
|
S-Expressions
|
Common Lisp
|
Replaced the original implementation
|
I consider this to be my best contribution:
- The parser is 5 SLOC (even w/ having to parse square brackets); The writer is ~20 SLOC
- By comparison, the Java parser consists of 6 classes and ~200 SLOC
- Few languages have contributions for the harder writing S-Expressions tasks
|