Python has optional arguments…

I think the answer to this is currying. It’s not quite as cute:

foo a b = ...

Later becomes

foo = foo1 const
foo1 c a b = ...

If you don’t like sticking c at the front you’ll have to use lambda:

foo a b = \ a b -> foo 1 a b const
foo1 a b c = ...

In some cases you can use flip I suppose. Someone who knows haskell better than me might have better solutions to it…

Oh yes, I have to say that requiring an account is not inviting casual commenters…

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>