|
User Name
|
neko-mangaka |
|
Unique Hits
|
411 |
|
Real Name
|
Chris Bouchard |
|
Location
|
United States New York |
|
Occupation
|
Web Developer |
|
Gender
|
Male |
|
Age
|
22 Years Old |
|
WebSite
|
infothruway.net |
|
|
Currying in JavaScript: Fun for the Whole Family!
Programming
|
As I've said before, I'm quite partial to JavaScript. Lately, I've been reading about currying functions, so let's see if currying can be done in JavaScript.
The begs the question, What is currying? Currying is a technique to transform a function that takes some number of arguments to a function that takes fewer. The process was named after the logician Haskell Curry. The goal is to get something that works like this:
When we pass fewer than the required number of arguments, it returns a function that takes the remaining arguments. Once we pass the correct number of parameters, it evaluates the function.
Before possibly reinventing the wheel, I looked online to see if anyone had done this. While there are plenty of JavaScript functions that claim to curry, they all get it wrong. They do something like this (using the same add from above):
They do get the add_3 function in the end, but all they do is create a new function with View In Full
 |
7 Comments |
9.00 out of 10 |
|
|
|
|
Splitting a list recursively in Scheme
|
Scheme
|
1.48 Year Ago
|
1
|
|
7.00
|
- - -
|
1,660 Chrs
|
|
|
If you're like me, you've been programming in Scheme and wanted to split a list into sub-lists of [semi]-equal length. I'm sure there's a library function to do this (I didn't even look), but I wanted
|
|
|
|
Tail Call Optimization
|
JavaScript
|
1.82 Year Ago
|
3
|
|
9.00
|
- - -
|
1,820 Chrs
|
|
|
A big problem in JavaScript is recursion. As a functional programming language, recursion is a natural way to express many algorithms. Unfortunately, most browsers have atrociously short function ca
|
|
| Please login to post comments. |
|
|
Hi ya mate,
I recognize you from Deviant Art :-) nice to have you on here. Gonna PM ya.
Kind regards,
Scott
|
|
 |
Chris Bouchard (22) United States, New York |
|
|
neko-mangaka has 0 fans
become a fan |
|
 |
|
|
 |
|