[OpenSCAD] Digging into search( )

clothbot andrew at plumb.org
Mon Apr 20 11:38:22 EDT 2015


Hi Rusun,

Very briefly, vector and string 'index' counting starts at 0, not 1.

list1= ["abc",1,"def",2,"ghi",3]
 search( "def", list1 ) 

...will return '[2]' because list1[2]=="def"; list1[0]=="abc"

list2=["abc","def","def",2,"ghi",3]
search( "def", list2 ) 

...will now return '[1,2]' because list2[1]=="def" and list2[2]=="def";
list2[0]=="abc"

In my simplified search, all matches are always returned.  It is now up to
the user to decide how many/few to filter off and by what
mechanism/algorithm.

I think that yes, I'll eventually add list/vector support to match_value,
however it will be considerably more involved to implement than the simple
'atomic' data structures. 

Support search for an N-dimension vector match could be fun+useful:
  - add 'tol[erance]' parameter to allow for 'close enough' floating point
'distance' matches.

Picking my battles. :-)

Andrew.



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




More information about the Discuss mailing list