Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

float-help explanation of "list" could be improved #142

Closed
umlaeute opened this issue Mar 27, 2023 · 1 comment
Closed

float-help explanation of "list" could be improved #142

umlaeute opened this issue Mar 27, 2023 · 1 comment

Comments

@umlaeute
Copy link

umlaeute commented Mar 27, 2023

the current [float-help.pd] states:

list gets truncated to the first item

and gives an example [10.5 12.9 A(

in the reference section it states:

list - considers the first element if it's a float, stores and outputs it.

the statements are factually wrong.
rather than truncating a list to its first item, it instead distributes the list atoms to the inlets.

in the example ([10.5 12.9 A() this is what happens:

  1. since we only have 2 inlets, the 3rd atom (A) is discarded.
  2. the 2nd atom (12.9) is sent to the 2nd inlet (setting the internal state to 12.9)
  3. the 1st atom (10.5) is sent to the 1st inlet (effectively overwriting the 12.9, and then triggering an output of the current (10.5) value.

in practice this behaviour boils down to the two statements given above.

however, things get more complicated if the list contains symbols as the 1st or 2nd atom.

e.g. [10.5 A( will happily throw an error:

inlet: expected 'float' but got 'symbol'

because the symbol A is sent to the 2nd inlet (which is float-only).
after emitting the error, 10.5 is stored and output.

also, we can do:

[10(
|
[list $1.5 12.9(
|
[float]

which will output 10.5 (without an error), as the 1st atom triggers the symbol method of the object, which in turn converts the literal 10.5 into a number.

and of course we get two errors when sending a [list foo bar( to the object.

i do not want to propose to get into too much detail (as my explanation above), but refer to the common property of distributing list atoms to (cold) inlets.

@porres
Copy link
Collaborator

porres commented Mar 27, 2023

thanks for this. I reproduced this mistake from extended/purr misinterpretation of what was going on :/

I guess we just remove the "list" mentioning. Somewhere in the docs we have this information that list are distributed when there is no list method. This can be more evident in something like this --> #96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants