Re: newbie question



dvlfrnd wrote:
hi there,
here's a newbie question
im not a programmer and lisp is the only language i've ever worked
with,
but somehow i love it and i wanna learn.
i was giving myself exercises and came up with this,pardon my
programming inefficency and please help.
say there's a list of even length
(a b c d e f ......)

how do i turn this into
((a b) (c d) (e f)....)

simply how do i couple the elements?

i first tried to write a function:

(defun couple-first-two (lst)
  (list (first lst) (second lst)))

but couldn't find a way to apply it to the entire list.
i tried a recursive function,but it didnt give the output i wanted.

What was your failed recursive solution? Post the code and we can help get you used to recursion.



kt .



Relevant Pages

  • Reply to Gerry Quinn - Perils of Java Schools.
    ... >> Most Java(any imperative language) programmers will instinctively opt ... >> for an iterative solution and will only use recursion when they are ... In those situations your imperative programmer takes a lot ... > abandon Java in favour of a toy language that is limited to them and no ...
    (comp.programming)
  • Reply to Gerry Quinn - Perils of Java Schools.
    ... >> Most Java(any imperative language) programmers will instinctively opt ... >> for an iterative solution and will only use recursion when they are ... In those situations your imperative programmer takes a lot ... > abandon Java in favour of a toy language that is limited to them and no ...
    (comp.programming)
  • Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
    ... >> Most Java(any imperative language) programmers will instinctively opt ... >> for an iterative solution and will only use recursion when they are ... Ask an average Java ... In those situations your imperative programmer takes a lot ...
    (comp.programming)
  • Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
    ... >> Most Java(any imperative language) programmers will instinctively opt ... >> for an iterative solution and will only use recursion when they are ... Ask an average Java ... In those situations your imperative programmer takes a lot ...
    (comp.programming)
  • Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
    ... >> Most Java(any imperative language) programmers will instinctively opt ... >> for an iterative solution and will only use recursion when they are ... Ask an average Java ... In those situations your imperative programmer takes a lot ...
    (comp.programming)