Hi Erik,

All you need to do is specialize the < operator for your tuple type.

Please check the definition of findmin by running:

@edit findmin([1,2,3])

You'll see the implementation is quite trivial. Let us know if you weren't 
able to make it work.

Best,
-Júlio

Em domingo, 29 de novembro de 2015 10:04:49 UTC-8, Erik Schnetter escreveu:
>
> Is there a version of `findmin` that allows passing in an arbitrary 
> comparison operator?
>
> In throw-away code, I often have an array containing tuples of both the 
> result and some additional operator. I want to find the minimum and its 
> location, but want to ignore the additional information. I would like to 
> use a user-defined comparison operator that looks only at one of the tuple 
> elements, yet `findmin` doesn't seem to offer this.
>
> -erik
>
> -- 
> Erik Schnetter <[email protected] <javascript:>> 
> http://www.perimeterinstitute.ca/personal/eschnetter/
>

Reply via email to