[PD] symbol2list leading zero

IOhannes m zmoelnig zmoelnig at iem.at
Thu Nov 3 09:20:58 CET 2011

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.

> 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]

Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3636 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20111103/26e6812a/attachment.bin>

More information about the Pd-list mailing list