Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
two questions about strings
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 34 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rüdiger Sonderfeld  
View profile  
 More options Jul 27 2002, 3:37 pm
Newsgroups: comp.lang.lisp
From: Rüdiger Sonderfeld <cplusplush...@gmx.net>
Date: Sat, 27 Jul 2002 23:34:31 +0200
Local: Sat, Jul 27 2002 5:34 pm
Subject: two questions about strings
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';


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rüdiger Sonderfeld  
View profile  
 More options Jul 27 2002, 3:46 pm
Newsgroups: comp.lang.lisp
From: Rüdiger Sonderfeld <cplusplush...@gmx.net>
Date: Sat, 27 Jul 2002 23:43:37 +0200
Local: Sat, Jul 27 2002 5:43 pm
Subject: Re: two questions about strings

Rüdiger Sonderfeld wrote:
> 1) How can I get the size of a string?

Ups :)

(length "hiho")

is what I needed


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nils Goesche  
View profile  
 More options Jul 27 2002, 3:49 pm
Newsgroups: comp.lang.lisp
From: Nils Goesche <n...@cartan.de>
Date: 27 Jul 2002 21:49:20 +0200
Local: Sat, Jul 27 2002 3:49 pm
Subject: Re: two questions about strings

Rüdiger Sonderfeld <cplusplush...@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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thomas F. Burdick  
View profile  
 More options Jul 27 2002, 4:04 pm
Newsgroups: comp.lang.lisp
From: t...@apocalypse.OCF.Berkeley.EDU (Thomas F. Burdick)
Date: 27 Jul 2002 13:04:34 -0700
Local: Sat, Jul 27 2002 4:04 pm
Subject: Re: two questions about strings

Rüdiger Sonderfeld <cplusplush...@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!       |                        
    /       /      `-----------------------'                        
   (   -.  |                              
   |     ) |                              
  (`-.  '--.)                              
   `. )----'                              


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rüdiger Sonderfeld  
View profile  
 More options Jul 27 2002, 5:25 pm
Newsgroups: comp.lang.lisp
From: Rüdiger Sonderfeld <cplusplush...@gmx.net>
Date: Sun, 28 Jul 2002 01:21:52 +0200
Local: Sat, Jul 27 2002 7:21 pm
Subject: Re: two questions about strings

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?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thomas F. Burdick  
View profile  
 More options Jul 27 2002, 5:37 pm
Newsgroups: comp.lang.lisp
From: t...@apocalypse.OCF.Berkeley.EDU (Thomas F. Burdick)
Date: 27 Jul 2002 14:37:18 -0700
Local: Sat, Jul 27 2002 5:37 pm
Subject: Re: two questions about strings

Rüdiger Sonderfeld <cplusplush...@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
  )

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nils Goesche  
View profile  
 More options Jul 27 2002, 5:42 pm
Newsgroups: comp.lang.lisp
From: Nils Goesche <n...@cartan.de>
Date: 27 Jul 2002 23:42:38 +0200
Local: Sat, Jul 27 2002 5:42 pm
Subject: Re: two questions about strings

Rüdiger Sonderfeld <cplusplush...@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))

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

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

PGP key ID #xC66D6E6F


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nils Goesche  
View profile  
 More options Jul 27 2002, 5:46 pm
Newsgroups: comp.lang.lisp
From: Nils Goesche <n...@cartan.de>
Date: 27 Jul 2002 23:46:11 +0200
Local: Sat, Jul 27 2002 5:46 pm
Subject: Re: two questions about strings

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...

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

PGP key ID #xC66D6E6F


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kaz Kylheku  
View profile  
 More options Jul 27 2002, 11:19 pm
Newsgroups: comp.lang.lisp
From: Kaz Kylheku <k...@ashi.footprints.net>
Date: Sun, 28 Jul 2002 03:19:41 +0000 (UTC)
Local: Sat, Jul 27 2002 11:19 pm
Subject: Re: two questions about strings

In article <ahv31f$kvv$0...@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.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vijay L  
View profile  
 More options Jul 27 2002, 11:39 pm
Newsgroups: comp.lang.lisp
From: vij...@lycos.com (Vijay L)
Date: 27 Jul 2002 20:39:56 -0700
Local: Sat, Jul 27 2002 11:39 pm
Subject: Re: two questions about strings

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

Thanks,
Vijay


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rainer Joswig  
View profile  
 More options Jul 28 2002, 5:23 am
Newsgroups: comp.lang.lisp
From: Rainer Joswig <jos...@lispmachine.de>
Date: Sun, 28 Jul 2002 11:23:29 +0200
Local: Sun, Jul 28 2002 5:23 am
Subject: Re: two questions about strings
In article <1eaf81aa.0207271939.6f6a0...@posting.google.com>,
 vij...@lycos.com (Vijay L) wrote:

Get rid of the IF...

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nils Goesche  
View profile  
 More options Jul 28 2002, 10:02 am
Newsgroups: comp.lang.lisp
From: Nils Goesche <n...@cartan.de>
Date: 28 Jul 2002 16:02:45 +0200
Local: Sun, Jul 28 2002 10:02 am
Subject: Re: two questions about strings

vij...@lycos.com (Vijay L) writes:
> Nils Goesche <n...@cartan.de> wrote in message <news:87sn24q1y4.fsf@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,
--
Nils Goesche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xC66D6E6F


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Jul 28 2002, 2:37 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: 28 Jul 2002 18:37:53 +0000
Local: Sun, Jul 28 2002 2:37 pm
Subject: Re: two questions about strings
* 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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nils Goesche  
View profile  
 More options Jul 28 2002, 4:51 pm
Newsgroups: comp.lang.lisp
From: Nils Goesche <car...@cartan.de>
Date: 28 Jul 2002 22:51:08 +0200
Local: Sun, Jul 28 2002 4:51 pm
Subject: Re: two questions about strings

Erik Naggum <e...@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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Immanuel Litzroth  
View profile  
 More options Jul 29 2002, 4:56 am
Newsgroups: comp.lang.lisp
From: Immanuel Litzroth <immanu...@enfocus.be>
Date: 29 Jul 2002 10:56:35 +0200
Local: Mon, Jul 29 2002 4:56 am
Subject: Re: two questions about strings

>>>>> "Erik" == Erik Naggum <e...@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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rüdiger Sonderfeld  
View profile  
 More options Jul 29 2002, 4:58 am
Newsgroups: comp.lang.lisp
From: Rüdiger Sonderfeld <cplusplush...@gmx.net>
Date: Mon, 29 Jul 2002 12:55:08 +0200
Local: Mon, Jul 29 2002 6:55 am
Subject: Re: two questions about strings

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.

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.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rüdiger Sonderfeld  
View profile  
 More options Jul 29 2002, 5:04 am
Newsgroups: comp.lang.lisp
From: Rüdiger Sonderfeld <cplusplush...@gmx.net>
Date: Mon, 29 Jul 2002 12:58:57 +0200
Local: Mon, Jul 29 2002 6:58 am
Subject: Re: two questions about strings

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.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rüdiger Sonderfeld  
View profile  
 More options Jul 29 2002, 5:25 am
Newsgroups: comp.lang.lisp
From: Rüdiger Sonderfeld <cplusplush...@gmx.net>
Date: Mon, 29 Jul 2002 13:20:08 +0200
Local: Mon, Jul 29 2002 7:20 am
Subject: Re: two questions about strings

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!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicolas Neuss  
View profile  
 More options Jul 29 2002, 6:00 am
Newsgroups: comp.lang.lisp
From: Nicolas Neuss <Nicolas.Ne...@iwr.uni-heidelberg.de>
Date: 29 Jul 2002 11:49:50 +0200
Local: Mon, Jul 29 2002 5:49 am
Subject: Re: two questions about strings

Rüdiger Sonderfeld <cplusplush...@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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ruediger Sonderfeld  
View profile  
 More options Jul 29 2002, 6:19 am
Newsgroups: comp.lang.lisp
From: Ruediger Sonderfeld <cplusplush...@gmx.net>
Date: Mon, 29 Jul 2002 14:14:27 +0200
Local: Mon, Jul 29 2002 8:14 am
Subject: Re: two questions about strings

Nicolas Neuss wrote:
> Rüdiger Sonderfeld <cplusplush...@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.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicolas Neuss  
View profile  
 More options Jul 29 2002, 7:15 am
Newsgroups: comp.lang.lisp
From: Nicolas Neuss <Nicolas.Ne...@iwr.uni-heidelberg.de>
Date: 29 Jul 2002 13:03:49 +0200
Local: Mon, Jul 29 2002 7:03 am
Subject: Re: two questions about strings

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 <cplusplush...@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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Immanuel Litzroth  
View profile  
 More options Jul 29 2002, 7:57 am
Newsgroups: comp.lang.lisp
From: Immanuel Litzroth <immanu...@enfocus.be>
Date: 29 Jul 2002 13:57:17 +0200
Local: Mon, Jul 29 2002 7:57 am
Subject: Re: two questions about strings
>>>>> "Nicolas" == Nicolas Neuss <Nicolas.Ne...@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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Barlow  
View profile  
 More options Jul 29 2002, 8:52 am
Newsgroups: comp.lang.lisp
From: Daniel Barlow <d...@telent.net>
Date: Mon, 29 Jul 2002 11:50:37 +0100
Local: Mon, Jul 29 2002 6:50 am
Subject: Re: two questions about strings

Rüdiger Sonderfeld <cplusplush...@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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nils Goesche  
View profile  
 More options Jul 29 2002, 9:11 am
Newsgroups: comp.lang.lisp
From: Nils Goesche <car...@cartan.de>
Date: 29 Jul 2002 15:11:18 +0200
Local: Mon, Jul 29 2002 9:11 am
Subject: Re: two questions about strings

Rüdiger Sonderfeld <cplusplush...@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 :-)

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.

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

PGP key ID 0x42B32FC9


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ruediger Sonderfeld  
View profile  
 More options Jul 29 2002, 9:37 am
Newsgroups: comp.lang.lisp
From: Ruediger Sonderfeld <cplusplush...@gmx.net>
Date: Mon, 29 Jul 2002 17:32:55 +0200
Local: Mon, Jul 29 2002 11:32 am
Subject: Re: two questions about strings

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/...

> 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.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 34   Newer >
« Back to Discussions « Newer topic     Older topic »