4 ms·
When it comes to f and s. Yes. Definitely, I do not want them and I do not need them. I like dash because it gives me the convenience of threading macros and a
by fishbacon 4y ago
When it comes to f and s. Yes. Definitely, I do not want them and I do not need them.
I like dash because it gives me the convenience of threading macros and anaphoric functions. Are there options for those in compat/emacs standard?
- daptaq 4y agoDash is weird because it is both a list library and and bundles macros. Conventional Emacs Lisp does not use anaphoric macros, and to my knowledge the ideomacy their usage is generally contested. Threading macros and stuff like if-let & co. have been available for a while and are backported by compat.
- fishbacon 4y agoMost of the time when I am just coding on my personal or small emacs lisp packages I really like the convenience of anaphoric functions. I have never seen an example of if-let that made me understand it, but I see thread-first and thread-last, those may be useful. Thanks!
- daptaq 4y ago> I have never seen an example of if-let that made me understand it, but I see thread-first and thread-last, those may be useful. They are often useful when you have a computation that might fail at any step, sort of like with Maybe monads in Haskell. Eg. if I want to retrive a password from auth-source, it might be that no entry exists, or that the entry has no password entry. In that case I do: (if-let* ((auth (auth-source-search :host "domain.org" :create t)) (func (plist-get (car auth) :secret)) (pass (funcall func))) (use-to-login-to-some-service pass) (user-error "Cannot find password"))
- mickeyp 4y agoEmacs has `thread-first' and `thread-last'.
- bollu 4y agoWhat is an anaphoric function / macro? I've seen this term floating around and I don't know what it means!
- iib 4y agoPage 189 of Paul Graham's "On Lisp" [1] introduces for the first time such a function. At least that is what I remember, and also what Wiki [2] seems to say. [1] http://ep.yimg.com/ty/cdn/paulgraham/onlisp.pdf http://ep.yimg.com/ty/cdn/paulgraham/onlisp.pdf [2] https://en.wikipedia.org/wiki/Anaphoric_macro https://en.wikipedia.org/wiki/Anaphoric_macro
- pmontra 4y agoNeither did I and so I searched for it and got prompted to post this offtopic reply (hopefully interesting for future debates on search engines.) I looked for anaphoric functions elisp on both DDD and Google. I believe that DDD uses Bing so TL;DR: Bing is not good at searching stuff, only basic queries. After maybe a couple of years of DDD I intuitively knew that I would have had to ask that question to Google.
- bollu 4y agoWhat is an anaphoric function and why would I want it?