[PD] how to write different types to [text]
Roman Haefeli
reduzent at gmail.com
Mon Mar 28 22:54:09 CEST 2022
On Sun, 2022-03-27 at 18:22 +0200, Christof Ressi wrote:
> > There is no way to get the rest of the message. I think [text get]
> > could simply output all sublists consecutively. By checking the
> > right outlet you know if a message spans a whole line (= 0), or is
> > part of a comma seperated list of messages (= 1).
>
> To be more precise: it should output all sublists when you request a
> *whole line* (field number = -1).
>
> If you have the following text:
>
> 1 2 3, foo bar baz, 5 6 7;
> [0( -> [text get] would output "1 2 3" (type 1), "foo bar baz" (type
> 1) and "5 6 7" (type 0)
[0( now returns only '1 2 3'. [1( accesses 'foo bar baz', and [2( '5 6
7' (type 0).
> But how would you access individual sublists?
There is no need to access _sublist_ since lists of either type are
accessed and counted the same. I think, this aspect of accessing
messages is already consistent and complete.
You cannot _create_ lists ending with a comma, however. I propose a
'type' inlet in [text set] and [text insert], just for completeness and
consistency.
[11 12 13( [2( [1( <- type
| / /
[text insert ]
with above text buffer example would create:
1 2 3, foo bar baz, 11 12 13, 5 6 7;
Roman
> I guess you should be able to do [3 3( -> [text get] to get the
> second sublist, but [3 4( -> [text get] should probably trigger an
> out-of-range error.
>
> But we do not know the indices and sizes of the individual sublists!
>
> Maybe [text size] could have an extra outlet to provide that
> information? Maybe output a list of indices?
>
> This definitely needs a bit of thinking...
>
> Christof
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management ->
> https://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20220328/7851e874/attachment.sig>
More information about the Pd-list
mailing list