unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eric Lilja <mindcooler@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Simple e-lisp question
Date: Tue, 14 Apr 2009 22:54:01 +0200	[thread overview]
Message-ID: <gs2t5b$tep$1@ger.gmane.org> (raw)
In-Reply-To: <002f01c9bd41$31391c00$0200a8c0@us.oracle.com>

Drew Adams wrote:
> 
> Lisp is English. If you can describe it clearly, you can code it.
> 
> If x has at least 2 elements, then 2nd, 1st, 3rd...
> Else x
> 
> at least 2 = cdr
> 2nd        = cadr
> 1st        = car
> 3rd...     = cddr
> 
> (defun switch2 (x)
>   (if (cdr x)
>       (cons (cadr x) (cons (car x) (cddr x)))
>     lst))
> 
> Hope this wasn't your only homework. ;-)

Thanks alot Mr Adams! And it wasn't even homework, just an old exercise 
I found.

- EL





  reply	other threads:[~2009-04-14 20:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14 19:49 Simple e-lisp question Eric Lilja
2009-04-14 20:39 ` Drew Adams
2009-04-14 20:54   ` Eric Lilja [this message]
     [not found] <mailman.5349.1239738617.31690.help-gnu-emacs@gnu.org>
2009-04-14 22:07 ` Pascal J. Bourguignon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='gs2t5b$tep$1@ger.gmane.org' \
    --to=mindcooler@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).