[Haskell-cafe] Generate 50 random coordinates

2006-12-01 Thread Huazhi (Hank) Gong
Hello,all My intention is to generate 50 random coordinates like (x,y). myrand :: Int myrand = randomRIO(1::Int, 100) rf=[(myrand, myrand) | a <- [1..50]] My short program is like this. However, GHCI say that the return type of randomRIO is IO a while the function defined by me is Int. Since I

Re: [Haskell-cafe] Re[2]: How to get subset of a list?

2006-12-01 Thread Huazhi (Hank) Gong
Good. I personally perfer this solution... Bulat Ziganshin-2 wrote: > > Hello Huazhi, > > Friday, December 1, 2006, 5:04:10 AM, you wrote: > >> However, like I want to choose s[1,3,6,10] or something like this. Are >> there >> some straightforward function or operator for doing this job? The

Re: [Haskell-cafe] How to get subset of a list?

2006-11-30 Thread Huazhi (Hank) Gong
05:47:43PM -0800, Huazhi (Hank) Gong wrote: >> >> Like given a string list s="This is the string I want to test", I want to >> get >> the substring. In ruby or other language, it's simple like s[2..10], but >> how >> to do it in Haskell? >

[Haskell-cafe] How to get subset of a list?

2006-11-30 Thread Huazhi (Hank) Gong
Like given a string list s="This is the string I want to test", I want to get the substring. In ruby or other language, it's simple like s[2..10], but how to do it in Haskell? -- View this message in context: http://www.nabble.com/How-to-get-subset-of-a-list--tf2735647.html#a7631994 Sent from th

RE: [Haskell-cafe] A question about stack overflow

2006-06-27 Thread Huazhi (Hank) Gong
lto:[EMAIL PROTECTED] Sent: Tuesday, June 27, 2006 5:34 PM To: Huazhi (Hank) Gong Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] A question about stack overflow Huazhi (Hank) Gong wrote: > Hi, all > > I'm just a newbie for Haskell and functional programming world. The idea >

[Haskell-cafe] A question about stack overflow

2006-06-27 Thread Huazhi (Hank) Gong
Hi, all I’m just a newbie for Haskell and functional programming world. The idea I currently read is quite different and interesting. I have one general question about the recursively looping style. For example: myMax [ ] = error “empty list” myMax [x] = x myMax [x:xs] = if x>= (myMax