From: Vmackeen
Subject: Newbie ?--need help with sm.prob.
Date: 
Message-ID: <20010505225222.11210.00002473@ng-cc1.aol.com>
hi,
I have three programs to writ in three different languages for my final exam.
Was wondering if anyone could help with lisp code that removes duplicate
entries in a list. e.g. [d a c a d d ] returns [a c d].
 

From: David Bakhash
Subject: Re: Newbie ?--need help with sm.prob.
Date: 
Message-ID: <m37kzvweqm.fsf@alum.mit.edu>
>>>>> "vmackeen" == vmackeen  <········@aol.com> writes:

 vmackeen> hi, I have three programs to writ in three different
 vmackeen> languages for my final exam.  Was wondering if anyone could
 vmackeen> help with lisp code that removes duplicate entries in a
 vmackeen> list. e.g. [d a c a d d ] returns [a c d].

this is easy in Common Lisp!

  (remove-duplicate-entries-from-list '(d a c a d d))

dave

p.s. look up the rest
From: Marco Antoniotti
Subject: Re: Newbie ?--need help with sm.prob.
Date: 
Message-ID: <y6cn18pqjff.fsf@octagon.mrl.nyu.edu>
········@aol.com (Vmackeen) writes:

> hi,
> I have three programs to writ in three different languages for my final exam.
> Was wondering if anyone could help with lisp code that removes duplicate
> entries in a list. e.g. [d a c a d d ] returns [a c d].

In Lisp you write

(defvar l '(d a c a d d))

(defun I-should-read-the-manual (l)
   (remove-duplicates l))

(I-should-read-the-manual l)

Enjoy.


-- 
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'.
From: Hannah Schroeter
Subject: Re: Newbie ?--need help with sm.prob.
Date: 
Message-ID: <9d97fs$prr$1@c3po.schlund.de>
Hello!

In article <···············@octagon.mrl.nyu.edu>,
Marco Antoniotti  <·······@cs.nyu.edu> wrote:

>[...]

>(defvar l '(d a c a d d))

>(defun I-should-read-the-manual (l)
>   (remove-duplicates l))

>(I-should-read-the-manual l)

Then do

(let ((symbol (find-symbol "L")))
  (setf (symbol-name symbol)
        "*I-SHOULD-CONSIDER-WHETHER-I-SHOULD-USE-GLOBAL-VARIABLES-ESPECIALLY-WITHOUT-STARS-AROUND-THE-NAME*"))

Kind regards,

Hannah.
From: Greg Menke
Subject: Re: Newbie ?--need help with sm.prob.
Date: 
Message-ID: <m3d79jy5cr.fsf@europa.mindspring.com>
> Hello!
> 
> In article <···············@octagon.mrl.nyu.edu>,
> Marco Antoniotti  <·······@cs.nyu.edu> wrote:
> 
> >[...]
> 
> >(defvar l '(d a c a d d))
> 
> >(defun I-should-read-the-manual (l)
> >   (remove-duplicates l))
> 
> >(I-should-read-the-manual l)
> 
> Then do
> 
> (let ((symbol (find-symbol "L")))
>   (setf (symbol-name symbol)
>         "*I-SHOULD-CONSIDER-WHETHER-I-SHOULD-USE-GLOBAL-VARIABLES-ESPECIALLY-WITHOUT-STARS-AROUND-THE-NAME*"))

Please excuse me if I misunderstood, but shouldn't it be;

 (let ((symbol (find-symbol "L")))
   (setf (symbol-value symbol)
         "*I-SHOULD-CONSIDER-WHETHER-I-SHOULD-USE-GLOBAL-VARIABLES-ESPECIALLY-WITHOUT-STARS-AROUND-THE-NAME*"))

this one replaces the value of 'l' with the long, interesting string, the other gave an error for me..

Gregm
From: Hannah Schroeter
Subject: Re: Newbie ?--need help with sm.prob.
Date: 
Message-ID: <9dbilo$ou5$1@c3po.schlund.de>
Hello!

In article <··············@europa.mindspring.com>,
Greg Menke  <··········@mindspring.com> wrote:

>[...]

>> (let ((symbol (find-symbol "L")))
>>   (setf (symbol-name symbol)
>>        
>"*I-SHOULD-CONSIDER-WHETHER-I-SHOULD-USE-GLOBAL-VARIABLES-ESPECIALLY-WITHOUT-STARS-AROUND-THE-NAME*"))

>Please excuse me if I misunderstood, but shouldn't it be;

> (let ((symbol (find-symbol "L")))
>   (setf (symbol-value symbol)

>"*I-SHOULD-CONSIDER-WHETHER-I-SHOULD-USE-GLOBAL-VARIABLES-ESPECIALLY-WITHOUT-STARS-AROUND-THE-NAME*"))

>this one replaces the value of 'l' with the long, interesting string,
>the other gave an error for me..

It was rather meant for human consumption. Though a function
(setf symbol-name) for renaming a symbol could be interesting *g*.

Kind regards,

Hannah.
From: Marco Antoniotti
Subject: Re: Newbie ?--need help with sm.prob.
Date: 
Message-ID: <y6cg0efsa1z.fsf@octagon.mrl.nyu.edu>
······@schlund.de (Hannah Schroeter) writes:

> Hello!
> 
> In article <···············@octagon.mrl.nyu.edu>,
> Marco Antoniotti  <·······@cs.nyu.edu> wrote:
> 
> >[...]
> 
> >(defvar l '(d a c a d d))
> 
> >(defun I-should-read-the-manual (l)
> >   (remove-duplicates l))
> 
> >(I-should-read-the-manual l)
> 
> Then do
> 
> (let ((symbol (find-symbol "L")))
>   (setf (symbol-name symbol)
>         "*I-SHOULD-CONSIDER-WHETHER-I-SHOULD-USE-GLOBAL-VARIABLES-ESPECIALLY-WITHOUT-STARS-AROUND-THE-NAME*"))

Good point.

What about constants defined with DEFCONSTANT?

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'.
From: Hannah Schroeter
Subject: Re: Newbie ?--need help with sm.prob.
Date: 
Message-ID: <9dbijj$had$1@c3po.schlund.de>
Hello!

In article <···············@octagon.mrl.nyu.edu>,
Marco Antoniotti  <·······@cs.nyu.edu> wrote:

>[...]

>"*I-SHOULD-CONSIDER-WHETHER-I-SHOULD-USE-GLOBAL-VARIABLES-ESPECIALLY-WITHOUT-STARS-AROUND-THE-NAME*"))

>Good point.

>What about constants defined with DEFCONSTANT?

I'd mark them too, however, my preference in this is not soo strong,
as the system hinders you in rebinding them anyway, so you will not
get strange errors in constructs like
  (let ((foo ...))
    ...)
if foo is constant, compared to the occasional special proclamation
of foo if you don't use the "*" convention or similar for global
variables.

The precedent set by the standard, however, contradicts my preference,
as there are predefined constants without any special marks.

Kind regards,

Hannah.