Hi Alex,
But shouldn't hex 232300002424 print to something like ##^N^N$$ instead of
##$$ ?
So the printed ASCII string (as char) carries all the information from the
hex string, and can be converted back to the exact same hex string?
At least in some special cases when it's needed?

Alexander Burger <picolisp@software-lab.de> schrieb am Di., 13. Feb. 2024,
07:56:

> Hi Thorsten,
>
> > it's been some time .. ;-)
>
> Welcome back! :)
>
>
> > I'm playing around a bit with hex<->ascii conversion in PicoLisp, and I
> > have the problem that (char 0) = NIL
> >
> >  (hex "00")
> > -> 0
> > : (char (hex "00"))
> > -> NIL
>
> This is correct.
>
> 'char' converts a number to a (transient) symbol here.
>
> A symbol's name is a string, a null-terminated sequence of UTF-8
> characters. In
> case of 'char', this string has a single character and a terminating null
> byte.
> This is the same as in other languages like C.
>
> So the number 65 gives a symbol "A":
>
>    : (char 65)
>    -> "A"
>
> But what happens with 0?
>
> It gives an empty string, i.e. a null-byte
>
>    : (char 0)
>    -> NIL
>
> and an empty string in PicoLisp is NIL.
>
>    : ""
>    -> NIL
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>

Reply via email to