POV-Ray : Newsgroups : povray.off-topic : Why is Haskell interesting? : Re: Why is Haskell interesting? Server Time
4 Sep 2024 17:24:12 EDT (-0400)
  Re: Why is Haskell interesting?  
From: Darren New
Date: 2 Mar 2010 11:33:16
Message: <4b8d3dcc$1@news.povray.org>
Invisible wrote:
>>> Scientific applications are a vanishingly small market segment.
>>
>> I'm not so sure about that.
> 
> How many people use computers to do scientific calculations?
> How many people use computers to run their office suite?
> Yeah, exactly.

Sure. I wouldn't say "vanishingly small", given the number of offices that 
actually do science for a living.

> Care to elaborate on what it is?

Not especially. Let's just mention "COBOL".

> Every node has either zero or two children.

Fair dinkum. I was thinking of a different algorithm.

> I've never read the implementation of a hash table, for that matter.

You should. I expect things like skip lists and skip graphs and DHTs are the 
sorts of things you'd get into.

> In just about any programming language imaginable, it would be possible 
> to look at the raw assembly code generated to figure out where some data 
> is physically stored in memory, and then link in some raw assembly to 
> directly access that data. 

So, because you can link assembly code to your Haskell, that means Haskell 
isn't functional? Because assembly code isn't functional?

> Which is, of course, nonesense. Real programs don't do this kind of 
> thing. If your program doesn't attempt to circumvent encapsulation, then 
> you get the benefits of encapsulation.

Uh, no. That's my point. You might get some of the benefits of encapsulation 
(like correct code being easier to understand), but if neither the compiler 
nor the runtime enforce encapsulation and you have no way of detecting 
errors that violate encapsulation, then your language is doing a poor job of 
encapsulation, at least for many of the benefits of encapsulation.

>>>> What is this?
>>>>
>>>>    (lambda (x) (x + 1))
>>>>
>>>> It's a lambda expression.
>>>>
>>>>    y = (lambda (x) (x + 1))
>>>>
>>>> What is y?  It's a closure.
>>>
>>> I still don't get it. (But then, I don't even know what language that 
>>> is...)
>>
>> Do you understand the difference between classes and instances?
> 
> Yes. (But I'm not sure how this is related to functions...)

"Lambda" is the class. "Closure" is the instance.

Lambda is an expression. A closure is the value of the expression.

What is this:
    \ x . x + y

It's a lambda expression. It's not a value, because you don't know what "y" 
is. It means different things depending on where it is in the program and 
when you evaluate it. Every time you evaluate it, you'll get something 
different back, depending on "y", yes?

That thing you get back, that encapsulates the value of "y"? That's a closure.

> Heh. Talking to yourself is the first sign of madness. ;-)

Oh, you can't help that. We're all mad here.

-- 
Darren New, San Diego CA, USA (PST)
   The question in today's corporate environment is not
   so much "what color is your parachute?" as it is
   "what color is your nose?"


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.