[mercury-users] [petdr at miscrit.be: Report on the ICFP 2000 prog contest]

Thomas Conway conway at cs.mu.OZ.AU
Wed Sep 6 12:44:51 AEDT 2000


On Wed, Sep 06, 2000 at 12:32:04PM EST, schachte at cs.mu.OZ.AU wrote:
> On  6 Sep, Thomas Conway wrote:
> 
> > We could easily have made point be:
> > 
> > :- type point(T)
> > 	--->	point(float, float, float).
> > 
> > :- type worldPointType ---> worldPointType.
> > 
> > :- type objectPointType ---> objectPointType.
> > 
> > :- type worldPoint == point(worldPointType).
> > 
> > :- type objectPoint == point(objectPointType).
> 
> Wouldn't it be easier to just do:
> 
> :- type worldPoint ---> worldpoint(float,float,float).
> :- type objectPoint ---> objectpoint(float,float,float).
> 
> What advantage do you get from the more complicated (and, IMHO, less
> intuitive) approach?

Code reuse:

:- func vecProd(point(T), point(T)) = point(T).

:- func dotProd(point(T), point(T)) = float.

etc.

-- 
 Thomas Conway              Unicode for terrorists: U+0001 300C
 <conway at cs.mu.oz.au>         "Tie his hands behind his back"
 Mercurian )O+  
--------------------------------------------------------------------------
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