Re: NIL and ""

2014-08-23 Thread Christophe Gragnic
On Sun, Aug 24, 2014 at 7:47 AM, Alexander Burger  wrote:
>
>>  wrote:
>> >
>> > If NIL doesn't exist at all, then why do you need to expose it?  If
>> > you language exposes lists or strings then empty ones carry the same
>> > meaning.
>>
>> I don't want to expose it.
>> Sorry, maybe I wasn't clear enough.
>> In particular, I'd like my users to type in a REPL "",
>> and see the result "", not NIL.
>
> Well, as Michel said, then it is easy, isn't it? You just change the
> print routine to output '""' instead of 'NIL'.

Now I understand this answer. Thanks Michel.
BTW, are you the author of the book Delphi5?

> Concerning your original question:
>
> NIL representing the empty string seems so natural to me, that I never
> thought much about it, and have difficulties to imagine a life without
> it ;)
>
> A few points about the background come to mind, though:
>* It wouldn't work smoothly in conditionals any longer ('cond', 'if',
>  'and', 'or' etc.)
>* It would take up space in property-lists and in the database
>* If the empty string were a transient symbol, it would no longer be
>  uniqe, and '==', 'memq', 'asoq', 'throw' etc. cannot be used on it
>
> What type of object would '""' be? Not an internal symbol, as the double
> quotes point to a transient symbol. Transient symbols without name are
> anonymous symbols, however, which are created with 'new' and 'box', and
> which print as something like '$177702023320760'. If you print them all
> as '""', anynymous symbols cannot be distinguished any longer, e.g.
> during debugging, and some tools like 'edit' would not be able to handle
> them.

Thanks, this is the kind of info I was asking for.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: NIL and ""

2014-08-23 Thread Alexander Burger
Hi Christophe,

>  wrote:
> >
> > If NIL doesn't exist at all, then why do you need to expose it?  If
> > you language exposes lists or strings then empty ones carry the same
> > meaning.
> 
> I don't want to expose it.
> Sorry, maybe I wasn't clear enough.
> In particular, I'd like my users to type in a REPL "",
> and see the result "", not NIL.

Well, as Michel said, then it is easy, isn't it? You just change the
print routine to output '""' instead of 'NIL'.


Concerning your original question:

NIL representing the empty string seems so natural to me, that I never
thought much about it, and have difficulties to imagine a life without
it ;)

A few points about the background come to mind, though:
   * It wouldn't work smoothly in conditionals any longer ('cond', 'if',
 'and', 'or' etc.)
   * It would take up space in property-lists and in the database
   * If the empty string were a transient symbol, it would no longer be
 uniqe, and '==', 'memq', 'asoq', 'throw' etc. cannot be used on it

What type of object would '""' be? Not an internal symbol, as the double
quotes point to a transient symbol. Transient symbols without name are
anonymous symbols, however, which are created with 'new' and 'box', and
which print as something like '$177702023320760'. If you print them all
as '""', anynymous symbols cannot be distinguished any longer, e.g.
during debugging, and some tools like 'edit' would not be able to handle
them.

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


Re: NIL and ""

2014-08-23 Thread Christophe Gragnic
On Sat, Aug 23, 2014 at 9:17 PM, Michel Pelletier
 wrote:
>
> If NIL doesn't exist at all, then why do you need to expose it?  If
> you language exposes lists or strings then empty ones carry the same
> meaning.

I don't want to expose it.
Sorry, maybe I wasn't clear enough.
In particular, I'd like my users to type in a REPL "",
and see the result "", not NIL.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: NIL and ""

2014-08-23 Thread Michel Pelletier
On Sat, Aug 23, 2014 at 11:56 AM, Christophe Gragnic
 wrote:
> On Sat, Aug 23, 2014 at 3:13 PM, Alexander Burger  
> wrote:
>>> Is there somewhere some info about "" being NIL?
>>http://software-lab.de/doc/ref.html#nilSym
>>http://software-lab.de/doc/ref.html#nilSym-io
>
> Thanks. I knew about this links, I just wanted to know why.
>
>>> The language I'm trying to embed in PicoLisp would love to have
>>> "" and NIL different !
>>
>> Why? I believe this is a wonderful feature! A lot of PicoLisp's
>> expressive power is a result of this universality of NIL.
>
> This kind of answers my question !
> I understand this being a power, a kind of polymorphism, like
> in Python where the boolean value of "", [],… is False.
> But in the language I design, I'd like to have separate values
> for "" and NIL. In fact, NIL doesn't exists at all!
>
> I'm afraid this is a big problem for me.
> Maybe I'll try with a special symbol…

If NIL doesn't exist at all, then why do you need to expose it?  If
you language exposes lists or strings then empty ones carry the same
meaning.

-Michel

>
>
> chri
>
> --
>
> http://profgra.org/lycee/ (site pro)
> http://delicious.com/profgraorg (liens, favoris)
> https://twitter.com/profgraorg
> http://microalg.info
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: NIL and ""

2014-08-23 Thread Christophe Gragnic
On Sat, Aug 23, 2014 at 3:13 PM, Alexander Burger  wrote:
>> Is there somewhere some info about "" being NIL?
>http://software-lab.de/doc/ref.html#nilSym
>http://software-lab.de/doc/ref.html#nilSym-io

Thanks. I knew about this links, I just wanted to know why.

>> The language I'm trying to embed in PicoLisp would love to have
>> "" and NIL different !
>
> Why? I believe this is a wonderful feature! A lot of PicoLisp's
> expressive power is a result of this universality of NIL.

This kind of answers my question !
I understand this being a power, a kind of polymorphism, like
in Python where the boolean value of "", [],… is False.
But in the language I design, I'd like to have separate values
for "" and NIL. In fact, NIL doesn't exists at all!

I'm afraid this is a big problem for me.
Maybe I'll try with a special symbol…


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: NIL and ""

2014-08-23 Thread Alexander Burger
Hi Christophe,

> Is there somewhere some info about "" being NIL?

   http://software-lab.de/doc/ref.html#nilSym
  ...
   • to represent a string of length zero
  ...

   http://software-lab.de/doc/ref.html#nilSym-io

  Besides for standard normal form, NIL is also recognized as (), [] or ""


> I'd like to know why, maybe with some historical hindsight,

There is no special history to it.


> The language I'm trying to embed in PicoLisp would love to have
> "" and NIL different !

Why? I believe this is a wonderful feature! A lot of PicoLisp's
expressive power is a result of this universality of NIL.

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