in reply to Hello Perl 6. Running pugs on Windows

I'm very happy that you are checking out my code! There were multiple reasons that broke the quicksort example, chief among them being that "map" and "grep" had not been implemented. :-)

However, if you check out the current repository, you'll find an example/quicksort.p6 that indeed works, using "multi sub" dispatch. I'll list you in the AUTHORS file, if you'd let me know your name.

The code in the repository looks like this:

use v6; multi sub quicksort ( ) { () } multi sub quicksort ( *$x, *@xs ) { my @pre = @xs.grep{ $_ < $x }; my @post = @xs.grep{ $_ >= $x }; (@pre.quicksort, $x, @post.quicksort); } (1, 5, 2, 4, 3).quicksort.say;

I need to check with p6l folks on whether quicksort() can match a slurpy list this way. It is possible that quicksort( *[] ) would be a more accurate. Once I found out the answer, I'll fix the examples accordingly.

Thanks,
/Autrijus/

Replies are listed 'Best First'.
Re: It now works. :)
by pernod (Chaplain) on Feb 18, 2005 at 09:26 UTC
    I'm very happy that you are checking out my code! There were multiple reasons that broke the quicksort example, chief among them being that "map" and "grep" had not been implemented. :-)

    A little too much enthusiasm on my part there, perhaps. I saw something that looked like it could work, and did not actually check out if the internals were implemented :)

    Thank you very much for this initiative autrijus. In my humble opinion, you deserve all the praise the Perl community can muster. Keep up the good work!

    I'm having some trouble building Pugs right now, though. I am therefore unable to run your examples ... It looks like an issue with the generated Makefile. Building the darcs repository now fails with dmake complaining about:

    dmake.exe: Error -- 'C:\dev\fun\pugs\pugs.exe' not found, and can't be made.

    I tried to copy in the old executable from a previous install, but then it would not rebuild, even after resaving the files to rewrite their dates. Fetching the repository again didn't work either. I dont't have more time to investigate this now (I'm at work), but I'll see if can figure something out when I get home.

    pernod
    --
    Mischief. Mayhem. Soap.

      I think it's a dmake issue. Try tweaking the Makefile and replace all c:\dev\fun\pugs\pugs.exe to pugs.exe and let me know if it works?

      Of course you can always do a cd src then ghc --make Main.hs by hand...

        You were right about dmake. Doing a s#C:\def\fun\pugs\(pugs.exe)#$1#g on the Makefile removes the previous error. I also tried to modify the Makefile.PL to not use a complete path, which gave the same result. So now I get to build the sources, but linking fails:

        C:\dev\fun\pugs>dmake ghc --make -o pugs src/Main.hs -isrc Chasing modules from: src/Main.hs Skipping Cont ( src/Cont.hs, src/Cont.o ) Skipping Internals ( src/Internals.hs, src/Internals.o ) Skipping Context ( src/Context.hs, src/Context.o ) Skipping AST ( src/AST.hs, src/AST.o ) Skipping Lexer ( src/Lexer.hs, src/Lexer.o ) Skipping Monads ( src/Monads.hs, src/Monads.o ) Skipping Bind ( src/Bind.hs, src/Bind.o ) Skipping Junc ( src/Junc.hs, src/Junc.o ) Skipping Shell ( src/Shell.hs, src/Shell.o ) Skipping Pretty ( src/Pretty.hs, src/Pretty.o ) Skipping Help ( src/Help.hs, src/Help.o ) Skipping Parser ( src/Parser.hs, src/Parser.o ) Skipping Prim ( src/Prim.hs, src/Prim.o ) Skipping Eval ( src/Eval.hs, src/Eval.o ) Skipping Main ( src/Main.hs, src/Main.o ) Linking ... C:/ghc/ghc-6.2.2/libHSreadline.a(Readline__56.o)(.text+0x33):ghc11748. +hc: undefined reference to `rl_initialize' C:/ghc/ghc-6.2.2/libHSreadline.a(Readline__96.o)(.text+0xaa):ghc11748. +hc: undefined reference to `readline' C:/ghc/ghc-6.2.2/libHSreadline.a(Readline__98.o)(.text+0x63):ghc11748. +hc: undefined reference to `add_history' dmake.exe: Error code 1, while making 'pugs.exe'

        I tried with source both from the darcs repository and the subversion repository at http://svn.openfoundry.org/pugs/. They both give the same result. Looks like my windows box lacks some neat library. Oh well, I've got OS X at home, so perhaps it will work out better there.

        I hope this doesn't take your attention from making Pugs better, though!

        Edit: autrijus, would you prefer to use rt.cpan.org instead of posting here? Is feedback like this at all useful for Pugs? Just wondering if there is a small way I can help ...

        pernod
        --
        Mischief. Mayhem. Soap.