Re: [stack] otuto design comments?

stevan apter — 2004-05-15 15:31:06

well, it appears to be an impressive piece of work, but i'm having
some trouble penetrating getting the "aerial overview" sense of the
terrain. perhaps someone more familiar with the mainstream
functional languages (haskel, ocaml, &c.) would feel more at home.

what would help, i think, is half-a-dozen (annotated) examples, drawn
from the familiar list:

fibonacci
factorial
quicksort
&c.



----- Original Message -----
From: "andrew cooke" <andrew@...>
To: "concatenative list" <concatenative@yahoogroups.com>
Sent: Saturday, May 15, 2004 10:09 AM
Subject: [stack] otuto design comments?


>
> i've finished an intial draft of the otuto design (and have implemented
> the parser code for rules).
>
> http://www.acooke.org/andrew/diary/2004/may/15.html
> http://www.acooke.org/andrew/diary/2004/may/otuto-draft-design-2.html
>
> any comments would be welcome.
>
> cheers,
> andrew
>
> --
> ` __ _ __ ___ ___| |_____ work web site: http://www.ctio.noao.edu/~andrew
> / _` / _/ _ \/ _ \ / / -_) personal web site: http://www.acooke.org/andrew
> \__,_\__\___/\___/_\_\___| list: http://www.acooke.org/andrew/compute.html
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>

andrew cooke — 2004-05-15 22:20:45

thanks. i've updated the document to include two versions of fibonacci
(one with accumulator). since i'm unsure how to program quicksort (which
would really be heapsort in a pure functional language, i think, since
there's no destructive update) i haven't added that (one of the things i
want to look at is how to add control operations to make things like
heapsort simple, but my problem may also be that i simply don't yet have
any experience programming a language like this).

i've also clarified the meta-programming part, which is what i've been
working on most recently.

cheers,
andrew

stevan apter said:
> well, it appears to be an impressive piece of work, but i'm having
> some trouble penetrating getting the "aerial overview" sense of the
> terrain. perhaps someone more familiar with the mainstream
> functional languages (haskel, ocaml, &c.) would feel more at home.
>
> what would help, i think, is half-a-dozen (annotated) examples, drawn
> from the familiar list:
>
> fibonacci
> factorial
> quicksort
> &c.


--
` __ _ __ ___ ___| |_____ work web site: http://www.ctio.noao.edu/~andrew
/ _` / _/ _ \/ _ \ / / -_) personal web site: http://www.acooke.org/andrew
\__,_\__\___/\___/_\_\___| list: http://www.acooke.org/andrew/compute.html

Slava Pestov — 2004-05-15 22:45:15

andrew cooke wrote:

>(which
>would really be heapsort in a pure functional language, i think, since
>there's no destructive update)
>
How important is being side-effect free in a concatenative language?
Forth for example, is perhaps as full of side effects as it gets. :-)

Slava

andrew cooke — 2004-05-15 23:10:19

i don't know anything about forth (and little more about concatenative
languages in general, this is all reather new), but my experience with
functional languages suggests that being free of side-effects is usually
useful, but occasionaly frustrating (less so as you become more
experienced, but i don't know whether it tends to zero, or some smaller
value).

in the case of tuto, more pragmatically, it simplifies the language
conceptually. while the syntax is rather complicated, i know how to
handle that. i'm less sure about implementing languages than i am about
parsing, so it seemed to make sense to make the semantics as simple as
possible.

(i have no great illusions about otuto being the languge that everyone
needs - it's satisfying a "private itch")

andrew

Slava Pestov said:
> andrew cooke wrote:
>
>>(which
>>would really be heapsort in a pure functional language, i think, since
>>there's no destructive update)
>>
> How important is being side-effect free in a concatenative language?
> Forth for example, is perhaps as full of side effects as it gets. :-)
>
> Slava

--
` __ _ __ ___ ___| |_____ work web site: http://www.ctio.noao.edu/~andrew
/ _` / _/ _ \/ _ \ / / -_) personal web site: http://www.acooke.org/andrew
\__,_\__\___/\___/_\_\___| list: http://www.acooke.org/andrew/compute.html

stevan apter — 2004-05-16 00:23:30

thanks andrew.

{ fib-slow | 0 } => { | 0 }
{ fib-slow | 1 } => { | 1 }
{ fib-slow | 'n } => { + fib-slow - $1 $'n fib-slow - | 2 'n }

what's going on in that final line? what is it supposed to mean?


----- Original Message -----
From: "andrew cooke" <andrew@...>
To: <concatenative@yahoogroups.com>
Sent: Saturday, May 15, 2004 6:20 PM
Subject: Re: [stack] otuto design comments?


>
> thanks. i've updated the document to include two versions of fibonacci
> (one with accumulator). since i'm unsure how to program quicksort (which
> would really be heapsort in a pure functional language, i think, since
> there's no destructive update) i haven't added that (one of the things i
> want to look at is how to add control operations to make things like
> heapsort simple, but my problem may also be that i simply don't yet have
> any experience programming a language like this).
>
> i've also clarified the meta-programming part, which is what i've been
> working on most recently.
>
> cheers,
> andrew
>
> stevan apter said:
> > well, it appears to be an impressive piece of work, but i'm having
> > some trouble penetrating getting the "aerial overview" sense of the
> > terrain. perhaps someone more familiar with the mainstream
> > functional languages (haskel, ocaml, &c.) would feel more at home.
> >
> > what would help, i think, is half-a-dozen (annotated) examples, drawn
> > from the familiar list:
> >
> > fibonacci
> > factorial
> > quicksort
> > &c.
>
>
> --
> ` __ _ __ ___ ___| |_____ work web site: http://www.ctio.noao.edu/~andrew
> / _` / _/ _ \/ _ \ / / -_) personal web site: http://www.acooke.org/andrew
> \__,_\__\___/\___/_\_\___| list: http://www.acooke.org/andrew/compute.html
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>

andrew cooke — 2004-05-16 01:18:09

stevan apter said:
> thanks andrew.
>
> { fib-slow | 0 } => { | 0 }
> { fib-slow | 1 } => { | 1 }
> { fib-slow | 'n } => { + fib-slow - $1 $'n fib-slow - | 2 'n }

there are two lists, one of operations and of values. they meet at the
"|". the head of the operations list is the operation that's applied
(application is simply rewriting the two lists according to the
appropriate rule) so if n=2 the evaluation goes something like:

{ fib-slow | 2 }
defn of fib-slow, with 'n=2
-> { + fib-slow - $1 $2 fib-slow - | 2 2 }
subtraction (head of operations list is '-', top two values are 2 and 2
-> { + fib-slow - $1 $2 fib-slow | 0 }
defn of fib-slow applied to zero
-> { + fib-slow - $1 $2 | 0 }
$x is a function that returns x ('quotation' in the doc), so
-> { + fib-slow - $1 | 2 0 }
same for $1
-> { + fib-slow - | 1 2 0 }
subtraction
-> { + fib-slow | 1 0 }
defn of fib-slow applied to 1
-> { + | 1 0 }
addition
-> { | 1 }

andrew

>
> what's going on in that final line? what is it supposed to mean?

--
` __ _ __ ___ ___| |_____ work web site: http://www.ctio.noao.edu/~andrew
/ _` / _/ _ \/ _ \ / / -_) personal web site: http://www.acooke.org/andrew
\__,_\__\___/\___/_\_\___| list: http://www.acooke.org/andrew/compute.html