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
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
, 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
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
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
--
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
/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
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
= 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
___
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
.
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
___
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
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
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
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
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
) 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
.
|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
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
( 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
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
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
(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
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
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
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
|}
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
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
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
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
-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
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
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 {
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
= 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
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
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
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
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]
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
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 -
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
| ...
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
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
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.
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
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
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
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
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
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
|(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)
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
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 =
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
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
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
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
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
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
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
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
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?
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
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
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
66 matches
Mail list logo