Does fmap remove enough complexity to warrant it's own fn? Here's
what fmap would now look like.
(def fmap (partial same map))
Granted, it's probably the #1 use for same, so you might have a point.
Sean
On Oct 29, 12:44 am, Konrad Hinsen wrote:
> On 28.10.2010, at 21:57, Sean Devlin wrote:
>
On 28.10.2010, at 21:57, Sean Devlin wrote:
> Okay, functor is a good idea but a weak implementation. My complaint
> is that it only provides functor behavior for the map function. same
> is a higher order function that works on anything, and is based on
> protocols. Take a look at the test cas
Okay, functor is a good idea but a weak implementation. My complaint
is that it only provides functor behavior for the map function. same
is a higher order function that works on anything, and is based on
protocols. Take a look at the test cases to understand what I'm
talking about.
http://gith
On 28 Oct 2010, at 16:42, Amitava Shee wrote:
I would like to apply an higher order function on an arbitrarily
nested data structure which yields exactly the same structure but the
original values replaced by the result of applying the passed in
function.
This is somewhat akin to the fmap funct
Okay, you're re-inventing clojure.walk. Please take a look at that
namespace.
On Oct 28, 11:52 am, "Eric Schulte" wrote:
> Without each type specifying where it would like the function applied
> the result will be sort of hacky, but here's my hackey attempt at fmap
> in clojure.
>
> It makes som
Without each type specifying where it would like the function applied
the result will be sort of hacky, but here's my hackey attempt at fmap
in clojure.
It makes some assumptions (e.g. you would only want to apply f to the
values rather than the keys of a hash). Also I'm not sure what the best
wa
Functor's fmap in Haskell is passed where to apply the function as an
(hidden in the type class dictionary) argument.
You would need somehow to be more specific about where you want to
apply your function in the data-structure.
(On predefined position, a la Functor, or on every leaf, with a
defini
Like my same fn or something different? Maybe combine it with
prewalk?
Sean
On Oct 28, 10:42 am, Amitava Shee wrote:
> I would like to apply an higher order function on an arbitrarily
> nested data structure which yields exactly the same structure but the
> original values replaced by the resul
I would like to apply an higher order function on an arbitrarily
nested data structure which yields exactly the same structure but the
original values replaced by the result of applying the passed in
function.
This is somewhat akin to the fmap function in Functor type class in
haskell. I had a bri