Re: The '^' character in strings

2014-07-01 Thread Alexander Burger
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
101 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


The '^' character in strings

2014-06-30 Thread Chris Double
What is the special magic that ^ does in strings? If I do the following:

  (prinl hello ^ world)

Then only hello  is printed. If I read using (read) a string
containing '^' it is similarly truncated.

-- 
http://www.bluishcoder.co.nz
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: The '^' character in strings

2014-06-30 Thread Danilo Kordic
^ starts an escape sequence.
: (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.
Source code of interpreter should explain it best, but I can't understand
it yet.



On Tue, Jul 1, 2014 at 5:47 AM, Chris Double chris.dou...@double.co.nz
wrote:

 What is the special magic that ^ does in strings? If I do the following:

   (prinl hello ^ world)

 Then only hello  is printed. If I read using (read) a string
 containing '^' it is similarly truncated.

 --
 http://www.bluishcoder.co.nz
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe