Re: [Haskell-cafe] Optimization with Strings ?

2009-12-03 Thread Alec Berryman
Emmanuel CHANTREAU on 2009-12-03 13:03:02 +0100:

> In my futur program, it use a lot of binary trees with strings (words)
> as leaf. There is just arround 1000 words and they will appear a lot of
> times. The program will possibly consume a lot of process and memory
> (it is a mathematics proover).
> 
> I began this program in C++ but haskell has a prety good speed and
> memory footprint and is easier. But I don't know if it worth to do this
> optimization: having a dictionary to translate string words in Int.
> 
> The answer depends on the automatic optimizations in GHC, because GHC
> could compare quickely two strings if it is the same object, so it
> depends if program generated by GHC have a dictionary (tree) of strings
> internaly. Someone knows this ?

I don't know of a library to intern strings, but it's not too hard to
implement.  I couldn't find the code I wrote to do this, but I looked
around a bit and this is about what I remember doing:

http://www.haskell.org/pipermail/haskell-cafe/2005-June/010335.html

For the application I was using, interning strings did provide a
significant reduction in memory, but for whatever reason didn't help
with speed.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haskell stacktrace

2008-09-09 Thread Alec Berryman
Justin Bailey on 2008-09-09 14:12:38 -0700:

> 2008/9/9 Pieter Laeremans <[EMAIL PROTECTED]>:
> > What 's the best equivalent haskell approach ?
> > thanks in advance,
> > Pieter
>
> The preferred approach is to look at your code, figure out where you
> are using tail (or could be calling something that uses tail) and use
> the "trace" function to output logging info.

A nice way to automate that is using LocH from Hackage.  The original
announcement:

http://www.haskell.org/pipermail/haskell/2006-November/018729.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Richer (than ascii) notation for haskell source?

2008-05-14 Thread Alec Berryman
Patrick Surry on 2008-05-14 09:43:44 -0400:

> Probably a silly question, but for me one of the nice things about
> Haskell is that it's a lot like just writing math(s).  But in contrast
> to math you lose a lot of notational flexibility being limited to the
> ascii character set in your source code.

If you use emacs, there's some code that will display arbitrary
words/symbols as Greek letters or math symbols:

http://www.emacswiki.org/cgi-bin/wiki/PrettyLambda

It's cute.  It won't replace the actual text, just what's displayed, so
if you need to share your code with someone else, they'll still be able
to use it.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] CGI test

2007-07-10 Thread Alec Berryman
Andrew Coppin on 2007-07-10 21:23:23 +0100:

> Can somebody write a trivial (as in: small) program so I can test my CGI 
> stuff without having to actually install and configure Apache?

The Haskell wiki (http://www.haskell.org/) lists several web servers; one
appears to fit your needs of being small and able to run CGI.  Look under
"Applications and libraries" to get started.

> Actually, might be a useful thing to have in a library somewhere.

The Haskell wiki also lists several HTTP libraries.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Beginner's Question] How to read filenames from a DirStream

2007-04-08 Thread Alec Berryman
Albert Lee on 2007-04-09 10:46:14 +0800:

>  I want to ls the filenames of a directory.

[...]

>  and I write that in haskell:
>
>  -
>  import System.Posix
>  import System.IO
>
>  main = do
> dp <- openDirStream "/"
> df <- readDirStream dp
> putStrLn df
> closeDirStream dp
>
>
>  --
>  It can print the first entry of the dir, but how can we list it all like the
>  C prog?  map ? list comperhension?

System.Posix is one way to do it, but you might find the functions in
System.Directory easier to use -  there's a function to get the
directory contents as a list of strings.  To print them out, you may
want to look at one of the mapM functions.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] LGPL libraries

2007-03-05 Thread Alec Berryman
brad clawsie on 2007-03-05 20:30:24 -0800:

> > (3) The GPL has never been tested in court
>
> http://www.fsf.org/news/wallace-vs-fsf
>
> note that during this thread there was a note from a contributor
> to promise to not sue a potentially infriging use. you should be
> careful of such promises, particularly considering that some fsf
> licenses include copyright assignment...

No FSF licenses include, demand, or require copyright assignment.  The
FSF encourages developers assign them the copyright to pieces of free
software for the reasons enumerated in the link you mentioned, but this
assignment is not a requirement for using the GPL or LGPL.  Case in
point: the Linux kernel.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Concurrency in Haskell

2007-01-25 Thread Alec Berryman
Chris Eidhof on 2007-01-25 22:04:18 +0100:

> Yes, I'm curious too. For example, it would be great if we could  
> change a function that uses map almost automatically to a function  
> that does the map in parallel. Ofcourse it should be in the IO monad,  
> so maybe mapM would be a better choice to start with.

http://www.haskell.org/ghc/docs/latest/html/users_guide/lang-parallel.html


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Refactoring recklessly

2006-12-12 Thread Alec Berryman
Greg Fitzgerald on 2006-12-12 11:24:58 -0800:

> I'd like to be able to reorganize my code and then verify that I didn't
> change any functionality.  That is, the old and new code have precisely the
> same meaning.
> 
> Also, I'd like to be able to change a function and verify that efficiency
> was the only thing affected.
> 
> Are either of these possible in Haskell or any language?

Use QuickCheck to generate parameters and compare return values for the
old and the new functions.


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Trivial database access in Haskell

2006-12-11 Thread Alec Berryman
Paul Moore on 2006-12-11 22:46:44 +:

> What I *can* do, is to attempt to install one of the libraries that
> looks closest to what I want (probably HDBC, because I'm familiar with
> the Python DB-API). But I honestly have little or no idea how to start
> - following the HDBC link on the Haskell Wiki leads to a huge list of
> tar.gz files, with no indication of which one I might want :-(
>
> Option 2, Takusen, leads to a file listing, but no downloadable package.
> 
> Option 3, HSQL, leads to a page which doesn't mention Oracle support
> (even though the Wiki page does) so I'm put off trying further...

I believe HSQL provides a similar interface to the the Python DB-API,
but you're right, I don't believe anyone has written Oracle support.



signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe