scan is similar to fold - except instead of the result being the final value, it's a list of all the intermediate values up to the final one (if it exists - scanl is productive and can handle infinite lists just fine).
So the first fibonacci number is 1 (we're concatenating it onto the front of the list), the second fibonacci number is also one (the second argument to scan), and every fibonacci number after that is the sum of the previous number (scan's running total) and the one before that.
(def string "This is an example tweet talking about scala and sbt.")
(some #(.contains string %) ["scala", "akka", "play framework", "sbt", "typesafe"])
6) I'm going to leave this blank for now. It's an easy enough problem, but I can't think of a way of doing it in a nifty one-liner.
Edit: Ahh thought of it now. group-by does it nicely:
(group-by #(> % 60) [49, 58, 76, 82, 88, 90])
which returns a map with the elements keyed to the result of the anonymous function. In this case:
{false [49 58], true [76 82 88 90]}
7) Something like
(xml-seq (clojure.xml/parse the-xml))
probably.
8)
(apply max [14, 35, -7, 46, 98])
(apply min [14, 35, -7, 46, 98])
9)
Clojure has pmap, which is used just like map is, work is just done in parallel. Also Clojure is known for its concurrency features, which I won't go over here.
10) I'm sure this can be done in a similar amount of code in Clojure, though I am not going to try.
I have a bit of experience with this as a course helper in the introductory (CS106 series) CS classes at Stanford.
I think it could be a very cool platform for assignments in CS107 (where students are introduced to Unix and C programming) or CS110/CS140 (the core OS classes).
Instead of ssh-ing into a locked-down cluster computer, students could boot a machine in their browser and get root access. No setup, no configuration. Everyone gets an identical setup, which would be really nice for the people making the assignments. The main thing people would need is a way to save files to a persistent disk. Maybe a filesystem driver could be added that uses HTML5 Local Storage, or talks to a web service running on the class website?
Incidentally, students in CS140 are already using Fabrice Bellard's software. You write most of a very simple Unix kernel, testing and running it in QEMU.
Off the top of my head, this seems to be one possibility of having something like a persistent development environment. I could fire up vim, the server could store the environment and I could easily write code from every place with a decent browser.
Oh I don't know, perhaps it doesn't include the 4-projector basement monitoring screen in the basement, relaying real-time hits and anomalous voting patterns.
I use GOM player, the good the thing about GOM is that it supports external codecs along with it internal ones too, unlike VLC. So you can use the CCP with this too, although they provide most of the codecs.
The external codec thing is a benefit for me because I use the CoreAVC codecs to play H.264 encoded files which have huge resolution (1080p) on my old PC. Methinks VLC should also allow external codecs.
Any clues as to why that happens? The code simply inserts the HTML of the content sections of the linked sites into the RSS feed. It doesn't seem to happen with all sites.
Probably it happens when the real text encoding is different from the declared one (at least that's the problem I encountered when aggregating content from unfiltered wild web).
If it really bothers, you can use chardet [1] to try to detect the real encoding (BeautifulSoup should use it if it's installed). But even this is not 100% foolproof.