[mercury-users] vector and strange warning

Michael Day mikeday at bigpond.net.au
Fri May 24 10:47:47 AEST 2002


Hi,

Here is a solution for being able to pre and post multiply a
vector/matrix/whatever by a float without having to import two different
modules for left and right sided operators.

It's also a test case for a strange warning I reported last week:

Mercury/cs/vector.c:31: warning: 
`mercury__fn__f_118_101_99_116_111_114_95_95_67_108_97_115_115_77_101_116_104_111_100_95_102_111_114_95_118_101_99_116_111_114_95_95_109_117_108_116_105_112_108_121_95_95_95_95_102_108_111_97_116_95_95_97_114_105_116_121_48_95_95_118_101_99_116_111_114_95_95_118_101_99_116_111_114_95_95_97_114_105_116_121_48_95_95_95_95_95_95_118_101_99_116_111_114_95_95_42_95_50_2_0' 
used but never defined

which is filling up my error logs. Any thoughts?

Michael

:- module vector.

:- interface.

:- import_module float.

:- type vector.

:- typeclass multiply(S, T) where
    [
	func S * T = vector
    ].

:- instance multiply(float, vector).
:- instance multiply(vector, float).

:- implementation.

:- type vector ---> vec(float, float).

:- instance multiply(float, vector) where
    [
	F * V = vec_mul(F, V)
    ].

:- instance multiply(vector, float) where
    [
	V * F = vec_mul(F, V)
    ].

:- func vec_mul(float, vector) = vector.

vec_mul(F, vec(X,Y)) = vec(F*X, F*Y).

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