Addendum to function currying

In my last post I’ve tried to explain the differences between Grey's anatomy season 13 downloadtodaytvseries.com partial function application and function currying.

The post was more generally addressed to JavaScript developers (as an accompanying material to a presentation I’m working on) so I’ve tried to keep the text as practical as possible in the context of JavaScript programming.

But as I remarked on, the post wasn’t academically correct, more precisely the examples I’ve used had a specific purpose of incorrectness. Skipping that part for now, let’s just see what exactly currying means to its true definition.

In mathematics and computer science, currying is the technique of transforming a function that takes multiple arguments (or an n-tuple of arguments) in such a way that it can be called as a chain of one argument functions.

Continue reading

2 Comments

Filed under Code, Discussion

Differentiating between function currying and partial function application

With the recent rise of functional programming (in recent years) a lot of concepts have made their way into mainstream programming languages. Higher order functions, closures, partial function applications, currying; just to name a few.

But from all these concepts, the last two seem to be in many places used interchangeably, or so may they seem from various articles and code snippets spread over the internet. Don’t get me wrong, I am responsible for such confusion myself, and my co-workers can blame me for it on that time when I tried to explain partial function application.

That, ends today, because I’ve gotten my facts right and demistified these two strange concepts that seamingly do the same thing. Continue reading

2 Comments

Filed under Code, Insight

A simple symfony 1.4 URL validator

A 0.5 improvement, is still an improvement.

As much as we’d like people to strictly fill in data into forms, they get annoyed and complain when the http:// prefix is mandatory. As such I had to create my own validator which is a little more permissive over symfony’s default URL validator.

Sometimes I really find user feedback bothersome.

Leave a Comment

Filed under Code

Sleepsort

It simply amazed me the cleverness that this guy on 4chan had when writing this algorithm.

For each number in the list, it spawns a process waiting an amount of time equal with the number received and afterwards prints its.

Brilliant, I would say.

Leave a Comment

Filed under Code

CodeJam, a lesson in Haskell IO

As you may know yesterday took place the qualification round for the Google Code Jam contest. While it’s start time was around 2AM in my timezone I felt pretty excited to participate, given that my objective was to use Haskell and get better in it.
Continue reading

Leave a Comment

Filed under Challenge, Code

Flavius Josephus in Haskell

My first Haskell solution for a programming praxis challenge, and this time I almost nailed it.

Almost, because even with a clear specification of the expected result I still managed to lose focus for a moment, and went for a “fancy” solution that doesn’t quite qualify as a solution. What I want to say is that instead of returning a list ordered with the people who have died, I have only returned the last person killed.
Continue reading

Leave a Comment

Filed under Challenge, Code

The Ackermann function in Haskell

While the Ackermann function is a trivial one to write, it made me realize something today.
Continue reading

Leave a Comment

Filed under Code

Bingo game in Io language

This is the third chronological challenge from ProgrammingPraxis, and this challenge took the most time to complete given I it was the first program I wrote in the Io language
Continue reading

Leave a Comment

Filed under Challenge, Code

FTP, PHP and leaky abstractions

To be honest until recently I never gave much taught on FTPs way of working. Sure I’ve used it for a long time, and tried to minimize it’s use for an even longer period; but sometimes you just get things as granted.

Due to some events that took place last week I realized how leaky the FTP libraries actually are.
Continue reading

Leave a Comment

Filed under Discussion, Insight

A Subversion horror story

Every once in a while the stars align for one, and only one single purpose; to drive developers in the twilight zone of bug madness. Unlike many other occurrences, this time the problem wasn’t code related, it all happened at the version control level.
Continue reading

2 Comments

Filed under Insight