Posts

Showing posts with the label Functional programming

Recursive Pooh

Image
Mind you, if Pooh is  tail-recursive , he’s basically getting to eat an ∞ amount of honey. Or, more likely, there is an OutOfHoney error…

“for loop”— and The Pain of Existence

Image
Say you’ve got a bunch-a items in a list,   [4, 1, 3, 2]   for example. If you look at all the reasons you might be using   for loops, you can probably break it down into one of the following. 1. Filter   a specific sub-list from the list . For example we want to pull out all the items less than   3 , so that   [4, 1, 3, 2] -> [1, 2] 2. Reduce   the values into a single one . For example, we want to sum all the items on the list, so that   [4, 1, 3, 2] -> 10 3. Map   an operation onto each item on the list . For example, we want to double each item, so that   [4, 1, 3, 2] -> [8, 2, 6, 4] . 4. Sort   the list in some form . For example, in descending form, so that   [4, 1, 3, 2] -> [4, 3, 2, 1] Oh there are many,   many   more things that you could be doing in your   for loops, but the vast majority tends to fall into one of the above   filter / reduce / map / sort   buckets. Or, ...

Video Codecs, and Rapidly Adapting to Network Conditions

Image
“ Genius lies in inventing stuff that is totally obvious in retrospect ”  — Me Every now and then you see stuff that genuinely surprises you. Oh, not in the “ it’s a floor-wax  and  a salad-dressing ” sense, but in the “ good god, that is so ridiculously obvious, why didn’t  I   think of that? ” sense. Fouladi et al (•).  have pulled off  two  of these with their new approach to video encoding — in their approach to architecting streaming video, and actually writing the codecs Video Streaming Let’s look at the architecture first. Most (all?) video streaming systems these days have two major components, a codec to encode the video, and a transport protocol to get it to the destination. The way the system usually works is that that the transport protocol figures out the network capacity the best it can, by looking at congestion, RTT, etc. The codec then uses the capacity to figure out what levels of compression to apply to the video, so that t...

I'm not smart enough to use mutable state

Image
with apologies to @kenbot

Why Erlang?

Image
A straight cut-and-paste from erlang-questions - it pretty much sez. it all, and very eloquently at that Anything can be done in any language, so the technical answer is "nothing". But the spirit of the question begs for an answer, especially in a company situation with deadlines. My company does mostly business data systems and custom extensions to certain products of ours. Originally we used a mix of Python (probably 70%), PL/pgSQL (maybe 10%), Guile/Scheme (probably around 10%), C (5%ish) and a smattering of Bash, Perl, Scala or Java, etc. where necessary. I am extremely familiar with Python and Guile, and between those two a one-dimensional solution to any conceivable problem can be reduced to triviality. They are great languages. They have great libraries. They tie into the rest of the *nix world smoothly. Super tools, *vastly* superior in every way (for us) than more prolific tools such as Java. But when it came time for us to deal with some new feature requests -- ...