zl.sub and empty lists

Don Sinclair's icon

Hi,

I was expecting that zl.sub would return found 0 when asked for a position in an empty list however it returns nothing (i.e. no output). Just curious about the reasoning behind this. Of course, for my current patch returning found 0 for an empty list would be more convenient!

don

Source Audio's icon

How do You send empty list ?

Don Sinclair's icon

Good question! Now I see where I went wrong. zl.sub works as expected. When initialized (with zlclear) a bang gives no output. After sub-list to find is specified, a bang outputs found 0. It is actually the dict object that is messing me up. The getkeys message to an empty dict gives no output. I will need to have a way to detect this. m

thanks for the response!

Source Audio's icon
Max Patch
Copy patch and select New From Clipboard in Max.

That can be done like this :