[PD] split number into digits

Lorenzo Sutton lorenzofsutton at gmail.com
Tue Jan 19 18:42:32 CET 2021


On 17/01/21 22:07, Roman Haefeli wrote:
> On Sun, 2021-01-17 at 13:29 -0500, José Rafael Subía Valdez wrote:
>> maybe with [mod]. Is the number always going to have 3 digits??
>>
>> playing around in 3 minutes, I came up with this (see picture
>> attached). I do not consider it to be elegant, but maybe its a place
>> to start
> 
> attached patch works with any number of digits (following Claude's
> suggestion).

And a variation on the theme (still seems to have problems with 'larger' 
numbers...) :-)

-------------- next part --------------
#N canvas 571 224 663 512 12;
#X obj 283 258 mod 10;
#X obj 115 264 div 10;
#X obj 115 317 t f f;
#X obj 55 148 t b f, f 6;
#X obj 168 364 != 0;
#X obj 115 228 t f f;
#X obj 283 363 list store;
#X obj 115 187 f;
#X obj 168 394 t f f;
#X obj 200 424 sel 0;
#X msg 283 317 prepend \$1;
#X floatatom 114 60 20 0 0 0 - - -;
#X obj 283 423 print digits;
#X obj 114 100 moses 0, f 19;
#X msg 221 317 bang;
#X msg 377 317 bang;
#X obj 114 148 t f b, f 38;
#X obj 115 424 spigot, f 8;
#X text 204 294 get list;
#X msg 164 18 123456;
#X msg 114 18 512;
#X text 275 52 >= 0 (negative is ignored);
#X text 275 70 works up to 7 digits;
#X connect 0 0 10 0;
#X connect 1 0 2 0;
#X connect 2 0 17 0;
#X connect 2 1 4 0;
#X connect 3 0 7 0;
#X connect 3 1 7 1;
#X connect 4 0 8 0;
#X connect 5 0 1 0;
#X connect 5 1 0 0;
#X connect 6 0 12 0;
#X connect 7 0 5 0;
#X connect 8 0 17 1;
#X connect 8 1 9 0;
#X connect 9 0 6 0;
#X connect 10 0 6 0;
#X connect 11 0 13 0;
#X connect 13 1 16 0;
#X connect 14 0 6 0;
#X connect 15 0 6 1;
#X connect 16 0 7 0;
#X connect 16 1 15 0;
#X connect 17 0 3 0;
#X connect 19 0 11 0;
#X connect 20 0 11 0;


More information about the Pd-list mailing list