opposite of append/prepend

Jul 21, 2008 at 4:09pm

opposite of append/prepend

Hello,

Is there any way to select a certain number/symbol on a list and delete it, sort of how prepend and append add to a list? I want to move letters from one list to another, as in:

[a b c d e] [w x y z]

becomes

[a b c d e x] [w y z]

when [x] is selected.

Adding to first list is easy, but removing from second list has me stumped.

Jay

#38964
Jul 21, 2008 at 4:26pm

“zl filter” is your friend

jb

#136446
Jul 21, 2008 at 4:29pm

On 21 juil. 08, at 18:09, Jay Bodley wrote:

> Hello,
>
> Is there any way to select a certain number/symbol on a list and
> delete it, sort of how prepend and append add to a list? I want to
> move letters from one list to another, as in:
>
> [a b c d e] [w x y z]
>
> becomes
>
> [a b c d e x] [w y z]
>
> when [x] is selected.
>
> Adding to first list is easy, but removing from second list has me
> stumped.

That’s a job for [zl filter]:

– Pasted Max Patch, click to expand. –

HTH,
ej

#136447
Jul 21, 2008 at 4:29pm

is this new to max 5? i’m still running the ancient 4.6

#136448
Jul 21, 2008 at 4:45pm

Here’s an ugly hack to do it in 4.6. Someone probably has a better way.

#P window setfont “Sans Serif” 12.;
#P window linecount 1;
#P newex 79 307 94 196620 zl group 1000;
#P newex 166 270 25 196620 t b;
#P message 251 93 15 196620 z;
#P message 232 93 15 196620 e;
#P message 213 93 15 196620 b;
#P number 190 157 35 12 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 166 238 50 196620 thresh;
#P message 79 385 82 196620 a b c d e f x;
#P newex 79 354 82 196620 prepend set;
#P newex 79 251 40 196620 itoa;
#P newex 74 158 40 196620 atoi;
#P newex 190 127 40 196620 atoi;
#P message 190 95 15 196620 x;
#P newex 74 205 55 196620 sel 120;
#P newex 74 129 58 196620 zl iter 1;
#P message 74 98 82 196620 a b c d e f x;
#P connect 2 1 6 0;
#P fasten 2 1 9 0 124 232 171 232;
#P connect 9 0 14 0;
#P connect 15 0 7 0;
#P fasten 14 0 15 0 171 299 84 299;
#P connect 6 0 15 0;
#P connect 13 0 4 0;
#P connect 12 0 4 0;
#P connect 11 0 4 0;
#P fasten 10 0 2 1 195 190 124 190;
#P connect 4 0 10 0;
#P connect 5 0 2 0;
#P connect 1 0 5 0;
#P connect 0 0 1 0;
#P connect 7 0 8 0;
#P connect 3 0 4 0;
#P window clipboard copycount 16;

#136449
Jul 21, 2008 at 5:09pm

message box with:
$1 $3 $4

or:

unpack w x y z
into:
pack w y z

- I think both of these should work, but all these really complex
replies have got me spooked!

Jay Bodley skrev:
> Hello,
>
> Is there any way to select a certain number/symbol on a list and delete it, sort of how prepend and append add to a list? I want to move letters from one list to another, as in:
>
> [a b c d e] [w x y z]
>
> becomes
>
> [a b c d e x] [w y z]
>
> when [x] is selected.
>
> Adding to first list is easy, but removing from second list has me stumped.
>
> Jay
>
> .
>
>

#136450
Jul 21, 2008 at 6:08pm

Thanks, Jeremy. With a little adjustment to fit my patch this is exactly what I needed.

#136451
Jul 21, 2008 at 6:31pm

The problem with those solutions is that they assume a known population and ordering of the lists. ‘zl filter’ under Max 5, or something like the hack I posted are necessary to deal with unknown list length and content, and can better respond to changing needs (if you need to suddenly filter q instead of x).

jb

Quote: Wetterberg wrote on Mon, 21 July 2008 19:09
—————————————————-
> message box with:
> $1 $3 $4
>
> or:
>
> unpack w x y z
> into:
> pack w y z
>
> – I think both of these should work, but all these really complex
> replies have got me spooked!

#136452
Jul 21, 2008 at 8:45pm

Jeremy Bernstein skrev:
> The problem with those solutions is that they assume a known population and ordering of the lists. ‘zl filter’ under Max 5, or something like the hack I posted are necessary to deal with unknown list length and content, and can better respond to changing needs (if you need to suddenly filter q instead of x).
Hey, I’m with you Jeremy, but sometimes you gotta K.I.S.S. – especially
if you DO know the length and content in advance, like when filtering
incoming data from a controller etc.
At any rate it’s always nice to have both the big and omnipotent
solutions as well as the cutesie ones, at least in my mind.

Andreas

#136453
Jul 21, 2008 at 8:55pm

This may not bring this discussion further, but it’s amusing reading:

In Defense of Omnipotence: http://www.jstor.org/pss/2218842

Perhaps telling, “In Defense of Cutesiness” didn’t come up with any hits.

jb

#136454
Jul 21, 2008 at 9:07pm

On Jul 21, 2008, at 4:45 PM, Andreas Wetterberg wrote:

> At any rate it’s always nice to have both the big and omnipotent
> solutions as well as the cutesie ones, at least in my mind.

And if you really want to get carried away, [mxj maxlispj] is the
List-Processing Object For You.

Yeah, I’m one of those awful people who laugh at their own jokes (I
have to — few others do…). I still get a kick out of the “bush-o-
matic” demo in the help patch. It’s amazing how well the artificial-
stupidity engine still remains relevant. I just generated this one a
minute ago:

“I am destroying the military. I believe we should pursue drilling
in the Arctic National Wildlife Refuge. Mission
Accomplished!. American families unnerstand a balanced budget? Dick
Cheney’s good friend Justice Scalia thinks we all hate a road map in
the mideast. The peoples of the Middle East want to defy nukular
weapons. Corporations want a manned mission to Mars by 2015.
America is safe again! Dead or alive. Smoke ‘em out. 9/11. Bring
‘em on. 9/11. Thank you — and may God Bless America.”

now *that’s* list-processing.

brad

http://music.columbia.edu/~brad

#136455
Jul 21, 2008 at 9:43pm

Quote: Jeremy Bernstein wrote on Mon, 21 July 2008 13:55
—————————————————-
> This may not bring this discussion further, but it’s amusing reading:
>
> In Defense of Omnipotence: http://www.jstor.org/pss/2218842
>
> Perhaps telling, “In Defense of Cutesiness” didn’t come up with any hits.
>

Try “In Defense of Cuteness”.
One hit: http://thebunnylounge.vox.com/library/photo/6a00c2252678c18e1d00c2252684e18e1d.html

Don’t question the cutesiness of a patch. Someone may sic Pikachu on you.

(sorry this is what happens when I need a break from work)

#136456
Jul 21, 2008 at 11:01pm

Jeremy Bernstein skrev:
> This may not bring this discussion further, but it’s amusing reading:
>
> In Defense of Omnipotence: http://www.jstor.org/pss/2218842
>
> Perhaps telling, “In Defense of Cutesiness” didn’t come up with any hits.
pfft, My God is so much cuter than Your God.

Jesse Terry from Ableton had a good name suggestion for Sampler, the
“big brother of Simpler”
- he wanted to call it “Complicator.” I quite liked that name ;)

andreas

#136457

You must be logged in to reply to this topic.