[Haskell-cafe] Newbie seeking advice regarding data structure for a tricky algorithm

2007-04-23 Thread Toby Hutton
Hi, I'm trying to implement a fast kd-tree in Haskell. http://en.wikipedia.org/wiki/Kd-tree It's a binary tree representing space partitions. One of the fastest ways to build kd-trees is outlined in this paper: http://www.cgg.cvut.cz/~havran/ARTICLES/ingo06rtKdtree.pdf (I'm trying to implement

Re: [Haskell-cafe] faster factorial function via FFI?

2007-04-23 Thread ajb
G'day all. Quoting Dan Weston <[EMAIL PROTECTED]>: > Why all the fuss? n! is in fact very easily *completely* factored into > prime numbers [...] It's even easier than that. primePowerOf :: Integer -> Integer -> Integer primePowerOf n p = (n - s p n) `div` (p-1) where s p 0 = 0 s p

Re: [Haskell-cafe] faster factorial function via FFI?

2007-04-23 Thread Dan Weston
Why all the fuss? n! is in fact very easily *completely* factored into prime numbers (and this never changes, so you can just read in a binary lookup table). It took my machine only 3 seconds to find the prime factors of the first 1000 factorials: Then you can do for example: import List bin

[Haskell-cafe] Re: haskell question

2007-04-23 Thread Greg Meredith
Oleg, Many thanks. i also found some course notes from Advance Functional Programming at Utrecht very useful. i have to wait until i have quality time to go over this because the next step is to close the final loop to find the fix point of - Process = Process(Nominate(Process)) i haven't wor

Re: [Haskell-cafe] COM and Haskell

2007-04-23 Thread Andrew Appleyard
On 24/04/2007, at 1:39 am, Justin Bailey wrote: Give me a way to get to the .NET libraries and the world is my oyster ... I second that :-) Such access will probably become more important over time as Microsoft release more .NET-only libraries (like Windows Presentation Foundation and Win

Re: [Haskell-cafe] Re: Haskell version of Norvig's Python Spelling Corrector

2007-04-23 Thread Albert Y. C. Lai
Albert Y. C. Lai wrote: I try using WordSet = [String] (plus corresponding change in code) and get great speedup, actually way more than 3x. There was also a memory growth phenomenon using Set String, and replacement by [String] stops that too, now it's constant space (constant = 20M). It is po

Re: [Haskell-cafe] faster factorial function via FFI?

2007-04-23 Thread David Roundy
On Mon, Apr 23, 2007 at 06:25:39PM -0500, Dan Drake wrote: > I'm finding the number of set partitions that correspond to a certain > integer partition. If p = p_1, p_2,...,p_k is an integer partition of n, > then there are > >n! > --

Re: [Haskell-cafe] faster factorial function via FFI?

2007-04-23 Thread Bryan O'Sullivan
Dan Drake wrote: This is combinatorics, so I can't just say "oh, this is small" and cross it off like physicists do. :) Binary splitting is much faster than the naive approach, but still easy to understand. That's fac1 in the attached file. I ran out of time to write an efficient implement

Re: [Haskell-cafe] faster factorial function via FFI?

2007-04-23 Thread Stefan O'Rear
On Mon, Apr 23, 2007 at 06:25:39PM -0500, Dan Drake wrote: > On Mon, 23 Apr 2007 at 12:03PM -0700, David Roundy wrote: > > I'm curious: what is your application? I've never seen one in which > > factorials actually need be computed. In physics, one factorial is > > generally divided by another (e.

Re: [Haskell-cafe] faster factorial function via FFI?

2007-04-23 Thread Dan Drake
On Mon, 23 Apr 2007 at 12:03PM -0700, David Roundy wrote: > I'm curious: what is your application? I've never seen one in which > factorials actually need be computed. In physics, one factorial is > generally divided by another (e.g. for combinatorics), so it's rarely > wise to take the actual fac

Re: [Haskell-cafe] COM and Haskell

2007-04-23 Thread Rafael
Hi, I don't read it, anyway you can try. http://liinwww.ira.uka.de/cgi-bin/bibshow?e=Njtd0DjufTffs02::8%6015/fyqboefe%7d3352:26&r=bibtex&mode=intra http://research.microsoft.com/%7esimonpj/Papers/com.ps.gz att Rafael Cabral On 4/19/07, Justin Bailey <[EMAIL PROTECTED]> wrote: All, I'm intere

Re: [Haskell-cafe] Is there a best *nix or BSD distro for Haskell hacking?

2007-04-23 Thread Rafael Almeida
All in all it doesn't really matter what system you run. What you really need is a haskell compiler or interpreter installed, preferable one compatible with the standard and latest version of programs you may want to research. Use the system you alredy know how it works so the OS won't bug you whe

Re: [Haskell-cafe] QuickCheck testing of AST transformers

2007-04-23 Thread Neil Mitchell
Hi My experience is that generating correct AST's is hard to get right. I've found regression testing to be more useful when doing program transformation. I would follow Lennarts solution of writing a function that semantically evaluates each expression. I would then add a bit into your program

Re: [Haskell-cafe] QuickCheck testing of AST transformers

2007-04-23 Thread Thomas Schilling
Additionally, as a safety net, you might want to type-check the code that's being produced by your Arbitrary instances and state some invariants on your code. Also, you'll likely want to limit your number of evaluation steps if your language allows non-terminating programs. In any case,

Re: [Haskell-cafe] faster factorial function via FFI?

2007-04-23 Thread Stefan O'Rear
On Mon, Apr 23, 2007 at 01:06:07PM -0500, Dan Drake wrote: > Hello everyone, > > I have some code in which the bottleneck is the factorial function. I > began by using a naive > > fac n = product [1..n] > > but it looks like there are faster ways to do it. I could try to look up > those faster

Re: [Haskell-cafe] QuickCheck testing of AST transformers

2007-04-23 Thread Lennart Augustsson
Without looking into your language and transformation in more detail it's hard to come up with concrete suggestions. But here are some anyway: Write an interpreter for each of your languages (original AST, transformed AST) etc, and then use a quickcheck property stating that well formed

[Haskell-cafe] QuickCheck testing of AST transformers

2007-04-23 Thread Joel Reymont
My previous post did not receive any replies so I thought I might try generalizing the problem a bit... Suppose I'm parsing a language into a syntax tree and then transforming that tree into another AST representing a "core language". The core language is a more general AST that should help

[Haskell-cafe] ANN: template 0.1 - Simple string substitution

2007-04-23 Thread Johan Tibell
As an exercise I wrote a simple string substitution library that supports "$"-based substitution ala Perl or Python. Example usage: import qualified Data.ByteString.Lazy.Char8 as B import Text.Template context = Map.fromList . map packPair where packPair (x, y) = (B.pack x, B.pack y) hello

Re: [Haskell-cafe] Announce: DisTract: Distributed Bug Tracker implemented in Haskell

2007-04-23 Thread Bryan O'Sullivan
Nice. You might find Bugs Everywhere interesting for comparison. http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Announce: DisTract: Distributed Bug Tracker implemented in Haskell

2007-04-23 Thread Matthew Sackman
DisTract is a Distributed Bug Tracker. We're all now familiar with working with distributed software control systems, such as Monotone, Git, Darcs, Mercurial and others, but bug trackers still seem to be fully stuck in the centralised model: Bugzilla and Trac both have single centralised servers.

[Haskell-cafe] New York Functional Programmers Network Inaugural Meeting - Thurs day May 3rd 2007 from 6pm

2007-04-23 Thread Mansell, Howard
We are starting up a New York area-based network for functional programmers. The idea is to have a regular meeting through which functional programmers can meet to discuss experiences, get and give information, find jobs etc. The first official meeting will be held on Thursday May 3rd at the off

Re: [Haskell-cafe] faster factorial function via FFI?

2007-04-23 Thread David Roundy
On Mon, Apr 23, 2007 at 01:06:07PM -0500, Dan Drake wrote: > Hello everyone, Hi! > I have some code in which the bottleneck is the factorial function. I > began by using a naive > > fac n = product [1..n] > > but it looks like there are faster ways to do it. I could try to look up > those fas

Re: [Haskell-cafe] Performance and STUArrays

2007-04-23 Thread Daniel Fischer
Am Sonntag, 22. April 2007 15:06 schrieb Dominic Steinitz: > I've been playing around some more trying improve the performance of the > SHA1 implmentation in the crypto library. I've isolated one of the > functions and implemented it using > > a) unfold > > and > > b) STUArray > > The STUArray impl

[Haskell-cafe] faster factorial function via FFI?

2007-04-23 Thread Dan Drake
Hello everyone, I have some code in which the bottleneck is the factorial function. I began by using a naive fac n = product [1..n] but it looks like there are faster ways to do it. I could try to look up those faster algorithms and implement them, but I'm guessing that using libgmp's factoria

[Haskell-cafe] About functional programing, type theory and a master thesis topic

2007-04-23 Thread Glauber Cabral
Hi everybody =) First time I write to the list. My name is Glauber and I'm doing my master course at UNICAMP, Brazil, under supervisor of Prof. Dr. Arnaldo Vieira Moura. I'm interested in Haskell, type theory and algebraic specification (formal methods). I've been studying these subjects to my Co

Re: [Haskell-cafe] Compilling GHC on Vista

2007-04-23 Thread Monique Monteiro
On 4/23/07, Tom Schrijvers <[EMAIL PROTECTED]> wrote: Do make sure that MingW's bin/ and libexec/gcc/mingw32/3.4.2/ are the very first two in your path. I get the same error message if I don't do that. Yes. Here is my cygwin.bat: @echo off SET MAKE_MODE=UNIX SET SHELL=c:/cygwin/bin/sh SET HO

Re: [Haskell-cafe] IDE support

2007-04-23 Thread David Waern
> Have you seen the GuiHaskell project, and were you aware that there is > a summer of code project on it? This will provide some way of > interfacing to all compilers, and various buttons, but none of the > editing features. Yes, I was aware of it. My plan was to experiment with the editor, the G

Re: [Haskell-cafe] IDE support

2007-04-23 Thread David Waern
> On 23/04/07, David Waern <[EMAIL PROTECTED]> wrote: >> > What IDE support is available for Haskell (Visuall Haskell, >> EclipseFP), >> > anything else? >> >> I'm working in Haste2[1]. But it is unreleased :P >> >> [1] http://www.dtek.chalmers.se/~davve/haste2-new.png > > That's really clean-looki

Re: [Haskell-cafe] IDE support

2007-04-23 Thread Neil Mitchell
Hi David, Yes, it's based on the Scintilla[1] editor and gtk2hs. I've only been working on it for a couple of weeks, and that includes creating the Scintilla binding for gtk2hs, so it doesn't have that many feature yet. There's no homepage either. [1] http://www.scintilla.org/ Have you seen t

Re: [Haskell-cafe] IDE support

2007-04-23 Thread David Waern
> This looks nice! Is there a project page for Haste2? How far along is > it? Is it based on gtk2hs? Yes, it's based on the Scintilla[1] editor and gtk2hs. I've only been working on it for a couple of weeks, and that includes creating the Scintilla binding for gtk2hs, so it doesn't have that many

Re: [Haskell-cafe] IDE support

2007-04-23 Thread Dougal Stanton
On 23/04/07, David Waern <[EMAIL PROTECTED]> wrote: > What IDE support is available for Haskell (Visuall Haskell, EclipseFP), > anything else? I'm working in Haste2[1]. But it is unreleased :P [1] http://www.dtek.chalmers.se/~davve/haste2-new.png That's really clean-looking and undistracting.

Re: [Haskell-cafe] IDE support

2007-04-23 Thread Andrew Wagner
This looks nice! Is there a project page for Haste2? How far along is it? Is it based on gtk2hs? On 4/23/07, David Waern <[EMAIL PROTECTED]> wrote: > What IDE support is available for Haskell (Visuall Haskell, EclipseFP), > anything else? I'm working in Haste2[1]. But it is unreleased :P [1] h

Re: [Haskell-cafe] COM and Haskell

2007-04-23 Thread Justin Bailey
On 4/23/07, Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: I wonder what we (or someone else) could do to make it less work? Even a 'cookbook' to explain what to do would be jolly useful. Give me a way to get to the .NET libraries and the world is my oyster ... Based on my experience using .

[Haskell-cafe] Creating QuickCheck properties

2007-04-23 Thread Joel Reymont
Folks, I have code like this that I want to test with QuickCheck but I'm having trouble imagining how I would wrap it up in a property. Do I make sure that id, subs, back are always morphed properly or do I leave that to separate properties for their respective types? Do I then ensure tha

Re: [Haskell-cafe] IDE support

2007-04-23 Thread David Waern
> What IDE support is available for Haskell (Visuall Haskell, EclipseFP), > anything else? I'm working in Haste2[1]. But it is unreleased :P [1] http://www.dtek.chalmers.se/~davve/haste2-new.png /David ___ Haskell-Cafe mailing list Haskell-Cafe@haskel

Re: [Haskell-cafe] Gotta love Haskell - Mass management

2007-04-23 Thread Henning Thielemann
On Fri, 20 Apr 2007, Justin Bailey wrote: > Here's the trick I thought was neat. When creating the MassTime value, I > capture it in a closure and bind it to the selector function, as below: > > makeMass :: Day -> MassTime > makeMass day = > mass > where > -- Use trick here to capture

[Haskell-cafe] Re: IDE support

2007-04-23 Thread Benedikt Schmidt
Gour <[EMAIL PROTECTED]> writes: > On Sun, 22 Apr 2007 22:13:45 +0100 > "Claus Reinke" <[EMAIL PROTECTED]> wrote: >> if you can stay within haskell98, HaRe refactoring support for emacs >> and vim is still around: >> http://www.cs.kent.ac.uk/projects/refactor-fp/ > > What about shim (http://shim.

Re: [Haskell-cafe] Compilling GHC on Vista

2007-04-23 Thread Tom Schrijvers
On Mon, 23 Apr 2007, Monique Monteiro wrote: Tom, On 4/23/07, Tom Schrijvers <[EMAIL PROTECTED]> wrote: What does the config.log say? Are you able to run the MingW's gcc compiler yourself on a simple C program? I had a similar error, cause by the fact that gcc.exe cannot find cc1.exe, w

Re: [Haskell-cafe] newbie question on ordering

2007-04-23 Thread Joe Thornber
On 22/04/07, Nikolay Metchev <[EMAIL PROTECTED]> wrote: Hello guys, I have decided to try and get back into Haskell recently. I have used it in the past but have forgotten large chunks. I am trying to express the logic of a particular card game. For this purpose I need to be able to order cards i

Re: [Haskell-cafe] Compilling GHC on Vista

2007-04-23 Thread Marc Weber
> [...] > configure:3389: result: > configure: failed program was: > configure:3396: error: C compiler cannot create executables > See `config.log' for more details. configure: failed program was: X <- configure:3396: error: C compiler cannot create executables See `config.log' for more details.

Re: [Haskell-cafe] Compilling GHC on Vista

2007-04-23 Thread Monique Monteiro
Tom, On 4/23/07, Tom Schrijvers <[EMAIL PROTECTED]> wrote: What does the config.log say? Are you able to run the MingW's gcc compiler yourself on a simple C program? I had a similar error, cause by the fact that gcc.exe cannot find cc1.exe, which is in MingW/libexec/gcc/mingw32/3.4.2/. I

RE: [Haskell-cafe] COM and Haskell

2007-04-23 Thread Simon Peyton-Jones
| I've done things that are almost identical to what Neil suggests, and | I've also done a lot of work on calling Haskell code from Excel via | the Excel4 (XLL) API, but not so much work on calling COM from Haskell. | It's all doable, but it's a lot of work. I wonder what we (or someone else) coul

Re: [Haskell-cafe] Is there a best *nix or BSD distro for Haskell hacking?

2007-04-23 Thread Thomas Hartman
If you opt for ubuntu, have a look at http://groups.google.de/group/fa.haskell/browse_thread/thread/e63e73e7fc9e96c2/be76e381f8c33f39?lnk=st&q=%22haskell+cafe%22+%22Trouble+trying+to+find+packages+for+ubuntu+linux%22&rnum=1&hl=en#be76e381f8c33f39 This little hack enabled me to do a sort of "one

Re: [Haskell-cafe] IDE support

2007-04-23 Thread David House
On 22/04/07, Philipp Volgger <[EMAIL PROTECTED]> wrote: What IDE support is available for Haskell (Visuall Haskell, EclipseFP), anything else? There is pretty decent Emacs support. haskell-mode [1] provides the basis of this support. There are Emacs Lisp libraries for Haskell indentation, Haske

Re: [Haskell-cafe] COM and Haskell

2007-04-23 Thread Lennart Augustsson
I've done things that are almost identical to what Neil suggests, and I've also done a lot of work on calling Haskell code from Excel via the Excel4 (XLL) API, but not so much work on calling COM from Haskell. It's all doable, but it's a lot of work. And the code I've written is proprietary,

Re: [Haskell-cafe] Performance and STUArrays

2007-04-23 Thread Jean-Marie Gaillourdet
Hi Dominic, Dominic Steinitz wrote: > I've been playing around some more trying improve the performance of the SHA1 > implmentation in the crypto library. I've isolated one of the functions and > implemented it using > > a) unfold > > and > > b) STUArray > > The STUArray implementation is about tw

Re: [Haskell-cafe] Compilling GHC on Vista

2007-04-23 Thread Tom Schrijvers
I'm trying to compile GHC on Windows Vista, but I encountered the following error when running ./configure --host=i386-unknown-mingw32 --with-gcc=c:/MinGW/bin/gcc: configure: error: C compiler cannot create executables See `config.log' for more details. ./configure: line 3404: cannot create temp

Re: [Haskell-cafe] Re: Haskell version of Norvig's Python Spelling Corrector

2007-04-23 Thread Ketil Malde
On Sun, 2007-04-22 at 13:15 -0700, Stefan O'Rear wrote: > You can almost always do DP with less space, and this is no exception: > linear space for full Levenschtein, constant for the diagonal band. Right. Especially as we only want the final score and not the exact edits, we only need to keep

RE: [Haskell-cafe] COM and Haskell

2007-04-23 Thread Simon Peyton-Jones
Lennart Augustsson has quite a bit of experience in interface Haskell and Excel, although I'm not sure which "way". Simon From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Justin Bailey Sent: 19 April 2007 16:59 To: haskell-cafe@haskell.org Subject: