On 12/12/2010, at 7:08 PM, nore...@github.com wrote: > > Changed paths: > M src/doc/Bugs.fdoc > M tools/flx2html.flx
Well.. consider: I have array of string pairs, these are actually felix keywords with tool tips for the webserver. I thought I would use the Array module functions, but now I'm searching for a keyword, I can't just use "k in a" because a is key, value pair array. So hey, use the fancy array module: fun find[T, N] (eq:T->bool) (x:array[T, N]): opt[T] fun find[T, N] (eq:T*T->bool) (x:array[T, N]) (e:T): opt[T] two choices, using a string * string -> bool and a string to compare, or a closure of that function over the key, giving string->bool so I wrote: fun valof[N](x:array[string * string,N],key:string) => match Array::find(fun (k:string )=> k == key) x with | Some (?k,?v) => v | None => "" endmatch ; and go this: Client Error binding expression (((Array)::find[string^bool, N] _lam_7314 of (string)) x) CLIENT ERROR [lookup_qn_with_sig] (Simple module) Unable to resolve overload of (Array)::find[string^bool, N] of (string -> bool,(string^2)^<T7327>) candidates are: { generated curry fun find[T: TYPE, N: TYPE]: (T -> bool) -> (array[T, N] -> opt[T]); defined at build/release/lib/std/array.flx: line 141, cols 1 to 3 with view vs=T,N ts=<T5199>,<T5200> generated curry fun find[T: TYPE, N: TYPE]: (T * T -> bool) -> (array[T, N] -> (T -> opt[T])); defined at build/release/lib/std/array.flx: line 129, cols 1 to 3 with view vs=T,N ts=<T5186>,<T5187> } In ./abc.flx: line 2, cols 9 to 59 1: fun valof[N](x:array[string * string,N],key:string) => 2: match Array::find[string^2,N] (fun (k:string)=> k == key) x with *************************************************** 3: | Some (?k,?v) => v and thought .. OH NO NOT ANOTHER BUG IN FELIX.. even documented it. Ha! But there's no bug. The compiler is right. I got fooled by thinking string * string -> bool matched the second function so string -> bool matched the first. Did you? Actually .. T = string * string so I needed to write this: fun valof[N](x:array[string * string,N],key:string) => match Array::find(fun (kv:string * string)=> kv.(0) == key) x with | Some (?k,?v) => v | None => "" endmatch ; which works! Have to learn to trust the compiler more .. :) -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language