----- Original Message -----
From: IOhannes m zmoelnig zmoelnig@iem.at To: pd-list@iem.at Cc: Sent: Thursday, November 3, 2011 4:20 AM Subject: Re: [PD] symbol2list leading zero
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2011-11-02 18:06, rolf meesters wrote:
hi,
i'm using
[symbol2list -] | | [symbol( | | | [list2symbol]
on something like 00-ab-87-02. the result becomes 0ab872. so, i'm losing the leading zero's.
in other words the symbol '00' is handled like a number, probably any symbol that looks like a number is immediately treated like that. which, in the case above is unexpected (at least for me).
the idea is, that [symbol2list] breaks a symbol into a list of _atoms_, which are then evaluated the same way as ordinary lists (though i'm not sure whether it is implemented that way...)
e.g. is you create a message [list 00 ab 87 02( the 1st and last element of the list will evaluate to numbers (and thus "lose" their leading zeros). does this come unexpected to you?
however, it might be worth considering a "symbol only" mode of the object, that will never try to convert a token into a number but always keep it a symbol.
That would be useful.
-Jonathan
would it then be necessary, working with texts, always to check if
one's
not accidentally losing zero's?
btw, you are not "losing" any zeros. whether your pay cheque says "100,-€" or "000000000000100,-€" does not make any difference, when it comes to buying your marmite. those numbers are exactly the same.
if you need "00-ab" to split into two 2-character strings "00" and "ab" and want to use [symbol2list], you could simply convert all the numbers you got to 2-char strings by using [makefilename %02d]
mfgasdr IOhannes -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk6yTuUACgkQkX2Xpv6ydvT0+gCg497mHIcEDjGpsxVMpf9RvSLe O8QAn3a0g1mcH/CC054qXyQrNdhYYgB8 =bjB6 -----END PGP SIGNATURE-----
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list