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 [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: Problems with ghc (Daniel Fischer) 2. Re: Problems with ghc (Paul Johnston) 3. Re: Problems with ghc (Paul Johnston) 4. Re: Problems with ghc (Daniel Fischer) 5. better way to create Array defined on all indices (Larry Evans) 6. fix (Matthew J. Williams) 7. Re: fix (Brandon S. Allbery KF8NH) 8. Re: fix (Brandon S. Allbery KF8NH) 9. Re: better way to create Array defined on all indices (Larry Evans) ---------------------------------------------------------------------- Message: 1 Date: Wed, 15 Oct 2008 15:32:26 +0200 From: Daniel Fischer <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] Problems with ghc To: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" Am Mittwoch, 15. Oktober 2008 14:51 schrieb Paul Johnston: > Many thanks but no joy see below > Think it could be gmp which I had to also compile but it passed all its > checks. Seems the linker can't find gmp. Try compiling with the -L/path/to/gmp option (if that works, we at least have identified the problem, of course, for a real fix you would have to include that directory to the linker's search path). > Regards Paul Cheers, Daniel ------------------------------ Message: 2 Date: Wed, 15 Oct 2008 14:36:51 +0100 From: Paul Johnston <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] Problems with ghc To: Daniel Fischer <[EMAIL PROTECTED]> Cc: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Daniel Fischer wrote: > Am Mittwoch, 15. Oktober 2008 14:51 schrieb Paul Johnston: > >> Many thanks but no joy see below >> Think it could be gmp which I had to also compile but it passed all its >> checks. >> > > Seems the linker can't find gmp. > Try compiling with the -L/path/to/gmp option (if that works, we at least have > identified the problem, of course, for a real fix you would have to include > that directory to the linker's search path). > > >> Regards Paul >> > > Cheers, > Daniel > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > Sorted :-) [EMAIL PROTECTED]:~/haskell/aht/3$ ghc -L=/usr/local/lib/ -o Haq --make Haq.hs [1 of 1] Compiling Main ( Haq.hs, Haq.o ) Linking Haq ... [EMAIL PROTECTED]:~/haskell/aht/3$ ./Haq "Bother" "Haq! BotherOr not!" [EMAIL PROTECTED]:~/haskell/aht/3$ Tried putting /usr/local/lib in $LD_LIBRARY_PATH but that didn't seem to work, pity. Anyway many, many thanks Paul ------------------------------ Message: 3 Date: Wed, 15 Oct 2008 15:35:03 +0100 From: Paul Johnston <[EMAIL PROTECTED]> Subject: [Haskell-beginners] Re: Problems with ghc To: Christian Maeder <[EMAIL PROTECTED]> Cc: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Christian Maeder wrote: > Paul Johnston wrote: > >> [EMAIL PROTECTED]:~/haskell/aht/3$ ghc >> -L=/usr/local/lib/ -o Haq --make Haq.hs >> [1 of 1] Compiling Main ( Haq.hs, Haq.o ) >> Linking Haq ... >> [EMAIL PROTECTED]:~/haskell/aht/3$ ./Haq "Bother" >> "Haq! BotherOr not!" >> [EMAIL PROTECTED]:~/haskell/aht/3$ >> >> Tried putting /usr/local/lib in $LD_LIBRARY_PATH but that didn't seem to >> work, pity. >> Anyway many, many thanks >> > > I think setting LIBRARY_PATH would work. > > Cheers Christian > Tried setting both LD_LIBRARY_PATH and LIBRARY_PATH [EMAIL PROTECTED]:~/haskell/aht/3$ env | grep LIBRARY LIBRARY_PATH=/usr/lib:/opt/csw/lib:/opt/csw/lib/engines:/usr/local/lib LD_LIBRARY_PATH=/usr/lib:/opt/csw/lib:/opt/csw/lib/engines:/usr/local/lib [EMAIL PROTECTED]:~/haskell/aht/3$ Still same issue [EMAIL PROTECTED]:~/haskell/aht/3$ touch Haq.hs [EMAIL PROTECTED]:~/haskell/aht/3$ ghc -o Haq Haq.hs Undefined first referenced symbol in file __gmpz_tdiv_q /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_tdiv_r /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpn_cmp /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_add /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_and /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_gcd /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_ior /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_com /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_mul /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_xor /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_sub /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpn_gcd_1 /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_init /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_fdiv_qr /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmp_set_memory_functions /usr/local/lib/ghc-6.8.3/libHSrts.a(Storage.o) __gmpz_divexact /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) __gmpz_tdiv_qr /usr/local/lib/ghc-6.8.3/libHSrts.a(PrimOps.o) ld: fatal: Symbol referencing errors. No output written to Haq collect2: ld returned 1 exit status [EMAIL PROTECTED]:~/haskell/aht/3$ Cheers Paul ------------------------------ Message: 4 Date: Wed, 15 Oct 2008 17:04:13 +0200 From: Daniel Fischer <[EMAIL PROTECTED]> Subject: [Haskell-beginners] Re: Problems with ghc To: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" Am Mittwoch, 15. Oktober 2008 16:35 schrieb Paul Johnston: > Christian Maeder wrote: > > Paul Johnston wrote: > >> [EMAIL PROTECTED]:~/haskell/aht/3$ ghc > >> -L=/usr/local/lib/ -o Haq --make Haq.hs > >> [1 of 1] Compiling Main ( Haq.hs, Haq.o ) > >> Linking Haq ... > >> [EMAIL PROTECTED]:~/haskell/aht/3$ ./Haq "Bother" > >> "Haq! BotherOr not!" > >> [EMAIL PROTECTED]:~/haskell/aht/3$ > >> > >> Tried putting /usr/local/lib in $LD_LIBRARY_PATH but that didn't seem to > >> work, pity. > >> Anyway many, many thanks > > > > I think setting LIBRARY_PATH would work. > > > > Cheers Christian > > Tried setting both LD_LIBRARY_PATH and LIBRARY_PATH > > [EMAIL PROTECTED]:~/haskell/aht/3$ env | grep LIBRARY > LIBRARY_PATH=/usr/lib:/opt/csw/lib:/opt/csw/lib/engines:/usr/local/lib > LD_LIBRARY_PATH=/usr/lib:/opt/csw/lib:/opt/csw/lib/engines:/usr/local/lib > [EMAIL PROTECTED]:~/haskell/aht/3$ > > > Still same issue > > [EMAIL PROTECTED]:~/haskell/aht/3$ touch Haq.hs > [EMAIL PROTECTED]:~/haskell/aht/3$ ghc -o Haq Haq.hs What happens with --make now? > > Cheers Paul ------------------------------ Message: 5 Date: Wed, 15 Oct 2008 16:05:30 -0500 From: Larry Evans <[EMAIL PROTECTED]> Subject: [Haskell-beginners] better way to create Array defined on all indices To: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: array_complete.proto.hs Type: text/x-haskell Size: 1125 bytes Desc: not available Url : http://www.haskell.org/pipermail/beginners/attachments/20081015/004cbffb/array_complete.proto-0001.bin ------------------------------ Message: 6 Date: Wed, 15 Oct 2008 23:51:45 +0100 From: "Matthew J. Williams" <[EMAIL PROTECTED]> Subject: [Haskell-beginners] fix To: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="us-ascii"; format=flowed hello listers, a few days ago A fellow lister sent me the following link: http://en.wikibooks.org/wiki/Haskell/Fix_and_recursion The 'fix' function is interesting to say the least. There is one example that I've had difficulty expanding: fix (\rec n -> if n == 0 then 1 else n * rec (n-1)) 5 120 My interpretation: fix (\rec n -> if n == 0 then 1 else n * rec (n-1)) 5 ((\rec n -> if n == 0 then 1 else n * rec (n-1)) (fix (\rec n -> if n == 0 then 1 else n * rec (n-1)) )) 5 . . . Yet, it does not quite explain how 'fix' does not result in infinite recursion. Sincerely Matthew J. Williams ------------------------------ Message: 7 Date: Wed, 15 Oct 2008 19:04:03 -0400 From: "Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] fix To: "Matthew J. Williams" <[EMAIL PROTECTED]> Cc: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On 2008 Oct 15, at 18:51, Matthew J. Williams wrote: > fix (\rec n -> if n == 0 then 1 else n * rec (n-1)) 5 > 120 > > My interpretation: > fix (\rec n -> if n == 0 then 1 else n * rec (n-1)) 5 > ((\rec n -> if n == 0 then 1 else n * rec (n-1)) (fix (\rec n -> if > n == 0 then 1 else n * rec (n-1)) )) 5 > . . . > > Yet, it does not quite explain how 'fix' does not result in > infinite recursion. Remember, Haskell is non-strict. When the computation reaches 0, the "then" branch of the conditional is evaluated and the "else" is unneeded and therefore ignored, so its re-invocation isn't seen. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon university KF8NH ------------------------------ Message: 8 Date: Wed, 15 Oct 2008 19:09:24 -0400 From: "Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] fix To: "Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]> Cc: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On 2008 Oct 15, at 19:04, Brandon S. Allbery KF8NH wrote: > On 2008 Oct 15, at 18:51, Matthew J. Williams wrote: >> Yet, it does not quite explain how 'fix' does not result in >> infinite recursion. > > Remember, Haskell is non-strict. When the computation reaches 0, > the "then" branch of the conditional is evaluated and the "else" is > unneeded and therefore ignored, so its re-invocation isn't seen. Think about this, btw: you can create new control operations as ordinary functions In strict languages you need to rely on special syntax (such as Perl's IO syntax + \& prototype, or Ruby's special block/proc syntax; in LISP/Scheme, you have to use a macro and/or quoting); non-strict evaluation gives it to you for free. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon university KF8NH ------------------------------ Message: 9 Date: Wed, 15 Oct 2008 23:50:53 -0500 From: Larry Evans <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] better way to create Array defined on all indices To: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" On 10/15/08 16:05, Larry Evans wrote: > I'd like to have an Array indices values > (see http://haskell.org/onlinereport/array.html) > defined on [minBound::indices ... maxBound::indices]. > The attached does this; however, it also allows > duplicate definitions (e.g. in the attached, the > value for Term index is defined twice). > > Is there a better way to do this? Maybe a > way that doesn't use all the contexts? > Also, is there a way to do it so that the value > associated with an index is not redefined? The aforementioned array.html has: _ -> error "Array.!: \ \multiply defined array element") suggesting it should detect redefinitions; however, the library on my system apparently doesn't do that. It will detect missing defintions with the same error found in array.html: [] -> error "Array.!: \ \undefined array element" Is this a bug in my ghc library? I'n on ubuntu and synaptic shows the ghc6 version as: 6.8.2-2ubuntu1 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/beginners/attachments/20081015/c14acf5e/attachment.htm ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 4, Issue 5 ***************************************