·············@gmail.com (sharda mishra) writes:
> PLEASE help me writing the following program in LISP language
> ;-
Homework, it sounds like. I'll give you some tips, you need to do the
work.
> Write a LISP function ODD-REVERSE which reverses the elements
> occuring at odd numbered position but keeps the elements at even
> numbered position in their given position.
>
> for example:-
>
> ODD-REVERSE '(5 7 (6 4 )3 12 (2 1) 9)) returns the list
>
> (9 7 12 3 (6 4) (2 1) 5)
Well, try breaking it down into smaller pieces. Wouldn't it be
simpler if you had a list of the elements in the odd-numbered
positions and a separate list of the elements in the even-numbered
positions? Then you could reverse the ``odd'' list, and ``merge''
the two lists back together.
--
;; Matthew Danish -- user: mrd domain: cmu.edu
;; OpenPGP public key: C24B6010 on keyring.debian.org