Forums > MaxMSP

prepend "list"

April 3, 2007 | 6:39 pm

hi

to a (quite long) list I need to prepend the words "list maxelem 9"
(yes, it is for driving a peqbank~)

of course the word "list" gets lost, so the object [prepend list
maxelem 4] does the same thing than [prepend maxelem 4]

I tried with [prepend list] which does not work when using the
[prepend] object, but works with the prepend message. So it kind of
could work, but makes me [prepend set] a pretty long list in a
message box, then send it a "prepend list" message… and "list"
gest lost again.

how could I prepend this word, "list", to a list ?(I seem to
remember there was a discussion about this question but was not able
to find it.)

many thanks

kasper

Kasper T. Toeplitz
noise, composition, bass, computer

http://www.sleazeArt.com

http://www.myspace.com/sleazeart


April 5, 2007 | 7:38 pm

Hi, why dont you use zl join? This should work!

GErald


April 5, 2007 | 7:43 pm

http://www.cycling74.com/forums/index.php?t=msg&goto=89976
i think its this one, lengthy, never figured out the answer myself

On 4/3/07, Kasper T Toeplitz wrote:
>
> hi
>
>
> to a (quite long) list I need to prepend the words "list maxelem 9"
> (yes, it is for driving a peqbank~)
>
> of course the word "list" gets lost, so the object [prepend list
> maxelem 4] does the same thing than [prepend maxelem 4]
>
> I tried with [prepend list] which does not work when using the
> [prepend] object, but works with the prepend message. So it kind of
> could work, but makes me [prepend set] a pretty long list in a
> message box, then send it a "prepend list" message… and "list"
> gest lost again.
>
> how could I prepend this word, "list", to a list ?(I seem to
> remember there was a discussion about this question but was not able
> to find it.)
>
> many thanks
>
> kasper
> –
> Kasper T. Toeplitz
> noise, composition, bass, computer
> http://www.sleazeArt.com
>
> http://www.myspace.com/sleazeart
>
>


April 5, 2007 | 8:07 pm


April 5, 2007 | 9:57 pm

> to a (quite long) list I need to prepend the words "list maxelem 9"
> (yes, it is for driving a peqbank~)
>
> of course the word "list" gets lost, so the object [prepend list
> maxelem 4] does the same thing than [prepend maxelem 4]
>

I think Gerald’s solution is better than my sprintf one:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 85 104 51 196617 tosymbol;
#P newex 86 125 112 196617 sprintf symout list %s;
#P connect 1 0 0 0;
#P window clipboard copycount 2;

mz


April 6, 2007 | 9:24 am

Hi,

I have to disappoint you, it seems not to be possible to prepend the word list to a list… and there is no %l arg to sprintf ;-)

Gerald

max v2;
#N vpatcher 40 30 640 430;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 169 260 47 9109513 1 list 2 3;
#P message 466 208 44 9109513 list 1 2 3;
#P newex 106 350 48 9109513 print slice;
#P newex 101 313 44 9109513 zl slice 1;
#P newex 50 159 126 9109513 sprintf hello list %ld %ld %ld;
#P button 326 70 15 0;
#P message 305 119 26 9109513 mist;
#P message 280 245 20 9109513 list;
#P newex 278 312 26 9109513 print;
#P message 238 248 26 9109513 mist;
#P newex 282 278 40 9109513 atoi;
#P button 386 66 15 0;
#P newex 380 281 26 9109513 print;
#P message 412 119 34 9109513 1 2 34;
#P message 341 122 20 9109513 list;
#P newex 382 228 31 9109513 zl join;
#P newex 204 207 26 9109513 print;
#P message 203 124 29 9109513 1 2 3;
#P newex 203 162 110 9109513 sprintf mist %ld %ld %ld;
#P connect 1 0 14 0;
#P connect 18 0 15 0;
#P connect 14 0 15 0;
#P connect 15 1 16 0;
#P connect 1 0 0 0;
#P connect 14 0 2 0;
#P connect 0 0 2 0;
#P connect 8 0 10 0;
#P connect 11 0 8 0;
#P connect 9 0 8 0;
#P connect 13 0 12 0;
#P connect 7 0 4 0;
#P connect 18 0 6 0;
#P connect 17 0 6 0;
#P connect 3 0 6 0;
#P connect 12 0 3 0;
#P connect 4 0 3 0;
#P connect 5 0 3 1;
#P connect 7 0 5 0;
#P connect 13 0 5 0;



_j
April 6, 2007 | 10:29 am

why not substitute the word list with something else and then substitute it back just before its needed?



jln
April 6, 2007 | 11:04 am


April 6, 2007 | 11:28 am

On 6 avr. 07, at 13:04, jln wrote:

> But won’t the problem be the same ? It’ll still be removed when
> needed, won’t it ?
>
> In fact, I guess the question is why do you really need the word
> list to prepend your parameters ? If it’s for visual information,
> then you’ll need to make it as a symbol at some point, as people
> suggested. On the other hand, if it’s for your string to be
> recognized as a list, I’d prepend your parameter with 1 or whatever
> int you want and use route to get rid of it when needed. Or maybe
> I’m missing something, here.

‘list’ is a reserved keyword (like int or float). Kasper, could you
post just a part of the patch, so we can look at it to solve your issue.

ej



jln
April 6, 2007 | 12:22 pm


April 6, 2007 | 12:52 pm

hi.
have you try with scripting ?
this patch is very unpleasant but it seems to be working ….

#P toggle 43 289 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 15 55 615 455;
#P window setfont "Sans Serif" 9.;
#P newex 256 29 19 9109513 t b;
#P window linecount 1;
#P message 280 46 108 9109513 script delete messname;
#P inlet 228 31 15 0;
#P outlet 350 319 15 0;
#P objectname out;
#P newex 56 292 43 9109513 deferlow;
#P objectname defer;
#P message 70 265 157 9109513 script connect defer 0 messname 0;
#N thispatcher;
#Q end;
#P newobj 228 280 54 9109513 thispatcher;
#P message 97 241 148 9109513 script connect messname 0 out 0;
#P newex 42 135 53 9109513 t b b b b;
#P objectname trig;
#P window linecount 2;
#P newex 228 69 369 9109513 sprintf script new messname message 149 113 78
9109513 list maxelem 9 %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s
%s %s %s %s %s %s %s;
#P connect 0 0 1 0;
#P connect 1 0 5 0;
#P connect 1 2 4 0;
#P connect 1 3 2 0;
#P connect 7 0 0 0;
#P connect 0 0 3 0;
#P connect 8 0 3 0;
#P connect 2 0 3 0;
#P connect 4 0 3 0;
#P connect 7 0 9 0;
#P connect 9 0 8 0;
#P pop;
#P newobj 133 130 89 9109513 p try;
#B color 4;
#P message 133 88 405 9109513 shelf 4. 0. 3. 500. 6000. peq 2000. 1. 0. 8.
5. peq 3000. 0.5 -2. 10. 0. peq 4000. 1.2 -2. -18. -6.;
#P newex 115 317 39 9109513 *~ 0.1;
#P flonum 54 119 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 24 141 40 9109513 *~ 0.1;
#P newex 24 84 35 9109513 noise~;
#P newex 115 341 29 9109513 dac~;
#P window setfont "Sans Serif" 10.;
#P newex 115 212 469 9109514 peqbank~ maxelem 3 shelf 2. 0. 3. 100. 5000.
peq 1000. 1. 0. 15. 6. peq 3000. 0.5 0. 10. 2.;
#P window setfont "Sans Serif" 9.;
#P comment 58 106 27 9109513 gain;
#P connect 3 0 4 0;
#P connect 5 0 4 1;
#P connect 8 0 1 0;
#P connect 4 0 1 0;
#P connect 1 0 6 0;
#P connect 9 0 2 0;
#P connect 6 0 2 0;
#P connect 7 0 8 0;
#P window clipboard copycount 10;

best


April 6, 2007 | 1:10 pm


April 6, 2007 | 1:15 pm

>Hi, why dont you use zl join? This should work!

does not

kasper



jln
April 6, 2007 | 1:17 pm


April 6, 2007 | 3:16 pm

Hello

That works for me…

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 723 131 52 196617 1 2 3 4 5;
#P newex 723 149 52 196617 toSymbol;
#P message 723 190 84 196617 list 1 2 3 4 5;
#P newex 723 170 93 196617 sprintf set list %s;
#P connect 2 0 0 0;
#P connect 3 0 2 0;
#P connect 0 0 1 0;
#P window clipboard copycount 4;

jmb

jose manuel berenguer
jmbeal@telefonica.net +34932857046 +34696538403. http://
http://www.sonoscop.net/jmb/
jmberenguer@sonoscop.net +34933064128. http://www.sonoscop.net/
caos->sonoscop. cccb. montalegre, 5. 08001 barcelona
spain


April 6, 2007 | 6:49 pm

> ‘list’ is a reserved keyword (like int or float). Kasper, could you
> post just a part of the patch, so we can look at it to solve your issue.
>

One solution would be for peqbank~ to use a different word for this function. It was, I think, a poor decision on the designer’s part to use list (as a reserved word). I can leave it in there for compatibility, but also give that function a better name.

Any suggestions?

mz


April 6, 2007 | 7:12 pm

> > ‘list’ is a reserved keyword (like int or float). Kasper, could you
>> post just a part of the patch, so we can look at it to solve your issue.
>>
>
>
>One solution would be for peqbank~ to use a different word for this
>function. It was, I think, a poor decision on the designer’s part
>to use list (as a reserved word). I can leave it in there for
>compatibility, but also give that function a better name.
>
>Any suggestions?

of course it would be nice!!

eq ? bank ?

best

kasper

Kasper T. Toeplitz
noise, composition, bass, computer

http://www.sleazeArt.com

http://www.myspace.com/sleazeart


April 10, 2007 | 1:29 pm

Quote: Kasper T Toeplitz wrote on Tue, 03 April 2007 20:39
—————————————————-
> to a (quite long) list I need to prepend the words "list maxelem 9"
> (yes, it is for driving a peqbank~)

Frankly, the use of the list message as described in peqbank~’s .help file is bound to cause problems in Max. I don’t know if Tristan and Michael are reading, but I would strongly recommend that they overhaul the object to provide an alternative approach for what they’re using lists for. Lists beginning with messages are "officially" invalid in Max. I know there are techniques for circumventing this rule, I’ve even done it myself, but it is a Bad Idea. As you’ve discovered, Kasper, there are objects that enforce the rule that "any list beginning with a symbol is converted to a message (the symbol) followed by arguments (the rest of the list)."

Since the peq, shelf, and maxelem messages are already delcared as variable-parameter (A_GIMME) messages, it would be better practice to parse a message like ‘maxelem 4 shelf 4. 0. 3. 500. 6000. peq 2000. 1. 0. 8. 5. peq 3000. 0.5 -2. 10. 0. peq 4000. 1.2 -2. -18. -6.’ into the component messages.

I think the easiest way to work around the problem is to simply send the messages separately, perhaps using a comma-delimited message box.

#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P message 27 121 278 196617 maxelem 4 , shelf 4. 0. 3. 500. 6000. , peq 2000. 1. 0. 8. 5. , peq 3000. 0.5 -2. 10. 0. , peq 4000. 1.2 -2. -18. -6.;
#B color 9;
#P window clipboard copycount 1;

Hope this helps,
Peter (sort of back on the list)


April 10, 2007 | 2:06 pm

Quote: Peter Castine wrote on Tue, 10 April 2007 15:29
—————————————————-
> Hope this helps,
> Peter (sort of back on the list)

It’s true, it has been awfully silent from your side the past few months. Nothing bad going on, I hope?

Mattijs


April 10, 2007 | 6:07 pm

Quote: Peter Castine wrote on Tue, 10 April 2007 06:29
—————————————————-
> Quote: Kasper T Toeplitz wrote on Tue, 03 April 2007 20:39
> —————————————————-
> > to a (quite long) list I need to prepend the words "list maxelem 9"
> > (yes, it is for driving a peqbank~)
>
> Frankly, the use of the list message as described in peqbank~’s .help file is bound to cause problems in Max. I don’t know if Tristan and Michael are reading, but I would strongly recommend that they overhaul the object to provide an alternative approach for what they’re using lists for.

Yes indeed I’m reading; two messages back I was suggesting the same thing, and calling for suggestions for a more appropriate name.

I’m liking "bank," so far. I’ll leave "list" in, for backward compatibility.

mz


April 10, 2007 | 7:18 pm

> > Frankly, the use of the list message as described in peqbank~’s .help file is bound to cause problems in Max. I …
>
> I’m liking "bank," so far. I’ll leave "list" in, for backward compatibility.
>

The macho version is at

http://www.cnmat.berkeley.edu/MAX/downloads/

CFM and Windows versions pending.

mz


April 10, 2007 | 8:04 pm

> Yes indeed I’m reading; two messages back I was suggesting the same thing, and calling for suggestions for a more appropriate name.

Sorry, missed that…

> I’m liking "bank," so far. I’ll leave "list" in, for backward compatibility.

If you want a dedicated message for concatenating multiple messages… how about ‘params’ or ‘settings’? For that matter, the ‘set’ message is currently unused (using it in this setting would be only a little unorthodox, at least without the difficulties of ‘list’).

But ‘bank’ is also fine.

– P.

>Nothing bad going on, I hope?
No, just trying to focus on real work that needs to be done. And giving the Max list up for Lent seemed more productive than, say, swearing off chocolate.-)


Viewing 22 posts - 1 through 22 (of 22 total)