Quoting
md9slj@mdstud.chalmers.se — 2001-09-03 14:09:29
Hi.
I just wondered why the quoting machanism in joy
(used (among other things) for providing aruments to higher-order
words, like map)
makes it possible to destructure the list.
I.e why is
[dup *] uncons
possible ?
(Yes, Iv'e read Further Frequently Asked Questions about Joy 3.)
Doesn't this mean that a compiler can't merge the code inside the
quotation (because it's not opaque) ?
And doesn't this mean that evaluating such a quotation with a stack
means effectively interpreting and traversing through the
list/quotation ?
Say in lisp, quotation is used to more easily write (pair-based)
datastructures which may or may not represent programs, in the latter
case reflecting over the object program with the meta program.
But most often (I think) one needs meta-programming one does it with
macros wich are used at macro-expand-time (~= compile-time).
So the meta-programming overhead usually doesn't affect the run-time.
So I'm a little suprised that quotations as used for higher-order
words support destructuring as opposed to building a lambda-closure
and passing that to a higher-order function in an applicative
language.
I'm not against the idea that one can have a program representation
in a structure (in this case a list) for meta-programming. It just
feels a little strange that this is defaulty used for higher-order
words.
Is it for symmetry or simpliness ?
Or implementation ease ?
I would perhaps prefer one construct that puts a program fragment on
stack that's indivisable (works like lambda in that it delays (not
neccesary closure-building)) and then probably additionally keep the
current quotation mechanism for lists and meta-programming (which
works like lisps quotation)
Can someone enlighten me ?
(Hmm, does [1 2 3] put a list with the numbers 1,2,3 or a list with
the stack-transformers/functions that put 1,2,3 on the stack
respectively ?
If the latter, then quotation already has to do with program
fragments ...
Maybe this is a/the justification ?
)
--
Stefan Lj
Jack Waugh — 2001-09-05 14:27:23
I don't know why the designers of Joy want quotations to be divisable
by default, but I can answer your last question
> (Hmm, does [1 2 3] put a list with the numbers 1,2,3 or a list with
> the stack-transformers/functions that put 1,2,3 on the stack
> respectively ?
Both. In Joy, the literals 1, 2, 3, etc., in addition to
representing numbers, also _are_ stack transformers that leave
themselves on the stack if executed.
But whereas you can say [2] i, you can't say 2 i. Hmm.
Manfred von Thun — 2001-09-06 06:51:54
On Mon, 3 Sep 2001
md9slj@... wrote:
> Hi.
>
> I just wondered why the quoting machanism in joy
> (used (among other things) for providing aruments to higher-order
> words, like map)
> makes it possible to destructure the list.
>
> I.e why is
> [dup *] uncons
> possible ?
>
> (Yes, Iv'e read Further Frequently Asked Questions about Joy 3.)
The question is dealt with just a little towards the end of
the "Rationale for Joy" paper.
> Doesn't this mean that a compiler can't merge the code inside the
> quotation (because it's not opaque) ?
I had not thought about this, but yes, you are right, a compiler
will have to be clever to be able to know whether a quotation is
ever going to be executed or just treated as data.
> And doesn't this mean that evaluating such a quotation with a stack
> means effectively interpreting and traversing through the
> list/quotation ?
>
> Say in lisp, quotation is used to more easily write (pair-based)
> datastructures which may or may not represent programs, in the latter
> case reflecting over the object program with the meta program.
> But most often (I think) one needs meta-programming one does it with
> macros wich are used at macro-expand-time (~= compile-time).
> So the meta-programming overhead usually doesn't affect the run-time.
>
> So I'm a little suprised that quotations as used for higher-order
> words support destructuring as opposed to building a lambda-closure
> and passing that to a higher-order function in an applicative
> language.
>
> I'm not against the idea that one can have a program representation
> in a structure (in this case a list) for meta-programming. It just
> feels a little strange that this is defaulty used for higher-order
> words.
>
> Is it for symmetry or simpliness ?
> Or implementation ease ?
The public myth:
"Like Aphrodite, who emerged from a sea-shell fully formed,
perfect and beautiful, so Joy emerged from the mind of its
Father fully formed, perfect and beautiful."
The private truth:
"The history of Joy has been a Comedy of Errors. It started
as a Prolog program that elminated Prolog variables from
some constructions involving binary relations, inspired by
work by Quine and Backus. At one stage I even had a combinator
for binary relations which mimicks a Wheatstone bridge in
electrical circuitry. Use? I never found one!
And then ... and then .. and then .."
Well, symmetry, simplicity, implementation ease - all of those.
But your question made me think more about it, and I'll try to
find an actual case.
I'll also answer your other posting in a few days.
- Manfred
Manfred von Thun — 2001-09-11 08:04:40
Our University is in the process of installing a new machine
for our web pages, and new URLs (!).
In the process of moving my pages all sorts of horrible things
happened to them. It seems that pages that had the .html extension
can be viewed properly as before. But you might see a version
of the file as it was 10 days ago - I am furious, as you might
imagine. On the other hand, pages with a .joy or some other
extension for a good reason don't link through at all. Furious.
I can't even log onto the new machine to fix things !!!
Please be patient for a few days.
Furiouser and furiouser
- Manfred
(no author) — 2001-09-11 10:28:11
At Mon, 10 Sep 2001 14:44:51 +1100,
Manfred von Thun wrote:
>
>
> On Fri, 7 Sep 2001 rrt@... wrote:
>
> > <Pine.PMDF.3.96.1010906170130.538974807A-100000@...>
> > User-Agent: Wanderlust/2.6.0 (Twist And Shout) SEMI/1.14.3 (Ushinoya)
> > FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 MULE XEmacs/21.4
> > (patch 4) (Artificial Intelligence) (i686-pc-linux)
> > MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
> > Content-Type: text/plain; charset=US-ASCII
> >
> > > I'm so glad that you are still here with us. I had seen your name
> > > on the conference list, of course. Your offer to give a paper is
> > > of course most welcome. In case anybody else also wants to give a
> > > paper on Joy, you should divide the job in some way or another.
> > > I'll be glad to held in whatever way is possible. In particular,
> > > you are welcome to "snarf" (I believe that is a technical term)
> > > as much from the Joy papers as you like. I'll write again with
> > > some suggestions, but that will be after the weekend.
> >
> > I don't have much time for writing at the moment (I still have to
> > write my own paper), so if you could help with that, that would be
> > excellent. I was thinking mostly of an introduction to the language
> > and some of the interesting correspondences with Forth; other Forthers
> > on the group are best placed to help with that (Billy?). Anyway, I've
> > suggested the idea to the program chair, Peter Knaggs, too.
>
> The conference prospectus asks for 8 pages. My initial draft would be:
>
> Pages Content From
>
> 1 Introduction (Joy synopsis) + Forth correspondence
> 2 Arithmetic (Tutorial)
> 3 Other types "
> 4 Combinators "
> 5 Sample progs " or from elsewhere
> 6 Substitutivity (Math Found)
> 7 No environment (Joy FAQ) + Forth ?
> 8 Algebra (Algebra) + Forth ?
>
> If you like, I shall cobble together a (probably too long)
> selection from those papers in HTML. You can then shorten it
> and turn it into one of the required formats.
>
> Does that sound acceptable?
Sounds excellent.
Manfred von Thun — 2001-10-01 02:17:00
On Thu, 6 Sep 2001, Manfred von Thun wrote:
> On Mon, 3 Sep 2001 md9slj@... wrote:
> > I just wondered why the quoting machanism in joy
> > (used (among other things) for providing aruments to higher-order
> > words, like map)
> > makes it possible to destructure the list.
> >
> > I.e why is
> > [dup *] uncons
> > possible ?
[..]
> > And doesn't this mean that evaluating such a quotation with a stack
> > means effectively interpreting and traversing through the
> > list/quotation ?
> >
> > Say in lisp, quotation is used to more easily write (pair-based)
> > datastructures which may or may not represent programs, in the latter
> > case reflecting over the object program with the meta program.
> > But most often (I think) one needs meta-programming one does it with
> > macros wich are used at macro-expand-time (~= compile-time).
> > So the meta-programming overhead usually doesn't affect the run-time.
See (5) optimiser below
> > So I'm a little suprised that quotations as used for higher-order
> > words support destructuring as opposed to building a lambda-closure
> > and passing that to a higher-order function in an applicative
> > language.
> >
> > I'm not against the idea that one can have a program representation
> > in a structure (in this case a list) for meta-programming. It just
> > feels a little strange that this is defaulty used for higher-order
> > words.
> >
> > Is it for symmetry or simpliness ?
> > Or implementation ease ?
> Well, symmetry, simplicity, implementation ease - all of those.
> But your question made me think more about it, and I'll try to
> find an actual case.
Lots of possibilities, and they all fall under the concept of
meta-programming, i.e. programming that takes programs as data:
(1) interpreter
(2) symbolic programming (similar to the symbolic differentiation
programs in some Lisp books)
(3) pretty printer ("will it fit onto one line?")
(4) compiler (sigh - one day?)
(5) optimiser (e.g. delete "dup pop")
(6) tutorial
So, lots of possibilities, but only two examples: (1) the 2 Joy-in-Joy
interpreters in the Pearls of Joy, and (6) the tutorial library.
Under (4) compiler would belong any translator to another language.
Maybe this will give people some ideas.
- Manfred