OK, so there are few extra costs for unknown tail calls.
First, there might be a pipeline stall if the jump address isn't
loaded into a register far enough in advance before the jump.
Second, you need to pass information about the number of arguments in
the caller.
And finally, you need to
On 30/03/2007, at 4:36 pm, Chris Witte wrote:
cp -rp ./../include/* /usr/local/include/mingw
cp: cannot stat `./../include/*': No such file or directory
The source paths for these copies are derived from the path of the
gcc binary ($GccDir). Did you call configure with '--with-gcc=C:/
Lennart Augustsson wrote:
So then tail calls should be very cheap when most of the arguments don't
change.
Yes, but the problem tends to be the arguments that change, and the fact that
they are passed on the stack. A C loop would keep the loop-carried variables in
registers. On x86_64 you
Thanks for all the wonderful solutions. I put them into one module so
other people can try it out: http://hpaste.org/1338
Thanks,
Bas van Dijk
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
David Waern wrote:
I'd like to set up a Trac for Haddock on hackage.haskell.org. Who should I
contact?
Let's hold off on this for now. I don't think Haddock warrants a full Trac of
its own just yet, the overheads of managing a Trac are pretty high compared to
editing the text file called
On 4/11/07, Andrew Appleyard [EMAIL PROTECTED] wrote:
The source paths for these copies are derived from the path of the
gcc binary ($GccDir). Did you call configure with '--with-gcc=C:/
Mingw/bin/gcc.exe'? I received those errors when I forgot to do that.
Yep that fixed that. Thanks.
I
I have a simply recursive solution that operates efficiently...
Bas van Dijk wrote:
Hello,
For my own exercise I'm writing a function 'weave' that weaves a
list of lists together. For example:
weave [[1,1,1], [2,2,2], [3,3]] == [1,2,3,1,2,3,1,2]
weave [[1,1,1], [2,2], [3,3,3]] ==
Chris Kuklewicz wrote:
Nicolas Frisby wrote:
Not portably.
[EMAIL PROTECTED]:~$ ghc-6.4.2 -e '( (foo++) `Data.Monoid.mappend`
(bar++) ) END'
foobarEND
[EMAIL PROTECTED]:~$ ghc-6.6 -e '( (foo++) `Data.Monoid.mappend`
(bar++) ) END'
fooENDbarEND
-- 6.6 sources
instance
Dmitry Antonyuk (lomeo) came up with a piece of code that hung GHC 6.6:
newtype Foo a = Foo (Foo a - a)
bar x@(Foo f) = f x
baz = bar (Foo bar)
See the original discussion (in Russian) at:
http://lomeo.livejournal.com/35674.html
___
Haskell-Cafe
Hi
Dmitry Antonyuk (lomeo) came up with a piece of code that hung GHC 6.6:
It's a documented bug in GHC:
http://www.haskell.org/ghc/docs/latest/html/users_guide/bugs.html#bugs-ghc
GHC's inliner can be persuaded into non-termination using the
standard way to encode recursion via a data type
David Waern wrote:
I'd like to set up a Trac for Haddock on hackage.haskell.org. Who should
I
contact?
Let's hold off on this for now. I don't think Haddock warrants a full
Trac of
its own just yet, the overheads of managing a Trac are pretty high
compared to
editing the text file
Let's hold off on this for now. I don't think Haddock warrants a full
Trac of
its own just yet, the overheads of managing a Trac are pretty high
compared to
editing the text file called TODO in the root of the Haddock source tree
:-)
What do you think of the Google bug tracker? Neil and I
Perl is a large, ugly, messy language filled with quirks and eccentricities,
while Haskell is an extremely elegant language whose design is guided by a
few overriding ideas. (Or so I'm told.)
Based on this one would think that it would be much easier to learn Haskell
than to learn Perl, but my
kynnjo:
Perhaps Haskell will never lend itself to something like a Perl one-liner,
but still I wish that there were books on Haskell that focused on making
Haskell useful to the learner as quickly as possible... If such already
exist and I've missed it, please let me know.
There's some
My opinion is that learnin haskell is difficult is just for the fact that
when you learn programming, you probably begin with C / C++ or some other
procedural/OO programming language, so you get used to think in these ways,
and when you have to switch to functional paradigm, you find it
Neil Mitchell wrote:
It's a documented bug in GHC:
http://www.haskell.org/ghc/docs/latest/html/users_guide/bugs.html#bugs-ghc
GHC's inliner can be persuaded into non-termination using the
standard way to encode recursion via a data type
Thanks Neil!
Sorry for the noise, I should have
Sorry to hear of your struggles. There has been a lot of work lately on
writing Haskell tutorials but there's still a long way to go,
unfortunately, as I discovered when I tried recently to find the
collection of sample code fragments on the wiki that I'm sure are around
somewhere.
I had the
I am also coming at haskell from a perl background.
While there is some truth to what you say, I do think haskell can be
used for keeping simple things simple in a way similar to perl.
Though you have to search harder since the documentation / tutorials
seem to be more optimized for making hard
-Original Message-
From: Mark T.B. Carroll [EMAIL PROTECTED]
Sent: Apr 11, 2007 10:18 AM
To: kynn [EMAIL PROTECTED]
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Why Perl is more learnable than Haskell
Sorry to hear of your struggles. There has been a lot of work lately on
On Wed, Apr 11, 2007 at 05:55:08AM -0700, kynn wrote:
Perl is a large, ugly, messy language filled with quirks and eccentricities,
while Haskell is an extremely elegant language whose design is guided by a
few overriding ideas. (Or so I'm told.)
i find that don's haskell hacking blog has
The post on dons' blog about the cpu scaler is a great example on how
haskell can easily used in the day-to-day hacking!
2007/4/11, brad clawsie [EMAIL PROTECTED]:
i find that don's haskell hacking blog has been written with the daily
hacker in mind:
Hallo,
On 4/11/07, riccardo cagnasso [EMAIL PROTECTED] wrote:
The post on dons' blog about the cpu scaler is a great example on how
haskell can easily used in the day-to-day hacking!
Just read it, it's a very nice post. I'm not afraid of math, but
it's a relief to see some code I can
Suppose I have expr = expr : expr : expr.
Can the above be left-factored to fail on empty input so that my
parser doesn't go into a loop?
Thanks, Joel
--
http://wagerlabs.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Wed, Apr 11, 2007 at 05:55:08AM -0700, kynn wrote:
Perl is a large, ugly, messy language filled with quirks and eccentricities,
while Haskell is an extremely elegant language whose design is guided by a
few overriding ideas. (Or so I'm told.)
Based on this one would think that it would
If you first language is LISP probably you find easy Haskell and difficult
pearl.
Hi,
my first programming language is lisp (that is, the language I am most
fluent in -- recently Common Lisp, earlier Scheme) and I find Haskell a
problematic programming language (this is a fresh experience
kynn wrote:
Perl is a large, ugly, messy language filled with quirks and
eccentricities, while Haskell is an extremely elegant language whose
design is guided by a few overriding ideas. (Or so I'm told.)
[snip]
May I ask why you want to learn it so much, if you find it so hard? I'm
I presume your grammar has other clauses for expr, otherwise the loop
is inevitable.
Assuming you have other clauses you can always left-factor.
Here's how those of us with weak memory can remember how to do it:
Say that you have
expr ::= expr : expr : expr
| b
Let's call the part
Is there a way to have any Parsec combinator skip a certain set of
keywords?
I tried lexeme = P.lexeme lexer . (skip ) but I don't think lexeme
is called for every keyword.
Thanks, Joel
--
http://wagerlabs.com/
___
Haskell-Cafe
Just in case I wasn't clear enough, I'm asking about skipping
keywords represented by the skip combinator that can be located
anywhere within the input.
I do know about skipMany and skipMany1, in fact skip is defined in
terms of these.
On Apr 11, 2007, at 9:04 PM, Joel Reymont wrote:
Is
On Wed, Apr 11, 2007 at 02:21:41PM +0100, Will Newton wrote:
On 4/11/07, kynn [EMAIL PROTECTED] wrote:
Perl is a large, ugly, messy language filled with quirks and
eccentricities,
while Haskell is an extremely elegant language whose design is guided by a
few overriding ideas. (Or so I'm
I've been dying to do this all day but work and then family intervened.
Dominic.
import Data.List
weave =
unfoldr f
where
f ([],_,_) = Nothing
f (x:xs,[],zs) = Just (x,([],[],[]))
f (x:xs,ys,zs) = Just (x,(ys,zs,xs))
You are correct, my weave did hide the list in the explicit composition of
closure(s).
I can be even more declarative and let the closure construction be implicit in
weave' below...
(and this message should be literate Haskell)
weave' uses a fixed point and pairs to tie the knot declaratively:
Hi,
I'm guessing you're not doing it the right way.
cvs -d :pserver:[EMAIL PROTECTED]:/srv/CVSROOT co SYRENE/src
By using types, you implementation becomes a lot more readable.
Being readable is not enough for being readable aloud.
And I think a lot of people here will disagree with
On Wed, Apr 11, 2007 at 05:55:08AM -0700, kynn wrote:
Perl is a large, ugly, messy language filled with quirks and eccentricities,
while Haskell is an extremely elegant language whose design is guided by a
few overriding ideas. (Or so I'm told.)
Based on this one would think that it would
I thought I could resist this thread but I'll bite =:-()
The first language i learned was basic. No real functions, simple step by
step instructions. I then learned hypercard, c, c++, python, assembly, vhdl,
and too many others!
Now i've decided to learn haskell. I view it as a mathematicians
Although there is still about one hour before Google officially publish
the final tally of accepted Summer of Code projects, I think I now can
safely reveal the 9 projects chosen for haskell.org, since we have no
outstanding conflicts with other mentoring orgs.
We received 64 proposals in total.
Ryan Dickie wrote:
I also hate matlab to death. Is there any possibility of using haskell as a
replacement using ghci?
Yes. The strongly typed linear algebra project (Vectro) does exactly
that. With an added guarantee that attempting to add or multiply
matrices of inappropriate sizes is a type
Ah... there really needs to be more literature written on switching to the
functional paradigm, IMHO.
That is really these guys haven't had an easy time with it.
On 4/11/07, Ryan Dickie [EMAIL PROTECTED] wrote:
I thought I could resist this thread but I'll bite =:-()
The first language i
On 4/11/07, riccardo cagnasso [EMAIL PROTECTED] wrote:
If you first language is LISP probably you find easy Haskell and difficult
pearl.
I must say I agree here. I spent 10 years programming in prolog before
I tried haskell. Most of my problems with haskell are because it has a
rather opaque
riccardo cagnasso wrote:
My opinion is that learnin haskell is difficult is just for the fact
that
when you learn programming, you probably begin with C / C++ or some other
procedural/OO programming language...
Actually, my first language was Scheme; I loved it, and I aced the class,
---
Haskell Weekly News
http://sequence.complete.org/hwn/20070412
Issue 60 - April 12, 2007
---
Welcome to issue 60 of HWN, a weekly newsletter
What's the best way to implement the following function in haskell:
Given a list and an integer k as input return the indices of the least k
elements in the list. The code should be elegant and also, more importantly,
must not make more than the minimum O(k*length(list)) number of operations.
R
mrvr84:
What's the best way to implement the following function in
haskell: Given a list and an integer k as input return the
indices of the least k elements in the list. The code should
be elegant and also, more importantly, must not make more
than the minimum
On Apr 11, 2007, at 23:10 , kynn wrote:
rather pragmatic. I have not been able to find enough support in
Haskell
for everyday tasks (e.g. read a stream from a socket; parse it into
a simple
The stuff in Network (not Network.Socket) gives you a Handle, which
you can treat more or less
On Thu, Apr 12, 2007 at 08:58:33AM +0530, raghu vardhan wrote:
What's the best way to implement the following function in haskell:
Given a list and an integer k as input return the indices of the least
k elements in the list. The code should be elegant and also, more
importantly, must not make
On Wed, Apr 11, 2007 at 08:38:48PM -0700, Stefan O'Rear wrote:
On Thu, Apr 12, 2007 at 08:58:33AM +0530, raghu vardhan wrote:
What's the best way to implement the following function in haskell:
Given a list and an integer k as input return the indices of the least
k elements in the list.
On Wed, Apr 11, 2007 at 09:20:12PM -0700, Tim Chevalier wrote:
On 4/11/07, Stefan O'Rear [EMAIL PROTECTED] wrote:
If you want to be really explicit about it, here is a sort that will
work:
sort [] = []
sort l@(x:_) = filter (x) l ++ filter (==x) l ++ filter (x) l
(A stable quicksort,
And just to remind people, the question is to find the indices and not
the numbers themselves. For example on input '3, [10,9,8,..., 3,2,1]'
the output must be '[9,8,7]'.
- Original Message
From: Stefan O'Rear [EMAIL PROTECTED]
To: raghu vardhan [EMAIL PROTECTED]
Sent: Wednesday, 11
Hi,
I am having trouble building c2hs on Mac OS X. I noticed that
Darwinports has a port for this, but I'd like to install it without
using Darwinports because I already have ghc compiled and installed
on my system.
Does anyone know how to get c2hs to work on the mac (or why it
doesn't
G'day all.
Quoting raghu vardhan [EMAIL PROTECTED]:
What's the best way to implement the following function in haskell:
Given a list and an integer k as input return the indices of the least k
elements in the list. The code should be elegant and also, more importantly,
must not make more
On Thu, 2007-04-12 at 15:20 +1000, Ruben Zilibowitz wrote:
Hi,
I am having trouble building c2hs on Mac OS X. I noticed that
Darwinports has a port for this, but I'd like to install it without
using Darwinports because I already have ghc compiled and installed
on my system.
Does
There seems to be some confusion about the question. There are two key things
to keep in mind here:
1) You must make at most O(k*n) comparisons (in the worst case) if the list has
length n.
2) The output must be the indices and not the numbers themselves.
So, any algorithm that sorts is no
52 matches
Mail list logo