On Wed, 12 Dec 2007, Mattias Bengtsson wrote:
I found myself writing this for an Euler-problem:
digits :: Int - [Int]
digits i | i 10= [i]
| otherwise = i `mod` 10 : digits ( i `div` 10 )
And i realised it was quite some time ago (before this function) i had
actually
Hello Steve,
Wednesday, December 12, 2007, 6:47:36 AM, you wrote:
* clear distinction between functional and imperative (is this
really an advantage? almost everything I deal with is IO, network,
and db related, what is left for purely functional?)
if your program has simple computations
gwern0 [EMAIL PROTECTED] writes:
If the reader is still interested and still takes Haskell
seriously after puzzling over the foregoing, this would either
be pointless or off-putting. Well, *of course* there are
compilers for most computers. You aren't a serious
On Wed, 12 Dec 2007, Emre Sahin wrote:
How do you think the description could be improved?
Why don't you let Haskell speak for itself?
Instead of putting such buzzwords nobody really understands (and
cares), put random problem descriptions and one-line solutions in
Haskell. Well
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Derek Elkins
(Not directed at gwern in particular)
I have a better idea. Let's decide to do nothing. The
benefits of this
approach are: 1) it takes zero effort to implement, 2) the number of
people who immediately give up
Bayley, Alistair wrote:
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Derek Elkins
(Not directed at gwern in particular)
I have a better idea. Let's decide to do nothing. The
benefits of this
approach are: 1) it takes zero effort to implement, 2) the number of
Mattias Bengtsson wrote:
I found myself writing this for an Euler-problem:
digits :: Int - [Int]
digits i | i 10= [i]
| otherwise = i `mod` 10 : digits ( i `div` 10 )
And i realised it was quite some time ago (before this function) i had
actually written any explicitly
hello john stefan,
Stefan Kersten [EMAIL PROTECTED] writes:
incidentally, i've been working on libsndfile bindings the last few
days; here's the darcs repository:
http://darcs.k-hornz.de/cgi-bin/darcsweb.cgi?r=hsndfile;a=summary
excellent news! i have, _much_ more incidentally,
a simple
gwern wrote:
Now, the Main Page on haskell.org is not protected, so I could just edit
in one of the better descriptions proposed, but as in my Wikipedia editing,
I like to have consensus especially for such visible changes.
Hey, why has the front-page already been changed then? I don't like
On Wed, 12 Dec 2007, Reinier Lamers wrote:
Back in my Introduction to Functional Programming course, Daan Leijen
demonstrated how to print integers in Haskell using function
composition. Something along the lines of:
printint :: Int - [Char]
printint = map chr . map (+0x30) . reverse . map
Emre Sahin wrote:
Why don't you let Haskell speak for itself?
Instead of putting such buzzwords nobody really understands (and
cares), put random problem descriptions and one-line solutions in
Haskell. Well known problems like Fibonacci, Quicksort, etc. may be
good candidates, even add 1 to all
On Wed, 12 Dec 2007, apfelmus wrote:
gwern wrote:
Now, the Main Page on haskell.org is not protected, so I could just edit
in one of the better descriptions proposed, but as in my Wikipedia editing,
I like to have consensus especially for such visible changes.
Hey, why has the
Andrew Coppin wrote:
Yeah, we should probably set up a seperate list for this stuff...
Perhaps you can use
http://haskell.org/haskellwiki/?title=Talk:FrontpageDraftaction=edit ?
That page is also a better place to fight your edit wars than the front
page is.
Reinier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Yesterday I uploaded a small update to the dataenc library:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dataenc-0.10.1
Dependenciesbase
License LGPL
Copyright Magnus Therning, 2007
Author Magnus Therning
Maintainer
Yesterday I uploaded a small update to the dataenc library:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dataenc-0.10.1
Dependenciesbase
License LGPL
Copyright Magnus Therning, 2007
Author Magnus Therning
Maintainer [EMAIL PROTECTED]
Exposed modules
Simon Peyton-Jones wrote:
Given instance C T where ..., for any method 'm' not
defined by ...:
for every class D of which C is a superclass
where there is an instance for (D T)
see if the instance gives a binding for 'm'
If this search finds exactly one
On Wed, 2007-12-12 at 16:27 +0100, Hans van Thiel wrote:
[snip]
I fear those people can do vast amounts of damage. :(
When inept programming yields the wrong result, it is clear (even to the
inept) that the program is bad.
When the result is correct but there are egregious time
Reinier Lamers schreef:
printint :: Int - [Char]
printint = map chr . map (+0x30) . reverse . map (`mod` 10) .
takeWhile (0) . iterate (`div`10)
Most of the time I use this:
digits :: Integer - [Int]
digits = map (flip(-)48.ord) . show
Regards
=@@i
On Dec 12, 2007 10:36 AM, Arie Groeneveld [EMAIL PROTECTED] wrote:
Reinier Lamers schreef:
printint :: Int - [Char]
printint = map chr . map (+0x30) . reverse . map (`mod` 10) .
takeWhile (0) . iterate (`div`10)
Most of the time I use this:
digits :: Integer - [Int]
digits = map
Ken,
Thanks for the references! Have two-level types been applied to parser
generation?
Best wishes,
--greg
Greg Meredith [EMAIL PROTECTED] wrote in article
[EMAIL PROTECTED]
in gmane.comp.lang.haskell.cafe:
Here is an idea so obvious that someone else must have already thought
of it
On Wed, 2007-12-12 at 11:19 +, Andrew Coppin wrote:
. . .
...and normal programmers care about the Fibonacci numbers because...?
Seriously, there are many, many programmers who don't even know what
Fibonacci numbers *are*. And even I can't think of a useful purpose for
them. (Unless
Simon Peyton-Jones wrote:
Concerning (b) here's a suggestion. As now, require that every instance
requires an instance declaration. So, in the main example of
http://haskell.org/haskellwiki/Class_system_extension_proposal, for a new data
type T you'd write
instance Monad T where
I'm working on a project which would generate a PHP data-access layer
from a Haskell model. I'm wondering what libraries might be already be
available for generating PHP or other types of code. The
pretty-printing library is one option. Any other suggestions?
Thanks in advance.
Justin
Hi
main = do (print . showln . length) = getContents
where showln a = show a ++ \n
This can be written better. print puts a newline at the end and does a
show, so lets remove that bit:
main = do (print . length) = getContents
Now we aren't using do notation, despite having a do block, and
On Dec 12, 2007 2:31 PM, Thomas Hartman [EMAIL PROTECTED] wrote:
exercise 2) find the first integer such that average of [1..n] is [10^6]
(solution involves building an accum list of (average,listLength) tuples.
again you can't do a naive fold due to stack overflow, but in this case even
Is there any really cross-platform GUI library for Haskell?
Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's
not native on my Mac; some Mac users don't install it and almost
all Mac users don't always run it.
I was able to install wxHaskell (after some hacking - this
Here's a version with cleaner separation between pure IO:
main = interact $ show . length . words
- Conal
On Dec 12, 2007 11:12 AM, Neil Mitchell [EMAIL PROTECTED] wrote:
Hi
Having got to the word counting example on the website:
wordcount :: IO ()
wordcount = do
wc -
On Dec 12, 2007 5:40 PM, Miguel Mitrofanov [EMAIL PROTECTED] wrote:
Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's
not native on my Mac; some Mac users don't install it and almost
all Mac users don't always run it.
Gtk is going native on Mac:
Hi
Having got to the word counting example on the website:
wordcount :: IO ()
wordcount = do
wc - wordcount' False 0
putStrLn (show wc)
where
wordcount' inword wc = do
ch - getc
case ch of
I prefer the elegant high-level style of wxhaskell over the current state of
gtk2hs. duncan has said he's interested in making a gtk2hs more elegant,
and daan has said he'll start supporting wxhaskell again. i don't know
which will happen first. - Conal
On Dec 12, 2007 11:47 AM, Neil Mitchell
On Dec 12, 2007, at 14:51 , Felipe Lessa wrote:
On Dec 12, 2007 5:40 PM, Miguel Mitrofanov [EMAIL PROTECTED]
wrote:
Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's
not native on my Mac; some Mac users don't install it and almost
all Mac users don't always run it.
Gtk
Hi
Is there any really cross-platform GUI library for Haskell?
Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's
not native on my Mac; some Mac users don't install it and almost
all Mac users don't always run it.
On Windows, Gtk2hs is not as native as wxHaskell, but is
Andrew Coppin [EMAIL PROTECTED] writes:
[...]
Yeah, we should probably set up a seperate list for this
stuff...
Agreed. :)
This type of general discussions cannot be concluded. A board of bored
Haskellers socialize themselves.
To be honest, I didn't read that thing (in
Tommy M McGuire wrote:
(Plus, interact is scary. :-D )
You have a scary feeling for a moment, then it passes. ;)
Gwern Branwen wrote:
I... I want to provide a one-liner for 'detab', but it looks
impressively monstrous and I'm not sure I understand it.
On the other hand, I'm not looking
Thomas Hartman wrote:
Note that 1 + ยทยทยท + n = n * (n+1) / 2, so the average of [1..n] is
(n+1) / 2
fair enough.
But I believe if I restate the problem so that you need to find the
average of an arbitrary list, your clever trick doesn't work and we need
eager eval or we blow the stack.
gracjanpolak:
I'm happy to announce a ReadP style parser for ByteStrings,
Text.ParserCombinators.ReadP.ByteString.
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bytestringreadp
Text.ParserCombinators.ReadP.ByteString is an adaptation of
Text.ParserCombinators.ReadP to work
Hi Thomas,
On Dec 12, 2007 5:31 PM, Thomas Hartman [EMAIL PROTECTED] wrote:
(solution involves building an accum list of (average,listLength) tuples.
again you can't do a naive fold due to stack overflow, but in this case even
strict foldl' from data.list isn't strict enough, I had to define
benja.fallenstein:
Hi Thomas,
On Dec 12, 2007 5:31 PM, Thomas Hartman [EMAIL PROTECTED] wrote:
(solution involves building an accum list of (average,listLength) tuples.
again you can't do a naive fold due to stack overflow, but in this case even
strict foldl' from data.list isn't
On Dec 12, 2007 9:58 PM, Don Stewart [EMAIL PROTECTED] wrote:
And no need to even use custom ones, just use the library strict pairs,
http://hackage.haskell.org/packages/archive/strict/0.2/doc/html/Data-Strict-Tuple.html
Oh, good! :)
'nother Haskell lesson learned. Thanks,
- Benja
Dan Weston wrote:
scanl above is not strict in its second argument. The data dependencies
cause the strictness. Cf:
Prelude head ([1,3] ++ head ((scanl undefined undefined) undefined))
1
The first claim is of course false, nore would the example show it anyway.
scanl is not strict in its
Bill Wood wrote:
On Wed, 2007-12-12 at 11:19 +, Andrew Coppin wrote:
. . .
...and normal programmers care about the Fibonacci numbers because...?
Seriously, there are many, many programmers who don't even know what
Fibonacci numbers *are*. And even I can't think of a useful purpose
Not can, should. And it might even survive in th world of Unicode.
On Dec 12, 2007 4:17 PM, Brent Yorgey [EMAIL PROTECTED] wrote:
On Dec 12, 2007 10:36 AM, Arie Groeneveld [EMAIL PROTECTED] wrote:
Reinier Lamers schreef:
printint :: Int - [Char]
printint = map chr . map (+0x30) .
I had it pretty well worked out for single parameter type classes, but I
couldn't see any nice extension to multiple parameters.
On Dec 11, 2007 5:30 PM, Simon Peyton-Jones [EMAIL PROTECTED] wrote:
| If it really would work ok we should get it fully specified and
| implemented so we can fix
Hello Andrew,
Thursday, December 13, 2007, 12:40:59 AM, you wrote:
Knuth[1] pp. 417-419 discusses Fibonacci trees and Fibonacci search.
According to Knuth (and who am I to argue with him) Fibonacci search has
better average case running time than binary search, although worst case
can be
On Wed, 2007-12-12 at 13:30 +, Magnus Therning wrote:
The visible change is the addition of a function, decode', that allows
lazier decoding by shifting some responisility to the user.
That's interesting. It's in the same spirit as the lazy variant provided
in the iconv lib. It'll be
Don Stewart wrote:
My thoughts too when reading the initial post was that it was all very
low level imperative programming. Not of the Haskell flavour.
-- Don
Oh, heck yeah. As I was thinking when I was translating it, I can't
even say I'm writing Pascal code using Haskell; I wouldn't
Am Mittwoch, 12. Dezember 2007 schrieb Miguel Mitrofanov:
Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's
not native on my Mac; some Mac users don't install it and almost
all Mac users don't always run it.
the problem is Apple. if you want to have a native gui on OSX
apfelmus wrote:
Tommy M McGuire wrote:
(Plus, interact is scary. :-D )
You have a scary feeling for a moment, then it passes. ;)
tabwidth = 4
-- tabstop !! (col-1) == there is a tabstop at column col
-- This is an infinite list, so no need to limit the line width
tabstops =
Hi Tommy,
detab is one of the programs I do not like. I kept the direct
translation approach up through that, but I think it really hides the
simplicity there; detab copies its input to its output replacing tabs
with 1-8 spaces, based on where the tab occurs in a line. The only
interesting
Since there are many useful per-line functions, do a little refactoring,
placing the following into a library:
perLine :: (String - String) - (String - String)
perLine f = unlines . map f . lines
On Dec 12, 2007 12:43 PM, apfelmus [EMAIL PROTECTED] wrote:
Tommy M McGuire wrote:
(Plus,
Another version of detab:
main = interact $ perLine $ concat . snd. mapAccumL f 0 where
f tab '\t' = (0, replicate (4-tab) ' ')
f tab char = ((tab+1) `mod` 4, [char])
- Benja
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Dec 13, 2007 2:20 AM, Benja Fallenstein [EMAIL PROTECTED] wrote:
Another version of detab:
main = interact $ perLine $ concat . snd. mapAccumL f 0 where
f tab '\t' = (0, replicate (4-tab) ' ')
f tab char = ((tab+1) `mod` 4, [char])
Although on reflection, I think I might like the
On Dec 13, 2007 2:28 AM, Benja Fallenstein [EMAIL PROTECTED] wrote:
Although on reflection, I think I might like the following compromise
with Tillmann's version best:
main = interact $ perLine $ detab 0 where
detab tab ('\t':cs) = replicate (4-tab) ' ' ++ detab 0 cs
On Dec 11, 2007 3:19 PM, David Menendez [EMAIL PROTECTED] wrote:
On Dec 11, 2007 9:20 AM, Duncan Coutts [EMAIL PROTECTED] wrote:
So my suggestion is that we let classes declare default implementations
of methods from super-classes.
snip.
Does this proposal have any unintended
54 matches
Mail list logo