[Haskell-beginners] combinatorial

Edward Z. Yang ezyang at MIT.EDU
Sun Nov 22 13:37:31 EST 2009


Excerpts from Edward Z. Yang's message of Sun Nov 22 13:29:42 -0500 2009:
> Letting Int decrease in successive iterations.
> 
> [snip]
> 
> workFunc 0 song eval = return song
> workFunc n song eval = do
>     song' <- generateFunc
>     case eval song' of
>         Nothing -> []
>         _ -> return song'

Um, I fudged the recursive case.

workFunc n song eval = do
    song' <- generateFunc
    case eval song' of
        Nothing -> []
        _ -> workFunc (n-1) song' eval

Cheers,
Edward


More information about the Beginners mailing list