Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: John Larkin <jjlarkin@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 13 Jun 2009 10:47:35 -0700
On Sat, 13 Jun 2009 18:11:40 +0100, Nobody <nobody@xxxxxxxxxxx> wrote:
On Sat, 13 Jun 2009 08:47:42 -0700, John Larkin wrote:
Time for ARM in desktop PCs maybe?
ARM and ADA.
Ada was a useful advance, but a lot's happened in the last 30 years.
Someone needs to drag Haskell out of the lab and cross-breed it with
Eiffel and Erlang.
http://en.wikipedia.org/wiki/Haskell_(programming_language)
Terrifying.
Would you care to elaborate?
It's another language that's an intellectual puzzle for people who
enjoy puzzles. As a toy for people who like this sort of thing, it's
fine. As a way for real programmers to write safe, clear, maintainable
code, it's a nightmare.
This...
factorial n = (foldl (.) id [\x -> x*k | k <- [1..n]]) 1
is indeed "remarkably concise".
Not by a long shot.
It's also unreadable and very dangerous.
Which is why no-one would actually write it that way (well, unless they're
making a mathematical argument which relies upon formulating it that way).
Of the various implementations given on that page, the most likely to be
used are either:
factorial 0 = 1
factorial n | n > 0 = n * factorial (n-1)
or:
factorial = product . enumFromTo 1
If you can't grok partial application or the composition operator, you
might rewrite the latter as:
factorial n = product (enumFromTo 1 n)
or:
factorial n = product [1..n]
This is about as close to a "natural" definition of the factorial function
as you can get. It's also noticably more concise than the version which
you started with (which you would only use either for mathematical
argument or if you need a contrived example to make the language look bad).
This is Visual Basic:
Function factorial(ByVal n as Integer) as Integer
factorial = 1
Dim a as Integer
For a = 1 to n
factorial = factorial * a
Next
End Function
Not only is this far more verbose than is remotely reasonable, computing a
mathematical function as a sequence of state transformations is the kind
of thing which only makes sense to someone who cannot get beyond the
imperative mindset.
The only reason to prefer the imperative version is if that is all that
you understand and all that you are willing to understand.
One of the great formative and traumatic events of my youth was the
moment that I realized that most programmers aren't interested in
producing usable solutions to my problems, they mostly want to play
mind games with computers, and all they want from me is to pay them
while they do it.
It only cost me six wasted man-months to learn that, so I guess I got
off easy.
What sort of electronics do you design?
John
.
- Follow-Ups:
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: Nobody
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- References:
- Overview Of New Intel Core i7(Nehalem) Processor
- From: whatnext@xxxxxxxxx
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: John Larkin
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: Dirk Bruere at NeoPax
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: John Larkin
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: Nobody
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: John Larkin
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: Nobody
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: John Larkin
- Re: Overview Of New Intel Core i7(Nehalem) Processor
- From: Nobody
- Overview Of New Intel Core i7(Nehalem) Processor
- Prev by Date: Re: OT - Archie - I Dare You
- Next by Date: Re: Overview Of New Intel Core i7(Nehalem) Processor
- Previous by thread: Re: Overview Of New Intel Core i7(Nehalem) Processor
- Next by thread: Re: Overview Of New Intel Core i7(Nehalem) Processor
- Index(es):
Relevant Pages
|