Re: [Haskell-cafe] Implementation of the Floyd-Warshall algorithm

2006-07-28 Thread Chris Kuklewicz
Every readArray and writeArray checks that the index tuple is in range. You could try an use Data.Array.Base (in GHC) and unsafeWrite and unsafeRead. They do not do bounds checking like readArray and writeArray. Oleg has a good interface to unchecked array usage here: http://okmij.org/ftp/Hask

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-28 Thread Udo Stenzel
Andrew Pimlott wrote: > On Wed, Jul 26, 2006 at 05:06:41PM -0400, David Roundy wrote: > > This doesn't apply uniformly to all programs--except that we can say > > that any path with a trailing '/' is intended to be a directory, and > > if it's not, then that's an error. > > I thought some more abo

Re: [Haskell-cafe] if-then-else as rebindable syntax

2006-07-28 Thread Immanuel Litzroth
"Doaitse Swierstra" <[EMAIL PROTECTED]> writes: >We alreday are at a stage where first year students trying to master >haskell get error messages like >"Bool is not an instance of the class Num" >if they accidently write 1 + True (or something equivalent, but less >obvious). Good! It will prepare

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-28 Thread Malcolm Wallace
"David House" <[EMAIL PROTECTED]> wrote: > > Or perhaps (?:) or something like that, > > This has come up a few times on #haskell, and the consensus is that a > tertiary (?:) operator isn't possible because of the deep specialness > of (:). However, you can simulate it pretty well: > > infixr 1

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-28 Thread Duncan Coutts
On Thu, 2006-07-27 at 11:07 -0700, Andrew Pimlott wrote: > On Wed, Jul 26, 2006 at 04:02:31PM -0700, Andrew Pimlott wrote: > > I admit I don't know enough to say how the lpt1 issue should be > > handled. Is there any Win32 call I can make that will help me avoid > > accidentally opening these magi

Re: [Haskell-cafe] Implementation of the Floyd-Warshall algorithm

2006-07-28 Thread Sebastian Sylvan
On 7/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi, I'm new to Haskell (yet I am very familiar with Lisp and OCaml), and I am trying to implement the Floyd-Warshall algorithm (finding the minimal distance between two nodes in a weighted graph). For an input graph with 101 nodes, the

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-28 Thread Niklas Broberg
(Appologies to Malcolm for multiple copies. Say after me, Reply All!) On 7/28/06, Malcolm Wallace <[EMAIL PROTECTED]> wrote: "David House" <[EMAIL PROTECTED]> wrote: > > Or perhaps (?:) or something like that, > > This has come up a few times on #haskell, and the consensus is that a > tertiary

Re: [Haskell-cafe] Implementation of the Floyd-Warshall algorithm

2006-07-28 Thread Sebastian Sylvan
On 7/28/06, Sebastian Sylvan <[EMAIL PROTECTED]> wrote: On 7/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > >I'm new to Haskell (yet I am very familiar with Lisp and OCaml), and > I am trying to implement the Floyd-Warshall algorithm (finding the > minimal distance between two no

Re[2]: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-28 Thread Bulat Ziganshin
Hello Andrew, Thursday, July 27, 2006, 10:07:11 PM, you wrote: >> I admit I don't know enough to say how the lpt1 issue should be >> handled. Is there any Win32 call I can make that will help me avoid >> accidentally opening these magic files? Say, if I call open with >> O_CREAT | O_EXCL? Unfo

Re[2]: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-28 Thread Bulat Ziganshin
Hello Udo, Thursday, July 27, 2006, 8:53:10 PM, you wrote: > Ah, never mind, I get the strong feeling I really don't want to know all > this. When even Windows 98 has been end-of-lifed we should rely on the > Unicode API, if anything. i don't think we can do this in _compiler's system libraries

Re: [Haskell-cafe] Implementation of the Floyd-Warshall algorithm

2006-07-28 Thread Bulat Ziganshin
Hello frederic, Friday, July 28, 2006, 10:44:51 AM, you wrote: > much slower than the C version. I would be very grateful if someone > cared to explain why this is unefficient and how to make it faster update :: STUArray s (Int, Int) Double -> Int -> Int -> Int -> ST s () update arr i j k = do

Re: [Haskell-cafe] Implementation of the Floyd-Warshall algorithm

2006-07-28 Thread Janis Voigtlaender
Sebastian Sylvan wrote: Dynamic programming is actually quite neat in Haskell. You can express it quite directly using arrays. arr = array (1,n) [ (k, foo k) | k <- [1..n]] foo k = ... now, foo would reference arr in some way, it it should probably contain some base case for k=1. So you basical

Re: [Haskell-cafe] StablePtr's and castStablePtrToPtr

2006-07-28 Thread Duncan Coutts
On Tue, 2006-07-25 at 22:16 -0400, DeeJay-G615 wrote: > I have a query which is asked out of interest's sake... > > I'm essentially looking for an affirmation of what I think I already > understand (or some info if I'm deluded ;)). > > To put this in context... > > > I have some C code... > >

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-28 Thread Andrew Pimlott
On Thu, Jul 27, 2006 at 09:59:37PM +0200, Udo Stenzel wrote: > Andrew Pimlott wrote: > > After all, the trailing slash has no real > > meaning for any intermediate processing you might do. > > Here I beg to differ. I'd expect: > > *> setFileName "foo" "bar" == "bar" > *> setFileName "foo/" "bar"