From: rodrigo vanegas
Subject: Re: Help
Date: 
Message-ID: <RV.94Aug9113557@tahoe.cs.brown.edu>
In article <··········@hemp.imel.kyoto-u.ac.jp>, ········@i.h.kyoto-u.ac.jp (shin'ya TAKAMURA) writes:

>   Hi all. Im a beginner of lisp programmer.
> I have a question in programming one. I need your help.

> (defun from-nth (e n)
>   (if (= n 1) e (from-nth (e (sub1 n)))))

> is the definition of "from-nth" function which "should"
> return a list from nth element of a given list.
> But when I run the function,

>>(from-nth '((a b b c) 2))

> 1. Trace: (FROM-NTH '((A B B C) 2))
> *** - EVAL/APPLY: too few arguments arguments given to FROM-NTH

As you called it, FROM-NTH is getting only one argument passed to it:

  ((a b b c) 2)

You want to say:

  (from-nth '(a b b c) 2)

By the way, if you're using Common Lisp, there is already a function
NTHCDR which has this functionality, but note that it is zero-indexed.

  (nthcdr 2 '(a b b c))  -->  (B C)


rodrigo vanegas
··@cs.brown.edu