3 ms·
Dash 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
by daptaq 4y ago
Dash 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"))