Posts filed under “haskell”

Coin Tricks

Derren Brown recently claimed he would predict the UK lottery numbers, live on television, and then explain how he did it. It’s doubtful that he did either — the alternative explanation that he’d actually committed a massive and improbably daring fraud is vastly more likely than the bullshit he spun out, as it’s actually possible… [...]

Is currying monadic?

Here’s a question that came up while I’ve been trying to implement currying in Perl: is Currying monadic? I’ve tried a couple of times, but not managed to explain what I mean very well on #haskell, so let’s see if a longer writeup explains it better. My simplistic understanding of monads is that they take [...]

Currying in Perl

“Currying” is a simple idea that is surprisingly powerful on the one hand, and which was surprisingly hard (at least for me) to get my head around – possibly because the concept didn’t exist natively in the languages I learnt first. When you declare a function in currying style, each argument is taken one at [...]

“Functional Pe(a)rls” at, Manchester, 5th May

The nice chaps at NorthWestEngland PerlMongers have organized a technical meeting on 5th May, at the Manchester Digital Development Agency. I’ll be doing a 3rd version of my Functional Pe(a)rls talk, about Haskell-inspired craziness in Pure Perl. And Matt Trout and Ian Norton will be talking about OO Database design, and Maildir migration, so there’s [...]

(rough) Grids in Haskell

(This isn’t a full blog post, but a note of a few things about implementing game grids in Haskell). A [[Cell]] structure seems to make sense for a lot of boards. In fact, even the problems I’m looking at might be approached simply indexing into row then col each time you want to access a [...]

More longest paths, and sick folds.

This week’s simple longest path exercise seems to have had more mileage in it than I expected. Thanks to everyone’s comments and suggestions, I’ve updated with a number of times with, among other things, an improved Haskell version that acts on path elements instead of just characters. But I had intended to do a version [...]

There’s the nub (snippet in Perl and Haskell)

Here’s a simple problem, with solutions in Perl and Haskell. @joel: suppose I have a list of strings (they happen to be paths) – how might I find only the longest instance of each path? @joel: that is give /foo /foo/bar /foo/bar/baz /qux I only want back /foo/bar/baz and /qux @joel: do I need to [...]

Crossword puzzles in Haskell

Every year or so I come back to the problem of writing a crossword puzzle compiler/player. I think Javascript would be the most promising for a web-based player, though I’ve given it a go in Java and Perl too. Modeling the problem is interesting in an Object Oriented language – I would find myself getting [...]

Functional Pe(a)rls v2 (now with Monads!) at the London Perl Workshop 2008

On Saturday I gave an updated version of my Functional Pe(a)rls talk. This time around I cut the whistlestop tour of builtin FP techniques in Perl (map/grep/join) and added a section on Monads – what they are and how to implement them. I’d originally worried that the slides might have been over-academic and hard to [...]

Countdown words game solver in Haskell

Will on #geekup has been working on a Countdown letters and numbers game solver written in Python. I thought it'd be fun to try to do it in Haskell, and started with the letters game (anagram) solver. Starting with a string of jumbled letters, the goal is to make the longest possible anagram. I remember [...]