Re: [PD] Further questions on struct and the external api

2021-09-15 Thread João Pais



I’m discovering the superb world of struct (with the 3 recommended tutorials, 
all of which very biased towards the graphic angle

at least there is a visible reward for all the effort it takes to work with 
data-s

I understand the argument, but for me I read it was ‘for graphics’ - it was 
limiting until I understood it was not just for that.


it was just a joke. but yes, most of the patching around is used for 
graphic display/interaction.




what you mean with dummy? [append] needs at least one float to be declared

That is what I mean, in this case I just need key -> float array, neither of 
them would be able to trigger a creation of a new item. This is why [text] is my 
new friend, although it won’t help with nested lists and arbitrary dictionary 
style structures. I’ll find a way.
I just tried to store and retrieve a pointer from [text] , it didn't 
work. But it does work with [list]. Maybe there is some smart hack that 
allows for (pointer) to be correctly read from [text].

if you're into consoles full or red letters.

:D

I’m trying to behave so the 2 proposals you put are great.


I guess so far no one predicted that a scalar could have no variables at all.

I am aware I’m bending the concept of struct. It was not meant to be a 
dictionary, especially not with nested ones.
that indicates the principle could be improved. such like it's not 
possible to append a scalar with a symbol directly, there are still 
things to improve. if a struct template doesn't need a float, why force 
it to have one?

the question I now have is for people developing externals

Is this list the right place for that question? I would like to be able to read 
and write [text] and [struct] declared in the patch within my externals but I 
don’t know if that is possible in the API.

probably the dev list might be more helpful, although they also are here.



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


Re: [PD] Further questions on struct and the external api

2021-09-15 Thread Pierre Alexandre Tremblay
>> I’m discovering the superb world of struct (with the 3 recommended 
>> tutorials, all of which very biased towards the graphic angle 
> at least there is a visible reward for all the effort it takes to work with 
> data-s

I understand the argument, but for me I read it was ‘for graphics’ - it was 
limiting until I understood it was not just for that.

> what you mean with dummy? [append] needs at least one float to be declared

That is what I mean, in this case I just need key -> float array, neither of 
them would be able to trigger a creation of a new item. This is why [text] is 
my new friend, although it won’t help with nested lists and arbitrary 
dictionary style structures. I’ll find a way.

> if you're into consoles full or red letters.

:D

I’m trying to behave so the 2 proposals you put are great.

> I guess so far no one predicted that a scalar could have no variables at all.

I am aware I’m bending the concept of struct. It was not meant to be a 
dictionary, especially not with nested ones.

>> the question I now have is for people developing externals

Is this list the right place for that question? I would like to be able to read 
and write [text] and [struct] declared in the patch within my externals but I 
don’t know if that is possible in the API.

Thanks again all for the help.

p


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


Re: [PD] Further questions on struct and the external api

2021-09-15 Thread João Pais



I’m discovering the superb world of struct (with the 3 recommended tutorials, 
all of which very biased towards the graphic angle


at least there is a visible reward for all the effort it takes to work 
with data-s




but I found ways around) and my new favourite friend is [text] for that reason 
:)

2 questions:

- in the attached patch, I needed to create a dummy entry to my ‘test-item’ 
struct to be able to dynamically add entries infusing [append] - do I 
understand right?


what you mean with dummy? [append] needs at least one float to be 
declared, if that's what you mean (unless someone implements a bang 
method to add a scalar without variables). the "key" variable can be 
removed from the template, if you wish. But the scalar created isn't a 
dummy, but the array itself.


Btw you can use [append test-item] with no further arguments. But there 
will be an error message "pd-test-item.: no such field" every time it 
receives an input, although it does create the scalar. You can even 
remove all variables and leave only [struct test-item array value 
float], if you're into consoles full or red letters. I guess so far no 
one predicted that a scalar could have no variables at all.




- it seems that I would be able to find workarounds the fact we cannot search 
my dataset by making an entry that would hold my keys at the top but that is 
cumbersome so I’m now making friends with the fantastic [text] object… the 
question I now have is for people developing externals: is it possible to 
access and write to struct and/or arrays from an external developed through the 
API? I didn’t find examples doing so nor any reference to text_buf in the API 
so I wonder if anyone has any pointers on that. Worse case I can use a message 
to dump a list and then [text fromlist] but that would be limited by the 
maxlength of the said list which was a problem in Max (hence us going the extra 
mile of supporting native dicts there)

Thanks all for your help.

p


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


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


[PD] Further questions on struct and the external api

2021-09-15 Thread Pierre Alexandre Tremblay
Dear all

I’m discovering the superb world of struct (with the 3 recommended tutorials, 
all of which very biased towards the graphic angle but I found ways around) and 
my new favourite friend is [text] for that reason :)

2 questions:

- in the attached patch, I needed to create a dummy entry to my ‘test-item’ 
struct to be able to dynamically add entries infusing [append] - do I 
understand right?

- it seems that I would be able to find workarounds the fact we cannot search 
my dataset by making an entry that would hold my keys at the top but that is 
cumbersome so I’m now making friends with the fantastic [text] object… the 
question I now have is for people developing externals: is it possible to 
access and write to struct and/or arrays from an external developed through the 
API? I didn’t find examples doing so nor any reference to text_buf in the API 
so I wonder if anyone has any pointers on that. Worse case I can use a message 
to dump a list and then [text fromlist] but that would be limited by the 
maxlength of the said list which was a problem in Max (hence us going the extra 
mile of supporting native dicts there) 

Thanks all for your help.

p



test-struct-3.pd
Description: Binary data
___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list