From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Sweeter Emacs Lisp Date: Sun, 14 Jul 2013 16:22:39 +0200 Message-ID: References: <8738rh6ftk.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1373811779 13029 80.91.229.3 (14 Jul 2013 14:22:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Jul 2013 14:22:59 +0000 (UTC) Cc: emacs-devel To: fgallina@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 14 16:23:01 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UyNCW-0000f2-WA for ged-emacs-devel@m.gmane.org; Sun, 14 Jul 2013 16:23:01 +0200 Original-Received: from localhost ([::1]:37374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyNCW-0005Jd-9s for ged-emacs-devel@m.gmane.org; Sun, 14 Jul 2013 10:23:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyNCR-0005Fq-Hm for emacs-devel@gnu.org; Sun, 14 Jul 2013 10:22:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyNCO-0005S3-Nw for emacs-devel@gnu.org; Sun, 14 Jul 2013 10:22:55 -0400 Original-Received: from hermes.netfonds.no ([80.91.224.195]:57277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyNCO-0005RX-Ej; Sun, 14 Jul 2013 10:22:52 -0400 Original-Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UyNCC-0007ww-7i; Sun, 14 Jul 2013 16:22:40 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAADFBMVEVJEBWSQjF1JCXboE2p aSTxAAACZ0lEQVQokRVRX0gTcRz/Oo71u/nQOZyb24PX5dqpD4EPvYTTRCSFysS7OcXOxC011gia VFK3DZ3borCHO3OhruH8c6APQb0GvQW9RFymoUKkD9GDCPOmcl4/Hz98+Pzh8wFjN1DbE/C7F3p7 dRDVvJUfqsmPdwkGGIWVXEeq35wensWA+6tELVmTctGHgfonRyRyVNp134Cdva5kO0COsc9ghj8k UGqApi5LBuh9RwQgGqhbsgDTU8cIrOMIeV49hdBY0UHPBFG1Z2sMOKHI0jVDNOtZL4CgFQmCl7DB rwL41tXxGMu2W6UTDYzwvxZ0ZY4uc+3jnHO/E7T3ObK+OMDgtJ68tJhZ7nzZiEMNL1kjlw9SDaIA 2icn4erjeArxEQhl4lA5vx00RV/LsBaIRz+K+r1Y84YE8tuBZt8zfaupLTgJ37r42DQvqdkbtrvQ 9sRksYWPOKp/qQckv3uCmy9w3aN5DvJ+S1IKH3JUdqkbhnscsWmOO9MMAy93nrnp2WvcJMi+z02j OCfetCFDKGCiM/OneVN0RQah0oRcIXWUYaUIaGIDWblYwdc3Nu6AqHtL3Iu2N+/PVxkg+g5I1tuH 6uv2RTBKd5O0d5ax2vAGmva15QKbHGJunpzA1e8FAgWlNLLjqaq0Imt1jjCorrANqrDvoFsHo5Y6 NQIB/jHBOFuBmJyIwIfEIwQIAe25I+BPI2Y21pGrtXNnbz+sZqLwzlzmxwdvBqvTcXo54f6Cmc2f DjD1Q4rcw8yP206qZIo0l4V1MPTVRPkyObEwZ8etjwNKt5JJjVSoWHPwACmKkry+Vmr8B0nUApks n9w0AAAAAElFTkSuQmCC X-Now-Playing: Coil's _Stolen and Contaminated Songs_: "The Original Wild Garlic Memory" X-Hashcash: 1:23:130714:emacs-devel@gnu.org::oYEGc8rqxv2jnMpX:0000000000000000000000000000000000000000005wfm X-Hashcash: 1:23:130714:fgallina@gnu.org::16apZ4rRCy2ZUh8y:0y+O7 In-Reply-To: <8738rh6ftk.fsf@gnu.org> (fgallina@gnu.org's message of "Sat, 13 Jul 2013 23:22:31 -0300") User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) X-MailScanner-ID: 1UyNCC-0007ww-7i MailScanner-NULL-Check: 1374416560.47564@I22ytCoFqM3XcEnqOde8dQ X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161873 Archived-At: fgallina@gnu.org writes: > + The *threading* macros "->" and "->>": [...] > (setq tag (cons "

" "

")) > > (defun tag-desc (tag) > (concat (upcase (car tag)) ".")) > > (defun tag-desc-stripped (tag) > (upcase (replace-regexp-in-string "[<\\/> ]" "" (car tag)))) > > ;; with threading macros > (defun tag-desc (tag) > (-> (car tag) (upcase) (concat "."))) > > (defun tag-desc-strip (tag) > (->> (car tag) (replace-regexp-in-string "[<\\/> ]" "") (upcase))) It's not clear what the point of these are. Just to make the code more obscure and cool? The new forms (as demonstrated here) even leads to longer code, in addition to being pretty opaque. While the "old" code is obvious and easy to read. > + when-let, if-let: Yes, `when-let' is pretty nice. > + *we need a built-in core mapcan (could be called mapcat), filter and > sequence concatenation (could be called cat?) function that doesn't > depends on cl-lib*. This is fundamental stuff isn't it? Why is such a > need to require a library for it? Why not just use the cl functions? > + Destructuring in defun and let: This looks weirder than I thought > because of our (ab)use of parens everywhere, but I feel this is > something brillant to have as part of the core language. Destructuring lambda argument lists (a la Common Lisp) would be very nice, yes, but is probably an uphill battle. > ;; let destructuring > (defun fmt-tag (tag) > (let (((open close) tag)) > (format open close))) This is just a different way to write `destructuring-bind', though. I don't see the point. > + make `let` work like `let*`: "let's" stop confusing newcomers. I don't think it's that confusing. It would be more confusing having let and let* work differently in Emacs Lisp than in other Lisps, I think. > + hash-tables: how come that working with hash-tables is such a pain? > I love how they are function of themselves in clojure and that > there's reader syntax for them. > > (setq tags (make-hash-table)) > (puthash tags :p "

") > (puthash tags :span "") > (gethash :span tags) ; -> "

" That's painful? It seems clear and nice to me. > ;; clojuresque version > (setq tags {:p "

" :span ""}) > (:p tags) ; -> "

" > (tags :p) ; -> "

" > (:html tags) ; -> nil This just seems like a "neat" way to write opaque code. Did the Clojure people come from a Perl or Scheme background, by any chance? > [0] http://clojure.org/ If these are the bits that are exciting in Clojure, then Clojure doesn't seem particularly exciting to me. :-) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/