News for hackers. Stuff that matters.
Re:Data flow syntax: The missing piece for the success of fu... by dwenzek on Friday July 17, 2015 @05:08AM (#9901837)
The post is interesting and highlights a true fact : it is not always easy to chain map/filter/reduce transformations when the processed values are compound and call for processing that are specific to each part.

Nonetheless, the proposed solution is most in the component/object realm rather in the functional world.

As an evidence the use of nouns rather verbs as in :

    splitter.input = hi_generator.his
    lowercaser.input = splitter.left_part
    uppercaser.input = splitter.right_part
This is not a judgement, just a remark. A functional solution would rather use transformation combinators to propagate a transformation on a specific value part. For instance :

    input |> map split_two_halves
          |> map_fst to_lower
          |> map_snd to_upper
Or even better, use lenses as a generic way to unpack a specific part of a data structure and to repack an updated value:

    input |> map split_two_halves
          |> map_lens fst to_lower
          |> map_lens snd to_upper

There are no comments on this comment yet.