Re: [Haskell-cafe] formal methods functional programming

2006-01-15 Thread Hal Daume III
I confess I haven't really been following this discussion, but a friend of mine has a recent paper that might be of interest (though it deals with ML rather than Haskell)... http://math.andrej.com/2005/04/09/specifications-via-realizability/ -- Hal Daume III

Re: [Haskell-cafe] Problems with square root...

2005-12-21 Thread Hal Daume III
as (round sqrt) 2 and round sqrt doesn't make sense. x(y) doesn't mean necessarily apply y to x as it does in C. parens only are used as they are in math to separate stuff. -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Hal Daume III
, and 1-11 are getting started with Hugs and so on. One of the whole points of YAHT is to introduce it early. -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume

Re: [Haskell-cafe] Proposal for a first tutorial.

2005-12-20 Thread Hal Daume III
better, I got somewhat annoyed. -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] Writing functions in Haskell.

2005-04-29 Thread Hal Daume III
sure the questions will still arise. -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] Writing functions in Haskell.

2005-04-28 Thread Hal Daume III
-- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Processing of large files

2004-11-03 Thread Hal Daume III
/haskell-cafe -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell-cafe] Writing binary files?

2004-09-11 Thread Hal Daume III
and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe -- Hal Daume III | [EMAIL

Re: type of (/) ?

2003-12-09 Thread Hal Daume III
= 5 my_avg list = (accum list) / xx --doesn't work -- same message as above This doesn't work because defaulting occurs and xx is given type Integer. -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume

Re: Resolving Ambiguous Types

2003-11-20 Thread Hal Daume III
___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume

Re: record matching syntax forensics

2003-11-13 Thread Hal Daume III
. John -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: Programming style (or: too clever by half?)

2003-11-12 Thread Hal Daume III
___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume

Re: Trying to understand tuples and lists

2003-11-05 Thread Hal Daume III
PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume ___ Haskell-Cafe mailing list [EMAIL PROTECTED

Re: Another Newbie question :)

2003-11-05 Thread Hal Daume III
Keith is entirely correct. You can see this from the definition of foldr: foldr :: (a - b - b) - b - [a] - b foldr f z [] = z foldr f z (x:xs) = f x (foldr f z xs) where clearly every [] is replaced by z and every : by f. I had heard this before when I was first beginning and didn't

Re: Data types basics

2003-11-04 Thread Hal Daume III
or of the form Baz x for some x which is of type a. This has constructors: Bar :: Foo a Baz :: a - Foo a I hope this sheds some light on the issue... -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume

Re: Help ? :)

2003-11-03 Thread Hal Daume III
Int Int here, the type is called PairOfInts and the constructor is called PairOfInts; the constructor takes two ints as arguments. HTH, - Hal -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume On Mon, 3

Re: Doubt regarding Types

2003-11-03 Thread Hal Daume III
) has type Bool, but it's expecting it to have type IO something. You need to lift the pure Bool value into IO by saying return: getBoardSize = do c - getLine return (validateBoardSize (read c)) -- Hal Daume III | [EMAIL PROTECTED] Arrest this man

Re: Haskell Asignement not working

2003-10-29 Thread Hal Daume III
. |n0 = `sideBySide` sb (bLine (n-1)) The `foo` notation is used to make a function (in your case sideBySide) into an infix function, so you can write x `foo` y. but in your case you're not using it infix, so you don't want the ``s. HTH, - Hal -- Hal Daume III

Re: random numbers

2003-10-24 Thread Hal Daume III
to this function must always return the same result). Secondly, but perhaps more importantly, is there a more 'beginnerish' list that I should be addressing this to? I've been following discussions on this one and they don't seem to be at quite this level. This list is appropriate. -- Hal Daume III

Re: parsing a file line by line

2003-10-16 Thread Hal Daume III
( Contents contains all the text in the file, which is given as input) Thanks Anagha -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume ___ Haskell-Cafe mailing

Re: putStr

2003-10-14 Thread Hal Daume III
In addition to what Keith said, it's also guarenteed that the trace is evaluated as soon as the function is entered. - Hal On Tue, 2003-10-14 at 02:36, Ferenc Wagner wrote: Hal Daume III [EMAIL PROTECTED] writes: f1 :: Int - Int f1 x | trace (The initial value is ++ show x) False

Re: putStr

2003-10-13 Thread Hal Daume III
this? Thank you ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths

Re: Type classes and code generation

2003-06-17 Thread Hal Daume III
(Moved to the Cafe) Yes, exactly. Every class is translated to a data type declaration, and every instance is translated to an element of that data type - a dictionary. (Note that you can't actually write those declarations in Haskell 98 in general, because they can have polymorphic

Re: a readFile problem

2003-06-03 Thread Hal Daume III
It would probably be helpful if you were to post the code you have and explain what part isn't working. There's a function: readFile :: FilePath - IO String (FilePath is just a String) which reads a file. This should be what you need to solve this exercise... - Hal -- Hal Daume III

Re: instance declaration troubles

2003-03-07 Thread Hal Daume III
the bottom of this stack. -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume On Fri, 7 Mar 2003, Nick Name wrote: Yes, I usually RTFM before posting, but you have misunderstood my question (however

Re: speedup help

2003-03-03 Thread Hal Daume III
at arrays if you can bound n. -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume On Mon, 3 Mar 2003, Damien R. Sullivan wrote: So, I'm having to calculate 'n choose k' an awful lot. At the moment I've got

Re: a monadic if or case?

2003-02-20 Thread Hal Daume III
|} All of this works both in the IO monad and the ST monad. Comments/Suggestions/Bug reports to me please. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume mp - fun case mp

Re: Exeption handling in GHC

2003-01-24 Thread Hal Daume III
a) *** Exception: a Prelude IO :m Control.Exception Prelude Control.Exception try (error a) Prelude Control.Exception it Left a HTH - Hal -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Fri, 24

Re: Lazy streams and unsafeInterleaveIO

2002-12-22 Thread Hal Daume III
BTW, I already found a major problem with the code I attached earlier, using unsafeInterleaveIO: Run in GHCi (as I had done), it works fine; but compiled by GHC and run as an executable, it waits for input and *then* displays the prompt after the user hits Enter ... not very helpful. I

Re: Fail: loop ???

2002-12-20 Thread Hal Daume III
the evaluation of this node, it try to evaluate itself, but now sees that it is marked as i'm being evaluated and thus knows that this will be an infinite loop. so, yes, you have an infinite loop somehwere in your code. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED

Re: ffi

2002-12-12 Thread Hal Daume III
-fffi three fs -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Thu, 12 Dec 2002, Martin Huschenbett wrote: $ ghc -ffi -o myprog Main.hs cfile.o When I try this I also get

Re: ffi

2002-12-12 Thread Hal Daume III
Perhaps you need a newer version of GHC...i just noticed you have and 02...I think you need an 04 to get the new FFI... -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Thu, 12 Dec 2002

Re: Editor Tab Expansion

2002-12-05 Thread Hal Daume III
As far as I understand it, I have 2 options: 1. Use braces and semicolons and ignore the layout rules. This is one option. Just to be sure, can I really, really forget about layout if I write fully braced and semicolonoized code? Yes. Besides, is there any reason why the syntax is LET {

Re: someone help me

2002-11-30 Thread Hal Daume III
Looks like homework to me, but for 1 and 2 you might look at read/show, head and (:[]); for 3, try executing the give action multiple times seperately. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra

Re: storing to a file

2002-11-14 Thread Hal Daume III
= writeFile fn . unlines . map (unwords . map show) readInts fn = readFile fn = return . (map (map read . words) . lines) The same applies to tuples, etc. This *vastly* inproves the efficiency and, for long lists, tends to make them more human-readable (IMO). - Hal -- Hal Daume III Computer science

Re: 1 line simple cat in Haskell

2002-11-13 Thread Hal Daume III
I'm not sure why someone hasn't suggested main = interact id which I think would accomplis everything you want, and probably be a heck of a lot faster, as (apparently) putChar and getChar are quire inefficient. -- Hal Daume III Computer science is no more about computers| [EMAIL

Re: producing and consuming lists

2002-11-05 Thread Hal Daume III
the old stuff. An expert might be able to prove me wrong, though, or you could try this and profile it and see if it works or not :) - Hal -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume

Re: can't find sequence?

2002-10-29 Thread Hal Daume III
I believe you need 5.04 or greater to get the hierarchical libraries. You might try just using Monad instead of Control.Monad.Identity with 5.02.2, but I can't guarentee anything. Even better: upgrade GHC :) - Hal -- Hal Daume III Computer science is no more about computers| [EMAIL

Re: SOE exercise

2002-10-22 Thread Hal Daume III
applyEach [(+1), (+3), (+2)] 1 = [2,4,3] :: [Integer] applyEach' :: [a-b] - a - [b] applyEach' funs x = map applyx funs where applyx (fun) = fun x ...or more simply: applyEach' l x = map ($x) l ___ Haskell-Cafe mailing list [EMAIL PROTECTED]

Re: FFI and GHC

2002-10-19 Thread Hal Daume III
Two things. First, you need a module name. So prefix your code with 'module Foo where'. Secondly, the call to ghc needs -fglasgow-exts to pick up the necessary extensions. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes

Re: Pure File Reading (was: Dealing with configuration data)

2002-10-11 Thread Hal Daume III
This message seems to have been lost and I'd like to try to breathe some life into it. First, a question: could such readFilePure functions be implemented on TOP of the current IO module (perhaps in IO.Pure or something). Of course, one could do something like: readFileOnce :: FilePath -

Re: need help optimizing a function

2002-10-08 Thread Hal Daume III
is going to be something like why can't the compiler detect that the array can be updated in place instead of copied and the answer, from what i can tell, is simply that it doesn't try. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about

Re: Data structure definitions

2002-10-08 Thread Hal Daume III
| ... data Value = VNumber Number | V... | ... etc... I'm not sure if this answers your question or not, tho... -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Tue, 8 Oct 2002, Mark T.B

Re: Boxed versus Unboxed

2002-10-02 Thread Hal Daume III
lazy functional languages on stock hardware: the Spineless Tagless G-machine which talks about this issue. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Wed, 2 Oct 2002, Shawn P. Garbett

Re: Dealing with configuration data

2002-09-26 Thread Hal Daume III
Koen, getConfig :: Configuration getConfig = unsafePerformIO $ do ...read configuration from file... return configuration (*) Actually, a Haskell compiler is free to inline these kind of expressions, so really one has to give a NOINLINE pragma to the compiler as well.

Re: new to haskell-not working for some reason

2002-09-25 Thread Hal Daume III
Among other things, please make sure your layout lines up. Also, you cannot have the definition of getText at the same indentation of userText-getText otherwise your compiler will think this is part of the do statement (I believe): main=do userText-getText

Re: Dealing with configuration data

2002-09-25 Thread Hal Daume III
and that it will only be written once. I don't feel bad about doing this because GHC does this itself for its own configuration :). -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Thu, 26

Re: Dealing with configuration data

2002-09-25 Thread Hal Daume III
Sorry, I should also mention implicit parameters, if you're willing to use that extension. I don't like them, though, and my impression from SPJ is that it's very unclear whether they will get into Haskell 2 or not... -- Hal Daume III Computer science is no more about computers| [EMAIL

Re: Dealing with configuration data

2002-09-25 Thread Hal Daume III
could be wrong...please correct me if I am. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Thu, 26 Sep 2002, Nick Name wrote: On Wed, 25 Sep 2002 16:06:29 -0700 (PDT) Hal Daume III

Re: Monad Maybe?

2002-09-23 Thread Hal Daume III
on this? -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Sun, 22 Sep 2002, Andrew J Bromage wrote: G'day all. On Sat, Sep 21, 2002 at 12:56:13PM -0700, Russell O'Connor wrote: case

Re: Monad Maybe?

2002-09-21 Thread Hal Daume III
show g | Just n = number g = Just (show n) | Just n = fraction g = Just (show n) | Just n = nimber g = Just (*++show n) | Nothing = Nothing These should be Just n - number g, not = - Hal ___ Haskell-Cafe

Re: layout problem

2002-09-18 Thread Hal Daume III
|(isMemberOf -f args) (isMemberOf -i args) =printFreq(sortWordCount(parseLcLine textLines)) |(isMemberOf -f args) these two '|'s should be lined up, as in: |(isMemberOf -f args) (isMemberOf -i args)

Re: Question about use of | in a class declaration

2002-08-21 Thread Hal Daume III
the two above instances would be rejected: you could only have one. This means that when you write 'f (5::Int)' it knows which instance to choose, since there can only be one. - Hal -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about

Re: questions

2002-08-20 Thread Hal Daume III
There are three basic problems here. The first is the syntax error you see, the second and third will become available once you fix the syntax error. lexi (a:x) | isLetter a = token: lexi restante where S = takeWhile isLetterorDigit x line 20 -- restante =

Re: Infix expressions

2002-07-29 Thread Hal Daume III
Is there any reason other than potential confusion when one of the two backquotes is accidentally omitted? I thought about this a while ago and I think it probably simply has to do with complexity of expressions. If you allow arbitrary expressions to appear within the ticks, you have a

Re: Doubts...

2002-07-26 Thread Hal Daume III
http://www.isi.edu/~hdaume as a DVI, PS or PDF. - Hal -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Fri, 26 Jul 2002, Pedro L. P. Dias wrote: Dear Professor: My name is Carlos

Re: problems figuring out what the type system is telling me

2002-06-07 Thread Hal Daume III
see http://haskell.org/wiki/wiki?ThatAnnoyingIoType and http://haskell.org/wiki/wiki?UsingIo -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Fri, 7 Jun 2002, Chris Moline wrote: hi

Re: Q: Resolving ambiguous type variable

2002-05-17 Thread Hal Daume III
In short, you cannot. What if your main were: main = getArgs = print . first_h The compiler doesn't know the difference and so it needs a type. Simple fix: main = print (first_h ([] :: [Char])) -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than

Re: Q: Resolving ambiguous type variable

2002-05-17 Thread Hal Daume III
explicitly specify what a is and that explicit type is an instance of show (like Char in my example), then everything is fine. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Fri, 17 May 2002

Re: Q: Resolving ambiguous type variable

2002-05-17 Thread Hal Daume III
don't know how to show it (i.e., we don't know which dictionary to use to lookup the show function for the datatype). -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Fri, 17 May 2002 [EMAIL

RE: defining (- Bool) as a set

2002-04-26 Thread Hal Daume III
checking), but couldn't because of this restriction. Is this still too loose to be made to work? -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Mon, 22 Apr 2002, Simon Peyton-Jones wrote

Re: lazy comparison for equality ?

2002-04-24 Thread Hal Daume III
I don't think you can write such a function. For instance, how would you know whether [1..] is circular or not? In order to know that it's not you'd need to evaluate it fully. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about

Re: Ground Up

2002-02-28 Thread Hal Daume III
On Thu, 28 Feb 2002, Jerzy Karczmarczuk wrote: I didn't follow that discussion, but let's be serious. Really. Your second version constructs and destroys plenty of tuples, of ephemeric data structures which live one step only, and this is obviously costly. No way to know this? Are you sure?

Re: (no subject)

2002-02-24 Thread Hal Daume III
to documentation. Hopefully the combination will help. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On 25 Feb 2002, Tom Bevan wrote: Hi, I've come across this sort of data constructor

Re: syntax...(strings/interpolation/here docs)

2002-02-13 Thread Hal Daume III
hugs and ghc. With hugs, I use the builtin feature, of course. With GHC, we just use a pre-processor. This is a bit awkward with GHC 5.02 and earlier versions, but starting with 5.03, GHC now has a proper interface for hooking in a pre-processor (don't know the details, bug Sigbjorn

Re: Random questions after a long haskell coding day

2002-01-26 Thread Hal Daume III
For your last question (about reduction to hnf), use the attached code; search the haskell mailing list for deepseq for more. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Sun, 27