On Tue, Jul 01, 2014 at 06:10:35AM +0200, Danilo Kordic wrote:
> ^ starts an escape sequence.

Yes. Or, perhaps to be more exact, they are read-macros.


> : (mapcar char (range 0 64))
> -> (NIL "^A" "^B" "^C" "^D" "^E" "^F" "^G" "^H" "^I" "^J" "^K" "^L" "^M"
> "^N" "^O" "^P" "^Q" "^R" "^S" "^T" "^U" "^V" "^W" "^X" "^Y" "^Z" "^[" "^\"
> "^]" "^^" "^_" " " "!" "\"" "#" "$" "%" "&" "'" "(" ")" "*" "+" "," "-" "."
> "/" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" ":" ";" "<" "=" ">" "?" "@")
> # I think You see the pattern.
> 
> : (setq v1 "^ ")
> -> $384402410  # For example.
> : (length v1)
> -> 0
> : (char v1)
> -> 0
> # NULL character.
> 
> I think that sequences that are not shown above are undefined and actual
> results are coincidence of implementation.  I haven't found it in docs.

Actually, this is the intended behavior.

The first rule is, that '^' simply keeps the lowest 5 bits of a
character. For example, he ASCII (or UTF-8) code for 'A' is 65, which is
"1000001" binary. Keeping the lowest five bits gives 1.

The second rule is that symbol names in PicoLisp cannot contain the null
byte. It is used as a terminator internally (similar to C).

Symbols without a name (i.e. the name consists _only_ of the null byte)
are called "anonymous" symbols, and are printed with a leading '$' like
the $384402410 above.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to