Re: [Haskell-cafe] algorithm-for-finding-numerical-permutation-given-lexicographic-index

2013-04-10 Thread mukesh tiwari
using lists, and attempting to index into them and measure their lengths. Perhaps a different data structure is in order. Thanks Tom Davie On 3 Apr 2013, at 17:38, Lone Wolf amslonew...@gmail.com wrote: http://stackoverflow.com/questions/8940470/algorithm-for-finding-numerical

Re: [Haskell-cafe] algorithm-for-finding-numerical-permutation-given-lexicographic-index

2013-04-09 Thread Lone Wolf
. Thanks Tom Davie On 3 Apr 2013, at 17:38, Lone Wolf amslonew...@gmail.com wrote: http://stackoverflow.com/questions/8940470/algorithm-for-finding-numerical-permutation-given-lexicographic-index How would you rewrite this into Haskell? The code snippet is in Scala. /** example

[Haskell-cafe] algorithm-for-finding-numerical-permutation-given-lexicographic-index

2013-04-03 Thread Lone Wolf
http://stackoverflow.com/questions/8940470/algorithm-for-finding-numerical-permutation-given-lexicographic-index How would you rewrite this into Haskell? The code snippet is in Scala. /** example: index:=15, list:=(1, 2, 3, 4) */ def permutationIndex (index: Int, list: List [Int

Re: [Haskell-cafe] algorithm-for-finding-numerical-permutation-given-lexicographic-index

2013-04-03 Thread Tom Davie
efficient, because you're using lists, and attempting to index into them and measure their lengths. Perhaps a different data structure is in order. Thanks Tom Davie On 3 Apr 2013, at 17:38, Lone Wolf amslonew...@gmail.com wrote: http://stackoverflow.com/questions/8940470/algorithm-for-finding

Re: [Haskell-cafe] Finding the average in constant space

2012-05-30 Thread Chris Wong
Sorry for the delayed response -- I've had exams the past few days. On Sun, May 27, 2012 at 8:21 PM, Eugene Kirpichov ekirpic...@gmail.com wrote: A lot of people have done this :) eg from me: google up a fairly recent thread from me about processing streams and perhaps the keyword timeplot

[Haskell-cafe] Finding the average in constant space

2012-05-27 Thread Chris Wong
Hello all I just came up with a way of executing multiple folds in a single pass. In short, we can write code like this: average = foldLeft $ (/) $ sumF * lengthF and it will only traverse the input list once. The code is at: https://gist.github.com/2802644 My question is: has anyone done

Re: [Haskell-cafe] Finding the average in constant space

2012-05-27 Thread Eugene Kirpichov
A lot of people have done this :) eg from me: google up a fairly recent thread from me about processing streams and perhaps the keyword timeplot (writing from a dying phone, can't do myself) 27.05.2012, в 12:04, Chris Wong chrisyco+haskell-c...@gmail.com написал(а): Hello all I just came

Re: [Haskell-cafe] Finding the average in constant space

2012-05-27 Thread Stephen Tetley
There are a few blog posts by Conal Elliott and Max Rabkin (I think) reifying folds as a data type to get more composition and thus fold different functions at the same time. Search for beautiful folding with the above authors names. Personally I didn't find the examples significantly more

Re: [Haskell-cafe] Finding the average in constant space

2012-05-27 Thread Steffen Schuldenzucker
Hi Chris, On 05/27/2012 10:04 AM, Chris Wong wrote: I just came up with a way of executing multiple folds in a single pass. In short, we can write code like this: average = foldLeft $ (/)$ sumF* lengthF and it will only traverse the input list once. The code is at:

Re: [Haskell-cafe] Finding longest common prefixes in a list

2012-01-23 Thread Gwern Branwen
On Sat, Jan 21, 2012 at 8:18 AM, Twan van Laarhoven twa...@gmail.com wrote: Notice that there are lots of miku-X prefixes found. This is probably not what you want. What exactly do you want the algorithm to do? For example, is obviously a prefix of every string, but it is not very long. On the

Re: [Haskell-cafe] Finding longest common prefixes in a list

2012-01-21 Thread Twan van Laarhoven
On 2012-01-20 23:44, Gwern Branwen wrote: On Fri, Jan 20, 2012 at 1:57 PM, Twan van Laarhoventwa...@gmail.com wrote: Here is some example code (untested): Well, you're right that it doesn't work. I tried to fix the crucial function, 'atLeastThisManyDescendants', but it's missing something

[Haskell-cafe] Finding longest common prefixes in a list

2012-01-20 Thread Gwern Branwen
name files with hyphens as the delimiters like the hypothetical '1998-wadler-monads.pdf', and it would be easy to write a stdin/stdout filter to break Strings on hyphens and sort by whatever is most common. But this is rather hardwired, can I solve the more general problem of finding the longest

Re: [Haskell-cafe] Finding longest common prefixes in a list

2012-01-20 Thread Twan van Laarhoven
On 20/01/12 18:45, Gwern Branwen wrote: Recently I wanted to sort through a large folder of varied files and figure out what is a 'natural' folder to split out, where natural means something like4 files with the same prefix. My idea for an algorithm would be: build a trie for the input

Re: [Haskell-cafe] Finding longest common prefixes in a list

2012-01-20 Thread Gwern Branwen
On Fri, Jan 20, 2012 at 1:57 PM, Twan van Laarhoven twa...@gmail.com wrote: Here is some example code (untested): Well, you're right that it doesn't work. I tried to fix the crucial function, 'atLeastThisManyDescendants', but it's missing something because varying parts doesn't much affect the

[Haskell-cafe] Re: Finding the contents of haskell platform?

2010-11-10 Thread John Pybus
Stephen Tetley wrote: I thought I read that Firefox does a font swap if it can't find a glyph, but thinking about it myself I can't see that this would make sense - Firefox would have to know an awful lot about the OSes fonts to know if they have missing glyphs. You're pretty much right,

Re: [Haskell-cafe] Re: Finding the contents of haskell platform?

2010-11-10 Thread Stephen Tetley
Hello John Thanks for the information - after I posted that message I read the CSS section of Yannis Haralambous's Fonts Encodings (_the_ book of all things font) and it has this text: In other words, the browser will check not only the existence of a given font but also the existence of each

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-06 Thread Andrew Coppin
On 05/11/2010 09:05 PM, Stephen Tetley wrote: On 5 November 2010 20:08, Andrew Coppinandrewcop...@btinternet.com wrote: Would it be hard to replace - with a real Unicode arrow character? It should be quite easy - whether a given font has an arrow readily available is a different matter. I

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-06 Thread Stephen Tetley
On 6 November 2010 09:52, Andrew Coppin andrewcop...@btinternet.com wrote: I can't remember the last time I saw a browser that couldn't do this. There /are/ symbols that don't work reliably, but the basic arrow symbols seem to be pretty well supported. Okay I'll shift my position a bit...

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-06 Thread Alexander Solla
On Nov 6, 2010, at 3:56 AM, Stephen Tetley wrote: Modern browsers might add in arrow from a different font if it is not present in the one chosen by the web page author - I suspect this is happening on this page where the arrow looks wrong typographically: I don't think that's what's going

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-06 Thread Stephen Tetley
On 6 November 2010 18:01, Alexander Solla a...@2piix.com wrote: On Nov 6, 2010, at 3:56 AM, Stephen Tetley wrote: Modern browsers might add in arrow from a different font if it is not present in the one chosen by the web page author - I suspect this is happening on this page where the arrow

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-05 Thread Don Stewart
dons: magnus: I know there's a .cabal file for the latest version of HP somewhere, but I can't coerce Google into finding me a link that actually works. Furthermore, the following page: http://hackage.haskell.org/platform/contents.html does list all the contents, but to my big

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-05 Thread Andrew Coppin
On 05/11/2010 02:59 PM, Don Stewart wrote: The changelog now lists all the versions: http://hackage.haskell.org/platform/changelog.html This is quite optimal. It would still be nice if one could easily answer the question which HP release was the one that contained process-1.0.1.1,

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-05 Thread Stephen Tetley
On 5 November 2010 20:08, Andrew Coppin andrewcop...@btinternet.com wrote: Would it be hard to replace - with a real Unicode arrow character? It should be quite easy - whether a given font has an arrow readily available is a different matter. It might be be simpler to drop into the Symbol font

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-05 Thread Nick Bowler
On 2010-11-05 21:05 +, Stephen Tetley wrote: On 5 November 2010 20:08, Andrew Coppin andrewcop...@btinternet.com wrote: Would it be hard to replace - with a real Unicode arrow character? It should be quite easy - whether a given font has an arrow readily available is a different matter.

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-05 Thread Stephen Tetley
On 5 November 2010 21:31, Nick Bowler nbow...@elliptictech.com wrote: Except that the Symbol font family is not available in all browsers. Ah ha - indeed you are right and the puritans at W3C and Mozilla.org seem to have dug their heels in. Unfortunately arrows don't appear to be in either the

[Haskell-cafe] Finding the contents of haskell platform?

2010-11-01 Thread Magnus Therning
I know there's a .cabal file for the latest version of HP somewhere, but I can't coerce Google into finding me a link that actually works. Furthermore, the following page: http://hackage.haskell.org/platform/contents.html does list all the contents, but to my big surprise it doesn't link

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-01 Thread Don Stewart
magnus: I know there's a .cabal file for the latest version of HP somewhere, but I can't coerce Google into finding me a link that actually works. Furthermore, the following page: http://hackage.haskell.org/platform/contents.html does list all the contents, but to my big surprise

Re: [Haskell-cafe] Finding the contents of haskell platform?

2010-11-01 Thread Magnus Therning
On Mon, Nov 1, 2010 at 14:47, Don Stewart d...@galois.com wrote: magnus: I know there's a .cabal file for the latest version of HP somewhere, but I can't coerce Google into finding me a link that actually works. Furthermore, the following page: http://hackage.haskell.org/platform

Re: [Haskell-cafe] Finding dependencies in cabal

2010-10-18 Thread Henk-Jan van Tuyl
On Mon, 18 Oct 2010 22:03:15 +0200, d...@patriot.net wrote: OK, I'm trying to install Haskore and it depends on an old version of QuickCheck. I'm happy to hack and update, but is there any way of finding out which modules depend on QuickCheck rather than going through each file one by one

Re: [Haskell-cafe] Finding dependencies in cabal

2010-10-18 Thread Stephen Tetley
On 18 October 2010 21:03, d...@patriot.net wrote: [SNIP] I'm happy to hack and update, but is there any way of finding out which modules depend on QuickCheck rather than going through each file one by one? grep for QuickCheck? - any module that uses it will need it in the import list

Re: [Haskell-cafe] finding out which gcc is hard-coded into a ghc?

2010-08-07 Thread Ivan Lazar Miljenovic
Günther Schmidt gue.schm...@web.de writes: how can I find out which gcc a ghc is hard-coded to use and is it possible to override it? At least in Linux as of 6.12.2, the /usr/bin/ghc wrapper script has a link to it. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com

[Haskell-cafe] finding out which gcc is hard-coded into a ghc?

2010-08-06 Thread Günther Schmidt
Hello, how can I find out which gcc a ghc is hard-coded to use and is it possible to override it? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] finding out which gcc is hard-coded into a ghc?

2010-08-06 Thread John Van Enk
If you're on Windows, I believe you can find the gcc.exe at the following location: C:\Program Files\Haskell Platform\2009.2.0.2\gcc.exe See this link for how to pick which C compiler to use: http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/options-phases.html#replacing-phases 2010/8/6

Re: [Haskell-cafe] finding out which gcc is hard-coded into a ghc?

2010-08-06 Thread Gaius Hammond
On 6 Aug 2010, at 18:05, Günther Schmidt wrote: Hello, how can I find out which gcc a ghc is hard-coded to use and is it possible to override it? See this page: http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/options-phases.html Cheers, G

[Haskell-cafe] Re: Finding zipper for custom tree

2010-07-16 Thread Heinrich Apfelmus
Sergey Mironov wrote: Sorry for late answer. Luke, Heinrich - thank you very much for explanations. I feel that I need more reading to get familiar with differentiation of functors and chain rule. Could you suggest some books or papers? For differentiation of data types, there is for example

Re: [Haskell-cafe] Re: Finding zipper for custom tree

2010-07-13 Thread Sergey Mironov
2010/7/2 Heinrich Apfelmus apfel...@quantentunnel.de: Sergey Mironov wrote: Hello list! I am trying to understand zipper concept using papers like [1] and [2]. Though main idea looks clear, I still have a problem in applying it for custom data types. Please help me with deriving

[Haskell-cafe] Re: finding the right mathematical model

2010-07-07 Thread Heinrich Apfelmus
Günther Schmidt wrote: Hi list, the problem I have stems from the app I had developed. What my app does is to split the money a hospital receives for a case to the departments involved in a fair way. An additional requirement however was to allow the users of the app to re-map any revenue

Re: [Haskell-cafe] finding the right mathematical model

2010-07-07 Thread John Lato
If you ignore the identity mappings (which all technically create trivial loops), these mappings would form a directed acyclic graph (DAG). I would look at some of the graph libraries, e.g. fgl, to see if they have anything appropriate. John From: G?nther Schmidt gue.schm...@web.de Hi list,

[Haskell-cafe] finding the right mathematical model

2010-07-04 Thread Günther Schmidt
Hi list, the problem I have stems from the app I had developed. What my app does is to split the money a hospital receives for a case to the departments involved in a fair way. An additional requirement however was to allow the users of the app to re-map any revenue shares credited to

Re: [Haskell-cafe] finding the right mathematical model

2010-07-04 Thread Andrew Korzhuev
What sort of model would be suitable to describe this, some sort of matrix? You still can get loops if your matrix represents graph. Sounds like you need a tree. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: Finding zipper for custom tree

2010-07-02 Thread Heinrich Apfelmus
Luke Palmer wrote: I would just use List. IIRC the derivative of list is: data DList a = DLIst [a] [a] Understood as the elements before the focused one and those after it. Unfortunately I can't remember how that is derived, and my own experiments failed to come up with anything similar.

[Haskell-cafe] Re: Finding zipper for custom tree

2010-07-02 Thread Heinrich Apfelmus
Sergey Mironov wrote: Hello list! I am trying to understand zipper concept using papers like [1] and [2]. Though main idea looks clear, I still have a problem in applying it for custom data types. Please help me with deriving Zipper-type from data DTree a = P | D [(a, DTree)] Looking in [1]

[Haskell-cafe] Finding zipper for custom tree

2010-07-01 Thread Sergey Mironov
Hello list! I am trying to understand zipper concept using papers like [1] and [2]. Though main idea looks clear, I still have a problem in applying it for custom data types. Please help me with deriving Zipper-type from data DTree a = P | D [(a, DTree)] Looking in [1] ('Zippers via

Re: [Haskell-cafe] Finding zipper for custom tree

2010-07-01 Thread Luke Palmer
On Thu, Jul 1, 2010 at 1:54 PM, Sergey Mironov ier...@gmail.com wrote: Hello list! I am trying to understand zipper concept using papers like [1] and [2]. Though main idea looks clear, I still have a problem in applying it for custom data types. Please help me with deriving Zipper-type from

[Haskell-cafe] Re: on finding abstractions ...

2010-02-16 Thread Heinrich Apfelmus
Günther Schmidt wrote: I've got a problem, in short my haskell code sucks. While it does work and I do manage to use higher-orderish aspects quite extensively to make my code more concise it still is nowhere abstract, always concrete and thus always with lots of boilerplate. Oh I have

[Haskell-cafe] on finding abstractions ...

2010-02-14 Thread Günther Schmidt
Hello, I've got a problem, in short my haskell code sucks. While it does work and I do manage to use higher-orderish aspects quite extensively to make my code more concise it still is nowhere abstract, always concrete and thus always with lots of boilerplate. Oh I have gotten better

Re: [Haskell-cafe] on finding abstractions ...

2010-02-14 Thread Jesper Louis Andersen
2010/2/14 Günther Schmidt gue.schm...@web.de: So fellows, what is the next stop on my road to enlightenment? I really think I need best to start from scratch. I think I'm sufficiently familiar now with most of Haskell's technicalities but how do I climb the ladder of abstraction? A couple of

Re: [Haskell-cafe] on finding abstractions ...

2010-02-14 Thread Jonathan Rockway
* On Sun, Feb 14 2010, Günther Schmidt wrote: So fellows, what is the next stop on my road to enlightenment? I really think I need best to start from scratch. I think I'm sufficiently familiar now with most of Haskell's technicalities but how do I climb the ladder of abstraction? Read more

Re: [Haskell-cafe] on finding abstractions ...

2010-02-14 Thread Stephen Tetley
Hi Günther Promoting a slightly contrary view, I'm not sure that abstraction should be a goal in itself. Richard Gabriel makes a point of valuing 'habitable' code over abstract code in his 'Patterns of Software' book (free from his website now that it's out of print). Habitable code being code

Re: [Haskell-cafe] on finding abstractions ...

2010-02-14 Thread Alexander Solla
On Feb 14, 2010, at 4:38 AM, Günther Schmidt wrote: I've got a problem, in short my haskell code sucks. While it does work and I do manage to use higher-orderish aspects quite extensively to make my code more concise it still is nowhere abstract, always concrete and thus always with lots

Re: [Haskell-cafe] on finding abstractions ...

2010-02-14 Thread Günther Schmidt
Well I just noticed that the boilerplate part consists of this: Import data by selecting fields from a table, feed them into some sort of internal data structure for later querying, times 12. All this involves quite a bit of boilerplate. Yeah, I guess I could abstract here a little. Günther

Re: [Haskell-cafe] on finding abstractions ...

2010-02-14 Thread Artyom Shalkhakov
Hello, 2010/2/14, Günther Schmidt gue.schm...@web.de: Hello, I've got a problem, in short my haskell code sucks. While it does work and I do manage to use higher-orderish aspects quite extensively to make my code more concise it still is nowhere abstract, always concrete and thus always

[Haskell-cafe] Finding substantial examples of Cabal Setup files

2009-12-10 Thread Jon Strait
Hi all, I was looking through some of the Hackage packages to find examples of how developers are extending UserHooks in their Setup files, but it wasn't easy, since the great majority of Cabal Setup files in Hackage simply require only the standard line of 'main = defaultMain' or

Re: [Haskell-cafe] Finding HP

2009-12-05 Thread Andrew Coppin
Malcolm Wallace wrote: The suggestion was to have a single Download button, leading to a *page* of suitably described links, allowing the user to choose whether they only wanted the basics (a choice of compiler/interpreter + cabal), or the whole Platform, or something else. It would be the

Re: [Haskell-cafe] Finding HP

2009-12-04 Thread Roel van Dijk
The suggestion was to have a single Download button, leading to a *page* of suitably described links, allowing the user to choose whether they only wanted the basics (a choice of compiler/interpreter + cabal), or the whole Platform, or something else.  It would be the ideal place to explain

Re: [Haskell-cafe] Finding HP

2009-12-04 Thread Martijn van Steenbergen
Don Stewart wrote: vandijk.roel: On Wed, Dec 2, 2009 at 11:44 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: On a more serious note, Download Haskell /= Download Haskell Platform, so if I were glancing down the sidebar looking for a link to download the Haskell Platform then the

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread Roel van Dijk
On Wed, Dec 2, 2009 at 11:44 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: On a more serious note, Download Haskell /= Download Haskell Platform, so if I were glancing down the sidebar looking for a link to download the Haskell Platform then the first link wouldn't have registered

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread Tony Morris
Furthermore, when someone offers feedback designed to improve a page, and does so in a very non-threatening way: On Dec 2, 2009, at 2:26 PM, Andrew Coppin wrote: My suggestion is that if we really want people to grab the HP rather than download GHC directly, maybe we could make the

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread minh thu
2009/12/3 Tony Morris tonymor...@gmail.com: Furthermore, when someone offers feedback designed to improve a page, and does so in a very non-threatening way: On Dec 2, 2009, at 2:26 PM, Andrew Coppin wrote: My suggestion is that if we really want people to grab the HP rather than

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread Gregory Crosswhite
If I wanted to know something *about* the *Haskell Platform* I would click the link The Haskell Platform under the section About. So it is actually mentioned 3 times on the front page. What could be improved are the 2 download links: Download Haskell and Download GHC. It would perhaps be

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread Don Stewart
vandijk.roel: On Wed, Dec 2, 2009 at 11:44 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: On a more serious note, Download Haskell /= Download Haskell Platform, so if I were glancing down the sidebar looking for a link to download the Haskell Platform then the first link

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread Joe Fredette
I think it makes sense, the HP is supposed to set up the entire environment needed for typical haskell development (at least, that is my understanding). As such, what's the point in making downloading haskell mean downloading a single _peice_ of haskell (GHC) only to have to download

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread John Van Enk
I'm all for making HP the default as long as we find a way to make some of the larger packages (I'm thinking gtk2hs) either ship with HP in Windows or install correctly with HP. On Thu, Dec 3, 2009 at 11:46 AM, Joe Fredette jfred...@gmail.com wrote: I think it makes sense, the HP is supposed to

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread Malcolm Wallace
It would perhaps be better to have one nice big Download button that takes you to a separate download page. Having a single download link that only points to the Haskell Platform would be a bit of a policy shift. ... but that was *not* what was suggested. The suggestion was to have a

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread Don Stewart
malcolm.wallace: The suggestion was to have a single Download button, leading to a *page* of suitably described links, allowing the user to choose whether they only wanted the basics (a choice of compiler/interpreter + cabal), or the whole Platform, or something else. It would be the ideal

Re: [Haskell-cafe] Finding HP

2009-12-03 Thread Brandon S. Allbery KF8NH
On Dec 3, 2009, at 11:43 , Don Stewart wrote: vandijk.roel: On Wed, Dec 2, 2009 at 11:44 PM, Gregory Crosswhite gcr...@phys.washington.edu wrote: On a more serious note, Download Haskell /= Download Haskell Platform, so if I were glancing down the sidebar looking for a link to download the

[Haskell-cafe] Finding HP

2009-12-02 Thread Andrew Coppin
Today I was setting up a my new, and I wanted to put Haskell on it. Rather than download GHC itself, I decided to install the Haskell Platform instead, just to see what it's like. Much to my surprise, I couldn't actually find any reference to its existence anywhere from the haskell.org home

Re: [Haskell-cafe] Finding HP

2009-12-02 Thread Don Stewart
andrewcoppin: Today I was setting up a my new, and I wanted to put Haskell on it. Rather than download GHC itself, I decided to install the Haskell Platform instead, just to see what it's like. Much to my surprise, I couldn't actually find any reference to its existence anywhere from

Re: [Haskell-cafe] Finding HP

2009-12-02 Thread Gregory Crosswhite
On Dec 2, 2009, at 2:26 PM, Andrew Coppin wrote: Subsequently, I realise [as somebody will no doubt point out] that the link is actually there, on the front page, right next to GHC, Hugs, et al. On Dec 2, 2009, at 2:29 PM, Don Stewart wrote: It is listed right on the front page, twice.

[Haskell-cafe] Finding the Convex Hull (Problem 12 of Real World Haskell)

2009-03-05 Thread Rob Crowther
I wrote a solution to this problem, but it appears to return incorrect results. There's a pastebin of the code at http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2121 and a picture of the inputs, outputs, and expected results graphed at http://img510.imageshack.us/img510/9971/resultsg.jpg I'm

Re: [Haskell-cafe] Finding the Convex Hull (Problem 12 of Real World Haskell)

2009-03-05 Thread Andrew Wagner
Whenever I'm looking for a bug in Haskell code, I find it helpful to start by seeing if I can simplify the code any first. In this case, there are a couple of things I notice: - validPointsOf is just a filter. It would be easier to write valid :: MyDirection - Bool and then validPointsOf =

Re: [Haskell-cafe] Finding the Convex Hull (Problem 12 of Real World Haskell)

2009-03-05 Thread Daniel Fischer
Am Donnerstag, 5. März 2009 13:40 schrieb Rob Crowther: I wrote a solution to this problem, but it appears to return incorrect results. There's a pastebin of the code at http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2121 and a picture of the inputs, outputs, and expected results graphed at

[haskell-cafe] Finding a PID in Windows

2009-02-22 Thread Alexandru Scvortov
Quick question. In Linux, if you want to find the PID of a process, you use getProcessID from System.Posix.Process. How do you do the same under Windows? I cannot find the equivalent function in System.Win32 and searching Google does not yield any useful results. Thanks.

Re: [haskell-cafe] Finding a PID in Windows

2009-02-22 Thread Bulat Ziganshin
Hello Alexandru, Sunday, February 22, 2009, 7:38:31 PM, you wrote: In Linux, if you want to find the PID of a process, you use getProcessID from The GetCurrentProcessId function returns the process identifier of the calling process. DWORD GetCurrentProcessId(VOID) you need to make FFI

Re: [Haskell-cafe] Shim: finding modules

2008-04-17 Thread pepe
On 16/04/2008, at 22:15, Graham Fawcett wrote: Hi folks, I'm a newbie, so please forgive any terminological mistakes. I've been using Shim in Emacs with great success, but there's one issue I've encountered, and I don't know if it's configuration problem or something fundamental. Consider a

Re: [Haskell-cafe] Shim: finding modules

2008-04-17 Thread Graham Fawcett
On Thu, Apr 17, 2008 at 4:26 AM, pepe [EMAIL PROTECTED] wrote: On 16/04/2008, at 22:15, Graham Fawcett wrote: I'd like to be able to tell Shim that 'App' is the root of my project, and to locate modules from that root. Is this possible? Shim already does this. All it requires is that

Re: [Haskell-cafe] Shim: finding modules

2008-04-17 Thread Marc Weber
I'd like to be able to tell Shim that 'App' is the root of my project, and to locate modules from that root. Is this possible? If adding the cabal file does'nt work contact me and we'll try to reslove this issue. Are you willing to test new versions/ extensions? Are you already using ghc-6.8 ?

Re: [Haskell-cafe] Shim: finding modules

2008-04-17 Thread Graham Fawcett
On Thu, Apr 17, 2008 at 10:41 AM, Marc Weber [EMAIL PROTECTED] wrote: I'd like to be able to tell Shim that 'App' is the root of my project, and to locate modules from that root. Is this possible? If adding the cabal file does'nt work contact me and we'll try to reslove this issue. It

[Haskell-cafe] Re: Shim: finding modules

2008-04-17 Thread Gour
Graham == Graham Fawcett [EMAIL PROTECTED] writes: Graham Equally glad that it's being supported! Thank you. Where one can found it? Few days ago I was told on #haskell that shim is dead :-/ Sincerely, Gour -- Gour | Zagreb, Croatia | GPG key: C6E7162D

Re: [Haskell-cafe] Re: Shim: finding modules

2008-04-17 Thread Graham Fawcett
2008/4/17 Gour [EMAIL PROTECTED]: Graham == Graham Fawcett [EMAIL PROTECTED] writes: Graham Equally glad that it's being supported! Thank you. Where one can found it? Few days ago I was told on #haskell that shim is dead :-/ The original, I believe: http://mapcar.org/haskell/shim/

[Haskell-cafe] Shim: finding modules

2008-04-16 Thread Graham Fawcett
Hi folks, I'm a newbie, so please forgive any terminological mistakes. I've been using Shim in Emacs with great success, but there's one issue I've encountered, and I don't know if it's configuration problem or something fundamental. Consider a module 'App' and submodules 'App.Front' and

Re: [Haskell-cafe] Trouble finding exception source

2008-02-27 Thread Denis Bueno
On Wed, Feb 27, 2008 at 2:01 AM, Judah Jacobson [EMAIL PROTECTED] wrote: Hi Denis, I was unable to run your program; it looks like there's a missing module 'Properties'. To include it in the sdist you probably need to add it under the other-modules field in the .cabal file. Sorry about

Re: [Haskell-cafe] Trouble finding exception source

2008-02-27 Thread Denis Bueno
On Wed, Feb 27, 2008 at 12:06 AM, [EMAIL PROTECTED] wrote: Fortuitously, I recently came across a bunch of bioinformatics software in Haskell. One of the libraries was called 'interlude', and it claims to be able to give line locations for errors in the Prelude. I was intending to upload

[Haskell-cafe] Trouble finding exception source

2008-02-26 Thread Denis Bueno
Hi all, I've got some code crashing with Prelude.foldr1: empty list. In GHCi, the code uses too much memory (I kill it after it consumes 1GB) to be able to use :trace and :history, but I just found out about the -xc RTS option. I tried that, and I get the following: GHC.List.CAFdsat:

Re: [Haskell-cafe] Trouble finding exception source

2008-02-26 Thread gwern0
On 2008.02.26 23:13:59 -0500, Denis Bueno [EMAIL PROTECTED] scribbled 7.4K characters: Hi all, I've got some code crashing with Prelude.foldr1: empty list. In GHCi, the code uses too much memory (I kill it after it consumes 1GB) to be able to use :trace and :history, but I just found out

Re: [Haskell-cafe] Trouble finding exception source

2008-02-26 Thread Judah Jacobson
Hi Denis, I was unable to run your program; it looks like there's a missing module 'Properties'. To include it in the sdist you probably need to add it under the other-modules field in the .cabal file. -Judah 2008/2/26 Denis Bueno [EMAIL PROTECTED]: Hi all, I've got some code crashing

Re: [Haskell-cafe] how to make haskell faster than python at finding primes?

2007-08-06 Thread Alex Jacobson
The challenge was the implement the modcount algorithm not to calculate primes per se. (see e.g. http://jjinux.blogspot.com/2005/11/io-comparison.html). -Alex- Donald Bruce Stewart wrote: alex: This implementation of calculating 1 primes (compiled with GHC -O2) is 25% slower than the

Re: [Haskell-cafe] how to make haskell faster than python at finding primes?

2007-08-06 Thread Alex Jacobson
Thought perhaps the problem is that modcount is just a slower algorithm. ... nevermind. Thanks. -Alex- Alex Jacobson wrote: The challenge was the implement the modcount algorithm not to calculate primes per se. (see e.g. http://jjinux.blogspot.com/2005/11/io-comparison.html). -Alex-

Re: [Haskell-cafe] how to make haskell faster than python at finding primes?

2007-08-06 Thread Paulo Tanimoto
Alex: The challenge was the implement the modcount algorithm not to calculate primes per se. (see e.g. http://jjinux.blogspot.com/2005/11/io-comparison.html). Can you show us the Python code? Paulo ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] how to make haskell faster than python at finding primes?

2007-08-06 Thread Vimal
Why not just: primes = sieve [2..] sieve (p : xs) = p : sieve [x | x - xs, x `mod` p 0] main = print (take 1000 primes) I am unable to see how exactly this will run. Given that primes is an infinite list, and that when it reaches numbers say, as large as

Re: [Haskell-cafe] how to make haskell faster than python at finding primes?

2007-08-06 Thread david48
On 8/6/07, Vimal [EMAIL PROTECTED] wrote: I am unable to see how exactly this will run. Given that primes is an infinite list, and that when it reaches numbers say, as large as 1, it will have to keep track of all the numbers (essentially prime numbers, which is the answer), whose

Re: [Haskell-cafe] how to make haskell faster than python at finding primes?

2007-08-06 Thread Vimal
Isn't it how it runs ? : 2: sieve [3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45, 47,49,... ] then 2:3:sieve [5,7,11,13,17,19,23,25,29,31,35,37,41,43,47,49,... ] then 2:3:5:sieve [7,11,13,17,19,23,29,31,37,41,43,47,49,... ] then 2:3:5:7:sieve

Re: [Haskell-cafe] how to make haskell faster than python at finding primes?

2007-08-06 Thread Vimal
primes n = sieve (take n [2..]) sieve (p:xs) = p : sieve [x | x - xs, x `mod` p 0] print (primes 1000) -- Vimal But as we can see, this obviously doesn't *take* 1000 primes, :-) -- Vimal ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] how to make haskell faster than python at finding primes?

2007-08-06 Thread Janis Voigtlaender
Vimal wrote: Why not just: primes = sieve [2..] sieve (p : xs) = p : sieve [x | x - xs, x `mod` p 0] main = print (take 1000 primes) I am unable to see how exactly this will run. Given that primes is an infinite list, and that when it reaches numbers say, as

Re: [Haskell-cafe] how to make haskell faster than python at finding primes?

2007-08-06 Thread Alex Jacobson
Paulo Tanimoto wrote: The challenge was the implement the modcount algorithm not to calculate primes per se. (see e.g. http://jjinux.blogspot.com/2005/11/io-comparison.html). Can you show us the Python code? Note this is python for the naive, accumulate and do modulus version. Not for

[Haskell-cafe] Re: Finding points contained within a convex hull.

2007-06-07 Thread DavidA
It's been a while, but I believe that you can solve integer programming problems of this type using Groebner bases. (Google for integer programming with Groebner bases). I have some Groebner basis code in Haskell at http://www.polyomino.f2s.com/david/haskell/commalg.html

Re: [Haskell-cafe] Finding points contained within a convex hull.

2007-06-07 Thread Jan-Willem Maessen
On Jun 6, 2007, at 11:38 PM, Daniel McAllansmith wrote: [Trying to find the domain of a bounded integer linear program] How would you go about finding extreme vertices? Would it be quicker than solving the constraints for each max/min? If you're just looking to find bounding coordinates

Re: [Haskell-cafe] Finding points contained within a convex hull.

2007-06-06 Thread Ilya Tsindlekht
On Wed, Jun 06, 2007 at 12:23:03PM +1200, Daniel McAllansmith wrote: Hello. I've got a system of linear inequalities representing half-spaces. The half-spaces may or may not form a convex hull. I need to find the integral coordinates that are contained within the convex hull, if there

Re: [Haskell-cafe] Finding points contained within a convex hull.

2007-06-06 Thread Simon Brenner
Do you simply want the set of coordinates, or do you want to do something smart with the them (i.e. optimize a function value etc)? In the first case, with a good starting point and a function that enumerates all coordinates (by going in a spiral, perhaps), I think this can be done in O(nm),

Re: [Haskell-cafe] Finding points contained within a convex hull.

2007-06-06 Thread haskell
Daniel McAllansmith wrote: Hello. I've got a system of linear inequalities representing half-spaces. The half-spaces may or may not form a convex hull. They could only fail to define a convex volume if they are inconsistent and define an empty set. Though they might define a convex volume

  1   2   >