[PD] list operation

Matt Barber brbrofsvl at gmail.com
Wed Apr 28 00:49:16 CEST 2010


Try the attached (threw together using list-abs) -- right inlet is the
value (12 in your example) and left inlet is the list of floats; I
think this follows established list-abs syntax.

It's possible that I overlooked a list-abs that already does this, and
there is probably a step or two you could skip.

You might get poor results if the list is a bang or contains symbols.

Matt


> Hello everyone,
>
> I would like to compare all the values in a list with a value of input and
> then decide which is the closest value and replace that value closer to the
> amount of input.
>
> For example, I have a list <2, 10, 35> and have an input value of <12> I
> would like the list as output <2, 12, 35>. I'm almost getting, but the patch
> is so ugly that I will not show here, i'm sure there is a more elegant
> solution. Does anyone have an idea?
> tnx ;)
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20100427/ac720c09/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: list-replace-closest.pd
Type: application/octet-stream
Size: 887 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20100427/0b637420/attachment.obj>


More information about the Pd-list mailing list