Re: Ideal computer language from scratch?




Betov wrote:
"Dragontamer" <prtiglao@xxxxxxxxx> écrivait news:1140812218.618548.154330
@u72g2000cwu.googlegroups.com:

[... Pathetic bullshits... ]

Confusing Methods and Language will never help
you at understanding anything. Mind you, the
day Assembly will not allow a programmer to do
something, no HLL will ever do this something
either.

You are welcome to an opinion.

But regardless; could you explain to me (don't even need to program or
show code) how you'd
implement the following functional methods in assembly language
(without resorting
to using or creating an external scripting language of some sort,
because you'd just
be creating another language to fill the holes that Assembly cannot do
by itself):

1. First order Functions; aka, functions as data.
2. Defining functions as combinations of data
3. Currying
4. Lazy data structures (such as an infinitly long list)
5. Guarentee a lack of side effects in a specific function
6. Creating a function during runtime

Mind you; i remember Randall writing how to pass data by lazy
evaluation in his
"Art of Assembly" book. So if Randall can come up with number 4, i'm
sure you can as
well :-p

Now; to disprove your statement; all 6 of those exist in Haskell, thus
it is something
Haskell (a very HLL) can do, that assembly cannot do.

1. Haskell basically only deals with functions. All data is concieved
as a function
that only returns one value.

2. The foldr example in my last post was Haskell code.

3. Again, the concept in my last post was a currying example in
Haskell.

4. fibs = 1 : 1 : zipWith (+) fibs (tail fibs)

Again, haskell. Scheme also provides a way for lazy evaluation wit
"delay" and "force"

5. Well, more of a feature of Haskell and not really anything you can
do in assembly.
Haskell guarentees a lack of side-effects for the majority of the
functions you define,
allowing the programmer to know that the function will always work the
same regardless.

So I cheated by including this one :) knowing Assembly simply cannot
guarentee this.
(else, it wouldn't be assembly, would it). But with that said, it is a
programming method
that Haskell supports that Assembly doesn't.

Now, to stop confusion: Haskell allows side effects through control
structures called
"Monads". So yes, you can create a pseudo random generator.

6. Haskell can do this with lambda function. Ditto with Scheme and
Lisp, and python.
It *defines* a new function; during runtime. So you can read in a file
for example, and
create a new function based on the file's inputs, or the user's input,
or data from
a network.

Again, explain how to do these in Assembly without creating another
(scripting) language
for support. The only way I (personally) can think of doing these in
Assembly is by
writing a simplified Haskell interpreter and embedding it into assembly
:-p

(well, enough of an interpreter to support runtime "lambda" statements,
and represent
functions during runtime)

Now seriously: I don't think you could learn *any* core concept of
"functional programming"
(the term used to describe programming using lazy evaluation, runtime
functions,
generators, lambda etc. etc.) in assembly language.

Actually, again, i remember Randall talking about how to do Lazy Eval
in Assembly, so
hope is not lost :-p So i change my stance to *most* concpets of
functional programming
can't be done in assembly.

--Dragontamer

.



Relevant Pages

  • Re: How come Ada isnt more popular?
    ... if you write some of the I/O parts in a systems programming ... I think that Ada *and* Haskell will make an interesting ... I wonder why one wouldn't just use Monads in most cases? ... functional language as number of people seem to think. ...
    (comp.lang.ada)
  • Re: Ideal computer language from scratch?
    ... to using or creating an external scripting language of some sort, ... A list of thunks would be one ways. ... Haskell can do, ... "functional programming" ...
    (alt.lang.asm)
  • Re: Newbie Question: Is it allowed for the function to change the value of parameters?
    ... functional programming with side ... Typical Lisp code doesn't use Lambda to wrap all the imperative stuff into a referentially transparent framework. ... Haskell is different in that respect. ... now that's something that isn't directly representable in a compiled language. ...
    (comp.lang.functional)
  • Re: Maths and programming languages.
    ... some graphing in maths but I am also looking at a programming language ... to have in a language like overflow detection. ... mathematician (the logician Haskell Curry). ...
    (sci.math)
  • Re: c to c++
    ... If you're lazy, you shouldn't be programming in the first place, no ... matter the language. ...
    (comp.lang.c)