Re: [PD] Vanilla [list-s2l] prototype

2009-11-20 Thread Georg Werner

Hi,

[foreach] sounds good - but i could not find it ... give me a hint, please.
g.

Mathieu Bouchard schrieb:

On Thu, 19 Nov 2009, Matt Barber wrote:

I think this might underline how useful it would be for those of us 
who use vanilla Pd to have some symbol manipulation tools in vanilla,


It's useless to underline it more than it's been underlined before. Just 
stop using vanilla. This fixes the problem.


Games like you've done can be fun though. I've had fun with the 
[list-drip] speed hacks in february. But it was only a game. In real 
life I use [foreach], which is written in C++, and it works fine and 
faster than what's possible to do as a regular Pd patch. The game was 
only for testing limits and demonstrating unusual techniques (i mean 
techniques that are unusual in the context of pd; they may be 
commonplace in some other programming language).


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801




___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Vanilla [list-s2l] prototype

2009-11-20 Thread Mathieu Bouchard

On Fri, 20 Nov 2009, Georg Werner wrote:


[foreach] sounds good - but i could not find it ... give me a hint, please.


It's part of GridFlow.

http://gridflow.ca/help/foreach-help.png

  http://gridflow.ca/download/gridflow-0.9.6.tar.gz
  http://gridflow.ca/download/packages/gridflow-0.9.6-macosx104-i386.tar.gz
  http://gridflow.ca/download/packages/gridflow-0.9.6-ubuntu-karmic-i386.tar.gz

\class ForEach : FObject {
\constructor () {}
\decl 0 list (...);
};
\def 0 list (...) {
t_outlet *o = outlets[0];
for (int i=0; iargc; i++) {
if  (argv[i].a_type==A_FLOAT)  outlet_float( o,argv[i]);
else if (argv[i].a_type==A_SYMBOL) outlet_symbol(o,argv[i]);
else RAISE(oops. unsupported.);
}
}
\end class {install(foreach,1,1);}

 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Vanilla [list-s2l] prototype

2009-11-20 Thread Mathieu Bouchard

On Fri, 20 Nov 2009, Mathieu Bouchard wrote:


[foreach] sounds good - but i could not find it ... give me a hint, please.

It's part of GridFlow.


Actually, the code could be shorter and support A_POINTER too. 
That's what it does now:


\class ForEach : FObject {
\constructor () {}
\decl 0 list (...);
};
\def 0 list (...) {
for (int i=0; iargc; i++) outlet_atom(outlets[0],argv[i]);
}
\end class {install(foreach,1,1);}

 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Vanilla [list-s2l] prototype

2009-11-19 Thread Matt Barber
 SplitTheAtoms = 16ms
 VanillaRulz = 27ms
 Teddy = 23ms
 1234 = 140ms
 PdIsGreat = 30ms

 using tclpd: under 0.05 ms for any of those.

 size of the external: about 260 bytes.

 and no symbol-table pollution, no memory leak.



I think this might underline how useful it would be for those of us
who use vanilla Pd to have some symbol manipulation tools in vanilla,
although I'm not convinced that I'm doing the symbol2list in the best
way for vanilla either (I used to think it couldn't be done at all).

Matt

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Vanilla [list-s2l] prototype

2009-11-19 Thread Mathieu Bouchard

On Thu, 19 Nov 2009, Matt Barber wrote:

I think this might underline how useful it would be for those of us who 
use vanilla Pd to have some symbol manipulation tools in vanilla,


It's useless to underline it more than it's been underlined before. Just 
stop using vanilla. This fixes the problem.


Games like you've done can be fun though. I've had fun with the 
[list-drip] speed hacks in february. But it was only a game. In real life 
I use [foreach], which is written in C++, and it works fine and faster 
than what's possible to do as a regular Pd patch. The game was only for 
testing limits and demonstrating unusual techniques (i mean techniques 
that are unusual in the context of pd; they may be commonplace in some 
other programming language).


 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Vanilla [list-s2l] prototype

2009-11-19 Thread Matt Barber
On Thu, Nov 19, 2009 at 7:44 PM, Mathieu Bouchard ma...@artengine.ca wrote:
 On Thu, 19 Nov 2009, Matt Barber wrote:

 I think this might underline how useful it would be for those of us who
 use vanilla Pd to have some symbol manipulation tools in vanilla,

 It's useless to underline it more than it's been underlined before. Just
 stop using vanilla. This fixes the problem.

I agree -- I don't use vanilla myself, but I know a lot of people do.
As you suggest it's useful for testing the limits -- the sorting
algorithms I implemented a year ago ([list-shellsort] in list-abs is
one of them) are in this class of objects.  I also think they're
useful for teaching students who are intimidated by written code
(almost all of my students are classically-trained composers) some
things about algorithmic thinking.

By underlining, I mean sometimes you don't know just how badly it's
missing until you try to do it in Pd and check the results against the
compiled libraries.  [list-l2s] will never be as fast as [list2symbol]
from zexy... etc.

MB


 Games like you've done can be fun though. I've had fun with the [list-drip]
 speed hacks in february. But it was only a game. In real life I use
 [foreach], which is written in C++, and it works fine and faster than what's
 possible to do as a regular Pd patch. The game was only for testing limits
 and demonstrating unusual techniques (i mean techniques that are unusual in
 the context of pd; they may be commonplace in some other programming
 language).

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Vanilla [list-s2l] prototype

2009-11-18 Thread Andy Farnell

SplitTheAtoms = 16ms
VanillaRulz = 27ms
Teddy = 23ms
1234 = 140ms
PdIsGreat = 30ms

On Wed, 18 Nov 2009 17:29:35 -0500
Matt Barber brbrof...@gmail.com wrote:

 Here's another update to the [list-s2l] prototype that uses a
 character table to try to maximize the chance of finding matching
 characters early -- on my machines it's cut some of the previous
 [realtime] measurements by about 80% depending on the message (on my
 macbook it takes 100 MS to break a symbol with all common ascii
 characters into its characters) -- but of course it's nowhere near as
 quick as the zexy object.
 
 I think it's close to usable, especially for short symbols.  Anyone
 wanna try it out?
 
 Matt
 
 
 On Wed, Nov 18, 2009 at 12:32 AM, Matt Barber brbrof...@gmail.com wrote:
  OK, here's a [list-s2l] with delimiting.  This wasn't easy.  =o)
  Included are all the abstractions needed --
 
  [symbollength] calculates the length of a symbol.
 
  [list-l2f], as yet undocumented, attempts to build a float from an
  incoming stream of numbers and symbols -- works pretty well.
 
  I tried to get as close as possible to the behavior of zexy [s2l] and
  [list-l2s] ...
 
  It's probably not fast enough to use in practice, but it would be
  worth testing with small symbols to find out
 
  If you could test it, I could work out the bugs.  I'd take
  suggestions, of course.
 
 
  Matt
 
 
 
  On Mon, Nov 16, 2009 at 6:22 PM, Matt Barber brbrof...@gmail.com wrote:
  Hello list,
 
  Attached is a prototype for a vanilla + list-abs [list-s2l].  I have
  leaned on the side of completeness and error reduction rather than
  efficiency -- there are many many ways to make this more efficient.
  Also, it doesn't handle delimiters yet (right now it breaks a symbol
  into its constituent characters, casting float symbols back to float),
  but I think I could figure out how to do it.
 
  Neither this nor [list-l2s] handles % appropriately...
 
  I'd appreciate any feedback.
 
  Matt
 
 
 

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Vanilla [list-s2l] prototype

2009-11-18 Thread Mathieu Bouchard

On Wed, 18 Nov 2009, Andy Farnell wrote:


SplitTheAtoms = 16ms
VanillaRulz = 27ms
Teddy = 23ms
1234 = 140ms
PdIsGreat = 30ms


using tclpd: under 0.05 ms for any of those.

size of the external: about 260 bytes.

and no symbol-table pollution, no memory leak.

 _ _ __ ___ _  _ _ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Vanilla [list-s2l] prototype

2009-11-17 Thread Matt Barber
OK, here's a [list-s2l] with delimiting.  This wasn't easy.  =o)
Included are all the abstractions needed --

[symbollength] calculates the length of a symbol.

[list-l2f], as yet undocumented, attempts to build a float from an
incoming stream of numbers and symbols -- works pretty well.

I tried to get as close as possible to the behavior of zexy [s2l] and
[list-l2s] ...

It's probably not fast enough to use in practice, but it would be
worth testing with small symbols to find out

If you could test it, I could work out the bugs.  I'd take
suggestions, of course.


Matt



On Mon, Nov 16, 2009 at 6:22 PM, Matt Barber brbrof...@gmail.com wrote:
 Hello list,

 Attached is a prototype for a vanilla + list-abs [list-s2l].  I have
 leaned on the side of completeness and error reduction rather than
 efficiency -- there are many many ways to make this more efficient.
 Also, it doesn't handle delimiters yet (right now it breaks a symbol
 into its constituent characters, casting float symbols back to float),
 but I think I could figure out how to do it.

 Neither this nor [list-l2s] handles % appropriately...

 I'd appreciate any feedback.

 Matt

#N canvas 281 56 684 695 10;
#X obj 122 513 sel s;
#X obj 143 361 makefilename %%.%ds;
#X msg 143 388 set \$1;
#X obj 48 212 until;
#X obj 76 297 + 1;
#X obj 33 623 f;
#X obj 122 311 symbol;
#X obj 48 238 t b b;
#X obj 149 563 s \$0-stop;
#X obj 122 539 t b b;
#X obj 75 174 r \$0-stop;
#X obj 192 468 print;
#X obj 184 46 inlet;
#X obj 184 174 t b b s;
#X obj 184 73 route symbol;
#X obj 33 644 outlet;
#X obj 192 445 spigot 0;
#X obj 237 423 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 223 204 s \$0-sym;
#X obj 122 280 r \$0-sym;
#X obj 149 490 r \$0-sym;
#X obj 122 422 makefilename;
#X text 31 18 find length of symbol by iterating the first n characters
;
#X text 276 362 - sprintf fun;
#X text 266 423 - try this on;
#X obj 48 297 f 1;
#X msg 138 232 1;
#X obj 157 145 sel s;
#X obj 184 100 loadbang;
#X msg 184 122 symbol;
#X obj 208 262 s \$0-protect;
#X obj 103 604 r \$0-protect;
#X msg 103 627 0;
#X connect 0 0 9 0;
#X connect 1 0 2 0;
#X connect 2 0 21 0;
#X connect 3 0 7 0;
#X connect 4 0 25 1;
#X connect 5 0 15 0;
#X connect 6 0 21 0;
#X connect 7 0 6 0;
#X connect 7 1 25 0;
#X connect 9 0 5 0;
#X connect 9 1 8 0;
#X connect 10 0 3 1;
#X connect 12 0 14 0;
#X connect 13 0 3 0;
#X connect 13 1 26 0;
#X connect 13 2 18 0;
#X connect 14 0 27 0;
#X connect 16 0 11 0;
#X connect 17 0 16 1;
#X connect 19 0 6 1;
#X connect 20 0 0 1;
#X connect 21 0 0 0;
#X connect 21 0 16 0;
#X connect 25 0 4 0;
#X connect 25 0 5 1;
#X connect 25 0 1 0;
#X connect 26 0 25 1;
#X connect 27 0 30 0;
#X connect 27 1 13 0;
#X connect 28 0 29 0;
#X connect 29 0 27 1;
#X connect 31 0 32 0;
#X connect 32 0 15 0;
#N canvas 600 22 381 423 10;
#N canvas 152 93 601 673 \$0-split-exp 0;
#X obj 133 263 list-fifo-delim E;
#X obj 133 174 until;
#X obj 250 197 b;
#X obj 250 263 b;
#X obj 116 229 until;
#X obj 133 197 list-fifo-delim e;
#X obj 99 37 inlet;
#X obj 231 357 f 1;
#X msg 246 336 1;
#X obj 246 315 r \$0-init;
#X obj 267 357 + 1;
#X obj 216 492 == 2;
#X obj 216 517 sel 0;
#X obj 216 470 f;
#X obj 119 374 list prepend;
#X obj 133 287 t a b;
#X obj 119 401 route 1 2;
#X obj 73 453 list;
#X obj 123 453 list;
#X obj 73 340 t b b b;
#X obj 73 547 spigot;
#X obj 123 547 spigot;
#X obj 123 574 outlet;
#X obj 73 574 outlet;
#X obj 216 541 s \$0-not-float;
#X obj 201 81 list-splat -1;
#X obj 238 105 sel e E;
#X obj 99 91 spigot;
#X obj 99 118 t b b b a;
#X obj 99 64 t a a;
#X obj 151 37 r \$0-init;
#X msg 151 59 1;
#X msg 194 120 0;
#X obj 238 152 s \$0-not-float;
#X obj 238 128 t b b;
#X connect 0 0 15 0;
#X connect 0 1 3 0;
#X connect 1 0 5 0;
#X connect 2 0 1 1;
#X connect 3 0 4 1;
#X connect 4 0 0 0;
#X connect 5 0 0 1;
#X connect 5 1 2 0;
#X connect 6 0 29 0;
#X connect 7 0 10 0;
#X connect 7 0 13 1;
#X connect 7 0 14 1;
#X connect 8 0 7 1;
#X connect 9 0 8 0;
#X connect 10 0 7 1;
#X connect 11 0 12 0;
#X connect 11 0 20 1;
#X connect 11 0 21 1;
#X connect 12 0 24 0;
#X connect 13 0 11 0;
#X connect 14 0 16 0;
#X connect 15 0 14 0;
#X connect 15 1 7 0;
#X connect 16 0 17 1;
#X connect 16 1 18 1;
#X connect 17 0 20 0;
#X connect 18 0 21 0;
#X connect 19 0 17 0;
#X connect 19 1 18 0;
#X connect 19 2 13 0;
#X connect 20 0 23 0;
#X connect 21 0 22 0;
#X connect 25 1 26 0;
#X connect 26 0 34 0;
#X connect 26 1 34 0;
#X connect 27 0 28 0;
#X connect 28 0 19 0;
#X connect 28 1 4 0;
#X connect 28 2 1 0;
#X connect 28 3 5 1;
#X connect 29 0 27 0;
#X connect 29 1 25 0;
#X connect 30 0 31 0;
#X connect 31 0 27 1;
#X connect 32 0 27 1;
#X connect 34 0 33 0;
#X connect 34 1 32 0;
#X restore 69 167 pd \$0-split-exp;
#X obj 71 109 s \$0-init;
#N canvas 114 405 327 248 \$0-exp 0;
#X obj 87 20 inlet;
#N canvas 811 159 593 616 \$0-exp-filter 0;
#X obj 157 54 list split 1;
#X obj 292 147 list;
#X obj 50 147 sel + -;
#X obj 69 307 s \$0-neg-exp;
#X msg 69 284 -1;
#X obj 434 384 == 0;
#X obj 454 340 int;

[PD] Vanilla [list-s2l] prototype

2009-11-16 Thread Matt Barber
Hello list,

Attached is a prototype for a vanilla + list-abs [list-s2l].  I have
leaned on the side of completeness and error reduction rather than
efficiency -- there are many many ways to make this more efficient.
Also, it doesn't handle delimiters yet (right now it breaks a symbol
into its constituent characters, casting float symbols back to float),
but I think I could figure out how to do it.

Neither this nor [list-l2s] handles % appropriately...

I'd appreciate any feedback.

Matt
#N canvas 443 63 631 589 10;
#X obj 100 24 inlet;
#X obj 161 534 outlet;
#X obj 72 401 sel s;
#X obj 155 209 makefilename %%.%ds;
#X msg 155 232 set \$1;
#X obj 159 95 s \$0-mainsym;
#X obj 99 373 r \$0-mainsym;
#X obj 182 440 list prepend;
#X obj 161 506 list;
#X obj 286 440 t a;
#X obj 60 130 until;
#X obj 147 181 + 1;
#X obj 61 240 symbol;
#X obj 119 181 f 1;
#X obj 72 213 r \$0-mainsym;
#X obj 100 78 t b b s;
#X msg 134 158 1;
#X obj 155 257 makefilename;
#X obj 61 154 t b b;
#X obj 182 334 list-lastx 2;
#X msg 206 308 symbol;
#X obj 155 300 t a a;
#X obj 72 425 t b b;
#X obj 99 450 s \$0-stop;
#X obj 33 79 r \$0-stop;
#X obj 251 411 r \$0-init;
#X obj 206 284 r \$0-init;
#X obj 146 129 s \$0-init;
#X obj 100 47 route symbol;
#X text 199 186 accumulate first n characters of symbol;
#N canvas 580 22 514 754 \$0-find-next-char 0;
#X obj 36 25 inlet;
#X obj 109 716 outlet;
#X obj 36 567 sel s;
#X obj 36 189 until;
#X obj 36 372 makefilename %c;
#X msg 36 164 256;
#X obj 36 220 f 0;
#X obj 70 220 + 1;
#X msg 88 189 0;
#X obj 36 245 sel 123 125;
#X obj 36 508 pack s s;
#X obj 36 536 list-l2s;
#X obj 36 460 symbol;
#X obj 36 406 t b s;
#X obj 109 675 symbol;
#X obj 36 50 t b a b;
#X obj 55 80 unpack s s;
#X obj 55 132 s \$0-test;
#X obj 112 106 s \$0-current;
#X obj 96 550 r \$0-test;
#X obj 107 443 r \$0-current;
#N canvas 0 22 450 300 %0-float? 0;
#X obj 133 91 inlet;
#X obj 133 202 outlet;
#X obj 222 201 outlet;
#X obj 178 141 moses 58;
#X obj 133 118 moses 48;
#X connect 0 0 4 0;
#X connect 3 0 2 0;
#X connect 3 1 1 0;
#X connect 4 0 1 0;
#X connect 4 1 3 0;
#X restore 99 267 pd %0-float?;
#X obj 108 639 spigot;
#X obj 168 641 spigot;
#X obj 199 682 float;
#X msg 227 342 1;
#X obj 231 543 r \$0-spigot;
#X obj 227 370 s \$0-spigot;
#X obj 181 580 == 0;
#X obj 36 284 t f b;
#X msg 80 301 0;
#X obj 168 325 t f f b;
#X obj 227 658 - 48;
#X obj 80 323 s \$0-spigot;
#X text 99 525 test for match;
#X text 274 658 - floats instead of symbols;
#X text 81 417 previous match string plus test ascii value;
#X text 132 178 -- iterate through all ascii values \, but don't make
finding a match a condition for stopping the loop - we could make this
more efficient by not testing all values \, and by making a match be
a condition for stopping the loop.;
#X connect 0 0 15 0;
#X connect 2 0 22 0;
#X connect 2 0 23 0;
#X connect 3 0 6 0;
#X connect 4 0 13 0;
#X connect 5 0 3 0;
#X connect 6 0 7 0;
#X connect 6 0 9 0;
#X connect 7 0 6 1;
#X connect 8 0 6 1;
#X connect 9 2 21 0;
#X connect 10 0 11 0;
#X connect 11 0 2 0;
#X connect 12 0 10 0;
#X connect 13 0 12 0;
#X connect 13 1 10 1;
#X connect 13 1 14 1;
#X connect 14 0 1 0;
#X connect 15 0 5 0;
#X connect 15 1 16 0;
#X connect 15 2 8 0;
#X connect 16 0 17 0;
#X connect 16 1 18 0;
#X connect 19 0 2 1;
#X connect 20 0 12 1;
#X connect 21 0 29 0;
#X connect 21 1 31 0;
#X connect 22 0 14 0;
#X connect 23 0 24 0;
#X connect 24 0 1 0;
#X connect 25 0 27 0;
#X connect 26 0 23 1;
#X connect 26 0 28 0;
#X connect 28 0 22 1;
#X connect 29 0 4 0;
#X connect 29 1 30 0;
#X connect 30 0 33 0;
#X connect 31 0 4 0;
#X connect 31 1 32 0;
#X connect 31 2 25 0;
#X connect 32 0 24 1;
#X restore 182 374 pd \$0-find-next-char;
#X text 313 377 find next character;
#X text 267 331 compare last two chunks to look for the next character
\; init with a blank symbol;
#X text 33 468 stop when we've found all characters;
#X connect 0 0 28 0;
#X connect 2 0 22 0;
#X connect 3 0 4 0;
#X connect 4 0 17 0;
#X connect 6 0 2 1;
#X connect 7 0 8 1;
#X connect 7 0 9 0;
#X connect 8 0 1 0;
#X connect 9 0 7 1;
#X connect 10 0 18 0;
#X connect 11 0 13 1;
#X connect 12 0 17 0;
#X connect 13 0 11 0;
#X connect 13 0 3 0;
#X connect 14 0 12 1;
#X connect 15 0 10 0;
#X connect 15 1 16 0;
#X connect 15 1 27 0;
#X connect 15 2 5 0;
#X connect 16 0 13 1;
#X connect 17 0 21 0;
#X connect 18 0 12 0;
#X connect 18 1 13 0;
#X connect 19 0 30 0;
#X connect 20 0 19 0;
#X connect 21 0 2 0;
#X connect 21 1 19 0;
#X connect 22 0 8 0;
#X connect 22 1 23 0;
#X connect 24 0 10 1;
#X connect 25 0 7 1;
#X connect 26 0 20 0;
#X connect 28 0 15 0;
#X connect 30 0 7 0;
#N canvas 22 119 674 278 10;
#X obj 62 168 print;
#X obj 259 125 list-s2l;
#X obj 259 185 print;
#X msg 259 71 symbol 1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx...@#$*()_+~`./?[]|
;
#X obj 332 142 unpack 0 0 0 0 0 0 0 0 0 0 s s;
#X floatatom 332 204 5 0 0 0 - - -;
#X floatatom 348 180 5 0 0 0 - - -;
#X symbolatom 492 207 10 0 0 0 - - -;
#X symbolatom 509 181 10 0 0 0 - -