From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenneth Tilton Newsgroups: gmane.emacs.help Subject: Re: Help needed to simplify code for customisation Date: Wed, 11 Mar 2009 02:37:42 -0400 Organization: Optimum Online Message-ID: <49b75c2b$0$22514$607ed4bc@cv.net> References: <46c6811e-771a-4162-a0c7-967b788793e1@v35g2000pro.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1236776263 17243 80.91.229.12 (11 Mar 2009 12:57:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Mar 2009 12:57:43 +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 Mar 11 13:58:59 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 1LhO1I-00053X-VI for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Mar 2009 13:58:58 +0100 Original-Received: from localhost ([127.0.0.1]:34847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LhNzu-00005O-EN for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Mar 2009 08:57:22 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!nx01.iad.newshosting.com!newshosting.com!69.16.185.51.MISMATCH!tmp-post01.iad!news.highwinds-media.com!news.cv.net!not-for-mail User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) Original-Newsgroups: gnu.emacs.help,comp.emacs,comp.lang.lisp In-Reply-To: Original-Lines: 39 Original-NNTP-Posting-Host: 24.187.122.229 Original-X-Complaints-To: abuse@cv.net Original-Xref: news.stanford.edu gnu.emacs.help:167515 comp.emacs:97998 comp.lang.lisp:262618 X-Mailman-Approved-At: Wed, 11 Mar 2009 08:55:06 -0400 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:62830 Archived-At: Marco Antoniotti wrote: > On Mar 10, 12:42 pm, "William James" wrote: >> TomSW wrote: >>> (require 'cl) >>> (defvar my-accounts-alist >>> '(("richardriley" "root" "richardriley") >>> ("rileyrgdev" "rileyrgdev")) >>> "Associate email accounts with sender addresses: an alist each item >>> of >>> which is a list whose first member is the account name and any >>> following >>> members are regular expressions to match against a sender address.") >>> (defun my-get-account (from) >>> (car (find-if (lambda (regexps) >>> (some (lambda (regexp) >>> (string-match regexp from)) >>> regexps)) >>> from my-accounts-alist >>> :key 'cdr))) >> Clojure: >> >> (def my-accounts-map >> { "richardriley" [#"root" #"richardriley"], >> "rileyrgdev" [#"rileyrgdev"] } ) >> >> (defn my-get-account [from] >> (ffirst >> (filter >> (fn [[acct re-list]] (some #(re-find % from) re-list)) >> my-accounts-map))) > > Hey. That is not the homework you are supposed to hand in. What are we going to do with our boy Willy? He never does his Ruby assignmens any more and just plays with a Lisp all day. I say no television until we seem some work. kt