Here's a possibility. Not very elegant, but it works. Replace the list and the numberboxes with whatever input and output you need and it ought to work, if the differences are smaller than 100000. -Chuckk
On 6/18/07, danja <[EMAIL PROTECTED]> wrote:
hello there, i have a [list] of numbers and i'd like to search through it for the value closest to the search subject. so to say, if i have '22 31 47 86' in my list and i match it with '45' the answer would be '47' (closest in the list). this rather useful function (fuzzy integer search?) must have been written by someone already, it's just that i can't find it :) i wouldn't ask if i could patch it myself, but i know how it might work: all integers from the list are compared to the reference (subject) number, and the integer in subtraction closest to '0' would be the hit... you know what i mean? any advice is very much appreciated! p.s. apologies for my ignorance, i'm just starting here... -- danja http://k0a1a.net _______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-- http://www.badmuthahubbard.com
#N canvas 461 157 563 508 12; #X obj 77 88 list; #X obj 77 184 - 45; #X msg 52 32 22 31 47 86; #X obj 93 353 f; #X obj 77 232 abs; #X obj 77 273 moses 100000; #X obj 77 208 t f f; #X obj 28 268 f; #X obj 74 384 f; #X obj 77 297 bang; #X obj 74 412 + 45; #X floatatom 432 67 5 0 0 0 - - -; #X obj 77 124 list split 1; #X floatatom 297 410 5 0 0 0 - - -; #X msg 168 235 100000; #X obj 52 61 t b l b; #X text 412 46 Comparator; #X text 51 10 List; #X text 290 386 Closest; #X connect 0 0 12 0; #X connect 1 0 6 0; #X connect 2 0 15 0; #X connect 3 0 8 1; #X connect 4 0 5 0; #X connect 5 0 7 0; #X connect 5 0 9 0; #X connect 6 0 4 0; #X connect 6 1 3 1; #X connect 7 0 5 1; #X connect 8 0 10 0; #X connect 9 0 3 0; #X connect 10 0 13 0; #X connect 11 0 10 1; #X connect 11 0 1 1; #X connect 12 0 1 0; #X connect 12 1 0 0; #X connect 14 0 5 1; #X connect 15 0 8 0; #X connect 15 1 0 0; #X connect 15 2 14 0;
_______________________________________________ PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list