newLISP Fan Club

Forum => Anything else we might add? => Topic started by: didi on June 30, 2007, 12:04:03 AM

Title: List function
Post by: didi on June 30, 2007, 12:04:03 AM
For the scaling of a xy-graph ,  i want  the first value of a list that is greater than 'mvalue' .  


( first ( filter (  fn(x) ( > x mvalue) ) prefer-list )

This is already my fourth version , it works , but maybe there is an easier/faster way .
Title:
Post by: cormullion on June 30, 2007, 01:47:59 AM
looks OK to me!



Using implicit addressing and comparison functions:


(prefer-list (find mvalue prefer-list <))


is probably no faster but possibly slightly neater. However, your version will not complain if there is no matching value - (first '()) is better than (prefer-list nil)... :-)