Past Meetup

Meeting with programming task in advance

This Meetup is past

33 people went

Location image of event venue

Details

Dear functional programming enthusiasts,

we thought it would be the time to have our first fun-club session this year, so next fun-club is

February, 28th, 2013 - 19:30
SoundCloud
Rosenthaler Strasse 13
10119 Berlin

This time we would like to give a little task in advance. The task described below is quite simple, but still going beyond the toy examples we had 2 sessions ago. We would like to see at least 5 volunteers who solve the task and present and discuss their solution at the next meeting (each in a different language if possible).

We'd be happy to have solutions in (at least) these languages:
- JavaScript
- Haskell
- Erlang
- LISP or a LISP dialect (Clojure anyone?)
- Scala or F#
- optional: a shell one-liner just with GNU tools and pipes

Write email to Lars (lars@nyantec.com) with the languages you offer to do and state which you'd be most happy with. He'll try to arrange that we get a selection that everyone is happy with.
Also write him if you find some problems with the task that you think everyone else should also know about.

All the best,
your fun-club organisers

tl'dr: here is the task:
----------------------------

You'll be given a simple textfile written in English language (like this one: http://www.textlibrary.com/download/moby-dic.txt).

Your task is to write a litte program that counts the occurences of words and print the 10 most frequent words with their number of occurences to stdout, like so (numbers are not correct!):

$ mysolution < moby-dic.txt
the: 50123
of: 10236
and: 9999
to: 4024
a: 3901
in: 2561
that: 2400
i: 2331
was: 2114
he: 1738

What is a word?
---------------------
- we'll assume that a word consists just of the the characters from a-z
- we don't distinguish uppercase and lowercase, so it's okay to convert everything to lowercase
- everything that is not in a-z can be considered a word boundary, so it's easiert for you to deal with commas, colons and the like.

What is the minimal requirement?
---------------------------------------
1. Write a minimal solution in your language that solves the task for the moby-dic.txt
2. Make your solution presentable (comment your source or prepare a little slide)
3. Be able to explain in a few sentences
- how your solution works
- what dependencies it has (non standard libraries etc)
- in what way your solution benefits from something special about your language
- and what its drawbacks are (if there are any)

What else can be done (optional)?
---------------------------------------------
Performance:
- Benchmark your solution in regards of time consumption. Either use the time command (man time) or even show us how to benchmark in your language.
- What is your solution spending time with? IO? Garbage collection?
- Improve that.
- Benchmark again...

Memory consumption:
- It is fine to read moby-dic.txt all at one into memory, but what if we give you a corpus that does exceed your machines memory? Fix this. Tell us about.
- Since this is functional programming: What datastructure did you use? Is it functional? Does it trigger heavy allocation and garbage collection? Find out and tell us about.