Oh man, with a little more searching (I promise I really did search quite a bit before I posted!) this post turned up:
[link:cs.hubfs.net]

All I needed was the "inline" keyword. Fantastic.

And, even better, it's even more general than 'a -> 'a -> 'a -> 'a -> 'a -> 'a

<!--

{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Consolas;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;}??\fs20 \cf1 let\cf0 \cf1 inline\cf0 interp y1 y2 x1 x2 x =\par ?? \cf1 let\cf0 ymax = max y1 y2\par ?? \cf1 let\cf0 ymin = min y1 y2\par ?? \cf1 let\cf0 xmax = max x1 x2\par ?? \cf1 let\cf0 xmin = min x1 x2\par ?? ((ymax-ymin)/(xmax-xmin))*(x-xmin)+ymin}

-->

let inline interp y1 y2 x1 x2 x =

let ymax = max y1 y2

let ymin = min y1 y2

let xmax = max x1 x2

let xmin = min x1 x2

((ymax-ymin)/(xmax-xmin))*(x-xmin)+ymin

^a -> ^a -> ^d -> ^d -> ^e -> ^i
when ^a : (static member ( - ) : ^a * ^a -> ^b) and
( ^b or ^c) : (static member ( / ) : ^b * ^c -> ^g) and
^d : (static member ( - ) : ^d * ^d -> ^c) and
( ^e or ^d) : (static member ( - ) : ^e * ^d -> ^f) and
( ^g or ^f) : (static member ( * ) : ^g * ^f -> ^h) and
( ^h or ^a) : (static member ( + ) : ^h * ^a -> ^i)

That's really impressive.

By on 11/20/2008 5:46 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