-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, Feb 27, 2017 at 08:21:03PM +0100, Andy Wingo wrote: > Hi, > > On Mon 27 Feb 2017 11:06, Alejandro Sanchez <hiph...@openmailbox.org> writes: > > > (define v (make <vector3> #:x 1)) > > > > (* -1 v) ; Does not work > > (* -2 v) ; Works fine > > I believe that Guile is doing strength reduction, transforming (* -1 v) > to (- 0 v).
Woah. This is somehow... exquisite. > It could be that this is totally the wrong thing. Is (* x 2) -> (+ x x) > a valid transformation if you don't know the type of x? I don't know. What we really want to know is the meaning of '*' and '+' (is that akin to constant folding?), but yes, for that we need some info about the type of x, I guess. > I think there's currently an assumption that if you extend *, that you > will do so in a mathy way, and that you implement - + and similar. But > in this case it's not the clear right thing to do. > > WDYT? We could remove this transformation, or only apply it when type > inference has run. If overloading is allowed then yes, it seems type inference has to go in first? regards - -- tomás -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAli1Lh4ACgkQBcgs9XrR2kYpEwCdGS4EaOgUy/tBL46i2Isiz1MZ sNwAnj+JM+oX7RM6LTjC8+h6r0qnIiBO =Cc5b -----END PGP SIGNATURE-----