Hi Konrad,

thanks for the long explanation.


> this. when ever it prints a list it checks to see if it might be a
> string by inspecting the first n bytes (I don't know how many) if they
> are all printable ascii cahracters then it prints the list as a

That's quite a kludge, IMHO.


> delimiter is allready taken, and there is no alternative. so I can't
> easily write an unpacked string in source.

This is not difficult when you use the backquote read macro:

   : (de foo ()                                            
      (let S '`(chop "abcdefghijklmnopqrstuvwxyz")
         (prinl (reverse S))                      
         (length S) ) )
   -> foo

   : (foo)              
   zyxwvutsrqponmlkjihgfedcba
   -> 26


> What I'm saying is that there may be a case to say that treating
> strings as lists by default may be better then treating them as

Perhaps. But this is also a matter of efficiency: A list of single
characters takes up four times the space (and even eight times on
64bits) compared to the packed symbol representation.

PicoLisp tries not to be overly clever. A list should be a list, and a
symbol should be a symbol, under all circumstances. What you see is what
you get. When you start to print things differently depending on the
context, you'll just create confusion.


> transient strings by default, especially as the transietn symbol names
> are stored as lists under the hood anyway.

Well, they are stored in cells, but not as lists of individual
characters.


> the documentation states somewhere that decision to treat strings as
> transient symbols may have been missguided.

If I recall correctly, the opposite was meant: That transient symbols
(which are an essential feature of the language) look syntactically like
strings in other languages.

In earlier versions of PicoLisp, transient symbols had another syntax
(i.e. :Var instead of "Var"). But then you cannot easily write transient
symbols with white space in the name etc., and you effectively lose the
ability to use transient symbols *like* strings in other languages.


> Once Strings are just lists all of the normal list processing
> functions can be appleid to them, and special characters can then be

Yes, this is an important feature, and also used frequently in PicoLisp.
It is easily achieved with (line), (chop) etc. But more important is
that real transient symbols also have a value cell and a property list.
This makes it possible to do things with "strings" which are not
possible in other languages.

For example, the whole locale translation mechanisms depend on the fact
that "strings" contain their current translation in the value cell. With
that, (prinl "house") will result in, for example, "Haus" if the locale
is German.


> given standard representations. The need to find out what the control
> sequences for things like tab and new line was also a stumbling block
> as they are not as intuitive as the '/' escapes used by most other
> programming languages.

You are free do define e.g.

   : (setq "\n" "^J"  "\r" "^M"  "\t" "^I")

(in the same transient scope, of course)


> the precision of numbers varies between lines.  This last part of
> actually parsing the numbers and getting them treated as numbers is
> where I got up to before giving up.

How did you try this? Should be no problem with the 'format' function,
where you can pass precision and separator values.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to