Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/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: First code review (Erik de Castro Lopo) 2. Mutable variables in do block? (Emanuel Koczwara) 3. Re: Mutable variables in do block? (Ozgur Akgun) ---------------------------------------------------------------------- Message: 1 Date: Sun, 24 Feb 2013 18:29:22 +1100 From: Erik de Castro Lopo <mle...@mega-nerd.com> Subject: Re: [Haskell-beginners] First code review To: beginners@haskell.org Message-ID: <20130224182922.b14c8369f9b27308395b6...@mega-nerd.com> Content-Type: text/plain; charset=US-ASCII Brent Yorgey wrote: > Since both the Grid and Heuristic values are created once and > then used in a read-only fasion, this is a perfect opportunity to use > arrays: see > > > http://hackage.haskell.org/packages/archive/array/latest/doc/html/Data-Array.html > > Using read-only arrays is really quite simple (as opposed to > read/write arrays which require a monad of some sort). Brent, out of curiosity, why Array instead of Data.Vector? Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ ------------------------------ Message: 2 Date: Sun, 24 Feb 2013 11:41:00 +0100 From: Emanuel Koczwara <poc...@emanuelkoczwara.pl> Subject: [Haskell-beginners] Mutable variables in do block? To: beginners@haskell.org Message-ID: <1361702460.3205.32.camel@emanuel-Dell-System-Vostro-3750> Content-Type: text/plain; charset="UTF-8" Hi, 1 main = do 2 line <- getLine 3 putStrLn line 4 line <- getLine 5 putStrLn line Here I have 'line' first bounded with a value at line 2, and then at line 4. It looks like I can set (or bind) a variable in 'do' block more than once, and it looks like it's a destructive update. But as I'm thinking about this more and more, it appears that the first and second 'line' are just an ordinary immutable variables. Line 4 just hides the 'line' from line 2 (outer lambda). Am I right? Emanuel ------------------------------ Message: 3 Date: Sun, 24 Feb 2013 10:44:59 +0000 From: Ozgur Akgun <ozgurak...@gmail.com> Subject: Re: [Haskell-beginners] Mutable variables in do block? To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Message-ID: <calzazpb6t7ues-hmug6mmer_k4zohurhppseotj8uyp3l2r...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Hi, On 24 February 2013 10:41, Emanuel Koczwara <poc...@emanuelkoczwara.pl>wrote: > it appears that the first > and second 'line' are just an ordinary immutable variables. Line 4 just > hides the 'line' from line 2 (outer lambda). Am I right? > Exactly. You can try desugaring the do notation to see what's going on even more clearly. Best, Ozgur -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20130224/b1f87d15/attachment-0001.htm> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 56, Issue 40 *****************************************