[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]

CC:   GLS at SU-AI, bug-lisp at MIT-AI, bug-lispm at MIT-AI 

    11-Jun-79  1907        HENRY at MIT-AI (Henry Lieberman)       CASEGO    
    Date: 11 JUN 1979 2209-EDT
    From: HENRY at MIT-AI (Henry Lieberman)
    Subject: CASEGO
    To: GLS at SU-AI

    What you really have in the examples you give to show
    the use of CASEGO is a loop. I think it should be coded
    as such, either by the use of DO or auxiliary functions
    rather than your proposed CASEGO.

		  ((BAR) ...)
		  (T (... "I'll assume BAR") (CASEGO-EXAMPLE 'BAR))))

    I think your proposal is like coding a loop using GO, which
    is generally acknowledged to be less winning.

This is true, although what you have written is not semantically
equivalent (though functionally equivalent) in that it re-performs
the dispatch needlessly.  This corresponds to the situation with the
famous Boehm-Jacopini "theorem", which shows that any program can
be made "structured" provided that a number of boolean variables
and redundant tests are introduced.  Also, without LABEL or LABELS
or some such I can't write the above in MacLISP "in place".

A better way around the problem using functions would be just to do
	       ((BAR) (BAR-CASE))
	       ((FOO) ...)
	       (T (... "assume BAR") (BAR-CASE)))
Again, in MacLISP I can't really write this "in place" and take
advantage of local variables.

I just used the name GO by analogy with the behavior in a PROG.
Actually, I might phrase my request entirely without reference to
GO (because some people dislike GO), and say that I want a construct
CASERETRY such that
	       ((FOO) FOO1)
	       ((BAZ QUUX) BAZQUUX1)
expands into
				   (SELECTQ X
					    ((FOO) (FOO-CASE))
					    ((BAR) (BAR-CASE))
					    ((BAZ QUUX) (BAZQUUX-CASE))
					    (T (DEFAULT-CASE))))))
where SELECTQ represents the more primitive simple-dispatch operation.
Now this uses no GOs, and therefore must be generally acknowledged to be
more winning, right?