Henning Thielemann wrote:
David Benbennick wrote:
But how can I implement memoization for a more complicated function?
For example, perhaps I want to memoize
f :: String - Int - Double - String - Bool
There was a long thread about a sophisticated technique called blue
prints, which allows
Luke Palmer wrote:
David Benbennick wrote:
It would be nice if I could just tell the compiler I command you to
memoize this function, and have it produce the required code
automatically.
Tru dat!
But it's not clear what the best way for the compiler writer to do
that is. For example, if I
Henning Thielemann writes:
Caching is not the default, but you can easily code this by yourself:
Define an array and initialize it with all function values. Because of
lazy evaluation the function values are computed only when they are
requested and then they persist in the array.
One should
On Sat, 12 Jan 2008 23:36:43 +0100, Daniel Fischer
[EMAIL PROTECTED] wrote:
Am Samstag, 12. Januar 2008 22:48 schrieb Luke Palmer:
On Jan 12, 2008 9:19 PM, Rafael Almeida [EMAIL PROTECTED] wrote:
After some profiling I found out that about 94% of the execution time is
spent in the
On Sun, 13 Jan 2008 11:48:09 +0100, Nicu Ionita [EMAIL PROTECTED] wrote:
Hi Rafael,
I have just two ideas, that could improve your strategy to reduce the
computation time:
1. perhaps there is also a minimum (not only a maximul) for the values you
should try
Yeah, that's a good one, the
Hi,
If I define the follwoing functions:
car (x:_) = x
car [] = []
cdr (_:xs) = xs
cdr [] = []
and try to apply them to some list, such as
car [1,2,3]
I get this odd error:
interactive:1:9:
No instance for (Num [a])
arising from the literal `3' at interactive:1:9
Possible fix:
Fernando Rodriguez writes:
car (x:_) = x
car [] = []
...
and try to apply them to some list, such as
car [1,2,3]
I get this odd error:
No instance for (Num [a])
arising from the literal `3' ...
The error is really a bit cryptic (who cares, Nums or whatever...)
but the error is
On 13 Jan 2008, [EMAIL PROTECTED] wrote:
If I define the follwoing functions:
car (x:_) = x
car [] = []
This won't typecheck. It helps to add a type signature
car :: [a] - a
The first element of an empty list is undefined, so you can do what
Prelude.head does and write:
car [] =
On Jan 13, 2008 7:55 AM, Fernando Rodriguez [EMAIL PROTECTED] wrote:
If I define the follwoing functions:
car (x:_) = x
car [] = []
What's the type signature for that function?
Cheers!
--Tom Phoenix
___
Haskell-Cafe mailing list
On Jan 13, 2008 2:07 PM, Tom Phoenix [EMAIL PROTECTED] wrote:
On Jan 13, 2008 7:55 AM, Fernando Rodriguez [EMAIL PROTECTED] wrote:
If I define the follwoing functions:
car (x:_) = x
car [] = []
What's the type signature for that function?
car :: [[a]] - [a]
--
Felipe.
Jed Brown writes:
On 13 Jan 2008, [EMAIL PROTECTED] wrote:
If I define the follwoing functions:
car (x:_) = x
car [] = []
This won't typecheck. It helps to add a type signature
car :: [a] - a
Good will, wrong diagnosis. This WILL check.
car :: forall a. [[a]] - [a]
J.
(This e-mail is a literate Haskell file.)
Ryan Ingram enlightened us with MonadPrompt as a very nice abstraction for
turn-based games, allowing easy programming and testing.
http://www.mail-archive.com/haskell-cafe@haskell.org/msg33040.html
http://ryani.freeshell.org/haskell/
I wonder how
On Sun, 2008-01-13 at 14:53 -0200, Felipe Lessa wrote:
Problem solved? Not really:
- This kind of implementation hides lots of subtle bugs. For example,
because of postGUIAsync being used in Print case, the user will see
multiple dialog boxes at once and -- strangely enough -- he'll
Because my university is in the MSNDAA-program I could download the new
Visual Studio 2008 Professional, what I've done today. Now I tried to
install the vshaskell-extension to start learning Haskell but the installer
only quits with the message that (of course) VS2005 is not installed. Now is
my
On Jan 13, 2008 4:01 PM, Duncan Coutts [EMAIL PROTECTED] wrote:
On Sun, 2008-01-13 at 14:53 -0200, Felipe Lessa wrote:
You could use another thread :-)
LOL, at first I thought of mail threads =).
That is have an output thread that reads a queue from your game engine
and only looks for the
Hi,
When I compile this code, ghc complains about some overlapped patterns in
function depth. What on Earth is ghc talking about? O:-)
data BinTree a = EmptyTree
| NodeBT a (BinTree a) (BinTree a)
deriving Show
emptyBT = EmptyTree
depth emptyBT = 0
On Jan 13, 2008, at 13:59 , Fernando Rodriguez wrote:
When I compile this code, ghc complains about some overlapped
patterns in function depth. What on Earth is ghc talking about? O:-)
emptyBT = EmptyTree
depth emptyBT = 0
depth (NodeBT _ left right) = max (1 + depth left) (1 + depth
Hello Fernando,
Hi,
When I compile this code, ghc complains about some overlapped patterns
in function depth. What on Earth is ghc talking about? O:-)
data BinTree a = EmptyTree
| NodeBT a (BinTree a) (BinTree a)
deriving Show
emptyBT = EmptyTree
depth emptyBT = 0
depth (NodeBT _ left right)
On Jan 13, 2008, at 14:05 , Fernando Rodriguez wrote:
depth emptyBT = 0
depth (NodeBT _ left right) = max (1 + depth left) (1 + depth right)
Sorry, the exact error is:
Warning: Pattern match(es) are overlapped
In the definition of `depth': depth (NodeBT _ left right) = ...
Fernando Rodriguez writes:
What on Earth is ghc talking about? O:-) (overlapping paterns)
emptyBT = EmptyTree
depth emptyBT = 0
depth (NodeBT _ left right) = max (1 + depth left) (1 + depth right)
GHC is always right...
Your first clause is GENERIC,
Hello Brandon S. Allbery KF8NH,
depth emptyBT = 0
depth (NodeBT _ left right) = max (1 + depth left) (1 + depth right)
If you use a variable in a pattern match, it creates a new binding
which irrefutably matches the corresponding argument. In other
words, you get a new local variable emptyBT,
Brian Sniffen writes:
[[send to me as a private message, probably by mistake]]
Or, if you really want to use emptyBT for some reason, with
depth x | x == emptyBT = 0
--
Brian T. Sniffen
OK, but then it is necessary to define the Eq instance for the trees
Jerzy Karczmarczuk
On Sun, 2008-01-13 at 16:37 -0200, Felipe Lessa wrote:
On Jan 13, 2008 4:01 PM, Duncan Coutts [EMAIL PROTECTED]
wrote:
On Sun, 2008-01-13 at 14:53 -0200, Felipe Lessa wrote:
Are you linking using -threaded or not? If not then you need another
trick to use cooperative scheduling between
What are the possibilities for website construction using Haskell?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Sun, 2008-01-13 at 20:59 +0100, Hugh Perkins wrote:
What are the possibilities for website construction using Haskell?
http://hackage.haskell.org/packages/archive/pkg-list.html
http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming
I'm sure you can figure it out from
On Jan 13, 2008 8:13 PM, Derek Elkins [EMAIL PROTECTED] wrote:
http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming
Good link. Lots of options apparently :-)
I'm sure you can figure it out from here, or at least come back with a
more specific question.
Which ones
hughperkins:
On Jan 13, 2008 8:13 PM, Derek Elkins [EMAIL PROTECTED] wrote:
http://www.haskell.org/haskellwiki/Applications_and_libraries/Web_programming
Good link. Lots of options apparently :-)
I'm sure you can figure it out from here, or at least come back with a
more specific
Felipe Lessa wrote: (abridged)
Ryan Ingram enlightened us with MonadPrompt as a very nice abstraction for
turn-based games, allowing easy programming and testing.
I wonder how nicely it fits on a Gtk2Hs application. =)
The problem lies in the fact that Gtk is event-driven, so
every time we ask
Hi
Which ones are most widely used? HWS and Wash Server Pages sounds
interesting?
Hoogle (http://haskell.org/hoogle) uses Haskell Source Extensions
(http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/)
My academic website (http://www-users.cs.york.ac.uk/~ndm/) uses some
custom code
ndmitchell:
Hi
Which ones are most widely used? HWS and Wash Server Pages sounds
interesting?
Hoogle (http://haskell.org/hoogle) uses Haskell Source Extensions
(http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/)
I thought haskell-src-exts was an extended Language.Haskell
Hi
Hoogle (http://haskell.org/hoogle) uses Haskell Source Extensions
(http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/)
I thought haskell-src-exts was an extended Language.Haskell parser?
Do you mean HSP -- haskell server pages?
No, I mean haskell-src-exts. It's a translator from
I've been thinking about hashlife recently. I've written part of a fairly
didactic C implementation http://dotat.at/prog/misc/hashlife.c but I
there are more interesting things that can be done with it.
In particular, the core calc2() function is essentially implementing lazy
evaluation, so it
ndmitchell:
Hi
Hoogle (http://haskell.org/hoogle) uses Haskell Source Extensions
(http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/)
I thought haskell-src-exts was an extended Language.Haskell parser?
Do you mean HSP -- haskell server pages?
No, I mean haskell-src-exts. It's
It might be even better to port it to the freely available downloadable
Visual Studio Shell:
http://msdn2.microsoft.com/en-us/vsx2008/products/bb933751.aspx
The F# plugin works for that environment, giving a very good free IDE.
Cheers,
Peter (on Fedora 8 using, woohoo, my first steps on Linux :)
I seem to remember a thread about this a while back actually, but...
Any chance of adding the number of downloads to the hackageDB page?
For those packages that are included in ghc, hugs etc, perhaps add a
green tick with included in ghc, included in hugs, etc?
That way it should be relatively
Don Stewart wrote:
Note that using string overloading we can remove some of the toHtml's...
{-# LANGUAGE OverloadedStrings #-}
instance IsString Html where fromString = toHtml
main = do
time - getClockTime
putStrLn . prettyHtml $
(header (thetitle testing))
Hi,
I've recently started using Yi, the haskell editor. I found it slightly
non-trivial to get started, so I've written up my installation method
and a beginners guide tutorial which I hope will be of interest to
other people who'd like to try Yi. It lives at:
Hi,
It's nice to write functions in point free style:
f = sort . nub
But sometimes I have to add an extra case, on a certain value:
f [] = [1]
f = sort . nub
But now these equations have different arities, and its rejected by
Haskell. Why does this not simply desugar to:
f [] = [1]
f x =
On Sun, 2008-01-13 at 23:18 +0100, Hugh Perkins wrote:
I seem to remember a thread about this a while back actually, but...
Any chance of adding the number of downloads to the hackageDB page?
For those packages that are included in ghc, hugs etc, perhaps add a
green tick with included in
That eta-expansion desugaring would lose sharing. Offhand, I don't know of
a desugaring that would do the trick and preserve sharing. Any ideas? -
Conal
On Jan 13, 2008 3:12 PM, Neil Mitchell [EMAIL PROTECTED] wrote:
Hi,
It's nice to write functions in point free style:
f = sort . nub
G'day all.
Quoting Neil Mitchell [EMAIL PROTECTED]:
It's nice to write functions in point free style:
f = sort . nub
But sometimes I have to add an extra case, on a certain value:
f [] = [1]
f = sort . nub
But now these equations have different arities, and its rejected by
Haskell.
I
G'day all.
Quoting Conal Elliott [EMAIL PROTECTED]:
That eta-expansion desugaring would lose sharing. Offhand, I don't know of
a desugaring that would do the trick and preserve sharing. Any ideas?
How about this?
f = let body = sort . nub
in \xs - case xs of
[] - [1]
On 11 Jan 2008, at 11:25 PM, Achim Schneider wrote:
Jonathan Cast [EMAIL PROTECTED] wrote:
On 11 Jan 2008, at 10:12 AM, Achim Schneider wrote:
David Roundy [EMAIL PROTECTED] wrote:
Prelude let x=1e-300/1e300
Prelude x
0.0
Prelude x/x
NaN
The true answer here is that x/x == 1.0 (not 0 or
Neil Mitchell [EMAIL PROTECTED] wrote:
i.e. lift the arities to the longest argument list.
Is there a reason this isn't done?
Most likely not, there are being made up right now.
Because
f = sort.nub
is different from
f x = (\x - sort.nub x)
or
f = sort.nub.id
or
f =
Achim Schneider [EMAIL PROTECTED] wrote:
Most likely not, there are being made up right now.
s/there/they/
f x = (\x - sort.nub x)
s/x//
--
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
On 12 Jan 2008, at 3:23 AM, Kalman Noel wrote:
Achim Schneider wrote:
Actually, lim( 0 ) * lim( inf ) isn't anything but equals one, and
the anything is defined to one (or, rather, is _one_ anything) to be
able to use the abstraction. It's a bit like the difference between
eight pens and a box
On 12 Jan 2008, at 3:33 AM, Cristian Baboi wrote:
On Sat, 12 Jan 2008 13:23:41 +0200, Kalman Noel
[EMAIL PROTECTED] wrote:
Achim Schneider wrote:
Actually, lim( 0 ) * lim( inf ) isn't anything but equals one, and
the anything is defined to one (or, rather, is _one_ anything) to be
able to
On 12 Jan 2008, at 4:06 AM, Achim Schneider wrote:
Kalman Noel [EMAIL PROTECTED] wrote:
Achim Schneider wrote:
Actually, lim( 0 ) * lim( inf ) isn't anything but equals one, and
the anything is defined to one (or, rather, is _one_ anything) to be
able to use the abstraction. It's a bit like
On 13 Jan 2008, at 4:15 PM, Achim Schneider wrote:
Neil Mitchell [EMAIL PROTECTED] wrote:
i.e. lift the arities to the longest argument list.
Is there a reason this isn't done?
Most likely not, there are being made up right now.
I'm glad you are capable of ever so nobly assigning the
I feel this is the right place to think about this?
(I'll crosspost a small announcement on ghc as well pointing to this thread)
Copied from http://hackage.haskell.org/trac/hackage/ticket/207#preview:
== Introduction ==
I personally depend on tags because the source code only tells what is
On 13 Jan 2008, at 4:56 PM, [EMAIL PROTECTED] wrote:
Jonathan Cast writes:
On 13 Jan 2008, at 4:15 PM, Achim Schneider wrote:
... never mind...
I'm glad you are capable of ever so nobly assigning the purest
imaginable motives to the designers of Haskell. You are an
inspiration to us
Jonathan Cast [EMAIL PROTECTED] wrote:
You don't get 1, you start off with it.
If you start off with anything, you can often end up with it as
well. Enlightenment comes when you realize that sometimes you
don't, and you acquire the ability to change your mind.
n = 12
n = 1 * n
Jonathan Cast [EMAIL PROTECTED] wrote:
On 13 Jan 2008, at 4:15 PM, Achim Schneider wrote:
Neil Mitchell [EMAIL PROTECTED] wrote:
i.e. lift the arities to the longest argument list.
Is there a reason this isn't done?
Most likely not, there are being made up right now.
I'm glad
Hi Conal,
On 1/13/08, Conal Elliott [EMAIL PROTECTED] wrote:
That eta-expansion desugaring would lose sharing.
Ah, that will be it.
1. Equations with different arities more often signal bugs than
correct intentions.
I don't believe that. I suspect the type system will mop these up.
2.
Neil Mitchell [EMAIL PROTECTED] wrote:
Hi,
It's nice to write functions in point free style:
f = sort . nub
But sometimes I have to add an extra case, on a certain value:
f [] = [1]
f = sort . nub
But now these equations have different arities, and its rejected by
Haskell. Why
On 13 Jan 2008, at 5:27 PM, Achim Schneider wrote:
Neil Mitchell [EMAIL PROTECTED] wrote:
Hi,
It's nice to write functions in point free style:
f = sort . nub
But sometimes I have to add an extra case, on a certain value:
f [] = [1]
f = sort . nub
But now these equations have different
Neil Mitchell writes:
I quite like the idea of permitting equations to have different
arities. It removes restrictions, makes things more regular etc.
More regular???
My goodness... Of course, it removes restrictions. But in the history of
humanity rarely the removal of restrictions made
On 13 Jan 2008, at 5:38 PM, [EMAIL PROTECTED] wrote:
Neil Mitchell writes:
I quite like the idea of permitting equations to have different
arities. It removes restrictions, makes things more regular etc.
More regular???
My goodness... Of course, it removes restrictions. But in the
history
Jonathan Cast [EMAIL PROTECTED] wrote:
On 13 Jan 2008, at 5:27 PM, Achim Schneider wrote:
Neil Mitchell [EMAIL PROTECTED] wrote:
Hi,
It's nice to write functions in point free style:
f = sort . nub
But sometimes I have to add an extra case, on a certain value:
f [] = [1]
On 13 Jan 2008, at 5:49 PM, Achim Schneider wrote:
Jonathan Cast [EMAIL PROTECTED] wrote:
On 13 Jan 2008, at 5:27 PM, Achim Schneider wrote:
Answer #2:
Because you can't write
f x = case x of
[] - [1]
- sort.nub
But why not?
Because arities aren't lifted to the longest
Neil Mitchell wrote:
Hi,
It's nice to write functions in point free style:
f = sort . nub
But sometimes I have to add an extra case, on a certain value:
f [] = [1]
f = sort . nub
But now these equations have different arities, and its rejected by
Haskell. Why does this not simply desugar
Hi,
In perl scripts (unix), one can do
==
#!/usr/local/bin/perl
BEGIN {
$ENV{LD_LIBRARY_PATH} = ...;
}
do my perl stuff
==
The setting of ENV variable before the program runs allows me to fix
the shell environments. In this case, I need to specify where to look
for the shared library.
How do
I haven't solved this problem yet, but I think it has more to do with
multiplicative partition than with perfect-square.
- Quan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hi,
On 1/14/08, Steve Lihn [EMAIL PROTECTED] wrote:
In perl scripts (unix), one can do
#!/usr/local/bin/perl
BEGIN { $ENV{LD_LIBRARY_PATH} = ...; }
I've not tested this (what a great line to start a post...), but see
if this works for you:
#! /usr/bin/env LD_LIBRARY_PATH=/path/to/libs
On Jan 13, 2008, at 23:16 , Liyang HU wrote:
On 1/14/08, Steve Lihn [EMAIL PROTECTED] wrote:
In perl scripts (unix), one can do
#!/usr/local/bin/perl
BEGIN { $ENV{LD_LIBRARY_PATH} = ...; }
I've not tested this (what a great line to start a post...), but see
if this works for you:
#!
On 13/01/2008, Steve Lihn [EMAIL PROTECTED] wrote:
Hi,
In perl scripts (unix), one can do
==
#!/usr/local/bin/perl
BEGIN {
$ENV{LD_LIBRARY_PATH} = ...;
}
do my perl stuff
==
The setting of ENV variable before the program runs allows me to fix
the shell environments. In this case, I
On 12/01/2008, Hugh Perkins [EMAIL PROTECTED] wrote:
On Jan 12, 2008 10:19 PM, Rafael Almeida [EMAIL PROTECTED] wrote:
After some profiling I found out that about 94% of the execution time is
spent in the ``isPerfectSquare'' function.
I guess that Haskell's referential transparence means
G'day all.
Quoting Neil Mitchell [EMAIL PROTECTED]:
I don't believe that. I suspect the type system will mop these up.
As previously noted, anything involving undefined (thanks to seq) is
not equivalent.
While undefined is arguably uncommon, error most certainly isn't:
f1 (x:xs) = {-
Hi
Can the list recommend books that use Haskell - or any FP language
but preferably Haskell - to illustrate the principles of compilers
and/or algorithms?
I think most of you would understand if I said that I'd prefer FP
code instead of funny math symbols that don't translate into ANSI
HStringTemplate is a port of Terrence Parr’s lovely StringTemplate
(http://www.stringtemplate.org) engine to Haskell.
It is available, cabalized, at:
darcs get http://code.haskell.org/HStringTemplate/
As interest has grown in using Haskell for web applications, there
has been an increasing
Hi Paul,
One textbook on algorithms with a functional approach is by Fethi Rabhi
and Guy Lapalme: Algorithms: A functional programming approach
published by Addison-Wesley, 235 pages, ISBN 0-201-59604-0
I'd imagine they wouldn't use many OCR unfriendly characters.
Purely Functional Data
71 matches
Mail list logo