How to use GenExpr?

Zack Lee's icon

Hi, I just installed a trial version of Max7 and I would like to use GenExpr object but I don't know how to use one. Is it not possible to use in the trial version?

Thanks.

Graham Wakefield's icon

gen~ should be working fine in the trial version. Create a [gen~] object, right click to select the help patcher, have a look around, and for GenExpr in particular start looking at the relevant reference pages.
https://docs.cycling74.com/max7/vignettes/gen_topic
https://docs.cycling74.com/max7/vignettes/gen_genexpr

I also strongly recommend taking a look at the many gen~ examples. (Help / Examples / Gen, or open Max's file browser and search for "gen~")

cuongit it's icon

I have 2 lists:

first_lst = [('-2.50', 0.49, 0.52), ('-2.00', 0.52, 0.50)]
second_lst = [('-2.50', '1.91', '2.03'), ('-2.00', '1.83', '2.08')]
I want to do the following math to it:

Multiply 0.49 by 1.91 (the corresponding values from first_lst and second_lst), and multiply 0.52 by 2.03 (corresponding values also). I want to do that under condition that values at position 0 in each corresponding tuple is idential so -2.50 == -2.50 etc. Obviously, we do the same math for remaning tuples as well.

My code:

[((fir[0], float(fir[1])*float(sec[1]), float(fir[2])*float(sec[2])) for fir in first_lst) for sec in second_lst if fir[0] == sec[0]]
Generates however some object:

[<generator object <genexpr> at 0x0223E2B0>]
Can you help me fix the code?

Graham Wakefield's icon

Gen isn't designed for working with lists. It is either for working with audio signals and buffers (gen~) or with jitter matrices and textures (jit.gen / jit.gl.pix).

I'm not sure what language your code is in?

For what you are wanting to do maybe you want to look at using javascript?

Zack Lee's icon

I don't think it's possible to use [genExpr] in the trial version.
If I create and open [gen~], I can't edit the gen patch.

Graham Wakefield's icon

Did your trial expire?

cuinjune's icon

No it's not expired yet. I think they blocked the feature in the trial version.