How do I call the double() function?
grocery_stocker
cdalten at gmail.com
Sat Mar 21 11:28:17 EDT 2009
On Mar 21, 8:21 am, Kushal Kumaran <kushal.kuma... at gmail.com> wrote:
> On Mar 21, 7:55 pm, grocery_stocker <cdal... at gmail.com> wrote:
>
> > Given the following....
>
> > def double(val):
> > return val.bind(lambda x: val.return_(x*2))
>
> > I get "AttributeError: 'int' object has no attribute 'bind' " when I
> > try to do the following
>
> > double(2)
>
> > <snipped>
>
> See the usage of the double function inhttp://lukeplant.me.uk/blogmedia/monad_explanation.py,
> which is presumably where you got it from. It's not being passed in
> an ordinary int. int's do not have bind or return_ attributes.
>
Yeah, I did the the code from
http://lukeplant.me.uk/blogmedia/monad_explanation.py
More information about the Python-list
mailing list