Functions are a type of monad, and function composition is a type of
monadic binding. You could certainly say that middleware are a type of
monad, but so many things can be thought of as monads that's not hugely
useful in and of itself.
- James
On 1 July 2016 at 18:14, Scott Klarenbach wrote:
>
Thanks Michael.
On Saturday, November 9, 2013 10:26:09 AM UTC-8, Michael Klishin wrote:
>
> 2013/11/9 Gary Zhao >
>
>> NoSuchMethodError
>> clojure.lang.RT.mapUniqueKeys([Ljava/lang/Object;)Lclojure/lang/IPersistentMap;
>>
>> clojure.algo.monads/loading--4910--auto-- (monads.clj:11)
>>
> It m
2013/11/9 Gary Zhao
> NoSuchMethodError
> clojure.lang.RT.mapUniqueKeys([Ljava/lang/Object;)Lclojure/lang/IPersistentMap;
> clojure.algo.monads/loading--4910--auto-- (monads.clj:11)
>
It means you have some code compiled against 1.5.1 in monads, one of the
other libraries or your own code.
Run l
Last week I released a project with a monadic translator that needed to:
- work on sequences of expressions, arbitrarily nested
- generate Clojure code or stop and report the first error
- maintain a symbol table with easy access but not global state
The relevant code is here:
https://github.com/b
I don't know if this is adequately "in the wild" (since it's part of a
monad lib itself), but part of my monads library uses a continuation monad
to let two mutually recursive functions traverse and rebuild a tree
structure without blowing the stack. It would be a pain to do this kind of
thing by h
oops, gen-plan was missing a helper function:
(defn- with-bind [id expr psym body]
`(fn [~psym]
(let [[~id ~psym] ( ~expr ~psym)]
(assert ~psym "Nil plan")
~body)))
On Mon, Apr 8, 2013 at 9:32 AM, Timothy Baldridge wrote:
> I have a love/hate relationship with monads. I th
I have a love/hate relationship with monads. I think their use in Clojure
programming is much more limited than most would like to admit.
However, I have found a very nice use for them: in my case, I'm attempting
to insert a very complex AST into Datomic. I'd like all my data to go into
Datomic as
In a few lines:
Monads are a common framework to represent any sequential computation.
What is a sequential computation?
- either no computation at all.
return :: a -> m a
does that.
- or I have already a computation and want to go on with my computation.
But then, I need to be able to look
On Friday, October 26, 2012 11:06:59 AM UTC-5, Brian Craft wrote:
> I've read about four tutorials on monads so far, but it still escapes me.
>
> In fact, I'm still not sure what problem it solves. I'm familiar with the
> problem of having, say, three functions like f(a) -> b, g(c) -> d, h(e) ->
I found these articles very valuable in understanding the original
motivation for monads and their use for practical development.
Imperative Functional Programming
Simon Peyton Jones, Philip Wadler
http://research.microsoft.com/pubs/67066/imperative.ps.z
Monadic Parser Combinators
Graham Hutton
On Fri, 2012-10-26 at 21:55 -0700, Ben Wolfson wrote:
> f :: a -> b
> g :: c -> d
> h :: e -> j [renamed from "f"]
>
> and "you'd like to chain [them] like f(g(h(x))), but you can't because
> b is a different type from c and d is a different type from e.", how
> does m-chain help?
>
> I would hav
On Fri, Oct 26, 2012 at 8:39 PM, Stephen Compall
wrote:
> On Fri, 2012-10-26 at 09:06 -0700, Brian Craft wrote:
>> First, do monads provide a generic solution, so I can apply
>> f(g(h(x)))?
>
> Yes. control.algo.monads provides it as m-chain.
Can you expand on this? If the functions are
f :: a
On Fri, 2012-10-26 at 09:06 -0700, Brian Craft wrote:
> First, do monads provide a generic solution, so I can apply
> f(g(h(x)))?
Yes. control.algo.monads provides it as m-chain.
The closest equivalent to m-chain in Haskell is (foldl' (>=>) return),
but in most situations you would favor f =<< g
On Oct 26, 2012, at 11:06 AM, Brian Craft wrote:
> I've read about four tutorials on monads so far, but it still escapes me.
>
> In fact, I'm still not sure what problem it solves.
Monads are hard to understand, and I too found I wasn't the target audience for
the explanations I read. I final
I can't say I grok monads completely yet, but was one of the tutorials you read
this one?
http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html
I like the style of showing how they solve problems that arise naturally in the
context of purely functional programming, with several
On Wed, Jul 13, 2011 at 1:37 PM, Raoul Duke wrote:
> On Wed, Jul 13, 2011 at 5:20 AM, Ken Wesson wrote:
>> Oh, I'm not saying my own is exploding -- just that macros can be
>> tough for some people to get their heads around, and monads even more
>> so, so combining the two ...
>
> maybe call them
On Wed, Jul 13, 2011 at 5:20 AM, Ken Wesson wrote:
> Oh, I'm not saying my own is exploding -- just that macros can be
> tough for some people to get their heads around, and monads even more
> so, so combining the two ...
maybe call them something else and it won't be so bad. when people see
the
On Wed, Jul 13, 2011 at 7:19 AM, Konrad Hinsen
wrote:
> On 13 Jul 2011, at 05:04, Ken Wesson wrote:
>
>>> One approach that has been proposed to improve composability of macros is
>>> to
>>> adopt a continuation-passing style. This would make macros a candidate
>>> for
>>> the continuation monad,
On 13 Jul 2011, at 05:04, Ken Wesson wrote:
One approach that has been proposed to improve composability of
macros is to
adopt a continuation-passing style. This would make macros a
candidate for
the continuation monad, so perhaps monads may be of use in
implementing
complex macros.
That
On 12 Jul 2011, at 23:18, Alan Malloy wrote:
On Jul 12, 12:01 pm, Konrad Hinsen wrote:
The composability issue with macros lies in writing them, not using
them.
Strongly disagree. Macros compose reasonably well when writing them
(eg, using let in the implementation of with-open is trivial);
On Tue, Jul 12, 2011 at 3:01 PM, Konrad Hinsen
wrote:
> On 12 Jul 2011, at 15:40, James Keats wrote:
>
>> My humble understanding is that macros complicate composability,
>> whereas monads facilitate it.
>
> The composability issue with macros lies in writing them, not using them.
> Monads are all
On Jul 12, 12:01 pm, Konrad Hinsen wrote:
> The composability issue with macros lies in writing them, not using them.
Strongly disagree. Macros compose reasonably well when writing them
(eg, using let in the implementation of with-open is trivial); it's
composing already-written macros with other
On Jul 12, 9:28 am, James Keats wrote:
> I'm mildly concerned about macros being seen as the "secret weapon" of
> clojure(/lisp).
> In their place, i wish monads would get a wider attention and embrace.
>
> Discuss? :-)
What is your concern, specifically? I don't see a position being
articulate
On 12 Jul 2011, at 15:40, James Keats wrote:
My humble understanding is that macros complicate composability,
whereas monads facilitate it.
The composability issue with macros lies in writing them, not using
them. Monads are all about composing computations with specific
properties, where
>> In their place, i wish monads would get a wider attention and embrace.
please y'all note that there's much more to
category-theory-in-programming-languages than just monads. :-)
http://www.haskell.org/haskellwiki/Typeclassopedia
sincerely.
--
You received this message because you are subscr
On Jul 12, 9:33 am, Thorsten Wilms wrote:
> It's not my perception that there is a lot of noise about macros,
> whereas articles about monads are like bunnies and have taken to the
> meta-level.
I was going to write an article about how to use monads to simplify
the implementation of the code for
On 07/12/2011 03:28 PM, James Keats wrote:
I'm mildly concerned about macros being seen as the "secret weapon" of
clojure(/lisp).
In their place, i wish monads would get a wider attention and embrace.
Do you want to suggest that it would be common that an issue can be
solved with either a ma
2011/7/12 David Nolen
> On Tue, Jul 12, 2011 at 9:40 AM, James Keats wrote:
>
>>
>>
>> On Jul 12, 2:36 pm, Tamreen Khan wrote:
>> > Are monads all that special? My understanding is that even in Haskell
>> > its wise to not use monads all that much, since it starts to make the
>> > code look a li
On Tue, Jul 12, 2011 at 9:40 AM, James Keats wrote:
>
>
> On Jul 12, 2:36 pm, Tamreen Khan wrote:
> > Are monads all that special? My understanding is that even in Haskell
> > its wise to not use monads all that much, since it starts to make the
> > code look a little too imperative if not wielde
On Jul 12, 2:36 pm, Tamreen Khan wrote:
> Are monads all that special? My understanding is that even in Haskell
> its wise to not use monads all that much, since it starts to make the
> code look a little too imperative if not wielded correctly. They're
> not really the meat of haskell/fp. Macro
Are monads all that special? My understanding is that even in Haskell
its wise to not use monads all that much, since it starts to make the
code look a little too imperative if not wielded correctly. They're
not really the meat of haskell/fp. Macros on the other hand are an
important part of lisp,
yea .. I was playing around and modified it in the due coarse.. :)
Sunil.
On Tue, Nov 2, 2010 at 5:28 PM, Konrad Hinsen wrote:
> On 02.11.2010, at 11:45, Sunil S Nandihalli wrote:
>
> > following is the extract from the monads example ...
>
> It looks quite modified and no longer returns pairs! H
Hi Konrad, nicolas and Ken,
Thanks for help. I am sure I will need more help when I try to walk through
the rest of the examples.
But the idea of monads is really neat..:)..
Sunil.
On Tue, Nov 2, 2010 at 7:19 PM, Ken Wesson wrote:
> On Tue, Nov 2, 2010 at 8:55 AM, Konrad Hinsen
> wrote:
>
>
On Tue, Nov 2, 2010 at 8:55 AM, Konrad Hinsen wrote:
> On 02.11.2010, at 13:34, Ken Wesson wrote:
>
> > This wouldn't work?:
> >
> > (with-monad sequence-m
> > (defn ntuples [n xs]
> > (apply (m-lift n list) (replicate n xs
>
> No.
>
> > (If m-lift is a macro that requires the arity arg
On 02.11.2010, at 13:34, Ken Wesson wrote:
> This wouldn't work?:
>
> (with-monad sequence-m
> (defn ntuples [n xs]
> (apply (m-lift n list) (replicate n xs
No.
> (If m-lift is a macro that requires the arity arg to be known at
> macroexpansion time:
>
> (with-monad sequence-m
>
On Tue, Nov 2, 2010 at 7:58 AM, Konrad Hinsen wrote:
> On 02.11.2010, at 11:45, Sunil S Nandihalli wrote:
>
> > following is the extract from the monads example ...
>
> It looks quite modified and no longer returns pairs! Here is the original:
>
> (with-monad sequence-m
> (defn pairs [xs]
>
On 02.11.2010, at 11:45, Sunil S Nandihalli wrote:
> following is the extract from the monads example ...
It looks quite modified and no longer returns pairs! Here is the original:
(with-monad sequence-m
(defn pairs [xs]
((m-lift 2 #(list %1 %2)) xs xs)))
> ; Another way to define pair
As I understand it, m-seq is transforms a list of monadic computation
into a computation returning the list of result.
The resulting computation just sequentially does every computationin
the sequence and keep the result.
It is useful when the arity is not known at runtime foir example.
On Tue,
The sample code is available now. Took a little bit to get it set.
It's the code from the tutorial with a little bonus. I implemented an
HTTP protocol parser, using the parser-m monad, as an example.
Jim
On Apr 16, 12:37 am, Baishampayan Ghose wrote:
> The code pagehttp://intensivesystems.net/
jim wrote:
> I've just posted a tutorial on using monads in Clojure at
>
> http://intensivesystems.net/tutorials/monads_101.html
>
> It's one big chunk of text since I haven't had time to break it up
> yet. It's also kind of rough, so if you see any typos, misspellings,
> errors, etc., post 'em
Hi Jim,
Thanks for writing the tutorial!
Kev
On Apr 16, 2:01 am, jim wrote:
> I've just posted a tutorial on using monads in Clojure at
>
> http://intensivesystems.net/tutorials/monads_101.html
>
> It's one big chunk of text since I haven't had time to break it up
> yet. It's also kind of
On Nov 25, 2008, at 9:06 AM, Konrad Hinsen wrote:
> But it would be fairly easy to implement symbol-
> macrolet on top of my replace-syms. Would that be something of
> interest to the Clojure community?
I have no experience with it myself, but I've seen it discussed as
something that would be
On Nov 21, 2008, at 17:10, Chouser wrote:
> This is pretty code. Did you just implement symbol-macro-let?
> Very nice.
I just saw a reference to symbol-macrolet with a description. My
function replace-syms is indeed very similar, the difference being
that it takes a map for defining the
On Nov 23, 1:15 pm, Konrad Hinsen <[EMAIL PROTECTED]> wrote:
> On 21.11.2008, at 20:10, Adam Jones wrote:
>
> >> The file contains the macro definitions, the definitions of three
> >> popular monads (maybe, list, state), and some illustrations of their
> >> use. Comments are welcome!
>
> > Since
On 21.11.2008, at 20:10, Adam Jones wrote:
>> The file contains the macro definitions, the definitions of three
>> popular monads (maybe, list, state), and some illustrations of their
>> use. Comments are welcome!
>
> Since they support mzero and mplus, aren't these equivalent to
> Haskell's Mona
Stuart Sierra writes:
> Rich gives out commit permission on clojure-contrib to people who are
> interested, but he doesn't dictate what goes in. You have to sign the
> Clojure Contributor agreement, which basically says that if the
> Clojure license changes at some point, you allow your contribut
On Nov 21, 3:14 am, Konrad Hinsen <[EMAIL PROTECTED]> wrote:
> As a first non-trivial exercice, I wrote an implementation of monads
> in Clojure. I just uploaded it to the Group:
>
> http://clojure.googlegroups.com/web/monads.clj
>
> The file contains the macro definitions, the definiti
On Fri, Nov 21, 2008 at 11:40 AM, Konrad Hinsen
<[EMAIL PROTECTED]> wrote:
>
> Thanks! I don't know what symbol-macrolet is/does, so I can't
> comment on that. It's probably some Common Lisp thing, right?
Probably, though when googling it just now, I seem to have found some
third-party implemen
On 21.11.2008, at 17:10, Chouser wrote:
> On Fri, Nov 21, 2008 at 6:14 AM, Konrad Hinsen
> <[EMAIL PROTECTED]> wrote:
>>
>> As a first non-trivial exercice, I wrote an implementation of monads
>> in Clojure. I just uploaded it to the Group:
>>
>>http://clojure.googlegroups.com/web/monads.
On Fri, Nov 21, 2008 at 6:14 AM, Konrad Hinsen
<[EMAIL PROTECTED]> wrote:
>
> As a first non-trivial exercice, I wrote an implementation of monads
> in Clojure. I just uploaded it to the Group:
>
>http://clojure.googlegroups.com/web/monads.clj
This is pretty code. Did you just implement
On Nov 21, 10:06 am, Konrad Hinsen <[EMAIL PROTECTED]> wrote:
> Actually, I have no idea of how clojure-contrib works. Is this a
> repository for all kinds of Clojure add-ons? Or stuff selected by
> Rich for a specific reason?
Rich gives out commit permission on clojure-contrib to people who are
On Nov 21, 2008, at 15:01, walterc wrote:
> how about clojure-contrib?
Actually, I have no idea of how clojure-contrib works. Is this a
repository for all kinds of Clojure add-ons? Or stuff selected by
Rich for a specific reason?
Konrad.
--~--~-~--~~~---~--~--
how about clojure-contrib?
On Nov 21, 7:14 pm, Konrad Hinsen <[EMAIL PROTECTED]> wrote:
> As a first non-trivial exercice, I wrote an implementation of monads
> in Clojure. I just uploaded it to the Group:
>
> http://clojure.googlegroups.com/web/monads.clj
>
> The file contains the macro
53 matches
Mail list logo