From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Harry Putnam Newsgroups: gmane.emacs.help Subject: Re: conditionals in elisp Date: Wed, 28 Oct 2009 11:19:25 -0500 Organization: Still searching... Message-ID: <87639zlcdu.fsf@newsguy.com> References: <87iqe1og0i.fsf@newsguy.com> <14A45A8A6D3A42A7ADA56DE8DB68C74E@us.oracle.com> <8763a1o0yx.fsf@newsguy.com> <873a53rij7.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1256748344 13293 80.91.229.12 (28 Oct 2009 16:45:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Oct 2009 16:45:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 28 17:45:37 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N3BeP-0007bl-3a for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Oct 2009 17:45:33 +0100 Original-Received: from localhost ([127.0.0.1]:49935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3BeO-00052a-LR for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Oct 2009 12:45:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N3BFp-0006Id-7X for help-gnu-emacs@gnu.org; Wed, 28 Oct 2009 12:20:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N3BFk-0006D7-Ee for help-gnu-emacs@gnu.org; Wed, 28 Oct 2009 12:20:08 -0400 Original-Received: from [199.232.76.173] (port=60638 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3BFk-0006Cr-7z for help-gnu-emacs@gnu.org; Wed, 28 Oct 2009 12:20:04 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:47561) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N3BFj-0004fu-PZ for help-gnu-emacs@gnu.org; Wed, 28 Oct 2009 12:20:04 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1N3BFb-00036p-TS for help-gnu-emacs@gnu.org; Wed, 28 Oct 2009 17:19:55 +0100 Original-Received: from c-98-215-178-110.hsd1.in.comcast.net ([98.215.178.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Oct 2009 17:19:55 +0100 Original-Received: from reader by c-98-215-178-110.hsd1.in.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Oct 2009 17:19:55 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 84 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-98-215-178-110.hsd1.in.comcast.net User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:07UBM2hBXhN3Du0pHaXhj5m9/0E= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69311 Archived-At: Thien-Thi Nguyen 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))) `---- [...]