Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  general observation about programming (Jeffrey Brown)
   2. Re:  general observation about programming (Henk-Jan van Tuyl)
   3. Re:  general observation about programming (Theodore Lief Gannon)
   4. Re:  general observation about programming (Michael Orlitzky)
   5. Re:  general observation about programming (Rustom Mody)


----------------------------------------------------------------------

Message: 1
Date: Sat, 27 Feb 2016 12:56:36 -0800
From: Jeffrey Brown <jeffbrown....@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] general observation about programming
Message-ID:
        <CAEc4Ma0dKziG7aTA5osXnX=zul85msfp_xtya8zmqtvkfac...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

It is, I agree, not appropriate everywhere, but point-free code can in the
right place be much more readable. Maps are a good example. Compare:

    map (f . g . h) xs

to

    map (\x -> f $ g $ h x) xs


On Fri, Feb 26, 2016 at 10:17 PM, Rustom Mody <rustompm...@gmail.com> wrote:

>
>
> On Fri, Feb 26, 2016 at 11:11 PM, Rein Henrichs <rein.henri...@gmail.com>
> wrote:
>
>> Pointfree is good for reasoning about *composition*. It can often be
>> more readable than pointful code when the focus of the function is on
>> composition of other functions. For example, take this function from Bird's 
>> *Pearls
>> of Functional Algorithm Design*:
>>
>>  boxes = map ungroup . ungroup . map cols . group . map group
>>
>
> And better if you read it in the right (ie left to right order)
>
>
> boxes  =  map group >>> group >>> map cols >> ungroup >>> map ungroup
> (From Control.Arrow)
>
> Even better if the 3-char clunky >>> is reduced to the 1-char ?
> map group ? group ? map cols ? ungroup ? map ungroup
> (From Control.Arrow.Unicode)
> [Those who find this unnatural/difficult/arcane/etc may like to check out
> Unix-pipes (or English :-) ]
>
> Some wishful thinking in the same direction
> (uses python but python is not really relevant)  :
> http://blog.languager.org/2014/04/unicoded-python.html
> Which to some extent I found works in Haskell :
> http://blog.languager.org/2014/05/unicode-in-haskell-source.html
> If only Haskell would go further!!
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>


-- 
Jeffrey Benjamin Brown
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160227/456db631/attachment-0001.html>

------------------------------

Message: 2
Date: Sun, 28 Feb 2016 02:35:15 +0100
From: "Henk-Jan van Tuyl" <hjgt...@chello.nl>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell" <beginners@haskell.org>,
        "Rustom Mody" <rustompm...@gmail.com>
Subject: Re: [Haskell-beginners] general observation about programming
Message-ID: <op.ydir05rwpz0j5l@alquantor>
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes

On Sat, 27 Feb 2016 07:17:13 +0100, Rustom Mody <rustompm...@gmail.com>  
wrote:

> On Fri, Feb 26, 2016 at 11:11 PM, Rein Henrichs <rein.henri...@gmail.com>
> wrote:
>
>> Pointfree is good for reasoning about *composition*. It can often be  
>> more
>> readable than pointful code when the focus of the function is on
>> composition of other functions. For example, take this function from  
>> Bird's *Pearls
>> of Functional Algorithm Design*:
>>
>>  boxes = map ungroup . ungroup . map cols . group . map group
>>
>
> And better if you read it in the right (ie left to right order)
>
>
> boxes  =  map group >>> group >>> map cols >> ungroup >>> map ungroup
> (From Control.Arrow)
>
> Even better if the 3-char clunky >>> is reduced to the 1-char ?
> map group ? group ? map cols ? ungroup ? map ungroup
> (From Control.Arrow.Unicode)

You can also use & from Data.Function (since base 4.8.0.0)
   map group & group & map cols & ungroup & map ungroup

Regards,
Henk-Jan van Tuyl


-- 
Folding@home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join the world's biggest networked computer and get  
us closer sooner. Watch the video.
http://folding.stanford.edu/


http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--


------------------------------

Message: 3
Date: Sat, 27 Feb 2016 17:46:56 -0800
From: Theodore Lief Gannon <tan...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] general observation about programming
Message-ID:
        <cajopsubea6kgr9kwogwq0zmids_fynijocllufa-fvrjwrf...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

>Those who find this unnatural/difficult/arcane/etc may like to check out
Unix-pipes (or English :-)

But chaining (a la pipes) isn't quite the same as composition. It's better
compared with do-notation, which *does* use the ordering you suggest.

As for English: try pronouncing (.) as "of."
On Feb 26, 2016 10:17 PM, "Rustom Mody" <rustompm...@gmail.com> wrote:

>
>
> On Fri, Feb 26, 2016 at 11:11 PM, Rein Henrichs <rein.henri...@gmail.com>
> wrote:
>
>> Pointfree is good for reasoning about *composition*. It can often be
>> more readable than pointful code when the focus of the function is on
>> composition of other functions. For example, take this function from Bird's 
>> *Pearls
>> of Functional Algorithm Design*:
>>
>>  boxes = map ungroup . ungroup . map cols . group . map group
>>
>
> And better if you read it in the right (ie left to right order)
>
>
> boxes  =  map group >>> group >>> map cols >> ungroup >>> map ungroup
> (From Control.Arrow)
>
> Even better if the 3-char clunky >>> is reduced to the 1-char ?
> map group ? group ? map cols ? ungroup ? map ungroup
> (From Control.Arrow.Unicode)
> [Those who find this unnatural/difficult/arcane/etc may like to check out
> Unix-pipes (or English :-) ]
>
> Some wishful thinking in the same direction
> (uses python but python is not really relevant)  :
> http://blog.languager.org/2014/04/unicoded-python.html
> Which to some extent I found works in Haskell :
> http://blog.languager.org/2014/05/unicode-in-haskell-source.html
> If only Haskell would go further!!
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160227/cdc26d85/attachment-0001.html>

------------------------------

Message: 4
Date: Sat, 27 Feb 2016 21:53:14 -0500
From: Michael Orlitzky <mich...@orlitzky.com>
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] general observation about programming
Message-ID: <56d2611a.1080...@orlitzky.com>
Content-Type: text/plain; charset=utf-8

On 02/27/2016 08:35 PM, Henk-Jan van Tuyl wrote:
>>
>> Even better if the 3-char clunky >>> is reduced to the 1-char ?
>> map group ? group ? map cols ? ungroup ? map ungroup
>> (From Control.Arrow.Unicode)
> 
> You can also use & from Data.Function (since base 4.8.0.0)
>    map group & group & map cols & ungroup & map ungroup
> 

I would love to hear the elevator pitch for making "and" mean "backwards
function application". Might as well go full retard:

  boxes m =
    m & ((? ungroup . map cols <<< group >>> map group) $ map ungroup)

As you can see, it gets more clear the more operators you use. Note that
(&) isn't backwards composition -- it's backwards application. So it's
analogous to "$" and not the "." operator. You can just google "&" to
find that out though.



------------------------------

Message: 5
Date: Sun, 28 Feb 2016 08:54:36 +0530
From: Rustom Mody <rustompm...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] general observation about programming
Message-ID:
        <caj+teoebs5uwpmvhrzo8udxbif4jcicgt4cfuzvwand3fx4...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Sun, Feb 28, 2016 at 2:26 AM, Jeffrey Brown <jeffbrown....@gmail.com>
wrote:

> It is, I agree, not appropriate everywhere, but point-free code can in the
> right place be much more readable. Maps are a good example. Compare:
>
>     map (f . g . h) xs
>
> to
>
>     map (\x -> f $ g $ h x) xs
>

Not quite a fair comparison
How about?
[ f (g (h x))  |  x <- xs ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160228/89b36787/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 92, Issue 38
*****************************************

Reply via email to