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
The Common Lisp Way (was: Re: Your introduction to Lisp...)
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 176 - 200 of 453 - Collapse all  -  Translate all to Translated (View all originals) < Older  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
 
Erann Gat  
View profile  
 More options Apr 14 2002, 1:59 pm
Newsgroups: comp.lang.lisp
From: g...@jpl.nasa.gov (Erann Gat)
Date: Sun, 14 Apr 2002 09:52:33 -0800
Local: Sun, Apr 14 2002 1:52 pm
Subject: Re: The Common Lisp Way (was: Re: Your introduction to Lisp...)
In article <87ads61skn....@ortler.iwr.uni-heidelberg.de>, Nicolas Neuss

Here's the passage in question:

  But in general, using symbols to name things is the (Common) Lisp way,
  and using the values directly is the Scheme way.

and the context can be found at
http://groups.google.com/groups?selm=3227419925997748%40naggum.net&ou...

I'm sorry, but I really don't see how citing that can be considered a
provokation.  Perhaps you would be so kind as to explain it to me?

> [1] What does BSG mean, by the way?

STFW.  Brotherhood of Saint Gregory.

E.


 
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.
Discussion subject changed to "introduction to Lisp..." by Raffael Cavallaro
Raffael Cavallaro  
View profile  
 More options Apr 14 2002, 2:42 pm
Newsgroups: comp.lang.lisp
From: raff...@mediaone.net (Raffael Cavallaro)
Date: 14 Apr 2002 11:42:37 -0700
Local: Sun, Apr 14 2002 2:42 pm
Subject: Re: introduction to Lisp...

"Sherif Elbanhawy" <egyptiancompu...@hotmail.com> wrote in message <news:3cb99abb$1_9@Usenet.com>...
> Hey guys,

> Is this a lisp technical discussion group or what....I did not even receive
> a comment about my questions....

Kent Pitman referred you to the aprropriate documentation for your
question(s) - <http://www.xanalys.com/software_tools/reference/HyperSpec/Front/index...>

These are very basic questions, (the kind of problem that one
encounters in the first week of an introductory course) so you should
be able to find the answers yourself by reading the HyperSpec - Kent
even gave you an additional hint, and suggested that you should take a
look at mapcar.

Please don't take offense, but we get a lot of students here
essentially asking correspondents to c.l.l to do their homework for
them. Yours are such elementary questions, that they look like a first
week homework set. If you're not asking for help with homework, but
are merely a newcomer to Common Lisp, then your should *really*
familiarize yourself with the HyperSpec - a document which is one of
the best references for any subject anywhere - the Common Lisp
community is *extremely* fortunate to have it.

BTW, Kent, who was too modest to say so in his post, is the author of
the HyperSpec.


 
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.
Discussion subject changed to "The Common Lisp Way (was: Re: Your introduction to Lisp...)" by Erann Gat
Erann Gat  
View profile  
 More options Apr 14 2002, 2:55 pm
Newsgroups: comp.lang.lisp
From: g...@jpl.nasa.gov (Erann Gat)
Date: Sun, 14 Apr 2002 10:05:49 -0800
Local: Sun, Apr 14 2002 2:05 pm
Subject: Re: The Common Lisp Way (was: Re: Your introduction to Lisp...)

In article <3227763757063...@naggum.net>, Erik Naggum <e...@naggum.net> wrote:
>   Quit attacking me.

I don't believe I am.  But if you could be more specific about what I've
said that you consider an attack then I will try to be more careful in the
future.

>   Quit talking about what I think or believe.

Talking about what others think is an inherent part of academic
discourse.  You need to realize that just because someone talks about your
views doesn't mean that you are under attack.  If your views are being
misrepresented (which seems hardly possible in this case since all I've
done is cite direct quotes from your postings) the appropriate response is
to clarify your views, not to insist that people stop talking about them,
or to call them idiots.

E.


 
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.
Discussion subject changed to "introduction to Lisp..." by Sherif Elbanhawy
Sherif Elbanhawy  
View profile  
 More options Apr 14 2002, 3:00 pm
Newsgroups: comp.lang.lisp
From: "Sherif Elbanhawy" <egyptiancompu...@hotmail.com>
Date: Sun, 14 Apr 2002 14:58:45 -0400
Local: Sun, Apr 14 2002 2:58 pm
Subject: Re: introduction to Lisp...
Kent, all,

You are absolutely right about what you said. this is the first time I use
newsgroups for such things...
Thanks for replying to me. and here are the questions in a clear way and
what I did so far:

i wanted to construct a function that will sort this list:

(b (c (d (e f)) ) g h k)

i was able to write the function to sort a list like this but that has
integers and not characters.

(defun print_list(L)
(cond
((NULL L) nil)
((atom L) (list L))
(t (append   (print_list (car list1)) (print_list (cdr list1)) ) )
))

I was able to get all the values of the list in one list (b c d e f g h k)

then I wanna pass this list to char-code to have all the values changed to
their ASCII code.

I used this function that I wrote
(sort (mapcar #'char-code '(#\t #\y)) #'>)

but the problem is I wanna feed the characters in the list to char-code and
not characters that I hardcoded (ex. (#\t #\y in the above example)

Hope I am clear this time:)

Sherif

"Kent M Pitman" <pit...@world.std.com> wrote in message
news:sfw7knajnd2.fsf@shell01.TheWorld.com...

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com

 
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.
Discussion subject changed to "The Common Lisp Way (was: Re: Your introduction to Lisp...)" by Erik Naggum
Erik Naggum  
View profile  
 More options Apr 14 2002, 3:27 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Sun, 14 Apr 2002 19:27:37 GMT
Local: Sun, Apr 14 2002 3:27 pm
Subject: Re: The Common Lisp Way (was: Re: Your introduction to Lisp...)
* Erik Naggum

> Quit attacking me.

* Erann Gat
| I don't believe I am.

  So there is no hope for a less hostile, more intelligent Erann Gat who
  actually manages to focus on the technical, and we can only expect more
  disillusioned whining and destructive rhetoric and context-free quoting
  and idiotic attacks that only tell us you refuse to grow a clue.  OK.

///
--
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: http://home.chello.no/~xyzzy/kitten.jpg


 
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.
Discussion subject changed to "introduction to Lisp..." by Nils Goesche
Nils Goesche  
View profile  
 More options Apr 14 2002, 3:54 pm
Newsgroups: comp.lang.lisp
From: Nils Goesche <n...@cartan.de>
Date: 14 Apr 2002 21:54:15 +0200
Local: Sun, Apr 14 2002 3:54 pm
Subject: Re: introduction to Lisp...

"Sherif Elbanhawy" <egyptiancompu...@hotmail.com> writes:
> Thanks for replying to me. and here are the questions in a clear way and
> what I did so far:

> i wanted to construct a function that will sort this list:

> (b (c (d (e f)) ) g h k)

> i was able to write the function to sort a list like this but that has
> integers and not characters.

As you write it, this tree contains symbols, not characters.

> (defun print_list(L)
> (cond
> ((NULL L) nil)
> ((atom L) (list L))
> (t (append   (print_list (car list1)) (print_list (cdr list1)) ) )
> ))

Your indentation, err, sucks :-)  You should indent like
everybody else, i.e.

(defun flatten (tree)
  (cond ((null tree) nil)
        ((atom tree) (list tree))
        (t (append (flatten (car tree))
                   (flatten (cdr tree))))))

FLATTEN is the common name for this kind of function.  Call it
whatever you want, but print_list is a bad name for two reasons:
First, it doesn't print anything but returns a list; second, we
usually use hyphens instead of underscores.  And consider using
NCONC instead of APPEND.

> I was able to get all the values of the list in one list (b c d e f g h k)

> then I wanna pass this list to char-code to have all the values changed to
> their ASCII code.

I don't think there is any guarantee that (char-code #\a) will be
the ASCII code of `a'.

> I used this function that I wrote
> (sort (mapcar #'char-code '(#\t #\y)) #'>)

> but the problem is I wanna feed the characters in the list to char-code and
> not characters that I hardcoded (ex. (#\t #\y in the above example)

> Hope I am clear this time:)

Not yet, I fear :-)  First, what does your list really look like?
If you do

BLARK 12 > (flatten '(b (c (d (e f))) g h k))
(B C D E F G H K)

you have a list of /symbols/, not characters.  And it is already
sorted, BTW.  Note that the function STRING< works well for
symbols, too.  If you really want to work with characters, you
should do something like

BLARK 17 > (flatten '(#\b (#\c (#\d (#\e #\f))) #\g #\h #\k))
(#\b #\c #\d #\e #\f #\g #\h #\k)

And if you want to sort such a thing, you might either use CHAR<
or CHAR-LESSP, or, if you insist on bringing CHAR-CODE into the
game, lookup the :KEY argument for SORT.

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.
Stefan Schmiedl  
View profile  
 More options Apr 14 2002, 4:10 pm
Newsgroups: comp.lang.lisp
From: s...@xss.de (Stefan Schmiedl)
Date: 14 Apr 2002 20:10:25 GMT
Local: Sun, Apr 14 2002 4:10 pm
Subject: Re: introduction to Lisp...
On Sun, 14 Apr 2002 14:58:45 -0400,

Sherif Elbanhawy <egyptiancompu...@hotmail.com> wrote:

> i wanted to construct a function that will sort this list:

> (b (c (d (e f)) ) g h k)

> i was able to write the function to sort a list like this but that has
> integers and not characters.

> (defun print_list(L)
> (cond
> ((NULL L) nil)
> ((atom L) (list L))
> (t (append   (print_list (car list1)) (print_list (cdr list1)) ) )
> ))

... which is an "expensive" way of reinventing a builtin function called
"flatten".

> I was able to get all the values of the list in one list (b c d e f g h k)

> then I wanna pass this list to char-code to have all the values changed to
> their ASCII code.

to satisfy my personal curiosity: which programming language(s) do you
already know?

> I used this function that I wrote
> (sort (mapcar #'char-code '(#\t #\y)) #'>)

you might want to take a look at other sorting functions, for
example those for strings ...

> but the problem is I wanna feed the characters in the list to char-code and
> not characters that I hardcoded (ex. (#\t #\y in the above example)

hmmm ... if you want to sort the characters represented by the
SYMBOL NAMES (hint hint;), why did you hardcode the symbols and
not the characters in the first place? Where do those symbols come
from?

> Hope I am clear this time:)

I have the feeling that you need to unlearn some old habits
to be able to write idiomatic lisp programs. You might also
want to read some introductions, referenced e.g. over at
http://www.lisp.org

s.


 
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 Apr 14 2002, 4:13 pm
Newsgroups: comp.lang.lisp
From: Nils Goesche <n...@cartan.de>
Date: 14 Apr 2002 22:13:11 +0200
Local: Sun, Apr 14 2002 4:13 pm
Subject: Re: introduction to Lisp...

s...@xss.de (Stefan Schmiedl) writes:
> On Sun, 14 Apr 2002 14:58:45 -0400,
> Sherif Elbanhawy <egyptiancompu...@hotmail.com> wrote:

> > (defun print_list(L)
> > (cond
> > ((NULL L) nil)
> > ((atom L) (list L))
> > (t (append   (print_list (car list1)) (print_list (cdr list1)) ) )
> > ))

> ... which is an "expensive" way of reinventing a builtin function called
> "flatten".

FLATTEN is common, but not builtin, I think.

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.
Stefan Schmiedl  
View profile  
 More options Apr 14 2002, 4:18 pm
Newsgroups: comp.lang.lisp
From: s...@xss.de (Stefan Schmiedl)
Date: 14 Apr 2002 20:18:49 GMT
Local: Sun, Apr 14 2002 4:18 pm
Subject: Re: introduction to Lisp...
On 14 Apr 2002 20:10:25 GMT,

Stefan Schmiedl <s...@xss.de> wrote:
> On Sun, 14 Apr 2002 14:58:45 -0400,
> Sherif Elbanhawy <egyptiancompu...@hotmail.com> wrote:

> ... which is an "expensive" way of reinventing a builtin function called
> "flatten".

oops. I just (re-)discovered that flatten is only built in
my personal .lisp-init but not in the standard. sorry for
the confusion.

s.


 
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.
Stefan Schmiedl  
View profile  
 More options Apr 14 2002, 4:22 pm
Newsgroups: comp.lang.lisp
From: s...@xss.de (Stefan Schmiedl)
Date: 14 Apr 2002 20:22:50 GMT
Local: Sun, Apr 14 2002 4:22 pm
Subject: Re: introduction to Lisp...
On 14 Apr 2002 22:13:11 +0200,

Nils Goesche <n...@cartan.de> wrote:

> FLATTEN is common, but not builtin, I think.

you're right. I think it appeared as a permanent part of
my lisp toolbox after a brief encounter with Mathematica
some ten years ago ... and I totally forgot about it.

s.


 
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.
Dr. Edmund Weitz  
View profile  
 More options Apr 14 2002, 4:27 pm
Newsgroups: comp.lang.lisp
From: e...@agharta.de (Dr. Edmund Weitz)
Date: 14 Apr 2002 22:26:57 +0200
Local: Sun, Apr 14 2002 4:26 pm
Subject: Re: introduction to Lisp...

s...@xss.de (Stefan Schmiedl) writes:
> ... which is an "expensive" way of reinventing a builtin function
> called "flatten".

builtin?

--

Dr. Edmund Weitz
Hamburg
Germany

The Common Lisp Cookbook
<http://cl-cookbook.sourceforge.net/>


 
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 Apr 14 2002, 4:31 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Sun, 14 Apr 2002 20:31:25 GMT
Local: Sun, Apr 14 2002 4:31 pm
Subject: Re: introduction to Lisp...
* s...@xss.de (Stefan Schmiedl)
| ... which is an "expensive" way of reinventing a builtin function called
| "flatten".

  There is no "builtin" function called "flatten".  Please do not post your
  beliefs as though they were facts when you can so easily check them.

| you might want to take a look at other sorting functions, for
| example those for strings ...

  Maybe you mean comparison functions rather than sorting functions?

| I have the feeling that you need to unlearn some old habits to be able to
| write idiomatic lisp programs.

  Maybe you should delay your advice for a while.

///
--
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: http://home.chello.no/~xyzzy/kitten.jpg


 
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.
Carl Shapiro  
View profile  
 More options Apr 14 2002, 4:44 pm
Newsgroups: comp.lang.lisp
From: Carl Shapiro <cshapiro+s...@panix.com>
Date: 14 Apr 2002 16:44:28 -0400
Local: Sun, Apr 14 2002 4:44 pm
Subject: Re: introduction to Lisp...

"Sherif Elbanhawy" <egyptiancompu...@hotmail.com> writes:
> i wanted to construct a function that will sort this list:

> (b (c (d (e f)) ) g h k)

> i was able to write the function to sort a list like this but that has
> integers and not characters.

Your tree doesn't contain characters, it contains symbols.  Had it
contained characters, Lisp would have printed it like this:

(#\B (#\C (#\D (#\E #\F))) #\G #\H #\K)

> then I wanna pass this list to char-code to have all the values changed to
> their ASCII code.

> I used this function that I wrote
> (sort (mapcar #'char-code '(#\t #\y)) #'>)

> but the problem is I wanna feed the characters in the list to char-code and
> not characters that I hardcoded (ex. (#\t #\y in the above example)

You can perform limited conversion of symbols into characters with
either the COERCE or CHARACTER functions.  For example, a function
which would translate your tree of symbols into a tree of characters
could look like this:

(defun characterify-tree (tree &optional acc)
  (cond ((null tree)
         acc)
        ((consp (car tree))
         (characterify-tree (cdr tree)
                            (append acc (list (characterify-tree (car tree) nil)))))
        (t
         (characterify-tree (cdr tree)
                            (append acc (list (character (car tree))))))))

Or, using more contemporary Common Lisp functionality, like this:

(defun characterify-tree (tree)
  (loop for elt in tree
        collect (if (consp elt) (characterify-tree elt) (character elt))))

Either way, you should get results like this:

(characterify-tree '(a b (c d (e f) g) h))
=> (#\A #\B (#\C #\D (#\E #\F) #\G) #\H)

If any of this seems useful, you really ought to read the Common Lisp
HyperSpec entry for the CHARACTER function.  It has a brief discussion
of the situations where coercion between symbols and characters will
(and will not) work.


 
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.
Discussion subject changed to "The Common Lisp Way (was: Re: Your introduction to Lisp...)" by Eduardo Muñoz
Eduardo Muñoz  
View profile  
 More options Apr 14 2002, 5:36 pm
Newsgroups: comp.lang.lisp
From: "Eduardo Muñoz" <e...@jet.es>
Date: 14 Apr 2002 23:42:50 +0200
Local: Sun, Apr 14 2002 5:42 pm
Subject: Re: The Common Lisp Way (was: Re: Your introduction to Lisp...)

g...@jpl.nasa.gov (Erann Gat) writes:
> > Since you cite very often out of context, your citations are usually
> > quite annoying provocations.

> Here's the passage in question:

NO, the passage in question is this:

http://groups.google.com/groups?selm=gat-1204021042320001%40192.168.1...

        (Erann Gat writes:)
        Well, according to Erik, it marks me as doing things the "Scheme way".  Of
        course, Erik, also distinguishes between "Scheme is a Lisp" and "Scheme is
        a member of the Lisp family of languages", so maybe "writing Scheme in CL"
        and "doing things the Scheme way [in CL]" don't mean the same thing
        either.

When you're talking about something that you do,
believe or think (or whatever) why do you need to
bring someone else opinion about it?.

This is a technical forum. It goes like this:
        1 You ask a question
        2 Get an answer (if lucky)
        3 You study the answer assuming it's right
        4 Ask for clarification if needed
        5 Repeat

Don't need to imagine or talk or whine about other
people opinion or thinking.

--

Eduardo Muñoz


 
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.
Discussion subject changed to "introduction to Lisp..." by Sherif Elbanhawy
Sherif Elbanhawy  
View profile  
 More options Apr 14 2002, 10:48 pm
Newsgroups: comp.lang.lisp
From: "Sherif Elbanhawy" <egyptiancompu...@hotmail.com>
Date: Sun, 14 Apr 2002 22:47:25 -0400
Local: Sun, Apr 14 2002 10:47 pm
Subject: Re: introduction to Lisp...
Ok guys,

Why is this not working??

(defun print_list(L)
(cond
((null L) nil)
((atom L) (list L))
(t (append   (print_list (car L)) (print_list (cdr L)))
(stable-sort (L) #'char-lessp))

I am trying to >(print_list '(#\f (#\h (#\b (#\e #\d)) ) #\g #\c #\k))

to get a sorted list (b c d e f g h k)

What is missing here?? please help!!!

If I wanted to use prog() here what do I need to do......

Appreciate all the help.

"Carl Shapiro" <cshapiro+s...@panix.com> wrote in message

news:ouyg01ynh77.fsf@panix3.panix.com...

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com

 
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.
Discussion subject changed to "The Common Lisp Way (was: Re: Your introduction to Lisp...)" by Erann Gat
Erann Gat  
View profile  
 More options Apr 14 2002, 10:59 pm
Newsgroups: comp.lang.lisp
From: g...@jpl.nasa.gov (Erann Gat)
Date: Sun, 14 Apr 2002 18:48:10 -0800
Local: Sun, Apr 14 2002 10:48 pm
Subject: Re: The Common Lisp Way (was: Re: Your introduction to Lisp...)
In article <uk7raj6sl....@jet.es>, "Eduardo =?iso-8859-1?q?Mu=F1oz?="

<e...@jet.es> wrote:
> ... why do you need to bring someone else opinion about it?.

Because that's the subject of my question.

E.


 
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.
Discussion subject changed to "Ancient Times (Was: Re: introduction to Lisp...)" by Rahul Jain
Rahul Jain  
View profile  
 More options Apr 14 2002, 11:00 pm
Newsgroups: comp.lang.lisp
From: Rahul Jain <rj...@sid-1129.sid.rice.edu>
Date: 14 Apr 2002 21:53:38 -0500
Local: Sun, Apr 14 2002 10:53 pm
Subject: Ancient Times (Was: Re: introduction to Lisp...)

"Sherif Elbanhawy" <egyptiancompu...@hotmail.com> writes:
> (defun print_list(L)

Given the style of this function and the desire to use PROG, I get the
impression that this class is being taught in an antedilluvian (before
the flood of dialects?) style. Did people actually use underscores as
word separators back then? I thought the underscore was a very rare
character to have before ASCII was in nearly universal use. Or is this
just an attempt to make the C programmers taking the class feel
better?

--
-> -/                        - Rahul Jain -                        \- <-
-> -\  http://linux.rice.edu/~rahul -=-  mailto:rj...@techie.com   /- <-
-> -/ "Structure is nothing if it is all you got. Skeletons spook  \- <-
-> -\  people if [they] try to walk around on their own. I really  /- <-
-> -/  wonder why XML does not." -- Erik Naggum, comp.lang.lisp    \- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   (c)1996-2002, All rights reserved. Disclaimer available upon request.


 
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.
Sherif Elbanhawy  
View profile  
 More options Apr 14 2002, 11:33 pm
Newsgroups: comp.lang.lisp
From: "Sherif Elbanhawy" <egyptiancompu...@hotmail.com>
Date: Sun, 14 Apr 2002 23:32:00 -0400
Subject: Re: Ancient Times (Was: Re: introduction to Lisp...)
Ok Rahul, since you were the first one to know I am a C programmer, let me
ask you this:
This is my code now:

(defun print_list(L)
(progn()
(cond
((null L) nil)
((atom L) (list L))
(t (append   (print_list (car L)) (print_list (cdr L)))))
(stable-sort L #'char-lessp)))

All I want now is to make the stable-sort function use the list output by
the (con..... statement and not the original list.  I think that is all I
need, right???

"Rahul Jain" <rj...@sid-1129.sid.rice.edu> wrote in message

news:87lmbpwu31.fsf_-_@photino.sid.rice.edu...

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com

 
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.
Discussion subject changed to "The Common Lisp Way (was: Re: Your introduction to Lisp...)" by Erann Gat
Erann Gat  
View profile  
 More options Apr 14 2002, 11:55 pm
Newsgroups: comp.lang.lisp
From: g...@jpl.nasa.gov (Erann Gat)
Date: Sun, 14 Apr 2002 19:00:50 -0800
Local: Sun, Apr 14 2002 11:00 pm
Subject: Re: The Common Lisp Way (was: Re: Your introduction to Lisp...)

In article <3227801257185...@naggum.net>, Erik Naggum <e...@naggum.net> wrote:
> * Erik Naggum
> > Quit attacking me.

> * Erann Gat
> | I don't believe I am.

>   So there is no hope...

That is entirely up to you.  As long as you refuse to tell me what I've
said that you perceive as an attack there's nothing I can do about it.

E.


 
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.
Discussion subject changed to "introduction to Lisp..." by Kenny Tilton
Kenny Tilton  
View profile  
 More options Apr 15 2002, 4:48 am
Newsgroups: comp.lang.lisp
From: Kenny Tilton <ktil...@nyc.rr.com>
Date: Mon, 15 Apr 2002 08:44:46 GMT
Local: Mon, Apr 15 2002 4:44 am
Subject: Re: introduction to Lisp...

Sherif Elbanhawy wrote:

> Ok guys,

> Why is this not working??

> (defun print_list(L)
> (cond
> ((null L) nil)
> ((atom L) (list L))
> (t (append   (print_list (car L)) (print_list (cdr L)))
> (stable-sort (L) #'char-lessp))

What's with the (L) as the first arg to stable-sort? Does that compile
for you?

Anyway, fix that and you are left with a common mistake: append makes a
new list which you do not capture anywhere, it just drifts off into a
GC. then you sort good old L, which is unchanged and hence still has
depth, ie, members which are not chars. char-lessp don't play dat.

throw in (setf L ....) around that append and i think you'll be ok.

--

 kenny tilton
 clinisys, inc
 ---------------------------------------------------------------
"Harvey has overcome not only time and space but any objections."
                                                        Elwood P. Dowd


 
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.
Discussion subject changed to "The Common Lisp Way (was: Re: Your introduction to Lisp...)" by Erik Naggum
Erik Naggum  
View profile  
 More options Apr 15 2002, 7:45 am
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Mon, 15 Apr 2002 11:45:37 GMT
Local: Mon, Apr 15 2002 7:45 am
Subject: Re: The Common Lisp Way (was: Re: Your introduction to Lisp...)
* Erik Naggum

> So there is no hope...

* Erann Gat
| That is entirely up to you.

  Q.E.D.

  Just take charge of your own life, now.  Think for yourself.  Here is a
  book suggestion for you: ISBN 0-312-28118-8.  Think about yourself,
  _only_, when you read it.  And _please_ figure out this context thing.

///
--
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: http://home.chello.no/~xyzzy/kitten.jpg


 
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.
Discussion subject changed to "Ancient Times (Was: Re: introduction to Lisp...)" by Erik Naggum
Erik Naggum  
View profile  
 More options Apr 15 2002, 8:40 am
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Mon, 15 Apr 2002 12:40:32 GMT
Local: Mon, Apr 15 2002 8:40 am
Subject: Re: Ancient Times (Was: Re: introduction to Lisp...)
* Rahul Jain
| Did people actually use underscores as word separators back then?  I
| thought the underscore was a very rare character to have before ASCII was
| in nearly universal use.

  The underscore is quite young.  The character in that position in ASCII and
  its precursors has a long history, but generally, _ was a back-arrow and
  ^ was an up-arrow.  _ has come to replace blank, which many have rendered
  as an underscore with very short vertical bars on each side.  Primitive
  syntax descriptions have a serious problem with whitespace, so they claim
  that a-b is three tokens, a_b one.  This arbitrariness is frustrating to
  people who know better.  OfCoursePeopleWhoWriteLikeThisDoNotSeeTheProblem.

| Or is this just an attempt to make the C programmers taking the class
| feel better?

  It is probably a feebleminded attempt to learn real syntaxes in stages,
  slow adaptability or something.  I mean, no textbooks on Lisp or Scheme
  or any other sufficiently similar language uses _ in identifiers, so this
  is an independent creation of the student who is unable to observe what
  others are doing.  Generally, I consider poor indentation and _ in symbol
  names a clear sign that the requestor is more lost that I would consider
  it in my interest to try to rectify.

  But more generally, space should be a valid character in identifiers, and
  with ISO 8859 and Unicode, it can be: just use the non-breaking-space.  I
  think this really _rules_ for extra super-high readability.

///
--
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: http://home.chello.no/~xyzzy/kitten.jpg


 
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.
Discussion subject changed to "Your introduction to Lisp..." by Matthias Blume
Matthias Blume  
View profile  
 More options Apr 15 2002, 9:56 am
Newsgroups: comp.lang.lisp
From: Matthias Blume <matth...@shimizu-blume.com>
Date: 15 Apr 2002 09:50:30 -0400
Local: Mon, Apr 15 2002 9:50 am
Subject: Re: Your introduction to Lisp...

Rahul Jain <rj...@sid-1129.sid.rice.edu> writes:
> Bruce Hoult <br...@hoult.org> writes:

> > I may be wrong, but I think I picked up a fine distinction between
> > "symbolic programming" (which is pretty much any non-numeric
> > programming, done in any language),

> Erm, then would programming using just characters as values be
> symbolic programming? No. I have no clue how you picked up this
> misconception, but symbolic programming is programming using symbols
> as data.

What is a "symbol" according to you?

"Symbolic programming" is a rather broad term which is generally used
to contrast with "numeric programming".

> > and "symbol programming", which is specifically the passing around
> > of CL symbols (which live in packages, and have function and value
> > slots and property lists).

> "Symbol programming" is a term I've never seen before. Not only does
> it sound funny, it implies nothing to do with CL...

He (Bruce) made that term up to emphasize the fine line that he is
detecting.  Right, Bruce?

--
-Matthias


 
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.
Discussion subject changed to "Ancient Times (Was: Re: introduction to Lisp...)" by Marco Antoniotti
Marco Antoniotti  
View profile  
 More options Apr 15 2002, 10:20 am
Newsgroups: comp.lang.lisp
From: Marco Antoniotti <marc...@cs.nyu.edu>
Date: 15 Apr 2002 10:19:49 -0400
Local: Mon, Apr 15 2002 10:19 am
Subject: Re: Ancient Times (Was: Re: introduction to Lisp...)

People here are trying to be helpful.  They are giving you all sorts
of information.  E.g. the fact that your input list does not have
characters but symbols.

And the fact that you should use a better editor (since your
indentation is "less-than-optimal").

Have you understood the difference between symbols and characters?

Here is the solution BTW.  Hope it will help you homework.

Given your last post, I will assume that your input list L is a nested
list of characters.

(defun sort-the-homework-list (L)
  (sort (flatten L) #'char<=))

Now.  If you want you can also check L

(defun sort-the-homework-list-2 (L)
  (let ((flattened-list (flatten L)))
    (unless (every #'characterp flattened-list)
      (error "Some element in the list (~S) is not a character."
             (find-if (complement #'characterp) flattened-list)))
    (sort flattened-list #'char<)))

Does this help?  Note that this is a good answer.  If your instructor
wnats something different it is his problem.

Cheers

--
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.


 
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.
Joe Marshall  
View profile  
 More options Apr 15 2002, 11:55 am
Newsgroups: comp.lang.lisp
From: "Joe Marshall" <prunesqual...@attbi.com>
Date: Mon, 15 Apr 2002 14:36:10 GMT
Local: Mon, Apr 15 2002 10:36 am
Subject: Re: Ancient Times (Was: Re: introduction to Lisp...)

"Erik Naggum" <e...@naggum.net> wrote in message

news:3227863232118899@naggum.net...

>   But more generally, space should be a valid character in identifiers,
and
>   with ISO 8859 and Unicode, it can be: just use the non-breaking-space.
I
>   think this really _rules_ for extra super-high readability.

Provided there is *some* way to visually distinguish it from a breaking
space!

 
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 176 - 200 of 453 < Older  Newer >
« Back to Discussions « Newer topic     Older topic »