[OpenSCAD] Digging into search( )

runsun runsun at gmail.com
Mon Apr 20 01:24:14 EDT 2015


clothbot wrote
> Example 3:
> 
> 	table3 =[ [“caterpillar”,3],[“cat”,2],[“dog”,2],[“cattle”,5],[“cod”,42]];
> 	search(“cat”, table3);
> 		[1]
> 	search(2,table3,1);
> 		[1,2]
> 	search(“bird",table3);
> 		undef

Also note that using a flat list like above is error-prone:

   table4 = [ “abc","def","def",3 ];
   search( “def”,table3 )= want:[2] got:[1]






-----

$  Runsun Pan, PhD 

$ -- OpenScad_DocTest: doc and unit test ( Github , Thingiverse  ) 

$ -- hash parameter model: here , here 

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly 




--
View this message in context: http://forum.openscad.org/Digging-into-search-tp12421p12438.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list