[mercury-users] Re: Lisp-like syntax for Mercury (Mercury & macros)

Milan Zamazal pdm at zamazal.org
Thu Jun 13 22:16:40 AEST 2002

>>>>> "RAO" == Richard A O'Keefe <ok at cs.otago.ac.nz> writes:

    RAO> I completely disagree.  My suggestion is precisely that square
    RAO> bracket notation should be used for lists, and round
    RAO> parenthesis notation should be used for other compound terms,
    RAO> goals included.  So a plain term such as 'ok(Result)' I would
    RAO> notate as '(ok Result)', ******NO****** as a list.


    RAO> While (define ...) and (case ...) are "special forms", the
    RAO> macros (if macros they be) that implement them would not be the
    RAO> macros that Lisp uses.  Since normal Lisp function calls and
    RAO> normal Lisp macro calls and normal Lisp special forms would not
    RAO> appear in Lispy-Mercury, I don't see their relevance, other
    RAO> than analogy.

    RAO> Prolog has control structurs that use normal term syntax, such
    RAO> as setof/3.  I don't see any difficulty with control structures
    RAO> having normal term syntax in Lispy-Mercury.


    RAO> What woudl you want explicit backquotes for?

Well, I should clarify that the transformer from Lispy-Mercury to
Mercury would be written in Common Lisp and one should be able to use
the full Lisp power in Lispy-Mercury.  As I've said, ideally, Mercury
would be a Common Lisp library.

`define' and `case' (or more precisely `mercury:case') would clearly be
true Lisp macros, transforming their contents to low-level Mercury
terms, notated in square brackets (except Mercury lists).

    RAO> I repeat: having written Scheme code very frequently over the
    RAO> last few years, I find that almost all uses of parentheses in
    RAO> my Scheme code are for function calls, special forms, or macro
    RAO> calls, PRECISELY corresponding to Prolog term syntax, and a
    RAO> very small proportion are for lists.

`define' and `case' no way precisely correspond to Mercury terms.

    RAO> Indeed, back in the days when I used to be able to read
    RAO> comp.lang.scheme, there was a serious proposal that Scheme
    RAO> implementations (with normal Lispy syntax) without any support
    RAO> at all for the list data-type would be quite useful.  The one
    RAO> thing they couldn't work around was rest arguments, so the
    RAO> proponents of list-free Scheme were requesting a more abstract
    RAO> interface to rest arguments (rest-length and rest-ref, or
    RAO> something like that).

I'm not going to start a Lisp<->Scheme flamewar here, I should perhaps
just rename `define' to `defpred'. :-)

Thank you for your valuable (and as usually quite entertaining and
generally informational) comments.  Since nobody except you has
expressed an interest in the issue, it's unlikely Lispy-Mercury will
come into reality, so we needn't resolve all the details.

I'd still be interested if anybody could suggest a good Lispy notation
for multiple mode declarations.

Milan Zamazal

And why?
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list