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: very impure [global] counter (Davi Santos) 2. problem exercise 3 page 60 Programming in Haskell (Roelof Wobben) 3. Re: very impure [global] counter (aditya siram) 4. Re: problem exercise 3 page 60 Programming in Haskell (David Place) 5. Re: problem exercise 3 page 60 Programming in Haskell (KC) 6. Re: problem exercise 3 page 60 Programming in Haskell (Daniel Seidel) 7. Re: very impure [global] counter (Davi Santos) 8. Re: problem exercise 3 page 60 Programming in Haskell (Roelof Wobben) ---------------------------------------------------------------------- Message: 1 Date: Fri, 22 Jul 2011 13:45:04 -0300 From: Davi Santos <dps....@gmail.com> Subject: Re: [Haskell-beginners] very impure [global] counter To: beginners@haskell.org Message-ID: <CANWsST8jiPMXT=vpvtkk+5tnhux8lmfrt27colzfy1b3ltt...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Thanks David, Patrick and Thomas, I think 'openTempFile' is exactly what I need. Is there a way to use this function with no physical disk access? In other words, is it possible to work with files like they were in a ramdrive? To clarify a little, all this is needed because I can't call java classes directly into haskell code. I have seen Jaskell and other apparently dead projects out there. But they are even far from the little convenience of a "system call" and some file manipulation. I tried also Scala to substitute Haskell in this task, but it is too young language, with memory leaks, library code instability and other problems (version 2.9.0.1). Also the Scala IDE(Netbeans plugin), the only I managed to use, is as buggy as Leksah (0.10.0.4). Is somebody else trying to access java code? Maybe also the Weka library like me? Davi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110722/1465d039/attachment-0001.htm> ------------------------------ Message: 2 Date: Fri, 22 Jul 2011 16:48:31 +0000 From: Roelof Wobben <rwob...@hotmail.com> Subject: [Haskell-beginners] problem exercise 3 page 60 Programming in Haskell To: <beginners@haskell.org> Message-ID: <snt118-w303988ebce81053d0e152bae...@phx.gbl> Content-Type: text/plain; charset="iso-8859-1" Hello, I don't see the answer here. If I brake down the problem. We have this : [(x,y) | x <- [1..3], y <- [4,5,6]] I have to use one generator with two nested list compreshession and make use of concat. So the x generator is [x | x <- [1..3]] and the Y genarator is [y| y <- [4..6]] So if I put it together it uses the numbers [1..6] so I could do something like this in pseudo code as guard. If generator smaller or equal 3 then its x else it's a y. But if I do concat [x,y] then I get [1..6] and that not good. If I use zip [x,y] then I get [ (1,4) (2,5) (3,6)] which is also not good but better. So im stuck now and im puzzeling the whole afternoon about this ? Anyone who can give me a hint ? Roelof -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110722/fd8315bd/attachment-0001.htm> ------------------------------ Message: 3 Date: Fri, 22 Jul 2011 11:52:30 -0500 From: aditya siram <aditya.si...@gmail.com> Subject: Re: [Haskell-beginners] very impure [global] counter To: Davi Santos <dps....@gmail.com> Cc: beginners@haskell.org Message-ID: <cajrreyg9kss+wu4qytggwbttkbbycannuzk4awbr9hre0q8...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 I would look for the C version of the Java libs. Haskell is pretty well integrated with C. -deech On Fri, Jul 22, 2011 at 11:45 AM, Davi Santos <dps....@gmail.com> wrote: > Thanks David, Patrick and Thomas, > I think 'openTempFile' is exactly what I need. > Is there a way to use this function with no physical disk access? > In other words, is it possible to work with files like they were in a > ramdrive? > To clarify a little, > all this is needed because I can't call java classes directly into haskell > code. > I have seen Jaskell and other apparently dead projects out there. > But they are even far from the little convenience of a "system call" and > some file manipulation. > I tried also Scala to substitute Haskell in this task, but it is too young > language, with memory leaks, > library code instability and other problems (version 2.9.0.1). > Also the Scala IDE(Netbeans plugin), the only I managed to use, is as buggy > as Leksah (0.10.0.4). > Is somebody else trying to access java code? Maybe also the Weka library > like me? > Davi > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > ------------------------------ Message: 4 Date: Fri, 22 Jul 2011 13:16:45 -0400 From: David Place <d...@vidplace.com> Subject: Re: [Haskell-beginners] problem exercise 3 page 60 Programming in Haskell To: Roelof Wobben <rwob...@hotmail.com> Cc: beginners@haskell.org Message-ID: <16c22fcc-3310-4ed1-b380-7af3deac5...@vidplace.com> Content-Type: text/plain; charset="iso-8859-1" On Jul 22, 2011, at 12:48 PM, Roelof Wobben wrote: > Hello, > > I don't see the answer here. > If I brake down the problem. > > We have this : > > [(x,y) | x <- [1..3], y <- [4,5,6]] > > I have to use one generator with two nested liOt compreshession and make use > of concat. > > So the x generator is [x | x <- [1..3]] > and the Y genarator is [y| y <- [4..6]] > > So if I put it together it uses the numbers [1..6] so I could do something > like this in pseudo code as guard. > If generator smaller or equal 3 then its x else it's a y. You won't need a guard to do this. > > But if I do concat [x,y] then I get [1..6] and that not good. > If I use zip [x,y] then I get [ (1,4) (2,5) (3,6)] which is also not good but > better. > > So im stuck now and im puzzeling the whole afternoon about this ? > > Anyone who can give me a hint ? I think that this exercise is very artificial. It is very easy to solve if you know how list comprehensions are implemented using map and other library functions. Personally, Roelof, I think you will be better off to forget about list comprehensions for the present and focus on understanding basic functions on lists like map, filter and concat. I'll give you the answer to the question because, I can't think of any hints. Don't look if you want to figure it out yourself. > concat [[(x,y) | y <- [4,5,6]] | x <- [1..3]] > > Roelof > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110722/3dc44d95/attachment-0001.htm> ------------------------------ Message: 5 Date: Fri, 22 Jul 2011 10:19:56 -0700 From: KC <kc1...@gmail.com> Subject: Re: [Haskell-beginners] problem exercise 3 page 60 Programming in Haskell To: Roelof Wobben <rwob...@hotmail.com>, beginners@haskell.org Message-ID: <CAMLKXykAVr_KKrmYJ3Dzx1zTsOO=dj0tmjyw_7yhhb++dyc...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 What is the problem for exercise 3 page 60 "Programming in Haskell"? On Fri, Jul 22, 2011 at 9:48 AM, Roelof Wobben <rwob...@hotmail.com> wrote: > Hello, > > I don't see the answer here. > If I brake down the problem. > > We have this : > > [(x,y) | x <- [1..3], y <- [4,5,6]] > > I have to use one generator with two nested list compreshession and make use > of concat. > > So the x generator? is [x | x <- [1..3]] > and the Y genarator is [y| y <- [4..6]] > > So if I put it together it uses the numbers [1..6] so I could do something > like this? in pseudo code as guard. > If generator smaller or equal 3 then its x else it's a y. > > But if I do concat [x,y] then I get [1..6] and that not good. > If I use zip [x,y] then I get [ (1,4) (2,5) (3,6)] which is also not good > but better. > > So im stuck now and im puzzeling the whole afternoon about this ? > > Anyone who can give me a hint ? > > Roelof > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -- -- Regards, KC ------------------------------ Message: 6 Date: Fri, 22 Jul 2011 19:22:28 +0200 From: Daniel Seidel <d...@iai.uni-bonn.de> Subject: Re: [Haskell-beginners] problem exercise 3 page 60 Programming in Haskell To: Roelof Wobben <rwob...@hotmail.com> Cc: beginners@haskell.org Message-ID: <1311355348.18260.33.ca...@entwood.iai.uni-bonn.de> Content-Type: text/plain Hi Roelof, I don't have a book, so I don't know the exercise exactly, but if I'm correct, you want the list [(1,4), (1,5), (1,6), (2,4), (2,5), (2,6), (3,4), (3,5), (3,6)] So the basic idea is to nest one list comprehension into another: You create a list [(x,4), (x,5), (x,6)] by the inner list comprehension with y <- [4..6] as generator. It should be [(x,y) | y <- [4..6]], where x is just free. The whole comprehension you stick as result into an outer comprehension whos generator creates the values for x (ie. 1,2 and 3). This will return the list of lists [[(1,4), (1,5), (1,6)],[(2,4), (2,5), (2,6)], [(3,4), (3,5), (3,6)]] which you can flatten by concat. I hope you manage the solution with the description above. I think it helps you more if I don't write the plain solution as working code. Cheers, Daniel. On Fri, 2011-07-22 at 16:48 +0000, Roelof Wobben wrote: > Hello, > > I don't see the answer here. > If I brake down the problem. > > We have this : > > [(x,y) | x <- [1..3], y <- [4,5,6]] > > I have to use one generator with two nested list compreshession and > make use of concat. > > So the x generator is [x | x <- [1..3]] > and the Y genarator is [y| y <- [4..6]] > > So if I put it together it uses the numbers [1..6] so I could do > something like this in pseudo code as guard. > If generator smaller or equal 3 then its x else it's a y. > > But if I do concat [x,y] then I get [1..6] and that not good. > If I use zip [x,y] then I get [ (1,4) (2,5) (3,6)] which is also not > good but better. > > So im stuck now and im puzzeling the whole afternoon about this ? > > Anyone who can give me a hint ? > > Roelof > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ Message: 7 Date: Fri, 22 Jul 2011 14:23:19 -0300 From: Davi Santos <dps....@gmail.com> Subject: Re: [Haskell-beginners] very impure [global] counter To: beginners@haskell.org Message-ID: <canwsst8jf7uxc+xtww+oj1gh5kn9blcnihi-ff-q_ezrc68...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Aditya, as I could search, If there is a C version of Weka, it appears to be very outdated by now. The library I use is http://www.cs.waikato.ac.nz/ml/weka/. Davi -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110722/e8c55ef8/attachment-0001.htm> ------------------------------ Message: 8 Date: Fri, 22 Jul 2011 18:29:39 +0000 From: Roelof Wobben <rwob...@hotmail.com> Subject: Re: [Haskell-beginners] problem exercise 3 page 60 Programming in Haskell To: <beginners@haskell.org> Message-ID: <snt118-w369b4e3a2ce4ea2a0bc4faae...@phx.gbl> Content-Type: text/plain; charset="iso-8859-1" Hello, Some one else give me the answer but I still don't get it. The answer is : concat [[(x,y) | y <- [4,5,6]] | x <- [1..3]] But the exercise says you have to use one generator and I see still two. Roelof > Subject: Re: [Haskell-beginners] problem exercise 3 page 60 Programming in > Haskell > From: d...@iai.uni-bonn.de > To: rwob...@hotmail.com > CC: beginners@haskell.org > Date: Fri, 22 Jul 2011 19:22:28 +0200 > > Hi Roelof, > > I don't have a book, so I don't know the exercise exactly, but if I'm > correct, you want the list > > [(1,4), (1,5), (1,6), (2,4), (2,5), (2,6), (3,4), (3,5), (3,6)] > > So the basic idea is to nest one list comprehension into another: > > You create a list [(x,4), (x,5), (x,6)] by the inner list comprehension > with y <- [4..6] as generator. > It should be [(x,y) | y <- [4..6]], where x is just free. > > The whole comprehension you stick as result into an outer comprehension > whos generator creates the values for x (ie. 1,2 and 3). > > This will return the list of lists > [[(1,4), (1,5), (1,6)],[(2,4), (2,5), (2,6)], [(3,4), (3,5), (3,6)]] > which you can flatten by concat. > > I hope you manage the solution with the description above. I think it > helps you more if I don't write the plain solution as working code. > > > Cheers, > > Daniel. > > > > On Fri, 2011-07-22 at 16:48 +0000, Roelof Wobben wrote: > > Hello, > > > > I don't see the answer here. > > If I brake down the problem. > > > > We have this : > > > > [(x,y) | x <- [1..3], y <- [4,5,6]] > > > > I have to use one generator with two nested list compreshession and > > make use of concat. > > > > So the x generator is [x | x <- [1..3]] > > and the Y genarator is [y| y <- [4..6]] > > > > So if I put it together it uses the numbers [1..6] so I could do > > something like this in pseudo code as guard. > > If generator smaller or equal 3 then its x else it's a y. > > > > But if I do concat [x,y] then I get [1..6] and that not good. > > If I use zip [x,y] then I get [ (1,4) (2,5) (3,6)] which is also not > > good but better. > > > > So im stuck now and im puzzeling the whole afternoon about this ? > > > > Anyone who can give me a hint ? > > > > Roelof > > > > > > _______________________________________________ > > Beginners mailing list > > Beginners@haskell.org > > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110722/bf0de8c8/attachment.htm> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 37, Issue 47 *****************************************