list-nth-help.pd 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #N canvas 0 31 624 592 10;
  2. #X floatatom 268 339 5 0 0 1 n - -;
  3. #X text 136 110 Inlets: 1) list to look up in;
  4. #X text 134 38 look up the nth element in a list. n has to be positive
  5. and is zero-based!;
  6. #X obj 56 493 list-idx;
  7. #X text 53 472 Also see:;
  8. #X obj 215 392 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
  9. -1 -1;
  10. #X obj 56 38 list-nth;
  11. #X text 193 129 2) number giving position to filter. Zero-based \,
  12. positive.;
  13. #X msg 201 238 0 1 2 3 4 5 6;
  14. #X text 138 83 Argument: <n \, default: 0==first element>;
  15. #X msg 223 300 a b c d e;
  16. #X obj 201 425 prepent set;
  17. #X msg 201 448;
  18. #X msg 149 395 bang;
  19. #X msg 218 266 list x y z;
  20. #X obj 201 364 list-nth 2;
  21. #X text 310 301 non-lists get converted to proper lists.;
  22. #X text 134 162 Note: negative postion numbers give no output \, lists
  23. longer than the index give a spurious 0 as result \, but also an error
  24. in the console: "$x: argument out of range".;
  25. #X text 53 520 [list-idx] is more flexible \, but a bit slower.;
  26. #N canvas 506 181 494 396 META 0;
  27. #X text 12 25 LICENSE SIBSD;
  28. #X text 12 105 AUTHOR Frank Barknecht;
  29. #X text 12 125 HELP_PATCH_AUTHORS Frank Barknecht. "pd meta" information
  30. added by Jonathan Wilkes for Pd version 0.42.;
  31. #X text 12 5 KEYWORDS control list_op;
  32. #X text 12 45 DESCRIPTION look up the nth element in a list;
  33. #X text 12 65 INLET_0 anything;
  34. #X text 12 85 OUTLET_0 float symbol pointer;
  35. #X restore 538 539 pd META;
  36. #X connect 0 0 15 1;
  37. #X connect 8 0 15 0;
  38. #X connect 10 0 15 0;
  39. #X connect 11 0 12 0;
  40. #X connect 13 0 11 0;
  41. #X connect 14 0 15 0;
  42. #X connect 15 0 5 0;
  43. #X connect 15 0 11 0;