Just trying a solution for exercise 61, Find the nearest value in a pdl to
a given value [0]
My solution looks a little clunky.  At the pdl command line

$a = random(10)
$z = 0.5
p $a->where( abs($a - $z) == abs($a - $z)->min )

Is there something more idiomatic?

cheers,
Boyd

[0]
https://gitlab.com/duffee/pdl-100#61-find-the-nearest-value-from-a-given-value-in-an-array-
-- 
Boyd Duffee
  No pain, no French bread - Teresa Monachino
_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to