Send Beginners mailing list submissions to
[email protected]
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
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Beginner question. (Brad Smith)
2. Re: Beginner question. (Sylvain Henry)
----------------------------------------------------------------------
Message: 1
Date: Mon, 11 Sep 2023 17:45:43 -0700
From: Brad Smith <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Beginner question.
Message-ID:
<cacfauz84_rjz_ac1dndbixzxufg4xm83n5g6gqtpukwem_m...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
I just started working my way through a Haskell book... first time with
functional programming. Mid way through the first chapter she's
introducing point-free programming with a trivial example transitioning
from not point-free...
makeGreeting salutation person = salutation <> " " <> person
to point free...
makeGreeting' = (<>) . (<> " ")
After a little playing with it... it seems to make sense. So I thought I'd
try evolving from salutation and name to salutation, first, and last names.
But, after a bit of tinkering, I haven't been able to make it work...
I'm sure it's something simple (one way or the other)... any help would be
appreciated!
Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20230911/de99057d/attachment-0001.html>
------------------------------
Message: 2
Date: Tue, 12 Sep 2023 10:07:42 +0200
From: Sylvain Henry <[email protected]>
To: <[email protected]>
Subject: Re: [Haskell-beginners] Beginner question.
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"; format=flowed
Hi,
https://pointfree.io/ gives:
Input: f x y z = x <> " " <> y <> " " <> z
Output: f = ((<>) .) . flip flip " " . ((<>) .) . (<>) . (<> " ")
So no, it's not something simple!
For clarity I would recommend using the non-point-free version, even in
the case given in the book. Use point-free only in simple cases like
`map (+ 1)` where the meaning is obvious.
Sylvain
On 12/09/2023 02:45, Brad Smith wrote:
> I just started working my way through a Haskell book... first time
> with functional programming. Mid way through the first chapter she's
> introducing point-free programming with a trivial example
> transitioning from not point-free...
>
> makeGreeting salutation person = salutation <> " " <> person
>
> to point free...
>
> makeGreeting' = (<>) . (<> " ")
>
> After a little playing with it... it seems to make sense. So I thought
> I'd try evolving from salutation and name to salutation, first, and
> last names. But, after a bit of tinkering, I haven't been able to make
> it work...
>
> I'm sure it's something simple (one way or the other)... any help
> would be appreciated!
>
> Brad
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 171, Issue 1
*****************************************