[mercury-users] Library v2 and Typeclasses'n'Stuff

David Glen JEFFERY dgj at cs.mu.OZ.AU
Sat Nov 6 15:14:45 AEDT 1999


On 06-Nov-1999, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> 
> Here's an addition to your suggested set of type classes:
> 
> :- sequence(S, T) where [
> 	    func [] = S(T),
> 	    func [T|S(T)] = S(T),
> 	    mode [] = out is det,
> 	    mode [out, out] = in is det
> ].

I think that last mode should be:
	mode [out|out] = in is semidet

(or probably mode .(out, out) is semidet).

> Using this type class, one can traverse any sort of sequence as if it
> were a list.  Seems like a pleasant way to do this.

It would be nice to be able to include some kind of mutual exclusion 
declaration between `[]/0' and `./2'.


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
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