Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread Derek Elkins
On Fri, 2007-12-28 at 17:54 -0600, Jonathan Cast wrote:

 Programming languages are generally classified into three groups,  
 imperative, functional, and logical.  The difference is in the style  
 of programming encouraged (or mandated, for older languages) by the  
 language.

Usually the divide is imperative v. declarative with the four major
paradigms (procedural, OO and logic, FP respectively) being subgroups of
those divisions.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread Jonathan Cast

On 6 Jan 2008, at 3:02 AM, Derek Elkins wrote:


On Fri, 2007-12-28 at 17:54 -0600, Jonathan Cast wrote:


Programming languages are generally classified into three groups,
imperative, functional, and logical.  The difference is in the style
of programming encouraged (or mandated, for older languages) by the
language.


Usually the divide is imperative v. declarative with the four major
paradigms (procedural, OO and logic, FP respectively) being  
subgroups of

those divisions.


And your explanation of this classification is?

I find the term `declarative' to be almost completely meaningless.

jcc


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread Derek Elkins
On Sun, 2008-01-06 at 09:45 -0800, Jonathan Cast wrote:
 On 6 Jan 2008, at 3:02 AM, Derek Elkins wrote:
 
  On Fri, 2007-12-28 at 17:54 -0600, Jonathan Cast wrote:
 
  Programming languages are generally classified into three groups,
  imperative, functional, and logical.  The difference is in the style
  of programming encouraged (or mandated, for older languages) by the
  language.
 
  Usually the divide is imperative v. declarative with the four major
  paradigms (procedural, OO and logic, FP respectively) being  
  subgroups of
  those divisions.
 
 And your explanation of this classification is?
 
 I find the term `declarative' to be almost completely meaningless.

I was originally thinking of having the final sentence: There are no
clear, accepted meanings for any of these terms.

Many people find any, perhaps all, of the terms: functional, object
oriented, imperative to be almost completely meaningless.  Mostly the
terms have no prescriptive meaning, but rather are defined by example.

At any rate, I wasn't and didn't explain anything as that was not my
intention.  I was merely pointing out that your usage is against the
norms and in a way similar in its disconcertingness to saying,
American politics is classified into three groups, conservatives,
Democrats and libertarians.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread jerzy . karczmarczuk
Derek Elkins writes: 


Jonathan Cast wrote:

I find the term `declarative' to be almost completely meaningless.


I was originally thinking of having the final sentence: There are no
clear, accepted meanings for any of these terms.


Clear, no.
Accepted, yes. 


Let Jonathan Cast repeat that statement to people who organise conferences
on Declarative Programming, or those who assembled: 


http://en.wikipedia.org/wiki/Declarative_programming
http://burks.brighton.ac.uk/burks/foldoc/90/29.htm
(or http://foldoc.org/foldoc.cgi?declarative+language) 

I can't see what is the purpose of all your argument... 

Jerzy Karczmarczuk 



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread Derek Elkins
On Sun, 2008-01-06 at 22:31 +0100, [EMAIL PROTECTED]
wrote:
 Derek Elkins writes: 
 
  Jonathan Cast wrote:
  I find the term `declarative' to be almost completely meaningless.
  
  I was originally thinking of having the final sentence: There are no
  clear, accepted meanings for any of these terms.
 
 Clear, no.
 Accepted, yes. 

That was a conjunction: clear AND accepted.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread Jonathan Cast


On 6 Jan 2008, at 1:31 PM, [EMAIL PROTECTED] wrote:


Derek Elkins writes:

Jonathan Cast wrote:

I find the term `declarative' to be almost completely meaningless.

I was originally thinking of having the final sentence: There are no
clear, accepted meanings for any of these terms.


Clear, no.
Accepted, yes.
Let Jonathan Cast repeat that statement to people who organise  
conferences

on Declarative Programming, or those who assembled:
http://en.wikipedia.org/wiki/Declarative_programming
http://burks.brighton.ac.uk/burks/foldoc/90/29.htm
(or http://foldoc.org/foldoc.cgi?declarative+language)


To quote your last citation:

 declarative language: Any relational language or functional language.

Yes, the term `declarative' means something in the sense that we can  
tell whether any given language is declarative or not, so I should  
have been more clear.  To wit, I do not believe the term  
`declarative' has any single referent, even in the sense that the  
term `functional' has any single referent.  I find the only  
similarity between Haskell and Prolog to be that neither is imperative.



I can't see what is the purpose of all your argument...


Granted.

jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread Jonathan Cast

On 6 Jan 2008, at 12:13 PM, Derek Elkins wrote:


On Sun, 2008-01-06 at 09:45 -0800, Jonathan Cast wrote:

On 6 Jan 2008, at 3:02 AM, Derek Elkins wrote:


On Fri, 2007-12-28 at 17:54 -0600, Jonathan Cast wrote:


Programming languages are generally classified into three groups,
imperative, functional, and logical.


NB: I will stipulate that most people consider imperative vs.  
declarative to be a further hierarchy above this division.  I will  
even stipulate that most people consider the procedural vs. OO  
distinction other than a distraction :)  So I should have said:  
programming languages may be classified into three groups, ... ---  
where the groups themselves are generally agreed to exist, to be  
mutually exclusive, and to capture the vast majority of programming  
languages.



  The difference is in the style
of programming encouraged (or mandated, for older languages) by the
language.


Usually the divide is imperative v. declarative with the four major
paradigms (procedural, OO and logic, FP respectively) being
subgroups of
those divisions.


And your explanation of this classification is?

I find the term `declarative' to be almost completely meaningless.


I was originally thinking of having the final sentence: There are no
clear, accepted meanings for any of these terms.

Many people find any, perhaps all, of the terms: functional, object
oriented, imperative to be almost completely meaningless.   
Mostly the

terms have no prescriptive meaning, but rather are defined by example.


I was trying to work within this framework.  Most languages support  
both imperative and functional paradigms, these days; but there are  
patterns which are awkward in some languages and natural in others.   
That is what I consider the main distinction.


But, while there are patterns that are natural in all (at least  
structured) imperative languages and no or few non-imperative ones  
(like while loops), I don't know of any patterns that are natural in  
all declarative languages.




At any rate, I wasn't and didn't explain anything as that was not my
intention.  I was merely pointing out that your usage is against the
norms


As a statistical statement, this may be true.


and in a way similar in its disconcertingness to saying,
American politics is classified into three groups, conservatives,
Democrats and libertarians.


Or like saying American politics is classified into three groups,  
statists, Rothbardians, and Randians :)


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread Derek Elkins
On Sun, 2008-01-06 at 13:48 -0800, Jonathan Cast wrote:
 On 6 Jan 2008, at 1:31 PM, [EMAIL PROTECTED] wrote:
 
  Derek Elkins writes:
  Jonathan Cast wrote:
  I find the term `declarative' to be almost completely meaningless.
  I was originally thinking of having the final sentence: There are no
  clear, accepted meanings for any of these terms.
 
  Clear, no.
  Accepted, yes.
  Let Jonathan Cast repeat that statement to people who organise  
  conferences
  on Declarative Programming, or those who assembled:
  http://en.wikipedia.org/wiki/Declarative_programming
  http://burks.brighton.ac.uk/burks/foldoc/90/29.htm
  (or http://foldoc.org/foldoc.cgi?declarative+language)
 
 To quote your last citation:
 
   declarative language: Any relational language or functional language.
 
 Yes, the term `declarative' means something in the sense that we can  
 tell whether any given language is declarative or not, so I should  
 have been more clear.  To wit, I do not believe the term  
 `declarative' has any single referent, even in the sense that the  
 term `functional' has any single referent.  I find the only  
 similarity between Haskell and Prolog to be that neither is imperative.

Indeed, you've discovered it.  The definition of declarative is often
not imperative.  (Or vice versa, where, as I said earlier, these are
primarily defined by example rather than some predicate.)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread jerzy . karczmarczuk
Derek Elkins writes: 


Jonathan Cast wrote:


I find the only  
similarity between Haskell and Prolog to be that neither is imperative.


Indeed, you've discovered it.  The definition of declarative is often
not imperative. 


I disagree. Practically. (I won't discuss doctrinal matter nor linguistic
hairsplitting). 


The relational syntax of Prolog is more universal than the functional
notation, since you have logic variables and logical-non-determinism, and
- thus - the possibility of making predicates where the roles of input and
output parameters are not pre-assigned, - 


- but there is a *strong* (meaning important) functional layer within,
and plenty of Prolog algorithms are expressed similarly in Lisp or in
Haskell. 


Many non-deterministic ones have natural translation into the List monad.
Some circular definitions using laziness are related to ones with
non-instantiated logical variables. 


If you don't want to see similarities, you won't.  But I assure you that
I have profited enormously from tha *affinities* between functional and
logic approaches, and you won't convince me that declarative is without
substance. 

Jerzy Karczmarczuk 



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread Peter Verswyvelen
Jerzy wrote:
 The relational syntax of Prolog is more universal than the functional
 notation, since you have logic variables and logical-non-determinism, and

Isn't this just because mathematically, a function *is* a relation, but not 
vice versa? A relation being just a subset of a Cartesian product of sets, 
while a function being a special kind of relation for which each element in the 
domain has exactly one image? So relations are inherently much more universal 
than functions, but they are not that practical to work with (for a computer 
and/or human?).

Gee, I should not talk about math here, as you category theory guys know a 
thousand times more math than I do ;-)

Cheers,
Peter


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread jerzy . karczmarczuk
Peter Verswyvelen writes: 


Jerzy wrote:

The relational syntax of Prolog is more universal than the functional
notation, since you have logic variables and logical-non-determinism, and


Isn't this just because mathematically, a function *is* a relation, but not 
vice versa? A relation being just a subset of a Cartesian product of sets, 
while a function being a special kind of relation for which each element in the 
domain has exactly one image? So relations are inherently much more universal 
than functions, but they are not that practical to work with (for a computer 
and/or human?).


You are right. Yes, functions are subsets of relations, and the affinity
between logical and functional programming is all but accidental. But
relations ARE PRACTICAL! Prolog, Mercury, etc. use them. Leda, Life ...
Combined paradigms are not so exotic. 


Gee, I should not talk about math here, as you category theory guys know a 
thousand times more math than I do ;-)


On the contrary, you should.
Tell what is interesting for you.
Don't let hairsplitters monopolize the discussion of mathematical side of
Haskell. I am sick seeing that 75% of true deep discussion turns around ...
sorry for the swearword - 

... bottom. 

Jerzy Karczmarczuk 


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2008-01-06 Thread Derek Elkins
On Sun, 2008-01-06 at 23:28 +0100, [EMAIL PROTECTED]
wrote:
 Derek Elkins writes: 
 
  Jonathan Cast wrote:
 
  I find the only  
  similarity between Haskell and Prolog to be that neither is imperative.
  
  Indeed, you've discovered it.  The definition of declarative is often
  not imperative. 
 
 I disagree. Practically. (I won't discuss doctrinal matter nor linguistic
 hairsplitting). 

I wasn't being that serious there, though oftentimes declarative -is-
used in a way that is mostly meaningless or as a buzzword.  One thing I
will stand by, however, is that the consensus is that declarative and
imperative are meant to be exhaustive and ideally disjoint (though
where to draw the line is tricky), and thus in that sense, declarative
is not imperative (and, as I said originally though you elided it,
vice versa.)

 
 The relational syntax of Prolog is more universal than the functional
 notation, since you have logic variables and logical-non-determinism, and
  - thus - the possibility of making predicates where the roles of input and
 output parameters are not pre-assigned, - 
 
  - but there is a *strong* (meaning important) functional layer within,
 and plenty of Prolog algorithms are expressed similarly in Lisp or in
 Haskell. 
 
 Many non-deterministic ones have natural translation into the List monad.
 Some circular definitions using laziness are related to ones with
 non-instantiated logical variables. 
 
 If you don't want to see similarities, you won't.  But I assure you that
 I have profited enormously from tha *affinities* between functional and
 logic approaches, and you won't convince me that declarative is without
 substance. 

declarative is often used in a way where HTML, XML and such are
declarative languages.

At any rate, also in the elided part of my reply, was the statement that
imperative/declarative are often defined by example, and the above
is just such a case (unless you have a clear definition of functional
and logical).  This simply defines declarative to mean
functional+logical making declarative a pure name devoid of any
descriptive power.

To make this email constructive, however, I will propose a slightly less
fuzzy criterion: namely a declarative language is one that, via the
Curry-Howard correspondence(s), corresponds strongly with (a relatively
standard) logic.  This arguably can be used to give some oomph to the
usage of the term declarative rather than it being just a name, though
I'll not bother.  This recovers the fact that functional and logic
languages are declarative and gives a -specific- similarity.  It agrees
fairly well with the ordering more declarative than determined by
consensus.  Finally, it points the way to allowing other languages
rather than not (functional or logical) = not declarative.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-28 Thread Wolfgang Jeltsch
Am Freitag, 28. Dezember 2007 07:49 schrieben Sie:
 On Thu, 27 Dec 2007 18:19:47 +0200, Wolfgang Jeltsch
 [EMAIL PROTECTED] wrote:
  Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi:
  I'll have to trust you, because I cannot test it.
 
  let x=(1:x); y=(1:y) in x==y .
 
  I also cannot test this:
 
  let x=(1:x); y=1:1:y in x==y
 
  In these examples, x and y denote the same value but the result of x ==
  y is _|_ (undefined) in both cases.  So (==) is not really equality in
  Haskell but a kind of weak equality: If x doesn’t equal y, x == y is
  False, but if x equals y, x == y might be True or undefined.

 Thank you.

 I can only notice that y always has an even number of 1, which is not the
 case for x :-)

Both have an infinite number of 1.  Why do you say “always”?  It seems that 
you think of x and y as “variables” whose values change over time.  This is 
not the case.  They both have a single value for all time: the infinite list 
consisting only of 1.

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-28 Thread Wolfgang Jeltsch
Am Freitag, 28. Dezember 2007 07:49 schrieben Sie:
 On Thu, 27 Dec 2007 18:14:53 +0200, Wolfgang Jeltsch

 [EMAIL PROTECTED] wrote:
  Am Donnerstag, 27. Dezember 2007 15:53 schrieb Cristian Baboi:
  On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson
 
  [EMAIL PROTECTED] wrote:
   Absolutly.  Every expression in Haskell denotes a value.
   Now, we've not agreed what value means, but to me it is a value. :)
 
  It is one value, or several ?
 
  It is one value with parts that are values themselves.

 It is one value or a SET of values ?
 What are the parts ?

A set of values is again a value.  So is a list of values.  This is similar to 
C++ where a field of an object can again be an object.

[1..] is a value of type [Int] and every element can be considered a part of 
this value.

Best wishes,
Wolfgang

P.S.: Didn’t send this to the list in the first place.  I don’t like mailing 
lists which don’t set the Reply-To: field.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-28 Thread Wolfgang Jeltsch
Am Freitag, 28. Dezember 2007 08:12 schrieb Cristian Baboi:
 On Thu, 27 Dec 2007 17:35:54 +0200, Jonathan Cast

 [EMAIL PROTECTED] wrote:
  Only on Von Neuman machines.  Haskell implementations are not required
  to run on Von Neuman machines.  That's why the language is called
  functional.  (Imperative languages, by contrast, are just abstractions
  of the underlying Von Neuman architecture, which is probably the source
  of your confusion).

 Can you tell me what is it that make a language imperative ?

 When I learned about formal grammars and languages, there was no
 discussion about this.

This is because a formal language (set of words) only consideres the syntactic 
aspect and formal grammars are only about describing formal languages.  In 
contrast, imperative vs. declarative is about semantics.  A language is 
imperative if programs written in this language say how something should be 
done instead of what should be the outcome.  This description is rather 
informal, of course.

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Yitzchak Gale
Cristian Baboi wrote:
   http://en.wikipedia.org/wiki/First-class_object
 I'll guess that 5,9,12 does not apply to Haskell functions.

I think there is a basic semantic difference between
what the author of that article meant by the word
function and what we mean by that word when
we are talking about Haskell.

In the article, function means a concrete
data object that specifies how to compute something.

In Haskell, a function is closer to the mathematical
idea of a function. Functions specify relationships between
elements of certain types, and then the compiler
uses them to create code to do your computation.
But there is no obligation for a compiler to create
any concrete data structure that corresponds to
a function. Often it does in practice, but not
always.

On the other hand, functions are members of types
that are just like any other Haskell type. They are
first-class in that sense.

Like any type, only certain operations make
sense on functions. Strings can be compared to each
other for equality and written to a disk, and you
can take the logarithm of a float, but none of those
operations make sense for functions. In particular,
two functions are equal only if they produce
the same value for every input, and in general it is
impossible for a computer to check that.

-Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Sebastian Sylvan
On 12/27/07, Cristian Baboi [EMAIL PROTECTED] wrote:
   http://en.wikipedia.org/wiki/First-class_object

 The term was coined by Christopher Strachey in the context of functions
 as first-class citizens in the mid-1960's.[1]

 Depending on the language, this can imply:
 1.  being expressible as an anonymous literal value
 2.  being storable in variables
 3.  being storable in data structures
 4.  having an intrinsic identity (independent of any given name)
 5.  being comparable for equality with other entities
 6.  being passable as a parameter to a procedure/function
 7.  being returnable as the result of a procedure/function
 8.  being constructable at runtime
 9.  being printable
 10. being readable
 11. being transmissible among distributed processes
 12. being storable outside running processes

 I'll guess that 5,9,12 does not apply to Haskell functions.


I don't think this is meant as a list of requirements, but as examples
of what being first class *can* mean. So yes, in Haskell some of these
points don't make much sense.

-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Fwd: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi



--- Forwarded message ---
From: Cristian Baboi [EMAIL PROTECTED]
To: Yitzchak Gale [EMAIL PROTECTED]
Cc:
Subject: Re: [Haskell-cafe] Wikipedia on first-class object
Date: Thu, 27 Dec 2007 12:21:44 +0200

I think I found the answer to why functions cannot be written to files.

This is by design. Haskell must be free.
Enabling writing functions to files, might make it ilegal in some
countries. :-)


On Thu, 27 Dec 2007 11:10:21 +0200, Yitzchak Gale [EMAIL PROTECTED] wrote:


Like any type, only certain operations make
sense on functions. Strings can be compared to each
other for equality and written to a disk, and you
can take the logarithm of a float, but none of those
operations make sense for functions. In particular,
two functions are equal only if they produce
the same value for every input, and in general it is
impossible for a computer to check that.

-Yitz


 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail  
Servers.

  part000.txt - is OK
http://www.eset.com





 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Yitzchak Gale
Cristian Baboi wrote:
 I think I found the answer to why functions cannot be written to files.
 This is by design. Haskell must be free.
 Enabling writing functions to files, might make it ilegal in some
 countries. :-)

Ha, excellent!

I imagine that is what Haskell must have been
like before they invented the IO monad. It certainly
was safer then.

-Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
Thinking about files and types, I recalled that in Pascal files must have  
types.



On Thu, 27 Dec 2007 12:40:22 +0200, Yitzchak Gale [EMAIL PROTECTED] wrote:

I'm not sure that in Haskell one can say that storing a value of some  
type

to disk is an operation defined on that type.


It is. For example:

hPutStr :: Handle - String - IO ()

The result type of this function is IO (), which means an
IO action. In this case, the semantics of the action are
that, when performed, it writes the bytes into a file.




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Yitzchak Gale
Cristian Baboi wrote:
 Ah! You must have been thinking that function in Haskell are members of
 DATA types.
 Or, to put it another way, Haskell make no distinction between data types
 and function types.

Yes.

I wrote:
 Like any type, only certain operations make
 sense on functions...

 Yes, but one can store the result of an operation to disk except in the
 particular case the result happen to be a function.

 No, you can only store the result of an operation to
 disk in the particular case that the result type represents
 a list of bytes. Otherwise, you have to serialize it first...
 But it is not clear at all how you could define a general
 serialization method for functions.

 Isn't that confusing levels of abstractions ?
 Of course functions are bytes, 'cause they are already stored as bytes in
 RAM.

That is just the point. A function in Haskell is an abstraction,
not bytes in RAM.

The compiler might implement the same function in several places,
with different bytes in each place. Or it might decide to combine it
into other functions, and not store any bytes in RAM at all for this
function.

The function itself represents a way of doing a calculation. It is not an
object that can do the calculation.

 I'm not sure that in Haskell one can say that storing a value
 of some type to disk is an operation defined on that type.

 It is. For example:
 hPutStr :: Handle - String - IO ()

 And this is a property of the type String ?
 The function hPutStr appears in the definition of the type String ?

Ah, you are thinking of operation on a type in the OOP sense.
Sorry, I wasn't clear. When I said only certain operations make
sense on each type, I just meant that there are only certain
things you can do with the type. In Haskell, the things you can
do with a type are the functions you can define that mention that
type in their signature.

-Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi

On Thu, 27 Dec 2007 14:37:51 +0200, Yitzchak Gale [EMAIL PROTECTED] wrote:


I wrote:

Like any type, only certain operations make
sense on functions...


Yes, but one can store the result of an operation to disk except in  
the

particular case the result happen to be a function.



No, you can only store the result of an operation to
disk in the particular case that the result type represents
a list of bytes. Otherwise, you have to serialize it first...
But it is not clear at all how you could define a general
serialization method for functions.



Isn't that confusing levels of abstractions ?
Of course functions are bytes, 'cause they are already stored as bytes  
in

RAM.


That is just the point. A function in Haskell is an abstraction,
not bytes in RAM.

The compiler might implement the same function in several places,
with different bytes in each place. Or it might decide to combine it
into other functions, and not store any bytes in RAM at all for this
function.

The function itself represents a way of doing a calculation. It is not an
object that can do the calculation.



I think you try to say that the time cannot be stored.



 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi

On Thu, 27 Dec 2007 14:37:51 +0200, Yitzchak Gale [EMAIL PROTECTED] wrote:



I wrote:

Like any type, only certain operations make
sense on functions...


Yes, but one can store the result of an operation to disk except in  
the

particular case the result happen to be a function.



No, you can only store the result of an operation to
disk in the particular case that the result type represents
a list of bytes. Otherwise, you have to serialize it first...
But it is not clear at all how you could define a general
serialization method for functions.



Isn't that confusing levels of abstractions ?
Of course functions are bytes, 'cause they are already stored as bytes  
in

RAM.



That is just the point. A function in Haskell is an abstraction,
not bytes in RAM.



The compiler might IMPLEMENT the same function in several places,
with different bytes in each place. Or it might decide to combine it
into other functions, and not store any bytes in RAM at all for this
function.


See ?


The function itself represents a way of doing a calculation. It is not an
object that can do the calculation.


Then trees of functions are ...


I'm not sure that in Haskell one can say that storing a value
of some type to disk is an operation defined on that type.



It is. For example:
hPutStr :: Handle - String - IO ()



And this is a property of the type String ?
The function hPutStr appears in the definition of the type String ?



Ah, you are thinking of operation on a type in the OOP sense.
Sorry, I wasn't clear. When I said only certain operations make
sense on each type, I just meant that there are only certain
things you can do with the type. In Haskell, the things you can
do with a type are the functions you can define that mention that
type in their signature.


How can one define in the language STORAGE of things ?
Storage of numbers for example ?
You said that the TYPE of a function forbids me somehow to store it in a  
file.
Now I understand that not the type forbids me, but the lack of a function  
with apropriate types.






 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 14:02:36 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



Comparing functions is certainly possible in Haskell, but there's no
standard function that does it.
If course, it might not terminate, but the same is true for many other
comparable objects in Haskell, e.g., infinite lists (which are  
isomorphic to

Nat-T).


The list [1 .. ] is a single value in Haskell ?




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Fwd: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi


How about x below:

let x=(1:x) in x ?

Is x a single value in Haskell ?

--- Forwarded message ---
From: Cristian Baboi [EMAIL PROTECTED]
To: Lennart Augustsson [EMAIL PROTECTED]
Cc: haskell-cafe@haskell.org haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Wikipedia on first-class object
Date: Thu, 27 Dec 2007 16:08:58 +0200

On Thu, 27 Dec 2007 14:02:36 +0200, Lennart Augustsson
[EMAIL PROTECTED] wrote:


Comparing functions is certainly possible in Haskell, but there's no
standard function that does it.
If course, it might not terminate, but the same is true for many other
comparable objects in Haskell, e.g., infinite lists (which are  
isomorphic to

Nat-T).


The list [1 .. ] is a single value in Haskell ?




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Lennart Augustsson
Absolutly.  Every expression in Haskell denotes a value.
Now, we've not agreed what value means, but to me it is a value. :)

  -- Lennart

On Dec 27, 2007 3:28 PM, Cristian Baboi [EMAIL PROTECTED] wrote:


 How about x below:

 let x=(1:x) in x ?

 Is x a single value in Haskell ?

 --- Forwarded message ---
 From: Cristian Baboi [EMAIL PROTECTED]
 To: Lennart Augustsson [EMAIL PROTECTED]
 Cc: haskell-cafe@haskell.org haskell-cafe@haskell.org
 Subject: Re: [Haskell-cafe] Wikipedia on first-class object
 Date: Thu, 27 Dec 2007 16:08:58 +0200

 On Thu, 27 Dec 2007 14:02:36 +0200, Lennart Augustsson
 [EMAIL PROTECTED] wrote:

  Comparing functions is certainly possible in Haskell, but there's no
  standard function that does it.
  If course, it might not terminate, but the same is true for many other
  comparable objects in Haskell, e.g., infinite lists (which are
  isomorphic to
  Nat-T).

 The list [1 .. ] is a single value in Haskell ?




  Information from NOD32 
 This message was checked by NOD32 Antivirus System for Linux Mail Servers.
  part000.txt - is OK
 http://www.eset.com
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 4:57 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 12:40:22 +0200, Yitzchak Gale [EMAIL PROTECTED]  
wrote:



I wrote:

On the other hand, functions are members of types
that are just like any other Haskell type. They are
first-class in that sense.


Cristian Baboi wrote:

I guess that would apply to any typed language.



Perhaps. But for many typed languages, it is not
practical to use. There may be problems with type
safety, or it may create a program that would
be considered hard to understand.

For example, in Haskell, you create a list of functions just
the same way you create a list of anything else.
You can then map a value across the functions, or
fold the functions together with the composition
operator, etc. These are normal, clear idioms
in Haskell that could easily appear in any simple
program. That is also true for some other functional
programming languages, but it is rare for
imperative ones.

Sometimes there is a particular style within a language
that works something like this. For example,
you can use C++ with STL that way in a certain sense.



Anyway, that is what I think it means when we say that
functions are first-class in Haskell.


Ah! You must have been thinking that function in Haskell are  
members of DATA types.
Or, to put it another way, Haskell make no distinction between data  
types and function types.



Like any type, only certain operations make
sense on functions. Strings can be compared to each
other for equality and written to a disk, and you
can take the logarithm of a float, but none of those
operations make sense for functions. In particular,
two functions are equal only if they produce
the same value for every input, and in general it is
impossible for a computer to check that.


Yes, but one can store the result of an operation to disk except  
in the

particular case the result happen to be a function.



No, you can only store the result of an operation to
disk in the particular case that the result type represents
a list of bytes. Otherwise, you have to serialize it first.


Happily, Haskell has some cool tools for easily creating  
serialization

methods. And there are a number methods that are already
provided in the libraries for many types and for many
uses - the Read and Show classes are just one example.



But it is not clear at all how you could define a general
serialization method for functions. If you can come up
with one, please post it to Hackage. :)


Isn't that confusing levels of abstractions ?
Of course functions are bytes, 'cause they are already stored as  
bytes in RAM.


Only on Von Neuman machines.  Haskell implementations are not  
required to run on Von Neuman machines.  That's why the language is  
called functional.  (Imperative languages, by contrast, are just  
abstractions of the underlying Von Neuman architecture, which is  
probably the source of your confusion).


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



Absolutly.  Every expression in Haskell denotes a value.
Now, we've not agreed what value means, but to me it is a value. :)


It is one value, or several ?


 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Lennart Augustsson
One value.  One infinite value.

On Dec 27, 2007 3:53 PM, Cristian Baboi [EMAIL PROTECTED] wrote:

 On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson
 [EMAIL PROTECTED] wrote:

  Absolutly.  Every expression in Haskell denotes a value.
  Now, we've not agreed what value means, but to me it is a value. :)

 It is one value, or several ?


  Information from NOD32 
 This message was checked by NOD32 Antivirus System for Linux Mail Servers.
  part000.txt - is OK
 http://www.eset.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Wolfgang Jeltsch
Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi:
 I'll have to trust you, because I cannot test it.

 let x=(1:x); y=(1:y) in x==y .

 I also cannot test this:

 let x=(1:x); y=1:1:y in x==y

In these examples, x and y denote the same value but the result of x == y is 
_|_ (undefined) in both cases.  So (==) is not really equality in Haskell but 
a kind of weak equality: If x doesn’t equal y, x == y is False, but if x 
equals y, x == y might be True or undefined.

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi

I'll have to trust you, because I cannot test it.

let x=(1:x); y=(1:y) in x==y .

I also cannot test this:

let x=(1:x); y=1:1:y in x==y





On Thu, 27 Dec 2007 17:29:12 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



One value.  One infinite value.

On Dec 27, 2007 3:53 PM, Cristian Baboi [EMAIL PROTECTED] wrote:


On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson
[EMAIL PROTECTED] wrote:

 Absolutly.  Every expression in Haskell denotes a value.
 Now, we've not agreed what value means, but to me it is a value. :)

It is one value, or several ?


 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail  
Servers.

 part000.txt - is OK
http://www.eset.com





 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail  
Servers.

  part000.txt - is OK
  part001.htm - is OK
http://www.eset.com





 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 8:53 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



Absolutly.  Every expression in Haskell denotes a value.
Now, we've not agreed what value means, but to me it is a value. :)


It is one value, or several ?


It is one and the same value, now and for ever, and in every  
incarnation on every Haskell machine.


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 8:08 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 14:02:36 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



Comparing functions is certainly possible in Haskell, but there's no
standard function that does it.
If course, it might not terminate, but the same is true for many  
other
comparable objects in Haskell, e.g., infinite lists (which are  
isomorphic to

Nat-T).


The list [1 .. ] is a single value in Haskell ?


Yes.  Of course.

jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 8:28 AM, Cristian Baboi wrote:



How about x below:

let x=(1:x) in x ?

Is x a single value in Haskell ?


(let x=1:x in x) is.  x went out of scope a couple of lines back.

jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 9:34 AM, Cristian Baboi wrote:


I'll have to trust you, because I cannot test it.

let x=(1:x); y=(1:y) in x==y .

I also cannot test this:

let x=(1:x); y=1:1:y in x==y


Correct.  You could try proving it.

Or you could try proving that these expressions are equal to _|_.   
Equality is defined on lists because we frequently use finite lists,  
where it makes sense.  Infinite lists are more like functions ---  
useful in the intermediate stages of computation, but really  
orthogonal to everything you think you know about computing.


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Wolfgang Jeltsch
Am Donnerstag, 27. Dezember 2007 16:57 schrieb Cristian Baboi:
 On Thu, 27 Dec 2007 17:52:19 +0200, Jonathan Cast
  Which is why Haskell treats IO as a domain specific language.

 Good to know. I intended to use Haskell for algorithms, but it seems it is
 not so good at them.

Why is I/O needed for algorithms?

And the fact that I/O is embedded into Haskell as a kind of a domain specific 
language doesn’t mean that Haskell is bad at I/O.  As Simon Peyton Jones put 
it: Haskell is the world’s finest imperative programming language.

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Wolfgang Jeltsch
Am Donnerstag, 27. Dezember 2007 15:53 schrieb Cristian Baboi:
 On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson

 [EMAIL PROTECTED] wrote:
  Absolutly.  Every expression in Haskell denotes a value.
  Now, we've not agreed what value means, but to me it is a value. :)

 It is one value, or several ?

It is one value with parts that are values themselves.

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Isaac Dupree

Bulat Ziganshin wrote:

here T is any type. you said that values of ANY TYPE can be saved to
disk, so show us the way


...


try to prove that this mean that value of ANY type may be saved to
disk


Run another program that uses lots of memory, and watch the entire 
Haskell program's memory be swapped out to disk.  Better yet, 
suspend-to-disk (or hibernate) your computer.  Voila -- values of any 
and all types have been saved to disk!  In a limited fashion, of course.


Isaac

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 18:13:57 +0200, Wolfgang Jeltsch  
[EMAIL PROTECTED] wrote:



Am Donnerstag, 27. Dezember 2007 16:57 schrieb Cristian Baboi:

On Thu, 27 Dec 2007 17:52:19 +0200, Jonathan Cast
 Which is why Haskell treats IO as a domain specific language.

Good to know. I intended to use Haskell for algorithms, but it seems it  
is

not so good at them.



Why is I/O needed for algorithms?


And the fact that I/O is embedded into Haskell as a kind of a domain  
specific
language doesn’t mean that Haskell is bad at I/O.  As Simon Peyton Jones  
put

it: Haskell is the world’s finest imperative programming language.



An algorithm is a finite recipe that allow one to solve a class of  
problems in a mechanical way.

To be able to use the algorithm one must be able to read it.
To be able to communicate the algorithm, one must be able to write it.

When I mentioned that IO is not needed for pebbles, I was joking.


 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 18:14:53 +0200, Wolfgang Jeltsch  
[EMAIL PROTECTED] wrote:



Am Donnerstag, 27. Dezember 2007 15:53 schrieb Cristian Baboi:

On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson

[EMAIL PROTECTED] wrote:
 Absolutly.  Every expression in Haskell denotes a value.
 Now, we've not agreed what value means, but to me it is a value. :)

It is one value, or several ?



It is one value with parts that are values themselves.


It is one value or a SET of values ?
What are the parts ?





 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 18:19:47 +0200, Wolfgang Jeltsch  
[EMAIL PROTECTED] wrote:



Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi:

I'll have to trust you, because I cannot test it.

let x=(1:x); y=(1:y) in x==y .

I also cannot test this:

let x=(1:x); y=1:1:y in x==y


In these examples, x and y denote the same value but the result of x ==  
y is
_|_ (undefined) in both cases.  So (==) is not really equality in  
Haskell but

a kind of weak equality: If x doesn’t equal y, x == y is False, but if x
equals y, x == y might be True or undefined.


Thank you.

I can only notice that y always has an even number of 1, which is not the  
case for x :-)




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 17:35:54 +0200, Jonathan Cast  
[EMAIL PROTECTED] wrote:



Only on Von Neuman machines.  Haskell implementations are not required  
to run on Von Neuman machines.  That's why the language is called  
functional.  (Imperative languages, by contrast, are just abstractions  
of the underlying Von Neuman architecture, which is probably the source  
of your confusion).


Can you tell me what is it that make a language imperative ?

When I learned about formal grammars and languages, there was no  
discussion about this.




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe