Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

two questions about strings

264 views
Skip to first unread message

Rüdiger Sonderfeld

unread,
Jul 27, 2002, 5:34:31 PM7/27/02
to
hi,
I'm new to common lisp and I have some problems with strings.

1) How can I get the size of a string?

Something like

>(strlen "hiho")
4

2) How can I get the code to a char?

Something like

>(code #\a)
1

or what you can do in C(++) with a simple convertation from a char to an
integer

int code=(int)'a';

Rüdiger Sonderfeld

unread,
Jul 27, 2002, 5:43:37 PM7/27/02
to
Rüdiger Sonderfeld wrote:
> 1) How can I get the size of a string?

Ups :)

(length "hiho")

is what I needed

Nils Goesche

unread,
Jul 27, 2002, 3:49:20 PM7/27/02
to
Rüdiger Sonderfeld <cplusp...@gmx.net> writes:

> 1) How can I get the size of a string?
>
> Something like
>
> >(strlen "hiho")
> 4

(length "hiho")

> 2) How can I get the code to a char?
>
> Something like
>
> >(code #\a)
> 1

(char-code #\a)

Regards,
--
Nils Goesche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xC66D6E6F

Thomas F. Burdick

unread,
Jul 27, 2002, 4:04:34 PM7/27/02
to
Rüdiger Sonderfeld <cplusp...@gmx.net> writes:

> 2) How can I get the code to a char?
>
> Something like
>
> >(code #\a)
> 1

CHAR-CODE takes a character and returns a number.
CODE-CHAR does the inverse.

You might also be interested in CHAR=, CHAR<, CHAR>, etc., depending
on why you want this. Be sure to check:

<http://www.xanalys.com/software_tools/reference/HyperSpec/Body/13_af.htm>

to learn about the guarantees of character ordering, if you have any
interest at all in portability.

--
/|_ .-----------------------.
,' .\ / | No to Imperialist war |
,--' _,' | Wage class war! |
/ / `-----------------------'
( -. |
| ) |
(`-. '--.)
`. )----'

Rüdiger Sonderfeld

unread,
Jul 27, 2002, 7:21:52 PM7/27/02
to
Thomas F. Burdick wrote:
> You might also be interested in CHAR=, CHAR<, CHAR>, etc., depending
> on why you want this. Be sure to check:

I wrote this function

(defun isupper(x)
(if (and (char>= x #\A) (char<= x #\Z))
t (return-from isupper))
nil)

but it always returns nil :(

(isupper #\A)
NIL
(isupper #\a)
NIL

(defun isupper (x)
(if (and (>= (char-code x) (char-code #\A)) (<= (char-code x) (char-code
#\Z)))
t (return-from isupper)))
nil)

(isupper #\A)
T
(isupper #\a)
NIL

this function works.

What's wrong?

Thomas F. Burdick

unread,
Jul 27, 2002, 5:37:18 PM7/27/02
to
Rüdiger Sonderfeld <cplusp...@gmx.net> writes:

> Thomas F. Burdick wrote:
> > You might also be interested in CHAR=, CHAR<, CHAR>, etc., depending
> > on why you want this. Be sure to check:
>
> I wrote this function
>
> (defun isupper(x)
> (if (and (char>= x #\A) (char<= x #\Z))
> t (return-from isupper))
> nil)
>
> but it always returns nil :(

Of course, it does exactly what you told it to:

(defun isupper (x)
(if (and ...)
t
(return-from isupper)
nil))

If the condition is true, the value of the IF form is T, which is then
discarded, and NIL is returned. If the condition is not true, then
you explicitly return NIL.

What you want is something like:

(defun isupper (x)
(if (and ...)
t
nil))

Although, if you read the link in my previous message, you'll see that
this isn't guaranteed to work. Besides, it's already built in:
UPPER-CASE-P.

> (defun isupper (x)
> (if (and (>= (char-code x) (char-code #\A)) (<= (char-code x) (char-code
> #\Z)))
> t (return-from isupper)))
> nil)

Dear lord, please use Emacs to format your code for you (M-q). This
is the Lisp equivalent of the C:

if (foo)
bar(f);
else
bar(f);
baz(f);

That function should be indented as:

;; one form


(defun isupper (x)
(if (and (>= (char-code x) (char-code #\A))
(<= (char-code x) (char-code #\Z)))
t
(return-from isupper)))

;; end of defun, followed by another form
nil
;; stray close paren
)

Nils Goesche

unread,
Jul 27, 2002, 5:42:38 PM7/27/02
to
Rüdiger Sonderfeld <cplusp...@gmx.net> writes:

> Thomas F. Burdick wrote:
> > You might also be interested in CHAR=, CHAR<, CHAR>, etc., depending
> > on why you want this. Be sure to check:
>
> I wrote this function
>
> (defun isupper(x)
> (if (and (char>= x #\A) (char<= x #\Z))
> t (return-from isupper))
> nil)
>
> but it always returns nil :(

That's because you told it to :-)

(defun isupper(x)
(if (and (char>= x #\A) (char<= x #\Z))

(return-from isupper t))
nil)

would work, as would

(defun isupper (x)


(if (and (char>= x #\A) (char<= x #\Z))
t

nil))

or simply

(defun isupper (char)
(char<= #\A char #\Z))

> (isupper #\A)
> NIL
> (isupper #\a)
> NIL
>
> (defun isupper (x)
> (if (and (>= (char-code x) (char-code #\A)) (<= (char-code x) (char-code
> #\Z)))
> t (return-from isupper)))
> nil)
>
> (isupper #\A)
> T
> (isupper #\a)
> NIL
>
> this function works.
>
> What's wrong?

Your RETURN-FROM form really is in the else clause of your IF form.

Nils Goesche

unread,
Jul 27, 2002, 5:46:11 PM7/27/02
to
Nils Goesche <n...@cartan.de> writes:

> Rüdiger Sonderfeld <cplusp...@gmx.net> writes:
>
> > Thomas F. Burdick wrote:
> > > You might also be interested in CHAR=, CHAR<, CHAR>, etc., depending
> > > on why you want this. Be sure to check:
> >
> > I wrote this function
> >
> > (defun isupper(x)
> > (if (and (char>= x #\A) (char<= x #\Z))
> > t (return-from isupper))
> > nil)
> >
> > but it always returns nil :(
>
> That's because you told it to :-)
>

> (defun isupper (x)
> (if (and (char>= x #\A) (char<= x #\Z))

> (return-from isupper t))
> nil)
>
> would work,

but only by accident; I meant

(defun isupper (x)
(if (and (char>= x #\A) (char<= x #\Z))

(return-from isupper t)
nil))

Another reason to write Lisp code in Emacs' lisp-mode...

Kaz Kylheku

unread,
Jul 27, 2002, 11:19:41 PM7/27/02
to
In article <ahv31f$kvv$07$1...@news.t-online.com>, Rüdiger Sonderfeld wrote:
> Thomas F. Burdick wrote:
>> You might also be interested in CHAR=, CHAR<, CHAR>, etc., depending
>> on why you want this. Be sure to check:
>
> I wrote this function
>
> (defun isupper(x)
> (if (and (char>= x #\A) (char<= x #\Z))

You are assuming that the characters A through Z have consecutive
values, which happens to be true in ASCII and character systems derived from
it, like ISO-8859-<N> and UNICODE.

In any case, Lisp already has this predicate function, it is
called upper-case-p. You should study the HyperSpec to discover
what functions are available in Common Lisp.

> t (return-from isupper))
> nil)
>
> but it always returns nil :(

That's because you told it to. The last form in the function is nil,
which is what is evaluated after the if form, unless the return-from
is evaluated, which also returns nil.

> (isupper #\A)
> NIL
> (isupper #\a)
> NIL
>
> (defun isupper (x)
> (if (and (>= (char-code x) (char-code #\A)) (<= (char-code x) (char-code
> #\Z)))
> t (return-from isupper)))

Here you have bad syntax, the function actually ends here.

> nil)

And this is superfluous.

Vijay L

unread,
Jul 27, 2002, 11:39:56 PM7/27/02
to
Nils Goesche <n...@cartan.de> wrote in message news:<87sn24q...@darkstar.cartan>...

> Nils Goesche <n...@cartan.de> writes:
>
> > Rüdiger Sonderfeld <cplusp...@gmx.net> writes:
> >
> > > Thomas F. Burdick wrote:
> > > > You might also be interested in CHAR=, CHAR<, CHAR>, etc., depending
> > > > on why you want this. Be sure to check:
> > >
> > > I wrote this function
> > >
> > > (defun isupper(x)
> > > (if (and (char>= x #\A) (char<= x #\Z))
> > > t (return-from isupper))
> > > nil)
> > >
> > > but it always returns nil :(
> >
> > That's because you told it to :-)
> >
> > (defun isupper (x)
> > (if (and (char>= x #\A) (char<= x #\Z))
> > (return-from isupper t))
> > nil)
> >
> > would work,
>
> but only by accident; I meant
>
> (defun isupper (x)
> (if (and (char>= x #\A) (char<= x #\Z))
> (return-from isupper t)
> nil))

why do you even use RETURN-FROM in function? the IF is the last (and
only) form in the function.

Thanks,
Vijay

Rainer Joswig

unread,
Jul 28, 2002, 5:23:29 AM7/28/02
to
In article <1eaf81aa.02072...@posting.google.com>,
vij...@lycos.com (Vijay L) wrote:

Get rid of the IF...

(defun isupper (x)
(char<= #\A x #\Z))

Nils Goesche

unread,
Jul 28, 2002, 10:02:45 AM7/28/02
to
vij...@lycos.com (Vijay L) writes:

> Nils Goesche <n...@cartan.de> wrote in message news:<87sn24q...@darkstar.cartan>...

> > (defun isupper (x)
> > (if (and (char>= x #\A) (char<= x #\Z))
> > (return-from isupper t)
> > nil))
>
> why do you even use RETURN-FROM in function? the IF is the last (and
> only) form in the function.

Because the OP used RETURN-FROM incorrectly. My last suggestion
in my first follow-up was

(defun isupper (char)
(char<= #\A char #\Z))

Regards,

Erik Naggum

unread,
Jul 28, 2002, 2:37:53 PM7/28/02
to
* Nils Goesche

| (defun isupper (char)
| (char<= #\A char #\Z))

Despite all the good intentions and efforts to help this lost newbie, I think
it is a mistake to try to help people who ask such questions. (This reply is
not directed specifically towards Nils.)

Defining your own because the standard function does not have the same name
as in C is wrong. We already have upper-case-p, lower-case-p, alpha-char-p,
etc, in Common Lisp. Reinventing wheels to look more like C will do nobody
any good. Even asking for strlen and isupper is extremely counterproductive.

People who ask for help in Common Lisp but refuse to relinquish their past
language remind that I want to learn French, but only to hear it and read it.
The utter helplessness of most French-speakers' attempt to produce English is
so grating on my ears that I not only would like to be relieved of listening
to it, speaking their language to them would probably be just as atrocious
(almost like pronouncing "fromage" like "fromidge").

The original poster has no problem with strings, he has a problem with his
willingness to learn Common Lisp. Much could be said about this affliction
of the mind that causes people to assume that what they do not understand
does not matter, that they have reached such a level of omniscience that they
no longer need to observe and listen and learn. Having learned enough, some
people evidently stop learning altogether. What they learned first is the
standard for everything that comes later. That the probably only _truly_
random element in anyone's life is the order in which they experience things,
seems not even to be underststandable -- they somehow believe that the order
they run into them is universalizable and important, that first impressions
really tell you everything you need to know about something. I have seen
people who have the mental capacity only for the transition from "have not
experienced" to "have experienced", and who are unable to make a distinction
between their observations and their conclusions, such that they are unable
to change their conclusions about what they observed. They walk around like
they had CD-Rs for brains.

What is the length of a string? C's string representation has no room for an
allocated length vs an active length. C's string representation has no
concept of substrings. C's strings cannot contain all possible characters.
C's strlen is actually (position 0 <string> :key #'char-code) and is O(n).

Forget "strlen". For our immediate purposes, there is no "strlen". "strlen"
does not _exist_.

Common Lisp has vectors with fill-points, and strings are vectors which are
sequences and arrays. Numerous functions that in other languages only work
on strings, work on sequences in Commo Lisp. Functions like search, match,
find, position, etc, are much more general than string functions in other
languages. A string with a fill-pointer has a total and an active length.
Most sequence functions accept bounding indices, start and end indices that
make it possible to use substrings without modifying the target strings.
Common Lisp even has displaced arrays if you really need a substring without
copying the string contents. Common Lisp has string-streams to read from and
write to strings in memory. Common Lisp has real charcters, not just small
integers. Common Lisp's characters are not bytes, so when Unicode came
along, there was no need to make extensive library and language changes.
Common Lisp supports base and extended characters and hence base-string in
addition to the general string.

Common Lisp is a big-city language. Spit out the hayseed, pronounce "shit"
with one syllable and "shotgun" with two. You're not in Kansas, anymore. C
is the language of the poor farmer village where the allocation of every seed
and livestock matters, where taxes are low and public service non-existent.
Appreciating the value of a large language is evidently hard for many people,
just like many people find themselves miserable in the big city and go to
great lengths to create a small village for themselves in the city where
everything is like it used to be where they came from. Common Lisp can
accomodate people who want to program in any old language and re-create what
they are used to, but if they want to get the most ouf ot it, the only way to
do it is to adapt to the language and accept that somebody else may be better
than you are at designing languages.

--
Erik Naggum, Oslo, Norway ***** One manslaughter is another man's laughter.

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.

Nils Goesche

unread,
Jul 28, 2002, 4:51:08 PM7/28/02
to
Erik Naggum <er...@naggum.net> writes:

> * Nils Goesche
> | (defun isupper (char)
> | (char<= #\A char #\Z))
>
> Despite all the good intentions and efforts to help this lost
> newbie, I think it is a mistake to try to help people who ask such
> questions. (This reply is not directed specifically towards
> Nils.)
>
> Defining your own because the standard function does not have the
> same name as in C is wrong. We already have upper-case-p,
> lower-case-p, alpha-char-p, etc, in Common Lisp. Reinventing
> wheels to look more like C will do nobody any good. Even asking
> for strlen and isupper is extremely counterproductive.

I understand what you're saying and actually agree with you, as far as
newbies are concerned. That's precisely why I so strongly oppose
using the word ``pointer'' when explaining anything about Lisp. If
you tell a newbie ``When you pass a cons cell to a function, what
really gets passed is a pointer to the cell, not the cell itself'' or
some such, you are only encouraging him to continue to think in C
terms like pointers and memory locations, instead of Lisp terms like
bindings and objects with identity. The result will be yet another
one who thinks Lisp is call-by-reference. So, when a newbie asks a
question thereby revealing that he is still thinking in wrong terms,
it is not right to tell him how to achieve whatever stupid thing he is
trying to do, but one should rather set him straight about his terms
and desires.

However, in this case, the OP wasn't even able to use IF and
RETURN-FROM correctly, something he should be capable of doing, had he
only read the first few pages of an introductory Lisp text. My
conclusion was that he hasn't even started learning Lisp yet but is
still only playing around with it, so I wouldn't even call him a
newbie :-) Often when we encounter something new, we want to play
around with it immediately. Of course, we could start learning how to
use it properly right away, but playing around with something new is a
natural human desire, I think. Sometimes I give in, sometimes not.
When I buy something new like a DVD player, I sometimes read the
manual right away, or first play around with it and read the manual
then. Sometimes, when I learn a new programming language, I read its
definition right away, as I did with SML or Java, for instance, and
sometimes I first play around with it, as I did with Lisp or OCaml.

As long as you are only playing around with something, you don't want
to hear long explanations about your misconceptions because listening
and thinking much would mean that you've stopped playing and have
started learning. Some people think this ``playing phase'' should be
omitted altogether because all it does is forming bad habits. Well,
maybe. But it's also fun :-) And it might make somebody curious
enough that he really starts learning. How dangerous it is depends
strongly on whether he is willing to give up old beliefs and
misconceptions, then. When we see that somebody isn't willing to drop
his old beliefs, we should scold him until he does, but only after he
has actually started learning, I think.

Regards,
--
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x42B32FC9

Immanuel Litzroth

unread,
Jul 29, 2002, 4:56:35 AM7/29/02
to
>>>>> "Erik" == Erik Naggum <er...@naggum.net> writes:

Erik> * Nils Goesche | (defun isupper (char) | (char<= #\A char
Erik> #\Z))

Erik> Despite all the good intentions and efforts to help this
Erik> lost newbie, I think it is a mistake to try to help people
Erik> who ask such questions. (This reply is not directed
Erik> specifically towards Nils.)


Erik> Defining your own because the standard function does not
Erik> have the same name as in C is wrong. We already have
Erik> upper-case-p, lower-case-p, alpha-char-p, etc, in Common
Erik> Lisp. Reinventing wheels to look more like C will do nobody
Erik> any good. Even asking for strlen and isupper is extremely
Erik> counterproductive.

Where did you pick up the idea that anyone is defining functions
"because the standard function does not have the same name as in C"?
Another reason could be: let's take a function whose semantics I
know, try to implement it in lisp and see what the differences there
are.
Immanuel

Rüdiger Sonderfeld

unread,
Jul 29, 2002, 6:55:08 AM7/29/02
to
Erik Naggum wrote:
> Despite all the good intentions and efforts to help this lost newbie, I
> think
> it is a mistake to try to help people who ask such questions. (This
> reply is not directed specifically towards Nils.)
>
> Defining your own because the standard function does not have the same
> name
> as in C is wrong.

I don't want to write my own upper-case-p function because they use
different names in C! I only want to test the language. My first poor
steps. And the string part in the tutorial I read is very short (I read the
LISP-tutorial.txt that I found in the clisp release documentation).

So I thought it is no problem to ask here and I asked for the C functions
because I hoped that everybody will understand me!

> Reinventing wheels to look more like C will do nobody
> any good.

you are right. But I only want to test the language (play with it a little
bit) and so I wrote some uninteressting functions! I didn't want to write a
big program looking like C!

> People who ask for help in Common Lisp but refuse to relinquish their
> past language

I don't want to relinquish my past language! I want to learn lisp for
additional use!

And I thought it isn't a problem to use the name of the C functions so that
it is easier to understand what I mean!



> The original poster has no problem with strings, he has a problem with
> his
> willingness to learn Common Lisp.

No! I read a tutorial! And I only want to play with Common Lisp because I
want to know if common lisp is the language I need.

> Much could be said about this
> affliction of the mind that causes people to assume that what they do
> not understand does not matter, that they have reached such a level of
> omniscience that they
> no longer need to observe and listen and learn. Having learned enough,
> some
> people evidently stop learning altogether. What they learned first is
> the
> standard for everything that comes later. That the probably only
> _truly_ random element in anyone's life is the order in which they
> experience things, seems not even to be underststandable -- they somehow
> believe that the order they run into them is universalizable and
> important, that first impressions
> really tell you everything you need to know about something. I have
> seen people who have the mental capacity only for the transition from
> "have not experienced" to "have experienced", and who are unable to make
> a distinction between their observations and their conclusions, such
> that they are unable
> to change their conclusions about what they observed. They walk around
> like they had CD-Rs for brains.

I don't think I have learned enough!

Oh C is so bad that you're OS and Common Lisp Interpreter is written in it.

Rüdiger Sonderfeld

unread,
Jul 29, 2002, 6:58:57 AM7/29/02
to
Nils Goesche wrote:
> However, in this case, the OP wasn't even able to use IF and
> RETURN-FROM correctly, something he should be capable of doing, had he
> only read the first few pages of an introductory Lisp text.

I read a tutorial.

> My conclusion was that he hasn't even started learning Lisp yet but is
> still only playing around with it, so I wouldn't even call him a
> newbie :-)

I want to test Common Lisp. If Common Lisp is what I need I will learn it
really.

> As long as you are only playing around with something, you don't want
> to hear long explanations about your misconceptions because listening
> and thinking much would mean that you've stopped playing and have
> started learning.

I want to hear long explanations because so I can see if Common Lisp is
what I want.

Rüdiger Sonderfeld

unread,
Jul 29, 2002, 7:20:08 AM7/29/02
to
Immanuel Litzroth wrote:
> Where did you pick up the idea that anyone is defining functions
> "because the standard function does not have the same name as in C"?
> Another reason could be: let's take a function whose semantics I
> know, try to implement it in lisp and see what the differences there
> are.

you are right!

Nicolas Neuss

unread,
Jul 29, 2002, 5:49:50 AM7/29/02
to
Rüdiger Sonderfeld <cplusp...@gmx.net> writes:

> > As long as you are only playing around with something, you don't want
> > to hear long explanations about your misconceptions because listening
> > and thinking much would mean that you've stopped playing and have
> > started learning.
>
> I want to hear long explanations because so I can see if Common Lisp is
> what I want.

This is unfair to us who are not so newby as you are. You obviously
want us to write an own tutorial for you who are too idle to find and
understand one. I consider this as a form of trolling. Please study

http://www.alu.org

and especially

http://www.psychologie.uni-trier.de:8000/projects/ELM/elmart.html

before you write in that impertinent way here.

Nicolas.

P.S.: By the way, there are several CL compilers written in CL.

Ruediger Sonderfeld

unread,
Jul 29, 2002, 8:14:27 AM7/29/02
to
Nicolas Neuss wrote:

> Rüdiger Sonderfeld <cplusp...@gmx.net> writes:
> This is unfair to us who are not so newby as you are. You obviously
> want us to write an own tutorial for you who are too idle to find and
> understand one.

I don't want you to write a tutorial for me! I only said that i want to
hear long explanations because you wrote that I don't wont to hear them.

> I consider this as a form of trolling.

[...]


> before you write in that impertinent way here.

I didn't knew that asking a question about to simple Common Lisp functions
and a code problem (okay it was a easy problem) is impertinence.

Nicolas Neuss

unread,
Jul 29, 2002, 7:03:49 AM7/29/02
to
Ruediger Sonderfeld <cplusp...@gmx.net> writes:

It is also not far from impertinence to cite only what fits to ones
response. The sentence to which I objected and which I find
impertinent is:

Rüdiger Sonderfeld <cplusp...@gmx.net> writes:

> I want to hear long explanations because so I can see if Common Lisp is
> what I want.

Again, and the last time: we all have other jobs to do than writing
you your own tutorial.

Nicolas.

Immanuel Litzroth

unread,
Jul 29, 2002, 7:57:17 AM7/29/02
to
>>>>> "Nicolas" == Nicolas Neuss <Nicola...@iwr.uni-heidelberg.de> writes:
Nicolas> Again, and the last time: we all have other jobs to do
Nicolas> than writing you your own tutorial.

Why not get on with it it then, or did you feel morally obliged to
vent your displeasure?
Immanuel

Daniel Barlow

unread,
Jul 29, 2002, 6:50:37 AM7/29/02
to
Rüdiger Sonderfeld <cplusp...@gmx.net> writes:

> Oh C is so bad that you're OS and Common Lisp Interpreter is written in it.

Speak for yourself, but most of _my_ Common Lisp compiler (note:
`compiler', `not interpreter') is written in Common Lisp. And the OS
is written in a variety of languages including C, Python, Perl and
several other Lisp and Lisp-like languages (rep, elisp, guile etc).


-dan

--

http://ww.telent.net/cliki/ - Link farm for free CL-on-Unix resources

Nils Goesche

unread,
Jul 29, 2002, 9:11:18 AM7/29/02
to
Rüdiger Sonderfeld <cplusp...@gmx.net> writes:

> Erik Naggum wrote:

> > Defining your own because the standard function does not have
> > the same name as in C is wrong.

> I don't want to write my own upper-case-p function because they use
> different names in C! I only want to test the language. My first
> poor steps. And the string part in the tutorial I read is very short
> (I read the LISP-tutorial.txt that I found in the clisp release
> documentation).

Nicolas gave you a URL of another one.

> So I thought it is no problem to ask here and I asked for the C
> functions because I hoped that everybody will understand me!
>
> > Reinventing wheels to look more like C will do nobody any good.
>
> you are right. But I only want to test the language (play with it a
> little bit) and so I wrote some uninteressting functions! I didn't
> want to write a big program looking like C!
>
> > People who ask for help in Common Lisp but refuse to relinquish
> > their past language
>
> I don't want to relinquish my past language! I want to learn lisp
> for additional use!

Please make up your mind: Sometimes you say you want to learn it,
sometimes you say you only want to play around with it, then you say
you want to ``test'' it in order to find out if it is what you need.
Well, at least I can assure you that you won't find out that without
actually learning it. Tutorials tell you how to play around with it,
they won't teach you much, if anything. That's what they're for, I
think. If you want to start learning, tutorials aren't good enough
anymore; get a book. Which one is right for you is hard to say; maybe
Paul Graham's ANSI Common Lisp, or Stephen Slade's Object-Oriented
Common Lisp, or, if you find those too hard, try

http://www-2.cs.cmu.edu/~dst/LispBook/

And find the HyperSpec to accompany them.

> And I thought it isn't a problem to use the name of the C functions
> so that it is easier to understand what I mean!

The point is another one, namely that in order to learn Lisp, you have
to stop thinking in C terms. Learn Lisp in its own terms. There are
people who try to map any new thing they learn about Lisp onto
something they already know from C, like ``Ah, in C, I would do that
in such-and-such way''. That way doesn't work here, you won't learn a
thing as long as you try to do that. /That's/ what Erik was concerned
about, and rightly so.

> > The original poster has no problem with strings, he has a
> > problem with his willingness to learn Common Lisp.
>
> No! I read a tutorial! And I only want to play with Common Lisp
> because I want to know if common lisp is the language I need.

See above.

> > I have seen people who have the mental capacity only for the
> > transition from "have not experienced" to "have experienced",
> > and who are unable to make a distinction between their
> > observations and their conclusions, such that they are unable to
> > change their conclusions about what they observed. They walk
> > around like they had CD-Rs for brains.
>
> I don't think I have learned enough!

That's nice to hear. So start learning and stop being so defensive :-)

> > Common Lisp is a big-city language. Spit out the hayseed,
> > pronounce "shit" with one syllable and "shotgun" with two.
> > You're not in Kansas, anymore. C is the language of the poor
> > farmer village where the allocation of every seed and livestock
> > matters, where taxes are low and public service
> > non-existent. Appreciating the value of a large language is
> > evidently hard for many people, just like many people find
> > themselves miserable in the big city and go to great lengths to
> > create a small village for themselves in the city where
> > everything is like it used to be where they came from. Common
> > Lisp can accomodate people who want to program in any old
> > language and re-create what they are used to, but if they want
> > to get the most ouf ot it, the only way to do it is to adapt to
> > the language and accept that somebody else may be better than
> > you are at designing languages.
>
> Oh C is so bad that you're OS and Common Lisp Interpreter is written
> in it.

Erik Naggum is not exactly known as a CLISP user. Most Common Lisp
systems compile into native machine code, and are not properly
described as ``Interpreters''. And yes, C and C++ /are/ bad, that's
why many of us have come here. Why don't you start learning and find
out for yourself? :-)

You'd better listen to him, rather than being sarcastic, and get on
with it.

Ruediger Sonderfeld

unread,
Jul 29, 2002, 11:32:55 AM7/29/02
to
Nils Goesche wrote:
> Nicolas gave you a URL of another one.

I found another interessting link and I start to read this online-book

http://www-2.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/cltl2.html


> Please make up your mind: Sometimes you say you want to learn it,
> sometimes you say you only want to play around with it, then you say
> you want to ``test'' it in order to find out if it is what you need.
> Well, at least I can assure you that you won't find out that without
> actually learning it. Tutorials tell you how to play around with it,
> they won't teach you much, if anything. That's what they're for, I
> think. If you want to start learning, tutorials aren't good enough
> anymore; get a book. Which one is right for you is hard to say; maybe
> Paul Graham's ANSI Common Lisp, or Stephen Slade's Object-Oriented
> Common Lisp, or, if you find those too hard, try
>
> http://www-2.cs.cmu.edu/~dst/LispBook/
>
> And find the HyperSpec to accompany them.

I think I will learn Common Lisp from now on.

>> And I thought it isn't a problem to use the name of the C functions
>> so that it is easier to understand what I mean!
>
> The point is another one, namely that in order to learn Lisp, you have
> to stop thinking in C terms. Learn Lisp in its own terms. There are
> people who try to map any new thing they learn about Lisp onto
> something they already know from C, like ``Ah, in C, I would do that
> in such-and-such way''. That way doesn't work here, you won't learn a
> thing as long as you try to do that. /That's/ what Erik was concerned
> about, and rightly so.

okay he is right

>> Oh C is so bad that you're OS and Common Lisp Interpreter is written
>> in it.
>
> Erik Naggum is not exactly known as a CLISP user. Most Common Lisp
> systems compile into native machine code, and are not properly
> described as ``Interpreters''. And yes, C and C++ /are/ bad, that's
> why many of us have come here. Why don't you start learning and find
> out for yourself? :-)

I only know clisp and clisp is mostly written in C. I thought that is
common to other implementations.

And I don't think you can compare C(++) and Common Lisp.
But we shouldn't discuss this!



> You'd better listen to him, rather than being sarcastic, and get on
> with it.

okay, you are right. I'm sorry. I think he's right that it is important to
forget C(++) and other languages I know.

Nils Goesche

unread,
Jul 29, 2002, 11:27:12 AM7/29/02
to
Ruediger Sonderfeld <cplusp...@gmx.net> writes:

> Nils Goesche wrote:
> > Nicolas gave you a URL of another one.
>
> I found another interessting link and I start to read this online-book
>

> [Link to CLTL2]

There are two problems with that book. It's first edition was the
defining description of Common Lisp, committee approved, sometime in
1984, long before the ANSI standard was adopted (1994), like K&R1 in a
way. It's second edition, however, appeared in 1990, when people were
still working on the ANSI standard. It is not clear exactly which
language it describes, it is somewhere inbetween CLTL1 and ANSI Common
Lisp. Moreover, it is not aimed at Lisp newbies, but looks more like
a quasi-standard. If you want the language definition, you should get
the HyperSpec, which has exactly the same content as the ANSI
Standard:

http://www.xanalys.com/software_tools/reference/HyperSpec/

Unlike K&R, neither CLTL nor the HyperSpec are very good introductions
to Lisp newbies. Get the HyperSpec to look things up, and a textbook
to actually learn Lisp. I've already recommended some.

> I only know clisp and clisp is mostly written in C. I thought that
> is common to other implementations.

Nope.

> And I don't think you can compare C(++) and Common Lisp.

How could you possibly know? :-)

Coby Beck

unread,
Jul 29, 2002, 2:57:39 PM7/29/02
to

"Ruediger Sonderfeld" <cplusp...@gmx.net> wrote in message
news:ai34m7$ilf$04$1...@news.t-online.com...

I don't think you've been impertinent. There will always be people reacting
badly, it may be their fault or yours, but can usually still be a
constructive learning experience. It never pays to dwell on it though, just
move on (as should anyone who sees some "impertinence" in what you asked,
real or not)

Welcome to Common Lisp and to comp.lang.lisp

--
Coby Beck
(remove #\Space "coby 101 @ bigpond . com")


Coby Beck

unread,
Jul 29, 2002, 3:25:12 PM7/29/02
to

"Nicolas Neuss" <Nicola...@iwr.uni-heidelberg.de> wrote in message
news:871y9mo...@ortler.iwr.uni-heidelberg.de...

> Ruediger Sonderfeld <cplusp...@gmx.net> writes:
> It is also not far from impertinence to cite only what fits to ones
> response. The sentence to which I objected and which I find
> impertinent is:
>
> Rüdiger Sonderfeld <cplusp...@gmx.net> writes:
>
> > I want to hear long explanations because so I can see if Common Lisp is
> > what I want.
>
> Again, and the last time: we all have other jobs to do than writing
> you your own tutorial.
>

Usenet posting is a volunteer endeavour, we all know that. Some will give
short answers, some long ones and the answers are for onlookers as much as
the OP. There is no harm in asking anything, silence is the only
appropriate response to a question you think is too much work to answer.
This guy is new here and is not being a jerk about anything, let's give him
a break.

There is an opportunity for benefit for lots of us when people come and ask
elementary questions. The intermediate people or even other newbies who
just learned something can make suggestions. Lurkers will have their
questions answered for free. More advanced people who have answered the
same question N times before can skip over it all unless a correction or
more subtle point comes up and then the fur flies and we all learn
something!

We need a bit more "live and let live" here in c.l.l and we'll all enjoy it
more.

Paul D. Lathrop

unread,
Jul 29, 2002, 5:22:03 PM7/29/02
to
Ruediger Sonderfeld <cplusp...@gmx.net> wrote in
news:ai3gab$udq$05$1...@news.t-online.com:
> okay, you are right. I'm sorry. I think he's right that
> it is important to forget C(++) and other languages I
know.

More precisely, it is important to learn each language on
it's own footing, and not try to map it onto another
language you know. Don't *forget* the other languages,
that would make the time you spent learning them into a
waste. Rather, set them aside while you learn Lisp. Then
you will be able to decide what language is the best tool
for your needs. I think you will find that Common Lisp
offers a superior set of tools. But you will only discover
this if you learn to program Lisp, not C-in-Lisp.

I do admit *my* first instinct when I learned my second
programming language was to try to map it in the same way
Erik spoke out against. However, I was fortunate enough to
have been taught Lisp as my first programming language, so
I was quickly broken of that habit. Lisp is unique. Try to
familiarize yourself with that uniqueness instead of
robbing yourself of it.

Regards,
Paul D. Lathrop

Paolo Amoroso

unread,
Jul 30, 2002, 2:46:19 PM7/30/02
to
On Mon, 29 Jul 2002 12:55:08 +0200, Rüdiger Sonderfeld
<cplusp...@gmx.net> wrote:

> I don't want to relinquish my past language! I want to learn lisp for
> additional use!

"A language that doesn't affect the way you think about programming, is not
worth knowing." - Alan Perlis


> Oh C is so bad that you're OS and Common Lisp Interpreter is written in it.

For the record, there are both--excellent--operating systems and Lisp
development environments written in Lisp.


Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://www.paoloamoroso.it/ency/README

JB

unread,
Jul 30, 2002, 4:14:26 PM7/30/02
to
Ruediger Sonderfeld wrote:

You are not alone. Many people have had the same experience:
They came to c.l.l and wanted to find out about CL. Then
they experienced the very same warm welcome you already
know.
Just do not care! Carry on playing with CL and ask
questions. Simply disregard the malicious responses. This
news group is extremely knowledgable (well, it used to
be..) and you can learn a lot here.

You were not impertinent. Maybe it was a bit inpolite when
you wrote, that you *wanted* to have long explanations
instead of another word, but it is all right.
C is an extremely good and successful language, maybe second
only to BASIC. But CL is different and even if you decide
against CL in the end, you may learn a lot by playing with
it.

--
Janos Blazi


-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----

Peter Lewerin

unread,
Jul 30, 2002, 6:02:29 PM7/30/02
to
> I don't want to write my own upper-case-p function because they use
> different names in C! I only want to test the language.


Well, if it works for you... To me, it seems like a strange way to test
or try out a new language. When I do that, I usually implement a couple
of language-independent specifications for simple applications, and do
my best to use the conventions and idioms of the language in question.

After all, what I'd like to see is the new language in action, not the
new language in old-language drag.

Just 0.02 Euro...

Nicolas Neuss

unread,
Jul 31, 2002, 3:41:21 AM7/31/02
to
"Coby Beck" <cb...@mercury.bc.ca> writes:

> Usenet posting is a volunteer endeavour, we all know that. Some will give
> short answers, some long ones and the answers are for onlookers as much as
> the OP. There is no harm in asking anything, silence is the only
> appropriate response to a question you think is too much work to answer.
> This guy is new here and is not being a jerk about anything, let's give him
> a break.
>
> There is an opportunity for benefit for lots of us when people come and ask
> elementary questions. The intermediate people or even other newbies who
> just learned something can make suggestions. Lurkers will have their
> questions answered for free. More advanced people who have answered the
> same question N times before can skip over it all unless a correction or
> more subtle point comes up and then the fur flies and we all learn
> something!
>
> We need a bit more "live and let live" here in c.l.l and we'll all enjoy it
> more.

OK. Admitted. I was only frightened to see another quarrel "Erik
against German newbie":-)

Nicolas.

Nicolas Neuss

unread,
Aug 2, 2002, 4:48:37 AM8/2/02
to
I wrote:

> "Coby Beck" <cb...@mercury.bc.ca> writes:
>
> > [criticism deleted]


>
> OK. Admitted. I was only frightened to see another quarrel "Erik
> against German newbie":-)
>
> Nicolas.

I reread my message and think that it needs some clarification. With
"OK. Admitted." I mean that I should not have posted in this thread.
And to be clear for the rest: *In my opinion* the fault for past
battles between Erik and some newbies lies for the major part with the
newbies. I do not want imply that Erik was attacking them without
reason. Only a slight bump for him was intended which I hope he can
bear.

Nicolas.

P.S.: What I learned from burning my fingers in this thread:

Rule 1: Do not do parallel news and mail conversation with some
person.

Rule 2: Remember that other persons may read a thread in a different
chronological order.

Rule 3: Do not post when you are in a hurry.

Rule 4: Do not assume too much context, especially when you are
posting with gaps of 1-2 days.

----------------------------------------------------------------
* end-of-thread * (at least for me)

0 new messages