Re: [Haskell-cafe] Maintaining the community

2007-07-13 Thread Jens Fisseler
On Fri, 13 Jul 2007, Andrew Coppin wrote:

> Mark T.B. Carroll wrote:
> > Andrew Coppin <[EMAIL PROTECTED]> writes:
> >
> >   
> > > ...and when you view a web page, your web browser has to connect to a
> > > web server somewhere.
> > >
> > > I don't see your point...
> > > 
> >
> > Very many news servers will only serve news to people on the network of
> > whoever's running the server: i.e. a rather restricted 'customer' base.
> >   
> 
> Really? Most web servers will accept a connection from anybody. (Unless it's
> *intended* to be an Intranet.) I'm not quite sure why somebody would configure
> their NNTP server differently...

That's probably because someone has to pay for maintenance. Most of the 
time, this will be the one who is running the server. So, if *you* were 
running a NNTP server and had to pay monthly fees and other recurring 
costs, whom would you grant access to your NNTP server?

With web servers, you, as the reader or consumer, don't have to pay for 
the access, because the owner of the web server takes care of these costs, 
because he/she probably gains some sort of benefit from this.

Regards,

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


Re: [Haskell-cafe] avoiding command window with wxHaskell on Windows?

2007-06-23 Thread Jens Fisseler
On Sat, 23 Jun 2007, Dean Herington wrote:

> But if I double-click the .exe file, I get a command window that hangs around
> (but doesn't appear to do anything, fortunately) until the program terminates.
> How can I avoid this command window?

With gtk2hs, using "-optl-mwindows" as a command line option for GHC lets 
me get rid of this window. Perhaps it will do the same for wxHaskell?

Regards,

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


Re: [Haskell-cafe] avoiding command window with wxHaskell on Windows?

2007-06-23 Thread Jens Fisseler
On Sat, 23 Jun 2007, Dean Herington wrote:

> But if I double-click the .exe file, I get a command window that hangs around
> (but doesn't appear to do anything, fortunately) until the program terminates.
> How can I avoid this command window?

With gtk2hs, using "-optl-mwindows" as a command line option for GHC lets 
me get rid of this window. Perhaps it will do the same for wxHaskell?

Regards,

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


Re: [Haskell-cafe] Collections

2007-06-20 Thread Jens Fisseler
On Tue, 19 Jun 2007, Andrew Coppin wrote:

> Maybe it's just a culture thing then... In your typical OOP language, you
> spend five minutes thinking "now, what collection type shall I use here?"
> before going on to actually write the code. In Haskell, you just go "OK, so
> I'll put a list here..."

I seriously doubt this.

You kind of mix two things, languages and libraries. Collections will most 
of the time be implemented as a library.

So, in order to use the appropriate collection type, you have to know 
you're standard library or know of other libraries available. Then, 
whenever you need an appropriate collection type, you look what's 
available. It's this way with Java, with C++ and *definitely* with 
Haskell, too.

Regards,

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


Re: [Haskell-cafe] Collections

2007-06-19 Thread Jens Fisseler
On Tue, 19 Jun 2007, Andrew Coppin wrote:

> In Smalltalk, there is a wide selection of collection types, all with
> different facilities and efficiency trade offs. There is bag, set, list,
> array, ordered list, dictionary, hash table, weak array, etc. A whole
> menagerie of collection types.
> 
> However, Haskell only has 1 type of collection: linked lists. (And only
> single-linked at that.) While other "normal" programming languages spend huge
> amounts of effort trying to select exactly the right collection type for the
> task in hand, Haskell programs only ever use linked lists.

Most Haskell programs use other data structures than lists.

Writing Haskell programs doesn't automagically change the the behaviour of 
linked list into the collection type you need. Have you looked at the 
Haskell standard library? There are quite many collection types available: 
sets, maps, hash tables, queues, graphs, you name it.

Note that most collection types are not built into the language itself, 
but are part of the standard library, i.e. the STL in case of C++, the 
Java standard library, and I presume it is the same with Smalltalk.

The equivalent of Haskell's list data type would be the array type of most 
imperative or object-oriented languages. Both are some sort of basic 
collection type, good for their own sake, but if you want more 
specialized collection types, you have to implement them.

Regards,

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


Re: [Haskell-cafe] latex table and backgound color

2007-06-19 Thread Jens Fisseler
> Is there any possibility to set a background color for different rows in a 
> tabular environment?

You might try the "colortbl" package:
http://texcatalogue.sarovar.org/entries/colortbl.html

But keep in mind that this is the Haskell-Cafe list, which has nothing
to do with LaTeX.

Regards,

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


Re: [Haskell-cafe] implementing a csv reader

2006-08-22 Thread Jens Fisseler
Hi Tamas,
 
> Questions:
> 
> 1. Please tell me if you know of a csv module, because then I would do
>something else.

I think MissingH contains a simple CSV parser, but the server seems to be 
down.
 
> 2. I am looking for a parser, but I don't know Haskell parsers.  Is
>Parsec a good choice?

Parsec is definitely a good choice, but beware that it parses the whole 
input before returning, thus it may consume a huge batch of memory. As CSV 
is a line oriented format, you should make your parser lazy. Search the 
mailing list archive for "lazy parser".

Regards,

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


Re: [Haskell-cafe] seq - RTFM?

2006-07-21 Thread Jens Fisseler
Hi Dusan,

>   my question is probably dull. So answers to better investigate manual 
> are welcome. Why is this correct?

the Haskell Report is probably better in explaining the behaviour of
'seq' than me: 
http://haskell.org/onlinereport/basic.html#sect6.2

Regards,

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


Re: [Haskell-cafe] Breaking cycles in a directed graph.

2006-07-13 Thread Jens Fisseler
Hi Daniel,

> > R.C. Read, R.E. Tarjan. Bounds on Backtrack Algorithms for Listing
> > Cycles, Paths and Spanning Trees. Networks 5: 237-252, 1975,
> >
> > section 8.3, "Cycles", of 
> > Edward M. Reingold, Jurg Nievergelt, Narsing Deo. Combinatorial
> > Algorithms: Theory and Practice. Prentice-Hall, Englewood Cliffs, 1977.
> >
> > You can also find a survey in
> >
> > Prabhaker Mateti, Narsing Deo. On Algorithms for Enumerating All
> > Circuits of a Graph. SIAM Journal on Computing, 5(1): 90-99, 1976.
> 
> Hi, Jens.
> 
> You don't know if there is an overview, or implementation, of these 
> algorithms 
> online do you?  I don't have (easy) access to these references.
> 
> Another that might be applicable is:
> Donald B. Johnson. Finding all the elementary circuits of a directed graph. 
> SIAM J. Comput, 5:77--84, 1975.

Johnson's algorithm is the one described in the book by Reingold et al.
I have only hardcopies of all references, although I have a
PROLOG-implementation of Tarjan's algorithm.

One possibility would be to scan the hardcopies and send them to you by
e-mail.

Regards,

Jens

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


Re: [Haskell-cafe] Breaking cycles in a directed graph.

2006-07-12 Thread Jens Fisseler
Hi Daniel,

> I want to detect all cycles within the graph and 'break' them by inserting a 
> minimal number of nodes that are labelled with a special cycle-breaker label.
> 
> Can anyone give me advice on a good algorithm for finding the cycles and 
> finding the optimum edges to insert the cycle-breaking nodes on?

I've had a similar problem as I needed to find all (even-length) cycles
in an undirected graph. To the best of my knowledge the algorithm,
described in

R.C. Read, R.E. Tarjan. Bounds on Backtrack Algorithms for Listing
Cycles, Paths and Spanning Trees. Networks 5: 237-252, 1975,

has the (currently) best known running time of O(V+E+EN), N being the
number of cycles found.

As the algorithm is not that easy to understand (at least for me), you
should perhaps have a look at section 8.3, "Cycles", of

Edward M. Reingold, Jurg Nievergelt, Narsing Deo. Combinatorial
Algorithms: Theory and Practice. Prentice-Hall, Englewood Cliffs, 1977.

The algorithm described there is easier to understand and implement.

You can also find a survey in

Prabhaker Mateti, Narsing Deo. On Algorithms for Enumerating All
Circuits of a Graph. SIAM Journal on Computing, 5(1): 90-99, 1976.

--

Hope this helps,

Jens

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


Re: [Haskell-cafe] Lists of Lists

2006-03-08 Thread Jens Fisseler
> > changeValue x i [xs] = [xs] !! i = x
> 
> where x is the value to change to, i is the index of the value to change,
> and [xs] is the list.
> 
> This however, dosen't work in Haskell. How would this be done in Haskell?

Think about what parts of the list you can reuse, how you can define
those parts and put them together.

You probably want to split the list at the index. 'splitAt' is the
function to use for this, as it will give you the resulting prefix and
suffix. The head of the suffix is the element you want to replace. So
you create a new list by appending the unaltered prefix, the new element
and the 'tail' of the suffix.

Regards,

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


Re: [Haskell-cafe] Lists of Lists

2006-03-08 Thread Jens Fisseler
> How would I get the value of, lets say, the 9th object in ["4179355","
> 567412"] ?
> 
> (in this case, that should return 6)
> 
> Any help/adivce would be great :)

Just concatenate the list elements and index the resulting list, but
note that list indices start from 0. Nevertheless I would say this is a
strange way to index such a list.

Regards,

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



Re: [Haskell-cafe] Prime numbers

2005-12-20 Thread Jens Fisseler
Hi Daniel!

You just have to change the arguments of the 'mod'-function:


old: divides a b = (mod a b == 0)

new: divides a b = (mod b a == 0)


Regards,

Jens

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


Re: [Haskell-cafe] Prime numbers

2005-12-20 Thread Jens Fisseler
Hi Daniel!

> How do I know that 38466629 is prime?

What about this: 38466629 = 31 x 1240859

Regards,

Jens

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


Re: [Haskell-cafe] IO Monad

2005-07-18 Thread Jens Fisseler
> Hi,
> Could anyone explain for me why its not possible to return a primitive type 
> (such as Integer, String) while doing some IO actions ?
> 
> e.g: foo :: IO() -> String
> 
> What does it have to do with "lazy evalution" paradigm ?

As there are people who can explain it better than me, just take a look
at this Hawiki page: http://haskell.org/hawiki/UsingIo

Regards,

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