From: Willem Moolenburgh
Subject: Character to symbol
Date: 
Message-ID: <35C856FC.27B0@dds.nl>
Hi,

I would like to transform a character back to a symbol,
 so for example go from #\A to symbol A. Because a character is less
generic than a symbol, this is a harder task than I thought it would be.
Who can help me out? 

Willem

From: Christopher Stacy
Subject: Re: Character to symbol
Date: 
Message-ID: <uzpdji5l8.fsf@pilgrim.com>
Willem Moolenburgh <·······@dds.nl> writes:
> I would like to transform a character back to a symbol,

I wonder why you think your character used to be a symbol?
From: Daniel R Barlow
Subject: Re: Character to symbol
Date: 
Message-ID: <6qaevr$nuo@fishy.ox.compsoc.net>
In article <·············@pilgrim.com>,
Christopher Stacy  <······@pilgrim.com> wrote:
>Willem Moolenburgh <·······@dds.nl> writes:
>> I would like to transform a character back to a symbol,
>
>I wonder why you think your character used to be a symbol?

Do you often think your character used to be a symbol?  Maybe your 
plans have something to do with this

-dan
From: Christopher Stacy
Subject: Re: Character to symbol
Date: 
Message-ID: <uyat1ixga.fsf@pilgrim.com>
···@fishy.ox.compsoc.net (Daniel R Barlow) writes:

> In article <·············@pilgrim.com>,
> Christopher Stacy  <······@pilgrim.com> wrote:
> >Willem Moolenburgh <·······@dds.nl> writes:
> >> I would like to transform a character back to a symbol,
> >
> >I wonder why you think your character used to be a symbol?
> 
> Do you often think your character used to be a symbol?  Maybe your 
> plans have something to do with this

Why do you say Do you often think your character used to be a symbol?
Earlier you said something about your mother.
From: Rainer Joswig
Subject: Re: Character to symbol
Date: 
Message-ID: <joswig-0708980850250001@pbg3.lavielle.com>
In article <·············@pilgrim.com>, Christopher Stacy
<······@pilgrim.com> wrote:

> ···@fishy.ox.compsoc.net (Daniel R Barlow) writes:
> 
> > In article <·············@pilgrim.com>,
> > Christopher Stacy  <······@pilgrim.com> wrote:
> > >Willem Moolenburgh <·······@dds.nl> writes:
> > >> I would like to transform a character back to a symbol,
> > >
> > >I wonder why you think your character used to be a symbol?
> > 
> > Do you often think your character used to be a symbol?  Maybe your 
> > plans have something to do with this
> 
> Why do you say Do you often think your character used to be a symbol?
> Earlier you said something about your mother.

Tell me something about your family.
From: Rob Warnock
Subject: Re: Character to symbol
Date: 
Message-ID: <6qeo7b$2m37h@fido.engr.sgi.com>
Rainer Joswig <······@lavielle.com> wrote:
+---------------
| <······@pilgrim.com> wrote:
| > ···@fishy.ox.compsoc.net (Daniel R Barlow) writes:
| > > Christopher Stacy  <······@pilgrim.com> wrote:
| > > >Willem Moolenburgh <·······@dds.nl> writes:
| > > >> I would like to transform a character back to a symbol,
| > > >I wonder why you think your character used to be a symbol?
| > > Do you often think your character used to be a symbol?  Maybe your 
| > > plans have something to do with this
| > 
| > Why do you say Do you often think your character used to be a symbol?
| > Earlier you said something about your mother.
| 
| Tell me something about your family.
+---------------

We were talking about you, not me.


-Rob

-----
Rob Warnock, 7L-551		····@sgi.com   http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA
From: Ulrich Hoffmann
Subject: Re: Character to symbol
Date: 
Message-ID: <6quvp4$9dd$1@amun.informatik.uni-kiel.de>
In <·················@cs.tcd.ie> John Moran <··········@cs.tcd.ie> writes:


> >  so for example go from #\A to symbol A. Because a character is less
> > generic than a symbol, this is a harder task than I thought it would be.

> (gensym #\A) will work.

Nope, gensym requires a string or an integer as argument (CltL2 245f).
Also it creates uninterned symbols, which is probably not what was originally 
intended, since  (eql (gensym n) (gensym n))  never holds.

To create an interned symbol with a printname of length one containing 
a given character c (of type string-char) in the current package 
use the phrase

(intern (string c))

The following equations are all true:
   
   (eql 'A (intern (string #\A)))
   (eql '|a| (intern (string #\a)))
   (eql (intern "A") (intern (string #\A)))

> And now a question from me I posted a while ago but didn't get an answer to.
> How do I type in pathnames for the PC seeing as the "\" character is a
> special character. eg. (load a:\subdir\filename.lsp)?

What about (load "a:\\subdir\\filename.lsp") ? 

Just a guess, sorry. I use DOS only for gaming. 

Regards,
      Ulrich

-- 
Ulrich Hoffmann, Uni Kiel        http://www.informatik.uni-kiel.de/~uho/
Institut f. Informatik,                       ···@informatik.uni-kiel.de
Preusserstr 1-9, D-24105 Kiel, Germany  Tel: +49 431 560426  Fax: 566143
From: Kent M Pitman
Subject: Re: Character to symbol
Date: 
Message-ID: <sfwaf58voec.fsf@world.std.com>
···@informatik.uni-kiel.de (Ulrich Hoffmann) writes:

> The following equations are all true:
>    
>    (eql 'A (intern (string #\A)))
>    (eql '|a| (intern (string #\a)))
>    (eql (intern "A") (intern (string #\A)))

Mostly. They'd be 'more true' (if there is such a concept) if you
specified a package argument to INTERN so that someone didn't manage
to split the package used to read those forms from the package used
to execute them, as in:

 (defun hoffmans-truth () (eql 'A (intern (string #\A))))
 
 (let ((*package* (find-package "KEYWORD")))
   (hoffmans-truth)) => NIL

> > And now a question from me I posted a while ago but didn't get an
> > answer to.  How do I type in pathnames for the PC seeing as the
> > "\" character is a special character. eg. 
> > (load a:\subdir\filename.lsp)?
> 
> What about (load "a:\\subdir\\filename.lsp") ? 

FWIW, in LispWorks for Windows (LWW), you can use the syntax
  (load "a:/subdir/filename.lisp")
too.  I find it a lot more convenient.  This is allowed by the language
standard, which leaves it to the implementation to define the mapping of
namestring syntax to native filename syntax.

(Incidentally, I try not to do much 'marketing hype' but since it's a
free thing and anyone can try, I will note that an LWW Personal
Edition is available now free from Harlequin; see
http://www.harlequin.com for details.)

Anyway, back on the issue of backslashes, it's a crying shame that the
DOS folks chose to use a commonly-used syntactic quoting character as
a directory separator.  Many DOS/Windows tools do understand /'s,
actually, but it's not uniform.  Too bad.
From: Howard R. Stearns
Subject: Re: Character to symbol
Date: 
Message-ID: <35D3239D.1C78F36@elwood.com>
Kent M Pitman wrote:
> 
> ···@informatik.uni-kiel.de (Ulrich Hoffmann) writes:
> ...
> > > And now a question from me I posted a while ago but didn't get an
> > > answer to.  How do I type in pathnames for the PC seeing as the
> > > "\" character is a special character. eg.
> > > (load a:\subdir\filename.lsp)?
> >
> > What about (load "a:\\subdir\\filename.lsp") ?
> 
> FWIW, in LispWorks for Windows (LWW), you can use the syntax
>   (load "a:/subdir/filename.lisp")
> too.  I find it a lot more convenient.  This is allowed by the language
> standard, which leaves it to the implementation to define the mapping of
> namestring syntax to native filename syntax.
> 
> (Incidentally, I try not to do much 'marketing hype' but since it's a
> free thing and anyone can try, I will note that an LWW Personal
> Edition is available now free from Harlequin; see
> http://www.harlequin.com for details.)
> 
> Anyway, back on the issue of backslashes, it's a crying shame that the
> DOS folks chose to use a commonly-used syntactic quoting character as
> a directory separator.  Many DOS/Windows tools do understand /'s,
> actually, but it's not uniform.  Too bad.

(For what it's worth, and nothing really to do with Lisp....)

Actually, MS appears to have relented.  The "Platform SDK" (formerly
known as the WIN32 SDK) provides the API that people are supposed to
write Windows programs with.  All the Platform SDK functions which
accept pathname namestrings accept both '/' and '\' as directory
separators.  It's nice that LWW supports both as well.

(Back to Lisp...)

If I recall correctly, pre-Common Lisps tended to use '/' as the quoting
(i.e. single escape) character.  Someone (Steele? Gabriel?) has observed
that switching to '\' left '/' free for use in pathname-namestrings for
the then-dominating Unix system.  I wonder if we have now reached the
point where there are more Windows Common Lisp system in use than Unix
systems.  (It is furtunate that Window's now supports both separators
just so that the Lisp community doesn't have to blow with the wind and
change back....)
From: Raymond Toy
Subject: Re: Character to symbol
Date: 
Message-ID: <4nww8c8yov.fsf@rtp.ericsson.se>
>>>>> "Howard" == Howard R Stearns <······@elwood.com> writes:

    Howard> (For what it's worth, and nothing really to do with Lisp....)

    Howard> Actually, MS appears to have relented.  The "Platform SDK" (formerly
    Howard> known as the WIN32 SDK) provides the API that people are supposed to
    Howard> write Windows programs with.  All the Platform SDK functions which
    Howard> accept pathname namestrings accept both '/' and '\' as directory
    Howard> separators.  It's nice that LWW supports both as well.

Umm, I remember that even in DOS 2.1, "/" was accepted by all of the
DOS functions as the directory separator.  But command.com didn't.

I think early windows programs accepted this too, unless the program
itself went out of it's way to enforce the backslash.

Ray
From: Kent M Pitman
Subject: Re: Character to symbol
Date: 
Message-ID: <sfwaf58txtu.fsf@world.std.com>
"Howard R. Stearns" <······@elwood.com> writes:

> If I recall correctly, pre-Common Lisps tended to use '/' as the quoting
> (i.e. single escape) character.  Someone (Steele? Gabriel?) has observed
> that switching to '\' left '/' free for use in pathname-namestrings for
> the then-dominating Unix system.  I wonder if we have now reached the
> point where there are more Windows Common Lisp system in use than Unix
> systems.  (It is furtunate that Window's now supports both separators
> just so that the Lisp community doesn't have to blow with the wind and
> change back....)

First, files are not the only reason that \ was chosen over / in CL,
so even if what you say was true, it would not be reason enough to change.
LOTS of programs use \ as the quoting char, and almost none use /.
That was one reason for the change.

Another reason for the change was that we needed / for division.  In
Maclisp, you had to use // and the second most common bug report (after
"Help! PLUS is broken.  (+ 5 5) returned 12", which was a problem with
the choice of base 8 as the default radix) was "What does it mean when
it says | 3| unbound variable??" (because someone had done (/ 3 4)
unwittingly, which was in Maclisp the sdame as (| 3| 4).  This alone
justifies not changing back.

We also needed / for rational numbers.  1/2 looks fine.  1\2, which
is what the Lisp Matchine's traditional Zetalisp dialect used, looks 
stupid.  (// 1\2 2) => 1\4 in Zetalisp.  Ick.

Also, incompatible changes require overwhelming consensus of the
community.  Even the change from representing characters as integers
to representing them as their own datatype, which many many people
wanted, cost the industry an enormous amount of money.  Symbolics
customers complained that it cost many 10's of thousands of dollars to
accept the new release in which we'd upgraded the array representation
to be CL compliant, and even then we had the consensus of the CL
industry (through a formal standards process) that this was a "good"
change.  Changing things merely because someone "believes" that a
certain rationale has been undone is an enormously dangerous thing.
What if Linux took hold?  Would the industry want it changed back?  CL
exists to provide commercial stability, not aesthetics.  That is an
explicit and core part of its design rationale.  Throwing that to the
wind is ill-recommended.

And anyway, the Web certainly outnumbers all other systems, I'm sure,
with its URL syntax, and is strong on the slash side, probably to stay.
So changing for one particular file syntax again seems ill-recommended.

The morally right thing is for Microsoft to make the change, since
myriad programs (not just Lisp) are caused a nuissance by this, and
changing it in a central place makes most sense...
From: Ulrich Hoffmann
Subject: Re: Character to symbol
Date: 
Message-ID: <6rbcar$158$1@amun.informatik.uni-kiel.de>
In <···············@world.std.com> Kent M Pitman <······@world.std.com> writes:

> > The following equations are all true:
> >    
> >    (eql 'A (intern (string #\A)))
> >    (eql '|a| (intern (string #\a)))
> >    (eql (intern "A") (intern (string #\A)))

> Mostly. They'd be 'more true' (if there is such a concept) if you
> specified a package argument to INTERN so that someone didn't manage
> to split the package used to read those forms from the package used
> to execute them, as in:

>  (defun hoffmans-truth () (eql 'A (intern (string #\A))))
>  
>  (let ((*package* (find-package "KEYWORD")))
>    (hoffmans-truth)) => NIL

You're right, I assumed no package modifications. It should read

 (eql 'A    (intern (string #\A) (symbol-package 'A)))

and so on.

Thanks for the remark,
                     Ulrich

-- 
Ulrich Hoffmann, Uni Kiel        http://www.informatik.uni-kiel.de/~uho/
Institut f. Informatik,                       ···@informatik.uni-kiel.de
Preusserstr 1-9, D-24105 Kiel, Germany  Tel: +49 431 560426  Fax: 566143
From: Donald Fisk
Subject: Re: Character to symbol
Date: 
Message-ID: <35D30FD1.57D751AC@bt-sys.spamblock.bt.co.uk>
John Moran wrote:

> And now a question from me I posted a while ago but didn't get an answer to.
> How do I type in pathnames for the PC seeing as the "\" character is a
> special character. eg. (load a:\subdir\filename.lsp)?

(load "a:\\subdir\\filename.lsp")

> John

-- 
Le Hibou (mo bheachd fhe/in: my own opinion)
"it's just that in C++ and the like, you don't trust _anybody_,
and in CLOS you basically trust everybody.  the practical result
is that thieves and bums use C++ and nice people use CLOS."
	-- Erik Naggum
From: Steve Gonedes
Subject: Re: Character to symbol
Date: 
Message-ID: <m2emukk5zs.fsf@KludgeUnix.com>
John Moran <··········@cs.tcd.ie> writes:
 
< And now a question from me I posted a while ago but didn't get an answer to.
< How do I type in pathnames for the PC seeing as the "\" character is a
< special character. eg. (load a:\subdir\filename.lsp)?
< 
< John

Have you though about using logical pathnames? You can then use

(load #p"someplace:;subdir;file.lsp").

(setf (logical-pathname-translations "data")
       '((";**;*.*.*" "/home/steve/lib/Scripts/LISP/")))

Now you could do

(directory #p"data:;tinfo;*.*.*")

or

(directory #p"data:;**;").