KBD

Keith Devens .com

Sunday, July 6, 2008 Flag waving
Crying is all right in its way while it lasts. But you have to stop sooner or later, and then... – C.S. Lewis (The Silver Chair, ch 2)

Tag: Functional Programming

Parents:

Daily link icon Monday, February 27, 2006

  1. The Implementation of Functional Programming Languages. "My 1987 book is now out of print, but it is now available online in its entirety." (Via reddit).

       (0) Tags: [Books, Functional Programming, To Read]

Daily link icon Tuesday, February 21, 2006

PHP's 'create_function' function

PHP's create_function function is so cumbersome to use that I'm creating shortcuts for the most common cases. Very often all you want to do is a map and return a particular field out of an associative array. So:

<?php
function mapfield($key$func=null){
    return 
create_function('$a',"return $func(\$a['$key']);");
}
?>

Used as in:

<?php
function tags_join($tags){
    
#given an array of tags give the canonical space separated listing
    
return join(' ',array_unique(array_map(mapfield('Name'), $tags)));
}
?>
July 2008
SunMonTueWedThuFriSat
 12345
6789101112
13141516171819
20212223242526
2728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 4 posts

Recent comments XML

Girls, please don't get breast implants

> And no, you will not be receiving​a picture.

:-(...

Keith: Jul 2, 6:05am

Javascript clone function

This is a clever way to clone an​object if you are using YAHOO UI.​Same tec...

Antonio: Jul 1, 12:47pm

I hate Norton Antivirus

Oh just one other thing norton is​great at keeping people out of your​compu...

kevin.sands: Jul 1, 12:50am

Generated in about 0.131s.

(Used 10 db queries)

mobile phone