The precedence of the operators differ. Use

1
2
3
4
5
6
7
8
9
10
let spiral2 i =
  let n  = truncate (0.5 * (sqrt (float i) + 1.0)) in
  let d  = i - (2*n - 1) * (2*n - 1) in
  let k  = d / (2*n)
  and o  = d % (2*n) in
  let sx = 1 -  (k    &&& 2)
  and sy = 1 - ((k+3) &&& 2)
  and dx =      k    &&& 1
  and dy =     (k+3) &&& 1 in
  (sx * (n - dx * (o + 1)), sy * (n - dy * (o + 1)))

Thanks,

Don

By on 11/23/2007 11:34 AM ()

The complete list of operators is available here:
[link:research.microsoft.com]

And as you can see they all are pretty numerous ;) and not very well documented. I think documentation is one area we will start to see great improvements on now were into productization.

Cheers,
Rob

By on 11/24/2007 10:21 AM ()

Hi Robert,

Yes, solid and complete documentation is what we need. Your book 'Foundations of F#' is an enormous step towards that, and I wouldn't have achieved nearly so much with F# in the last few days without it. Is there an errata posted online somewhere? I think I've located a few typos.

Best regards,

Rob

By on 11/25/2007 1:11 AM ()

Hi Rob,

Glad your enjoying the book. There is a list of errata here:
[link:www.strangelights.com]

If you find anything that is already on it please send it to me robert@strangelights.com

Also not that were I've found problems with a listing this has been correct in the code downloads from the apress site:
[link:www.apress.com]

Cheers,
Rob

By on 11/25/2007 3:00 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper