From: Paul P Manophath
Subject: help on lisp project
Date: 
Message-ID: <609sfi$nta$1@news.inc.net>
Can anyone help a beginner lisp programmer?

I want to define a function: EVERY-OTHER-NUMBER that takes a list as
argument and returns a list with every other number from the original
list.  For example:
     
       (EVERY-OTHER-NUMBER '(this 5 is really 2 insane 3 41 28))

should return this list (2 41).  If there is less than two number in a
list, return nil.  I also have to use recursion.  Do I need
another function that calls EVERY-OTHER-NUMBER that does part of the work?

The built-in functions that I can only use are:
 
first, rest, cons, append, list, if, cond, length, 
defun, let, null, atom, listp, numberp, zerop, equal,
eq, symbolp, and, or, not, +, -, 1-, *, /, =, >, <, setq

			Please help,
                        Pamela Mano

From: Patrick Tufts
Subject: Re: help on lisp project
Date: 
Message-ID: <60a5q4$9ap$1@new-news.cc.brandeis.edu>
Fall Semester already?

In answer to one of your questions, yes, you can do everything in a
single function. 

In answer to the rest, ask your teacher or take a look at the
recursion section in a Lisp textbook.

--Pat
From: Kent M Pitman
Subject: Re: help on lisp project
Date: 
Message-ID: <sfw4t7b12fs.fsf@world.std.com>
········@uwp.edu (Paul P Manophath) writes:

> Can anyone help a beginner lisp programmer?  I want to define a
> function: EVERY-OTHER-NUMBER that takes [...]  I also have to use
> recursion. 

I note you're coming from a .edu site at a time of year that is just
after the start of the fall term.  Also, the fact that you MUST
use recursion sounds like an instructor-imposed constraint.  So I have
to ask: Is this for a class?  

In general, I feel newsgroups are not an appropriate place to seek
help with routine homework assignments.  It's too easy for someone out
here to crank out the answer without you having to think hard about
it--and then you don't learn from the assignment.  Also, we often
don't know what you already know and don't know in a class.

> The built-in functions that I can only use are: 
> first, rest, cons, append, list, if, cond, length, 
> defun, let, null, atom, listp, numberp, zerop, equal,
> eq, symbolp, and, or, not, +, -, 1-, *, /, =, >, <, setq

Of curiosity, what Lisp has only these operations or why are you 
constrained only to use these?
From: Marco Antoniotti
Subject: Re: help on lisp project
Date: 
Message-ID: <scfn2l2n0sp.fsf@PATH.Berkeley.EDU>
······@world.std.com (Kent M Pitman) writes:

> 
> ········@uwp.edu (Paul P Manophath) writes:
> 
> > Can anyone help a beginner lisp programmer?  I want to define a
> > function: EVERY-OTHER-NUMBER that takes [...]  I also have to use
> > recursion. 
> 
	...
> 
> > The built-in functions that I can only use are: 
> > first, rest, cons, append, list, if, cond, length, 
> > defun, let, null, atom, listp, numberp, zerop, equal,
> > eq, symbolp, and, or, not, +, -, 1-, *, /, =, >, <, setq
> 
> Of curiosity, what Lisp has only these operations or why are you 
> constrained only to use these?

I hope they are using a full fledged Common Lisp.  OTOH, 'setq' is a
no-no in this assignment and two functions will work better than one. :)

-- 
Marco Antoniotti
==============================================================================
California Path Program - UC Berkeley
Richmond Field Station
tel. +1 - 510 - 231 9472
From: Kent M Pitman
Subject: Re: help on lisp project
Date: 
Message-ID: <sfwiuvqjxfk.fsf@world.std.com>
·······@cs.utexas.edu (Michael Alan Schaeffer) writes:

> In article <···············@world.std.com>,
> Kent M Pitman <······@world.std.com> wrote:
> >········@uwp.edu (Paul P Manophath) writes:
> >In general, I feel newsgroups are not an appropriate place to seek
> >help with routine homework assignments.
>
> While I've never asked for help on a homework problem in a
> newsgroup, I'm inclined to disagree.  I think that the main problem is
> that it is very easy to mislead somebody into doing your homework for
> you.  This is essentially cheating... 

I understand the point you're trying to make, and largely agree, so
let me make my original point (which was slightly different) less
subtle: I think minimal disclosure of the situation is ethically
called for.  It shouldn't be a burden on the group here to realize
when something is a homework assignment and when it is not.  

I think asking for help on a homework problem without giving such
disclosure ought to be defined as cheating even if it isn't always
intentional cheating exactly because there is no way to tell the
difference and teaching good ethics is at least as important as
teaching proper recursion in a beginning computer course (IMO).

Moreover, clearly specifying what the full nature of the assignment
was and what part you're looking for help on makes it easier for us
who might be inclined to help to know we aren't cheating.  I don't
mind doing a problem completely for someone who has Lisp to do for a
job because my company is in the business of selling Lisp and it's to
my benefit to give them as many examples as it takes to get a point
across.  I don't mind because I figure anyone doing Lisp for a job is
already pretty committed to Lisp if he's gotten past the part about
his boss asking him why he's not using C.  I don't have a similar
automatic feeling of commitment to a student (with no disrespect meant
to any particular student--I'm sure some, and for all I know, this one
we're picking on here) can be very well-intentioned.  But I don't
want to make it too easy to sail through without learning something.

So properly announcing "this is homework" is good for the student
and good for me.
From: Richard A. O'Keefe
Subject: Re: help on lisp project
Date: 
Message-ID: <60cle4$c54$1@goanna.cs.rmit.edu.au>
········@uwp.edu (Paul P Manophath) writes:

>Can anyone help a beginner lisp programmer?

>I want to define a function: EVERY-OTHER-NUMBER that takes a list as
>argument and returns a list with every other number from the original
>list.  For example:
>     
>       (EVERY-OTHER-NUMBER '(this 5 is really 2 insane 3 41 28))

>should return this list (2 41).

This is obviously an assignment of some kind.
Here's a suggestion.
Do it in two stages.
I'll use Scheme syntax.

    (define (every-other-number Items)
      (every-second-element
        (only-the-numbers Items)))

Now you just have to write only-the-numbers and every-second-element.
For only-the-numbers, I'll switch to Erlang syntax.

    only_the_numbers([X|Xs]) when number(X) -> [X|only_the_numbers(Xs)];
    only_the_numbers([_|Xs])                ->    only_the_numbers(Xs) ;
    only_the_numbers([])                    ->    [].

For every-second-element, I'll switch to Clean.

    every_second_element [] = []
    every_second_element [_] = []
    every_second_element [_,X:Xs] = [X:every_second_element(Xs)]

Now all you have to do is translate these things to Lisp,
and you're away laughing.

-- 
Unsolicited commercial E-mail to this account is prohibited; see section 76E
of the Commonwealth Crimes Act 1914 as amended by the Crimes Legislation
Amendment Act No 108 of 1989.  Maximum penalty:  10 years in gaol.
Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.