Re: [Haskell-cafe] Combining sequences
On Sun, 5 Apr 2009, michael rice wrote: Thanks. It looks like mergeBy will do the job, but is it available in Hugs? The package is Haskell98 and needs no further package, thus it should work with almost every Haskell system. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Combining sequences
On Mon, 6 Apr 2009, nowg...@yahoo.com wrote: Michael [mich...@localhost untitled folder]$ cd utility-ht-0.0.4 [mich...@localhost utility-ht-0.0.4]$ ls LICENSE Setup.lhs src utility-ht.cabal [mich...@localhost utility-ht-0.0.4]$ ./Setup.lhs configure --hugs /usr/bin/env: runhaskell: No such file or directory --OOPS! [mich...@localhost utility-ht-0.0.4]$ su Password: [r...@localhost utility-ht-0.0.4]# ./Setup.lhs configure --hugs /usr/bin/env: runhaskell: No such file or directory [r...@localhost utility-ht-0.0.4]# $ runhugs Setup.lhs configure --hugs might work___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Combining sequences
Hi Daniel, Thanks, but apparently no go. This isn't critical, as I already have a function that will combine two sequences. Michael = Michael [mich...@localhost untitled folder]$ cd utility-ht-0.0.4 [mich...@localhost utility-ht-0.0.4]$ ls LICENSE Setup.lhs src utility-ht.cabal [mich...@localhost utility-ht-0.0.4]$ ./Setup.lhs configure --hugs /usr/bin/env: runhaskell: No such file or directory --OOPS! [mich...@localhost utility-ht-0.0.4]$ su Password: [r...@localhost utility-ht-0.0.4]# ./Setup.lhs configure --hugs /usr/bin/env: runhaskell: No such file or directory [r...@localhost utility-ht-0.0.4]# --- On Mon, 4/6/09, Daniel Fischer wrote: From: Daniel Fischer Subject: Re: [Haskell-cafe] Combining sequences To: haskell-cafe@haskell.org Cc: "michael rice" Date: Monday, April 6, 2009, 12:04 PM Am Montag 06 April 2009 17:12:42 schrieb michael rice: > I downloaded it and it appears more complicated than just adding files to a > directory. There's a setup and a build, and no assurances it will work with > Hugs. > > I think I'll wait for more information. > > Michael > Try installing it with Cabal: ./Setup.lhs configure --hugs if that doesn't say otherwise, chances are that it will work, so try ./Setup.lhs build sudo ./Setup.lhs install If it doesn't work, you can copy the code from Data.List.HT ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Combining sequences
Am Montag 06 April 2009 17:12:42 schrieb michael rice: > I downloaded it and it appears more complicated than just adding files to a > directory. There's a setup and a build, and no assurances it will work with > Hugs. > > I think I'll wait for more information. > > Michael > Try installing it with Cabal: ./Setup.lhs configure --hugs if that doesn't say otherwise, chances are that it will work, so try ./Setup.lhs build sudo ./Setup.lhs install If it doesn't work, you can copy the code from Data.List.HT ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Combining sequences
I downloaded it and it appears more complicated than just adding files to a directory. There's a setup and a build, and no assurances it will work with Hugs. I think I'll wait for more information. Michael --- On Mon, 4/6/09, Thomas Hartman wrote: From: Thomas Hartman Subject: Re: [Haskell-cafe] Combining sequences To: "michael rice" Cc: "Henning Thielemann" , haskell-cafe@haskell.org Date: Monday, April 6, 2009, 12:26 AM It's not in hugs, nor in ghc. It's just in hackage. However, by the looks of it, you should probably be able to use it in hugs. I didn't actually check this, but the cabal file didn't name any fancy extensions, so it looks pretty cross-compiler. You can just go to http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utility-ht-0.0.4 wget http://hackage.haskell.org/packages/archive/utility-ht/0.0.4/utility-ht-0.0.4.tar.gz untar and put them with the rest of the files your hugs compiler uses for package import. (I don't actually know how package installation works in hugs... isn't it just put the files into a dir?) thomas. 2009/4/5 michael rice : > Thanks. It looks like mergeBy will do the job, but is it available in Hugs? > > Michael > > > --- On Sun, 4/5/09, Henning Thielemann > wrote: > > From: Henning Thielemann > Subject: Re: [Haskell-cafe] Combining sequences > To: "michael rice" > Cc: haskell-cafe@haskell.org > Date: Sunday, April 5, 2009, 9:09 PM > > > On Sat, 4 Apr 2009, michael rice wrote: > >> Is there a simple way to combine two sequences that are in ascending order >> into a single >> sequence that's also in ascending order? An example would be the squares >> [1,4,9,16,25..] >> combined with the cubes [1,8,27,64,125..] to form [1,1,4,8,9,16,25,27..]. > > http://hackage.haskell.org/packages/archive/utility-ht/0.0.4/doc/html/Data-List-HT.html#v%3AmergeBy > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Combining sequences
It's not in hugs, nor in ghc. It's just in hackage. However, by the looks of it, you should probably be able to use it in hugs. I didn't actually check this, but the cabal file didn't name any fancy extensions, so it looks pretty cross-compiler. You can just go to http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utility-ht-0.0.4 wget http://hackage.haskell.org/packages/archive/utility-ht/0.0.4/utility-ht-0.0.4.tar.gz untar and put them with the rest of the files your hugs compiler uses for package import. (I don't actually know how package installation works in hugs... isn't it just put the files into a dir?) thomas. 2009/4/5 michael rice : > Thanks. It looks like mergeBy will do the job, but is it available in Hugs? > > Michael > > > --- On Sun, 4/5/09, Henning Thielemann > wrote: > > From: Henning Thielemann > Subject: Re: [Haskell-cafe] Combining sequences > To: "michael rice" > Cc: haskell-cafe@haskell.org > Date: Sunday, April 5, 2009, 9:09 PM > > > On Sat, 4 Apr 2009, michael rice wrote: > >> Is there a simple way to combine two sequences that are in ascending order >> into a single >> sequence that's also in ascending order? An example would be the squares >> [1,4,9,16,25..] >> combined with the cubes [1,8,27,64,125..] to form [1,1,4,8,9,16,25,27..]. > > http://hackage.haskell.org/packages/archive/utility-ht/0.0.4/doc/html/Data-List-HT.html#v%3AmergeBy > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Combining sequences
Thanks. It looks like mergeBy will do the job, but is it available in Hugs? Michael --- On Sun, 4/5/09, Henning Thielemann wrote: From: Henning Thielemann Subject: Re: [Haskell-cafe] Combining sequences To: "michael rice" Cc: haskell-cafe@haskell.org Date: Sunday, April 5, 2009, 9:09 PM On Sat, 4 Apr 2009, michael rice wrote: > Is there a simple way to combine two sequences that are in ascending order > into a single > sequence that's also in ascending order? An example would be the squares > [1,4,9,16,25..] > combined with the cubes [1,8,27,64,125..] to form [1,1,4,8,9,16,25,27..]. http://hackage.haskell.org/packages/archive/utility-ht/0.0.4/doc/html/Data-List-HT.html#v%3AmergeBy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Combining sequences
On Sat, 4 Apr 2009, michael rice wrote: Is there a simple way to combine two sequences that are in ascending order into a single sequence that's also in ascending order? An example would be the squares [1,4,9,16,25..] combined with the cubes [1,8,27,64,125..] to form [1,1,4,8,9,16,25,27..]. http://hackage.haskell.org/packages/archive/utility-ht/0.0.4/doc/html/Data-List-HT.html#v%3AmergeBy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Combining sequences
Thanks, guys! This one works perfectly. I was monkeying with similar logic but wasn't sure about syntax. Michael --- On Sat, 4/4/09, Andrew Wagner wrote: From: Andrew Wagner Subject: Re: [Haskell-cafe] Combining sequences To: "michael rice" Cc: haskell-cafe@haskell.org Date: Saturday, April 4, 2009, 8:56 PM Here's a pretty straightforward approach: combine [] ys = ys combine xs [] = xs combine (x:xs) (y:ys) | x <= y = x : combine xs (y:ys) | otherwise = y : combine (x:xs) ys On Sat, Apr 4, 2009 at 8:40 PM, michael rice wrote: Is there a simple way to combine two sequences that are in ascending order into a single sequence that's also in ascending order? An example would be the squares [1,4,9,16,25..] combined with the cubes [1,8,27,64,125..] to form [1,1,4,8,9,16,25,27..]. Michael ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Combining sequences
Here's a pretty straightforward approach: combine [] ys = ys combine xs [] = xs combine (x:xs) (y:ys) | x <= y = x : combine xs (y:ys) | otherwise = y : combine (x:xs) ys On Sat, Apr 4, 2009 at 8:40 PM, michael rice wrote: > Is there a simple way to combine two sequences that are in ascending order > into a single sequence that's also in ascending order? An example would be > the squares [1,4,9,16,25..] combined with the cubes [1,8,27,64,125..] to > form [1,1,4,8,9,16,25,27..]. > > Michael > > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe