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. Re: applicative style (Williams, Wes(AWF))
2. Re: applicative style (Brandon Allbery)
3. Re: applicative style (Williams, Wes(AWF))
4. recursion - more elegant solution (Miro Karpis)
----------------------------------------------------------------------
Message: 1
Date: Fri, 28 Aug 2015 18:51:46 +0000
From: "Williams, Wes(AWF)" <[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>
Subject: Re: [Haskell-beginners] applicative style
Message-ID: <d205fb64.dce6%[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
The actual code I have working is:
let estimates = [5,5,8,8,2,1,5,2]
(/) <$> (Just $ foldl (+) 0 estimates) <*> ((Just . fromIntegral) (length
estimates))
What I want to do is get rid of all the parentheses except (/)
Is it possible?
Thanks,
wes
From: Beginners
<[email protected]<mailto:[email protected]>> on behalf
of "Williams, Wes(AWF)" <[email protected]<mailto:[email protected]>>
Reply-To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell
<[email protected]<mailto:[email protected]>>
Date: Friday, August 28, 2015 at 11:31 AM
To: "[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Subject: [Haskell-beginners] applicative style
Awesome, I clearly am off on my understanding.
How could I do this: "foldl (+) 0 estimates <+> (Just . fromIntegral) (length
estimates)" without the parenthesis?
Thanks,
Wes
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150828/248382c2/attachment-0001.html>
------------------------------
Message: 2
Date: Fri, 28 Aug 2015 15:01:46 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] applicative style
Message-ID:
<cakfcl4ucg5a3eh6mxrzggcvwh5_c_tz2conzfnu09qk8sef...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
On Fri, Aug 28, 2015 at 2:51 PM, Williams, Wes(AWF) <[email protected]>
wrote:
> What I want to do is get rid of all the parentheses except (/)
> Is it possible?
>
Not without breaking it up into chunks like you did in ghci (probably using
a let or where).
--
brandon s allbery kf8nh sine nomine associates
[email protected] [email protected]
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150828/83694d85/attachment-0001.html>
------------------------------
Message: 3
Date: Fri, 28 Aug 2015 20:39:36 +0000
From: "Williams, Wes(AWF)" <[email protected]>
To: "The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell" <[email protected]>
Subject: Re: [Haskell-beginners] applicative style
Message-ID: <d20614f9.dcf3%[email protected]>
Content-Type: text/plain; charset="us-ascii"
Thanks for the feedback and guidance Brandon!
From: Beginners
<[email protected]<mailto:[email protected]>> on behalf
of Brandon Allbery <[email protected]<mailto:[email protected]>>
Reply-To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell
<[email protected]<mailto:[email protected]>>
Date: Friday, August 28, 2015 at 12:01 PM
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level
topics related to Haskell <[email protected]<mailto:[email protected]>>
Subject: Re: [Haskell-beginners] applicative style
On Fri, Aug 28, 2015 at 2:51 PM, Williams, Wes(AWF)
<[email protected]<mailto:[email protected]>> wrote:
What I want to do is get rid of all the parentheses except (/)
Is it possible?
Not without breaking it up into chunks like you did in ghci (probably using a
let or where).
--
brandon s allbery kf8nh sine nomine associates
[email protected]<mailto:[email protected]>
[email protected]<mailto:[email protected]>
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150828/c0690699/attachment-0001.html>
------------------------------
Message: 4
Date: Sat, 29 Aug 2015 01:57:48 +0200
From: Miro Karpis <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] recursion - more elegant solution
Message-ID:
<CAJnnbxGONoXvXjvq0NErJk54Ab=ar2=1bagjspqhy9wk62e...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi haskellers, I have made one recursive function, where
input is:
nodesIds: [1,2,4,3,5]
edgesIds: [(3,5),(4,3),(2,4),(1,2)]
and on output I need/have:
[([1,2,4,3,5],(3,5)),([1,2,4,3],(4,3)),([1,2,4],(2,4)),([1,2],(1,2))]
I have made one function for this, but it seems to me a bit too big and
'ugly'? Please, do you have any hints for a more elegant solution?
joinEdgeNodes' :: [Int] -> [Int] -> [(Int, Int)] -> [([Int], (Int, Int))]
joinEdgeNodes' [] _ [] = []
joinEdgeNodes' [] _ _ = []
joinEdgeNodes' _ _ [] = []
joinEdgeNodes' (n) (wn) [e] = [(n, e)]
joinEdgeNodes' (n) [] (e:es) = joinEdgeNodes' n edgeNodes es ++
[(edgeNodes, e)]
where edgeNodes = take 2 n
joinEdgeNodes' (n) (wn) (e:es) = joinEdgeNodes' n edgeNodes es ++
[(edgeNodes, e)]
where edgeNodes = take edgeNodesLength n
edgeNodesLength = (length wn) + 1
I call the function with: let l = joinEdgeNodes' nodeIds [] edgeIds
Cheers,
Miro
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20150829/2a5ce4c6/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 86, Issue 22
*****************************************