Re: Overview Of New Intel Core i7(Nehalem) Processor



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


.



Relevant Pages

  • Re: Overview Of New Intel Core i7(Nehalem) Processor
    ... 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 ... factorial n = product (enumFromTo 1 n) ... Not only is this far more verbose than is remotely reasonable, computing a ...
    (sci.electronics.design)
  • Re: Overview Of New Intel Core i7(Nehalem) Processor
    ... Ada was a useful advance, but a lot's happened in the last 30 years. ... is indeed "remarkably concise". ... factorial n = product (enumFromTo 1 n) ... imperative mindset. ...
    (sci.electronics.design)
  • Re: Overview Of New Intel Core i7(Nehalem) Processor
    ... Ada was a useful advance, but a lot's happened in the last 30 years. ... factorial n = product (enumFromTo 1 n) ... Dr Philip C D Hobbs ... hobbs at electrooptical dot net ...
    (sci.electronics.design)
  • Re: SIGAda coverage in GCN
    ... Parallel evolution of game evaluation functions in ada ... and ALRM Annex E Distributed computing to harness a symmetric ... extension of an original single-task code to multi-tasking and distributed ... algorithm relies on human expertise to restrict the genetic search space. ...
    (comp.lang.ada)
  • Re: += in ada
    ... "Russ" wrote in message ... run circles around you while computing the circle's trajectory around you? ... Pascal, Fortran, and Ada. ... that Borland, among others have a C++ and a Pascal Compiler, they dont both ...
    (comp.lang.ada)