[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: conditionals in elisp
From: |
Harry Putnam |
Subject: |
Re: conditionals in elisp |
Date: |
Wed, 28 Oct 2009 11:19:25 -0500 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) |
Thien-Thi Nguyen <ttn@gnuvola.org> writes:
>
> If these (nicely formatted) examples are useful, they could be added to
> the documentation.
Yes nice examples all, and helpful. I guess I came at this more in
line with what is posted at one of the hits Pascal pointed to:
http://steve-yegge.blogspot.com/2008/01/emergency-elisp.html
This fellow says he was looking to demonstrate examples comparable to
other languages.
His examples of if/else seem to ring a bell for me.
> Also (to Harry Putnam): You can help avoid misunderstanding from other
> list members by stating explicitly "i read the Emacs Lisp manual node
> "Conditionals" and couldn't understand it".
Throughout this thread I've been a little amazed at how my OP comments
seem to have been taken.
I thought I said with some clarity that I didn't understand reading
the elisp manual. And laid out further what I was after... simplified
examples of if/else in elisp.
Is the following paragraph really so devoid of intent?
> This may be a chintzy way to do it but I really do not want to pound
> away at elisp intro and the elisp manual for hours. I usually
> start seeing red at the 4-5 paragraph and usually have been able to
> learn what I needed to know in things like perl and shell scripting
> from just a few real live examples that do something at least close
> to what I am trying then I can edit and tinker until I start to sort
> of `get it'.
>
What followed that was a fairly detailed account of what I was trying
to do then asked for simplified examples that did something at least
similar.
But, it certainly did not come across as intended.
Thanks for the examples and tips about testing tinkering etc.
Oh, and do experts here think that page cited above... in particular
the if/else examples, are good? not so good..?
Reprint of a couple here but there were several more (about 1/3 of the
way down the page cited above and below, if anyone has a mind to look):
http://steve-yegge.blogspot.com/2008/01/emergency-elisp.html
>From Steve Yegge's pages:
,----
| if/else
|
| Case 1: no else clause: (if test-expr expr)
|
| Example:
|
| (if (>= 3 2)
| (message "hello there"))
|
|
| Case 2: else clause: (if test-expr then-expr else-expr)
|
| (if (today-is-friday) ; test-expr
| (message "yay, friday") ; then-expr
| (message "boo, other day")) ; else-expr
|
|
| If you need multiple expressions (statements) in the then-expr, you
| wrap them with a call to progn, which is like curly-braces in C or
| Java:
|
| (if (zerop 0)
| (progn
| (do-something)
| (do-something-else)
| (etc-etc-etc)))
`----
[...]
- conditionals in elisp, Harry Putnam, 2009/10/26
- Re: conditionals in elisp, Richard Riley, 2009/10/26
- RE: conditionals in elisp, Drew Adams, 2009/10/26
- Re: conditionals in elisp, Harry Putnam, 2009/10/27
- RE: conditionals in elisp, Drew Adams, 2009/10/27
- Re: conditionals in elisp, Thien-Thi Nguyen, 2009/10/28
- RE: conditionals in elisp, Drew Adams, 2009/10/28
- Re: conditionals in elisp,
Harry Putnam <=
- Message not available
- Re: conditionals in elisp, LanX, 2009/10/28
- Re: conditionals in elisp, Harry Putnam, 2009/10/28
Re: conditionals in elisp, tomas, 2009/10/27