[mercury-users] Higher order (was The Logic of Mercury)

Lee Naish lee at cs.mu.OZ.AU
Thu Sep 9 16:59:59 AEST 1999


In message <19990908172717.A15415 at hydra.cs.mu.oz.au>you write:
> The place where
>I've found them to be desirable is in interpreters where it is nice to be
>able to represent builtins as functions in the normal table of functions.

Sounds reasonable.

As an aside its often the case that there are a finite number of different
functions you want to put in a data structure and you know them in advance.
Its then possible to create a mapping between these functions and a bunch
of constants, which you can put in the data structure instead of the
functions (basically you are inventing your own representation of these
functions).  You might have the overhead of an extra switch, but it may well
be faster than using the builtin method of representing/calling functions
due to better optimisation or avoiding some tricky cases.  For example, the
builtin version of call/1 in Prolog has to deal with conjunctions
containing cuts.  A user-defined version which doesn't deal with cuts is
faster in most systems.

	lee
--------------------------------------------------------------------------
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