Bagley shootout. Was: Lightningspeed haskell
I notice that the reverse file program, while concise, is quite slow. The program in its entirety is: main = interact $ unlines . reverse . lines Any thoughts on why its time is 5.68 seconds, vs 3.56 for tcl, 2 for perl, 0.19 for gcc, 0.18 for ocaml; and how it might be sped up? Is the lack of speed all in the stdio I/O? Is there a way to tell which benchmarks have no haskell entry? John Atwood -- Josef Svenningsson wrote: Hi all. Some days ago someone posted this url: http://www.bagley.org/~doug/shootout/ which is a page benchmarking a number of different languages and compilers where ghc is one of them. Some benchmarks lacked a haskell versions (and some still do) and so I decided to fill in some of the gaps. One benchmark turned out to give pretty remarkable results. It's the producer/consumer benchmark. I suggest you all take a look at it. The haskell version is six (SIX!!!) times faster than the c version. Hey, what's going on here? I would really like to hear some comments from our dear implementors. It should be noted that synchronisation is achieved by using slightly different kinds of primitives. But still... six times... I lift my hat of for the ghc-implementors. /Josef ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: A small problem.
for de-suguring of list comprehensions, see section 3.11 of the Haskell Report: http://www.haskell.org/definition/ or, in this case: area (Polygon vertices) = 0.5 * sum (concatMap ok l) where ok (Vertex x1 y1, Vertex x2 y2) = [(x1-x2)*(y1+y2)] ok _ = [] l = zip vertices (tail vertices ++ [head vertices]) John Friedrich Dominicus wrote: Ronny Wichers Schreur [EMAIL PROTECTED] writes: area :: Shape - Float area (Polygon vertices) = 0.5 * sum [(x1-x2)*(y1+y2) | (Vertex x1 y1, Vertex x2 y2) - zip vertices (tail vertices ++ [head vertices])] thanks, John Huges pointed me to a simular solution, JFYI list comprehension is not covered in that chapter nor are anonymous functions. I found that list comprehension is syntactic sugar for a map, just by sheeting (to page 90 in SOE). But I do not understand how to replace one by the other here. I'll have to wait and try till I found what list comprehansion stands for. Thanks anyway Friedrich -- for e-mail reply remove all after .com
Re: openfile :: String - String
Wy not load the list as program? E.g. list1 = ["word1" ,"word2" ,"word3" ] list2 = words "word1 word2 word3" list3 = words "\ \ word1\ \ word2\ \ word3\ \" John Atwood - Lars Lundgren wrote: On Wed, 26 Apr 2000, Hamilton Richards wrote: The Gofer prelude had a function openfile :: String - String which mapped file path names to strings containing the named files' contents. The Hugs98 Prelude doesn't seem to have anything like that function. Instead, it has things like readFile :: String - IO String Why would I want openfile instead of readFile? The problem in which the need for openfile arose is this: I want to load a binary search tree and a list with words read from a file, and then perform, interactively, several tests comparing the cost of searching the tree with that of searching the list. In addition to performing the tests interactively, I want to separate the cost of searching the list and the tree from the cost of constructing them. In order for the list and the tree to be used in several successive command-line evaluations without being reconstructed each time, they must be named globally. This is no problem with openfile, but readFile forces their names to be local to an IO command. Why is this a problem? After all, the names ARE dependent on IO. Can anyone suggest a solution? I do not understand the problem. Is it something like this you want? parseTree :: String - Tree parseList :: String - List buildTree:: IO Tree buildTree = do f - readFile "thetree" return (parseTree f) buildList:: IO List buildList = do f - readFile "thelist" return (parseList f) test :: IO() test = do tree - buildTree list - buildList dowhateverYouwant_interactive_or_not tree list dowhateverYouwant_interactive_or_not :: Tree - List - IO() /Lars L
Re: Lambada
Try Erik Meijer's home page: http://www.cs.ruu.nl/~erik/ John Atwood - Chris Angus wrote: Does anyone know where I can get some information on Lambada. I tried http://windows.st-lab.cs.uu.nl/Lambada/ but got a 403 (not authorised to view page) Cheers Chris
Re: haskell arrays....
Siva, Are you aware of chapter 6 of the Haskell 98 Library Report: http://haskell.org/onlinelibrary/array.html There are a couple of examples of using arrays there which might be enough to get you started. Also, if you're looking at FFT, FPs, and paralelism, you'll probably be interested in "The fastest Fourier Transform in the West": http://www.fftw.org/ John Atwood --- Simon Peyton-Jones wrote: Does anyone know of a good source of tutorial material on Haskell arrays? Anyone feel like typing something into the Haskell Wiki? | -Original Message- | From: Siva P Pochiraju [mailto:[EMAIL PROTECTED]] | Sent: 11 February 2000 01:29 | To: Simon Peyton-Jones | Subject: haskell arrays | | Hello sir, | | I am a Master's student at Univeristy of Texas @ San Antonio. | I got your e-mail from microisoft research page. | | currently i am working on, Glasgow haskell, gransim . | what i am looking for is some example to use arrays in haskell. | i want to see the performance of parallel fft when lists are | replaced by | arrays . | | i am trying hard but could not find the help (in books as | well as in user | guides) | | could you tell me where can i find such help. | | thanks in advance | siva
Re: haskell IDE
Daan Leijen wrote: VisualHaskell is indeed under development. However, due to licensing issues the release date is "somewhere next year". VisualHaskell will provide you with integrated interpreter, editor, project and compiler support; but it will be closer to VisualC++ than for example VisualBasic (ie. not very visual :-) (erik meijer I'm aware of John Reekie's version [1] and I see another [2], but I suspect you refer to yet another "Visual Haskell"; can you elaborate? Is it "Visual" in the language sense, or the IDE sense? John Atwood - [1] http://ptolemy.eecs.berkeley.edu/~johnr/papers/visual.html http://ptolemy.eecs.berkeley.edu/~johnr/papers/thesis.html (Chap. 4) [2] (well, I can't find the link, site's in Australia, I believe).
Re: How to use an state reader monad?
Works for me under ghc4.05; for hugs you need to: You have it right, except you need to 1) explicitly type test, test:: Reader [Char] Char 2) have Reader derive Show 3) use the -98 option at startup John Atwood - =?iso-8859-1?Q?Jos=E9_Romildo_Malaquias?= wrote: I came across an implementation of reader monads by Andy Gill, http://www.cse.ogi.edu/~andy/monads/MonadReader.htm inspired by the paper "Functional Programming with Overloading and Higher-Order Polymorphism" (by Mark P Jones) http://www.cse.ogi.edu/~mpj/pubs/springschool.html: -- -- Reader monads. -- A class of monads for describing computations that -- consult some fixed environment. class (Monad m) = ReaderMonad s m where -- asks for the (internal non-mutable) state ask :: m s -- this allows you to provide a projection function asks :: (ReaderMonad s m) = (s - a) - m a asks f = do s - ask return (f s) -- a parametarized reader monad newtype Reader w a = Reader { runReader :: w - a } instance Functor (Reader w) where fmap f m = Reader ( \w - f (runReader m w) ) instance Monad (Reader w) where return v = Reader ( \w - v ) p = f = Reader ( \w - runReader (f (runReader p w)) w ) fail str = Reader ( \w - error str ) instance ReaderMonad w (Reader w) where ask = Reader ( \w - w ) -- - Would someone write a simple Haskell program that ilustrates how one can use this reader monad? I have tried the following, but it fails at compilation: --- test = do env - ask if env == "choose a" then return 'a' else return 'b' do_test = runReader test "choose a" main = putStr (show do_test) --- Thanks. Romildo -- Prof. José Romildo Malaquias [EMAIL PROTECTED] Departamento de Computação Universidade Federal de Ouro Preto Brasil
Haskell wiki needs reset?
Looks like the Haskell wiki has been zeroed. Could someone reset it? John Atwood
Re: [haskell] Good theory texts?
Some suggestions: Abelson, Sussman and Sussman, _The Structure and Interpretation of Computer Programs_. http://www-mitpress.mit.edu/sicp/ especially chapter 3 about the costs and benefits of introducing assignment. Barendregt's _The Lambda Caclulus_ or his paper: _The impact of the lambda calculus_, at: http://www.cs.kun.nl/~henk/papers.html have you found The Haskell Bookshelf? http://www.haskell.org/bookshelf/ John Atwood --- Christopher Jeris wrote: Hi Haskellers, Could you suggest a good place for me to learn enough real CS theory to understand the issues and reasons behind the design and implementation of Haskell ? My background is in pure mathematics (not logic -- differential geometry and stuff) and most of the books I have consulted are either too advanced for me from a CS theory viewpoint, or spend an awfully long time explaining stuff like set theory to computer scientists without as much math background. I'm having trouble finding a happy medium. thanks, Chris Jeris (sometime MIT math grad student, maybe again later)
Re: XSLT: Is assignment really necessary for performance?
XML documents are trees, and processing them is graph traversal. This paper might be of some theoretical help: Functional Programming with Graphs, Martin Erwig. 2nd ACM SIGPLAN Int. Conf. on Functional Programming (ICFP'97), 52-65, 1997 (also in: ACM SIGPLAN Notices, Vol. 32,No. 8, Aug 1997, pp. 52-65) online at: http://www.informatik.fernuni-hagen.de/import/pi4/erwig/papers/abstracts.html The last line of the abstract reads: For example, depth-first-search expressed by a fold over a functional graph has the same complexity as the corresponding imperative algorithm. John Atwood -- S. Alexander Jacobson wrote: In this article (http://www.mulberrytech.com/xsl/xsl-list/archive/msg07336.html), Clark Evans claims that XSLT is too slow or too memory intensive because it is a functional language. He suggests adding Hashtables to XSLt to improve performance. Is this really necessary? Is the problem functional programming or something broken in the design of the XSLt lanuage? Backround: XSLt is a functional programming language designed to process XML documents. It is still in the draft stage. When it becomes a standard, XSLt functional programming is likely to be one of the dominant forms of Internet programming. We are already using XSLt here to manage generating the site. -Alex- ___ S. Alexander Jacobson Shop.Com 1-212-697-0184 voice The Easiest Way To Shop
Re: advice wanted on GUI design patterns
On Mon 27 Sep, Havoc Pennington wrote: I'm trying to learn Haskell, and I'm wondering what experiences people have with designing programs with graphical user interfaces. Adrian Hey wrote: I have none, but I think you need concurrency to do it properly, Cardelli Pike claim otherwise with their Squeak language. It compiles concurrent UI channels into sequential C. The Paper's on Cardelli's home page. In Haskell, one might use something like the R (resource) monad from the latest edition of the "Gentle Introduction...". John Atwood
Re: Announce: frantk
Meurig Sage wrote: Announce: FranTk I can't get franTk running under Win95. It fails with: Error while importing DLL "c:\t\TclHaskellSrc\TclPrim.dll" This file does exist. I also tried putting a copy of the dll on the windows PATH, in C:\windows. I'm using the May99 version of hugs98, and tcl/tk 8.2. Any help would be appreciated. Also, one note on getting it running under SunOS 5.6: making TclPrim.so required uppercasing tclPrim.c John Atwood
Re: CynWinTclHaskell...?
Alex Ferguson wrote: Does anyone else have experiences of building TclHaskell under CygWin? I'm assured that it ought to be possible, but have had no luck; crib sheets greatly appreciated. (Partial credit for negative results like 'it's a bust, drop back and punt to Linux'.) In comp.lang.tcl, there's a thread on tcl and cygwin tools, also on DLL's and VC++ vs. Borland compilers. One scary statement was seen: The DLL in Borland is different from the VC++. I guess you may check it if there is the "C" prefix and __dllexport. John Atwood
Re: Cryptarithm solver - Haskell vs. C++
Manuel M. T. Chakravarty wrote: Bart Demoen [EMAIL PROTECTED] wrote, Speed is not the only issue - feasability is an issue as well. I completely agree, but the original poster did not complain about a slight discrepancy in speed, he was puzzled about an unacceptable large gap of several orders of magnitude. Speed is not the only issue, but it definitely is _an_ issue. Another issue is correctness. What can be said about the correctness of the C++ program? the haskell program? What theorems do we get for free with this haskell program? John Atwood
Re: Haskore: looking for a function that reads a midi file...
Natividad Vilela Carral wrote: I'm looking for some function that reads a midi file and to generates Haskore. I'm trying to take a midi file and to generate a Mathematic function. I don't know of such a function, but a quick glance at the Haskore src, particularly MidiFile.lhs suggests to me that many of the pieces are there. How many clocks are there in a quarter note? Look in the file HaskToMidi.lhs John Atwood