Re: infix functions with patterns
Adam Chlipala <[email protected]> Thu, 14 Jan 2010 14:38:18 -0500
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
Jon Loldrup wrote: > I'm new on this mailinglist. I'm implementing an ant colony algorithm > in SML and I'm trying to make an infix function (fun CarCAdd) to add > two cartesian coordinates: > > fun (CarC(X(x1),Y(y1)) CarCAdd CarC(X(x2),Y(y2))) = CarC(X(x1+x2),Y(y1+y2)) > > I get this error message: > > ... > > I have another infix function using pattern matching as well: > fun (Rad(r1)) radAdd (Rad(r2)) = Rad(r1+r2) > > so I don't see why my CarC should be erroneous. > The difference that stands out to me is the extra set of parentheses around the lefthand side of the first clause. Removing those makes a difference for me in SML/NJ. ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev