Manlio Perillo wrote:
> Conal Elliott ha scritto:
>> Manlio,
>>
>> We live in the age of participation -- of co-education. Don't worry
>> about text-books. Contribute to some wiki pages & blogs today that
>> share these smart techniques with others.
>>
>
> When I started learning Haskell (by my
On Tue, 2009-03-24 at 23:13 -0700, Donn Cave wrote:
> Quoth Duncan Coutts :
>
> > You must not do this. It breaks the semantics of the language.
> >
> > Other people have given practical reasons why you should not but a
> > theoretical reason is that you've defined a non-continuous function.
> > T
Donn Cave wrote:
Could you elaborate a little, in what sense are we (?) relying on it?
I actually can't find any responses that make a case against it on a
really practical level - I mean, it seems to be taken for granted that
it will work as intended, and we're down to whether we ought to have
Quoth Duncan Coutts :
> You must not do this. It breaks the semantics of the language.
>
> Other people have given practical reasons why you should not but a
> theoretical reason is that you've defined a non-continuous function.
> That is impossible in the normal semantics of pure functional langu
Manlio Perillo wrote:
But this may be really a question of personal taste or experience.
What is more "natural"?
1) pattern matching
2) recursion
or
1) function composition
2) high level functions
Which is more "natural":
* C-style for-loops (aka assembly while-loops), or
* any modern languag
Jake McArthur wrote:
> Richard O'Keefe wrote:
> > May I suggest that the most important thing missing from
> > all these versions of the function is a comment?
> > Most of the time I shouldn't *care* how the function works.
> > (And that, for me, is one of the key benefits of Haskell.)
>
> Althou
On Mon, 2009-03-23 at 08:11 -0400, Xiao-Yong Jin wrote:
> Hi,
>
> I just feel it is not comfortable to deal with exceptions
> only within IO monad, so I defined
>
> > tryArith :: a -> Either ArithException a
> > tryArith = unsafePerformIO . try . evaluate
You must not do this. It breaks the sema
On Tue, Mar 24, 2009 at 2:42 PM, Manlio Perillo
wrote:
> Tim Newsham ha scritto:
>>>
>>> These friends are very interested in Haskell, but it seems that the main
>>> reason why they don't start to seriously learning it, is that when they
>>> start reading some code, they feel the "Perl syndrome".
Richard O'Keefe wrote:
May I suggest that the most important thing missing from
all these versions of the function is a comment?
Most of the time I shouldn't *care* how the function works.
(And that, for me, is one of the key benefits of Haskell.)
Although in this case, a proper name and type s
May I suggest that the most important thing missing from
all these versions of the function is a comment?
Most of the time I shouldn't *care* how the function works.
(And that, for me, is one of the key benefits of Haskell.)
___
Haskell-Cafe mailing lis
Hi Ketil,
Ketil Malde schrieb:
"Gü?nther Schmidt" writes:
let say I got an unordered lazy list of key/value pairs like
[('a', 99), ('x', 42), ('a', 33) ... ]
and I need to sum up all the values with the same keys.
So far I wrote a naive implementation, using Data.Map, foldl and insertWith.
On Tue, Mar 24, 2009 at 10:29:55PM +0300, Miguel Mitrofanov wrote:
> Maybe it's just me, but I think that
>
> takeList ns xs = evalState (mapM (State . splitAt) ns) xs
>
> or even
>
> takeList = evalState . map (State . splitAt)
>
> would be much clearer than both versions.
I love it! It wouldn't
Perhaps is much easier to create one line compositions of functions in
haskell rather than in C because the type system helps a lot in the process.
However, reusability of source code and maintainability has never been taken
seriously by haskell programmers, simply because there are no industrial
p
Dear Luke,
I suspect Black Magic at work here.
This seems to work and I so don't have a clue why. But thank you very
much nevertheless, I strongly suspect that, once I figured out why this
works, I will have learned a very, very important trick indeed.
Had I read "purely functional data stru
On Tue, 2009-03-24 at 16:43 -0700, Donn Cave wrote:
> If he really intended to promote some dumb code as a better
> alternative to some otherwise equivalent smart code,
`Smart' is Manlio's term --- or, rather, his characterization of his
friends' reaction upon seeing some inscrutable piece of (app
Code like that is why I love Haskell, while I haven't written a Haskell
program in years it is still a joy to read (much more so than the pretty
good zipWith version).
In reference to later comments: if you don't know Monads, you don't know
Haskell; that goes double for high order functions.
So rea
> Manlio -- You may be missing the point of my suggestion, which is to help
> people *find* code that suits them, rather than changing anyone's coding
> style. Optimizing code for one segment of readers is pessimizing it for
> another. Instead of dumbing down the smart code, I'd like to help your
"Gü?nther Schmidt" writes:
> let say I got an unordered lazy list of key/value pairs like
>
> [('a', 99), ('x', 42), ('a', 33) ... ]
>
> and I need to sum up all the values with the same keys.
>
> So far I wrote a naive implementation, using Data.Map, foldl and insertWith.
Data.Map.fromListWith
Conal Elliott ha scritto:
And advices to experienced Haskell programmers about how to document
their code so that it may help less experienced programmers.
Manlio -- You may be missing the point of my suggestion,
Ah, sorry.
which is to
help people *find* code that suits them, rathe
On Tue, 24 Mar 2009, Xiao-Yong Jin wrote:
Thanks for all the replies. Now I understand more about
Exceptions and Errors. I guess all I need is to compose a
larger monad, after all. I need to learn how to make
two different stacks of monad transformers cooperate
seamlessly, though.
Until no
Conal Elliott ha scritto:
Manlio,
We live in the age of participation -- of co-education. Don't worry
about text-books. Contribute to some wiki pages & blogs today that
share these smart techniques with others.
When I started learning Haskell (by my initiative), what I did was:
1) Quick
2009/3/24 Peter Verswyvelen :
>> This strategy is doomed to failure, unfortunately.
>
> So it is the good strategy, because Haskell's slogan is "avoid success at
> all cost" :-)
IN THE YEAR 1987, WAR WAS BEGINNING
BIG, IMPERATIVE SOFTWARE BEHEMOTHS CLASHED IN A STATE OF IMPURITY
UNDER THE SHADO
Jake McArthur writes:
> Xiao-Yong Jin wrote:
> | Then, why is 'div' not of type 'a -> a -> ArithExceptionMonad a' ?
> | Why does it throws this /ugly/ /error/ when it is applied to
> | 0? Why is it not using some beautiful
> | 'ArithExceptinoMonad'? Is 'Control.Exception' just pure
> | /ugly/ a
On Tue, Mar 24, 2009 at 11:35 PM, Scott A. Waterman wrote:
> Duane -
>
> yes, please. I've been wondering how to compile to a Mac .app structure.
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mkbndl
> Also, anyone have any hints about distributing Haskell apps for mac, when
> you
>
> This question makes me wonder... why is explicit recursion taught first?
> [...]
>
Perhaps also because teachers, being older than their students, are often
mired in outdated thinking.
On Tue, Mar 24, 2009 at 3:35 PM, Jake McArthur wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
Manlio,
We live in the age of participation -- of co-education. Don't worry about
text-books. Contribute to some wiki pages & blogs today that share these
smart techniques with others.
Learning/progress is mainly results when people respond to their
own incomprehension by moving into new & chal
Duane -
yes, please. I've been wondering how to compile to a Mac .app
structure.
Also, anyone have any hints about distributing Haskell apps for mac,
when you know the target will certianly *not* have a GHC environment
on it?
Thanks
--ts
On Mar 21, 2009, at 2:18 PM, Duane Johnson wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Jonathan Cast wrote:
| You know, this might actually need to be looked into.
|
| You need to know recursion and pattern-matching to *write* re-usable
| higher-order functions, but how appropriate is that as the first thing
| taught?
An excellent ques
>
> And advices to experienced Haskell programmers about how to document their
> code so that it may help less experienced programmers.
>
Manlio -- You may be missing the point of my suggestion, which is to help
people *find* code that suits them, rather than changing anyone's coding
style. Optim
*Launches missiles*
Bob
(that was my logo)
On 24 Mar 2009, at 21:46, Ross Mellgren wrote:
Doesn't matter how many times you seq the results, the thunk has
been forced.
-Ross
On Mar 24, 2009, at 4:45 PM, FFT wrote:
I demand a recount! The one that launches the missile should have
won!
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Xiao-Yong Jin wrote:
| Then, why is 'div' not of type 'a -> a -> ArithExceptionMonad a' ?
| Why does it throws this /ugly/ /error/ when it is applied to
| 0? Why is it not using some beautiful
| 'ArithExceptinoMonad'? Is 'Control.Exception' just pur
On Tue, 2009-03-24 at 23:15 +0100, Manlio Perillo wrote:
> Dan Piponi ha scritto:
> >> Miguel Mitrofanov wrote:
> >>> takeList = evalState . mapM (State . splitAt)
> >
> >> However, ironically, I stopped using them for pretty
> >> much the same reason that Manlio is saying.
> >
> > Are you saying
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Manlio Perillo wrote:
| But this may be really a question of personal taste or experience.
| What is more "natural"?
|
| 1) pattern matching
| 2) recursion
| or
| 1) function composition
| 2) high level functions
Definitely the latter two. They are e
Dan Piponi ha scritto:
Miguel Mitrofanov wrote:
takeList = evalState . mapM (State . splitAt)
However, ironically, I stopped using them for pretty
much the same reason that Manlio is saying.
Are you saying there's a problem with this implementation? It's the
only one I could just read immed
On Mar 24, 2009, at 1:51 PM, Manlio Perillo wrote:
But this may be really a question of personal taste or experience.
What is more "natural"?
1) pattern matching
2) recursion
or
1) function composition
2) high level functions
I think, actually, that one of the fundamental intuitions of (modern
On Tue, Mar 24, 2009 at 8:29 PM, Miguel Mitrofanov wrote:
> takeList ns xs = evalState (mapM (State . splitAt) ns) xs
>>
>
> or even
>
> takeList = evalState . map (State . splitAt)
>
> would be much clearer than both versions.
Brilliant. As a newbie, I knew all these functions, I have used them
Conal Elliott ha scritto:
I'd love to help newbies get the hang of Haskell without having to jump
in the deep (and smart-infested) end first. And I'd love for people to
keep writing smart code for non-newbies to enjoy.
Perhaps a practical suggestion would be some wiki pages devoted to
pointi
Yay, thanks everybody!
As Eelco pointed out, Darrin Thompson deserves much of the credit for
coming up with the design; I just made it pretty in Photoshop. :)
On Tue, 2009-03-24 at 08:29 -0400, John Van Enk wrote:
> Is this the part where all the pundits come out and talk about how
> Jeff isn't
On Tue, Mar 24, 2009 at 3:51 PM, Luke Palmer wrote:
> On Tue, Mar 24, 2009 at 3:15 PM, Gü?nther Schmidt wrote:
>
>> Hi,
>>
>> let say I got an unordered lazy list of key/value pairs like
>>
>> [('a', 99), ('x', 42), ('a', 33) ... ]
>>
>> and I need to sum up all the values with the same keys.
>>
Erik de Castro Lopo ha scritto:
Manlio Perillo wrote:
I was speaking about the best way to write a function, so that it may
help someone who is learning Haskell.
I've been learning Haskell for about 3 months.
I think its a mistake to write code so that its easy for someone
learning Haskell t
Zachary Turner ha scritto:
[...]
> but I do understand that one of the primary uses
cases and/or motivating factors for using Haskell is when you really
just NEED that extra abstraction and power you get from being able to do
these types of things. Someone once said that "simple problems shou
2009/3/24 Manlio Perillo :
> Jonathan Cast ha scritto:
>>
>> [...]
>>
>> I think, in general, the best way to document the purpose of the
>> function is
>>
>> -- | Split a function into a sequence of partitions of specified
>> lenth
>> takeList :: [Int] -> [a] -> [[a]]
*That* was what I crav
On Tue, Mar 24, 2009 at 3:15 PM, Gü?nther Schmidt wrote:
> Hi,
>
> let say I got an unordered lazy list of key/value pairs like
>
> [('a', 99), ('x', 42), ('a', 33) ... ]
>
> and I need to sum up all the values with the same keys.
>
> So far I wrote a naive implementation, using Data.Map, foldl an
On Tue, 2009-03-24 at 22:43 +0100, Manlio Perillo wrote:
> Jonathan Cast ha scritto:
> > [...]
> >
> > I think, in general, the best way to document the purpose of the
> > function is
> >
> > -- | Split a function into a sequence of partitions of specified
> > lenth
> > takeList :: [Int]
I'd love to help newbies get the hang of Haskell without having to jump in
the deep (and smart-infested) end first. And I'd love for people to keep
writing smart code for non-newbies to enjoy.
Perhaps a practical suggestion would be some wiki pages devoted to pointing
out code with various learni
As (yet another?) Haskell newbie, with a day job using Java (where
"keep it simple, stupid" is not a principle, it's a language enforced
requirement), I would much prefer the function is implemented in the
most concise and idiomatic style that the writer is capable of. That
is, either the z
Manlio Perillo wrote:
> I was speaking about the best way to write a function, so that it may
> help someone who is learning Haskell.
I've been learning Haskell for about 3 months.
I think its a mistake to write code so that its easy for someone
learning Haskell to read it. Code should be writt
>> The results of the Haskell logo competition are in!
>>
>> You can view them at
>> http://www.cs.cornell.edu/w8/~andru/cgi-perl/civs/results.pl?num_winners=1&id=E_d21b0256a4fd5ed7&algorithm=beatpath
>>
>> Congratulations Jeff Wheeler!
>
> Is there also a measure of how strong the winner wins ove
On Tue, Mar 24, 2009 at 11:41 PM, Henning Thielemann
wrote:
>> http://www.cs.cornell.edu/w8/~andru/cgi-perl/civs/results.pl?num_winners=1&id=E_d21b0256a4fd5ed7&algorithm=beatpath
>>
> Is there also a measure of how strong the winner wins over the "losers"?
The runner up was beaten 135 votes to 10
On Tue, 24 Mar 2009, Eelco Lempsink wrote:
The results of the Haskell logo competition are in!
You can view them at
http://www.cs.cornell.edu/w8/~andru/cgi-perl/civs/results.pl?num_winners=1&id=E_d21b0256a4fd5ed7&algorithm=beatpath
Congratulations Jeff Wheeler!
And ... please maintain the
Jonathan Cast ha scritto:
[...]
I think, in general, the best way to document the purpose of the
function is
-- | Split a function into a sequence of partitions of specified
lenth
takeList :: [Int] -> [a] -> [[a]]
Note that I was not speaking about the best way to document a function
On Tue, 24 Mar 2009, Eelco Lempsink wrote:
The results of the Haskell logo competition are in!
You can view them at
http://www.cs.cornell.edu/w8/~andru/cgi-perl/civs/results.pl?num_winners=1&id=E_d21b0256a4fd5ed7&algorithm=beatpath
Congratulations Jeff Wheeler!
Is there also a measure of
On Tue, Mar 24, 2009 at 12:41 PM, Manlio Perillo
wrote:
> I too have this feeling, from time to time.
>
So do I, because I haven't had the time to learn what I need to learn
in order to read the code smoothly. I find that when I do work out
the meaning, most often the style reflects conciseness
On Tue, 24 Mar 2009, Xiao-Yong Jin wrote:
Jake McArthur writes:
Xiao-Yong Jin wrote:
| The problem is that there will be many functions using such
| a function to invert a matrix, making this inversion
| function return Either/Maybe or packing it in a monad is
| just a big headache.
I disag
Miguel Mitrofanov wrote:
>>> takeList = evalState . mapM (State . splitAt)
I wrote:
>> However, ironically, I stopped using them for pretty
>> much the same reason that Manlio is saying.
Dan Piponi wrote:
> Are you saying there's a problem with this implementation? It's the
> only one I could jus
"Brettschneider, Matthias"
writes:
> Thx for your hints, I played around with them and the performance gets
> slightly better.
> But the major boost is still missing :)
>
> I noticed, that one real bottleneck seems to be the conversion of the array
> back into a list.
> The interesting part
On Tue, 2009-03-24 at 22:33 +0300, Eugene Kirpichov wrote:
> Pretty cool once you know what the function does, but I must admit I
> wouldn't immediately guess the purpose of the function when written in
> this way.
I wouldn't immediately guess the purpose of the function written in any
way.
I thi
Daniel Yokomizo writes:
> On Tue, Mar 24, 2009 at 1:27 PM, Xiao-Yong Jin wrote:
>> Henning Thielemann writes:
>>
>>> Try to never use exception handling for catching programming errors!
>>> Division by zero is undefined, thus a programming error when it
>>> occurs.
>>> http://www.haskell.org/h
On Tue, Mar 24, 2009 at 3:28 PM, Luke Palmer wrote:
> On Tue, Mar 24, 2009 at 3:14 PM, Xiao-Yong Jin wrote:
>
>> Jake McArthur writes:
>>
>> > Xiao-Yong Jin wrote:
>> > | The problem is that there will be many functions using such
>> > | a function to invert a matrix, making this inversion
>> >
On Tue, Mar 24, 2009 at 4:11 PM, Manlio Perillo wrote:
> Conal Elliott ha scritto:
>
>> Another helpful strategy for the reader is to get smarter, i.e. to invest
>> effort in rising to the level of the writer. Or just choose a different
>> book if s/he prefers. - Conal
>>
>>
> This strategy is
On Tue, Mar 24, 2009 at 3:14 PM, Xiao-Yong Jin wrote:
> Jake McArthur writes:
>
> > Xiao-Yong Jin wrote:
> > | The problem is that there will be many functions using such
> > | a function to invert a matrix, making this inversion
> > | function return Either/Maybe or packing it in a monad is
> >
> Miguel Mitrofanov wrote:
>> takeList = evalState . mapM (State . splitAt)
> However, ironically, I stopped using them for pretty
> much the same reason that Manlio is saying.
Are you saying there's a problem with this implementation? It's the
only one I could just read immediately. The trick is
2009/3/24 Peter Verswyvelen :
> But aren't these two definitions different algoritms? At first sight I think
> the second one is more efficient than the first one.
Some performance numbers:
--
module Main where
import System.En
On Tue, Mar 24, 2009 at 1:42 PM, Manlio Perillo
wrote:
>
> But, as an example, when you read a function like:
>
> buildPartitions xs ns = zipWith take ns . init $ scanl (flip drop) xs ns
>
> that can be rewritten (argument reversed) as:
>
> takeList :: [Int] -> [a] -> [[a]]
> takeList [] _
On Tue, Mar 24, 2009 at 10:11 PM, Manlio Perillo
wrote:
> This strategy is doomed to failure, unfortunately.
So it is the good strategy, because Haskell's slogan is "avoid success at
all cost" :-)
> We live in the real world, compromises are necessary.
I don't think so. It's just that we hav
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man." - George Bernard Shaw
On Tue, Mar 24, 2009 at 2:11 PM, Manlio Perillo wrote:
> Conal Elliott ha scritto:
>
>> Another h
Hah! It sure is. :)
On Tue, Mar 24, 2009 at 2:17 PM, Peter Verswyvelen wrote:
> Sometimes that is very hard when the writer is way smarter than the reader
> :-)
> 2009/3/24 Conal Elliott
>
> Another helpful strategy for the reader is to get smarter, i.e. to invest
>> effort in rising to the le
* Manlio Perillo wrote:
> But this may be really a question of personal taste or experience.
> What is more "natural"?
>
> 1) pattern matching
> 2) recursion
> or
> 1) function composition
> 2) high level functions
Composition of library functions is usually much more readable than hand
written re
Sometimes that is very hard when the writer is way smarter than the reader
:-)
2009/3/24 Conal Elliott
> Another helpful strategy for the reader is to get smarter, i.e. to invest
> effort in rising to the level of the writer. Or just choose a different
> book if s/he prefers. - Conal
>
>
> On
Hi,
let say I got an unordered lazy list of key/value pairs like
[('a', 99), ('x', 42), ('a', 33) ... ]
and I need to sum up all the values with the same keys.
So far I wrote a naive implementation, using Data.Map, foldl and insertWith.
The result of this grouping operation, which is effectiv
If any one seconds the motion, i'm picking up this part of the thread and
putting it in the humor section of the haskell wiki.
/jve
On Tue, Mar 24, 2009 at 4:48 PM, Ross Mellgren wrote:
> import Diebold.Unsafe (unsafeChangeVotes)...
>
> ?
>
> -Ross
>
> On Mar 24, 2009, at 4:47 PM, John Van Enk
Jake McArthur writes:
> Xiao-Yong Jin wrote:
> | The problem is that there will be many functions using such
> | a function to invert a matrix, making this inversion
> | function return Either/Maybe or packing it in a monad is
> | just a big headache.
>
> I disagree. If you try to take the invers
Conal Elliott ha scritto:
Another helpful strategy for the reader is to get smarter, i.e. to
invest effort in rising to the level of the writer. Or just choose a
different book if s/he prefers. - Conal
This strategy is doomed to failure, unfortunately.
We live in the real world, compromis
claus.reinke:
> Perhaps the "make a video" slogan doesn't quite explain what is
> intended - it didn't to me!-) Reading John Udell's short article
>
> What is Screencasting?
> http://www.oreillynet.com/pub/a/oreilly/digitalmedia/2005/11/16/what-is-screencasting.html?page=1
>
> gave me a better idea
"Recursion is the goto of functional programming". Also, "Do not confuse
what is natural with what is habitual." - Conal
On Tue, Mar 24, 2009 at 1:51 PM, Manlio Perillo wrote:
> Jake McArthur ha scritto:
>
>> [...]
>> | With my function, instead, you only have to "follow" 1 operation:
>> |
>> |
Another helpful strategy for the reader is to get smarter, i.e. to invest
effort in rising to the level of the writer. Or just choose a different
book if s/he prefers. - Conal
On Tue, Mar 24, 2009 at 1:44 PM, Manlio Perillo wrote:
> Yitzchak Gale ha scritto:
>
>> [...]
>> So the bottom line is
Jake McArthur ha scritto:
[...]
| With my function, instead, you only have to "follow" 1 operation:
|
| Prelude> (head, tail) = splitAt n xs
I think you are way oversimplifying your own code.
~takeList :: [Int] -> [a] -> [[a]]
~takeList [] _ = []
~takeList _ [] = [
import Diebold.Unsafe (unsafeChangeVotes)
...
?
-Ross
On Mar 24, 2009, at 4:47 PM, John Van Enk wrote:
Unless there's a rogue unsafeChangeVotes call in there somewhere.
On Tue, Mar 24, 2009 at 4:46 PM, Ross Mellgren hask...@z.odi.ac> wrote:
Doesn't matter how many times you seq the results,
Unless there's a rogue unsafeChangeVotes call in there somewhere.
On Tue, Mar 24, 2009 at 4:46 PM, Ross Mellgren wrote:
> Doesn't matter how many times you seq the results, the thunk has been
> forced.
>
> -Ross
>
>
> On Mar 24, 2009, at 4:45 PM, FFT wrote:
>
> I demand a recount! The one that l
On Tue, Mar 24, 2009 at 2:45 PM, FFT wrote:
> I demand a recount! The one that launches the missile should have won!
I guess nobody evaluated its merits.
>
>
> 2009/3/24 Eelco Lempsink :
> > The results of the Haskell logo competition are in!
> >
> > You can view them at
> >
> http://www.cs.c
Doesn't matter how many times you seq the results, the thunk has been
forced.
-Ross
On Mar 24, 2009, at 4:45 PM, FFT wrote:
I demand a recount! The one that launches the missile should have won!
2009/3/24 Eelco Lempsink :
The results of the Haskell logo competition are in!
You can view th
I demand a recount! The one that launches the missile should have won!
2009/3/24 Eelco Lempsink :
> The results of the Haskell logo competition are in!
>
> You can view them at
> http://www.cs.cornell.edu/w8/~andru/cgi-perl/civs/results.pl?num_winners=1&id=E_d21b0256a4fd5ed7&algorithm=beatpath
>
>
Yitzchak Gale ha scritto:
[...]
So the bottom line is that Manlio is right, really. It's just
that Haskell is still very different than what most
programmers are used to. So it does take a while to
get a feeling for what is "too smart".
Right, you centered the problem!
The problem is where to
On Tue, 24 Mar 2009, Daniel Yokomizo wrote:
If we try the other approach, we need to express the totality of
invMat by restricting its domain, so we can add, for example, a
phantom type to Matrix to signal it is invertible. As you need to
construct the Matrix before trying to invert it you can
On Tue, Mar 24, 2009 at 7:48 PM, Jonathan Cast wrote:
> On Tue, 2009-03-24 at 19:42 +0100, Manlio Perillo wrote:
> > But, as an example, when you read a function like:
> >
> > buildPartitions xs ns = zipWith take ns . init $ scanl (flip drop) xs ns
> >
> > that can be rewritten (argument reversed)
On Tue, 24 Mar 2009, Xiao-Yong Jin wrote:
invMat :: Matrix -> Matrix
You won't be able to invert all the matrix, mathematically.
And computationally, even a larger set of matrix might fail
to be inverted because of the finite precision. It is
relatively easier and more efficient to spot such
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Manlio Perillo wrote:
| With the original version, you have to "follow" 3 separate operations:
|
| Prelude> let xs = [1, 2, 3, 4] :: [Int]
| Prelude> let ns = [3, 1] :: [Int]
| Prelude> let _1 = scanl (flip drop) xs ns
| Prelude> let _2 = init _1
| Pr
2009/3/24 Rick R
> Correct. My point was only in the case that it would need to statically
> link to a GPL'd lib (which I'm not sure if such a case exists)
> If the gcc license suddenly decided to claim compiled items as derivative
> works, the IT world as we know it would end.
Any linkage to G
Manlio Perillo complained about:
>> buildPartitions xs ns = zipWith take ns . init . scanl (flip drop) xs $ ns
Miguel Mitrofanov wrote:
> takeList = evalState . mapM (State . splitAt)
Ha! Bravo!
As the author of the offending zipWith/scanl version,
I can say that love those State monad one-liner
> and that baby eating is an acceptable part of Haskell optimization
Actually, yes. It's usually best used like this:
data Foo = Bar {-# UNPACK #-} {-# EAT BABY #-} !Int
On Tue, Mar 24, 2009 at 8:42 AM, Creighton Hogg wrote:
> 2009/3/24 John Van Enk :
> > Is this the part where all the pundits
Jake McArthur ha scritto:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Manlio Perillo wrote:
| This is right.
| The problem is that often (IMHO) a function definition can be rewritten
| so that it is much more readable.
|
| As an example, with the takeList function I posted.
I looked at it, fo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Miguel Mitrofanov wrote:
| Maybe it's just me, but I think that
|
| takeList ns xs = evalState (mapM (State . splitAt) ns) xs
|
| or even
|
| takeList = evalState . map (State . splitAt)
|
| would be much clearer than both versions.
Definitely. I stu
Pretty cool once you know what the function does, but I must admit I
wouldn't immediately guess the purpose of the function when written in
this way.
2009/3/24 Miguel Mitrofanov :
>> | As an example, with the takeList function I posted.
>>
>> I looked at it, found nothing wrong with the original,
I changed the program, now it similar to the program from the wiki
(http://www.haskell.org/haskellwiki/Phone_number)
The version with ByteString compared to version with ordinary Strings
works 3.5 times faster.
(I put it to http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2830)
But version with Data
| As an example, with the takeList function I posted.
I looked at it, found nothing wrong with the original, and absolutely
hated your "fixed" version. I might have written it like this,
instead:
~buildPartitions xs ns = zipWith take ns . init . scanl (flip
drop)
xs $ ns
Maybe it's j
2009/3/24 Manlio Perillo :
> Tim Newsham ha scritto:
>>>
>>> These friends are very interested in Haskell, but it seems that the main
>>> reason why they don't start to seriously learning it, is that when they
>>> start reading some code, they feel the "Perl syndrome".
>>>
>>> That is, code written
When you think about it, what you are saying is that Haskell programmers
shouldn't take advantage of the extra tools that Haskell provides.
No, I'm not saying this.
But, as an example, when you read a function like:
buildPartitions xs ns = zipWith take ns . init $ scanl (flip drop) xs ns
tha
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Manlio Perillo wrote:
| This is right.
| The problem is that often (IMHO) a function definition can be rewritten
| so that it is much more readable.
|
| As an example, with the takeList function I posted.
I looked at it, found nothing wrong with the
On Tue, 2009-03-24 at 19:42 +0100, Manlio Perillo wrote:
> Tim Newsham ha scritto:
> >> These friends are very interested in Haskell, but it seems that the
> >> main reason why they don't start to seriously learning it, is that
> >> when they start reading some code, they feel the "Perl syndrome"
Jake McArthur ha scritto:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Manlio Perillo wrote:
| These friends are very interested in Haskell, but it seems that the main
| reason why they don't start to seriously learning it, is that when they
| start reading some code, they feel the "Perl syndro
1 - 100 of 156 matches
Mail list logo