-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
destructuring idea using ... #332
Comments
If there's a syntax for binding the last element(s), it would also make sense to have syntax for binding the middle elements. Something like |
Well it might make the most sense for For example: ;; What I think would be ideal
(let [(first middle last) (list 1 2 3 4 5 6)]
(list first middle last))
;; => (1 (2 3 4 5) 6)
;; What actually happens in dash.el
(let [(first middle last) (list 1 2 3 4 5 6)]
(list first middle last))
;; => (1 2 3)
;; What would be better notation for what actually happens
(let [(first middle last ...) (list 1 2 3 4 5 6)]
(list first middle last))
;; => (1 2 3) I remember when I first started using dash, it was not intutive to me that However this notation is already used by dash and changing it would result in a EDIT: On second thought is how this is how I would expect this to work. What I said
|
Note that the existing list destructuring notation is not unique to Dash, but common across Emacs packages and Lisp dialects. |
I personally like the ... syntax but it's a bit unlispy. We can go with Alternatively if there is a Note that we already support the syntax For syntax reasons we can't support |
Yes, that's what I suggested. Personally, I prefer to also include Another syntax that I considered was Even if |
I would understand For
Edit: I see, you want to specifically bind the last item only. |
A destructuring idea using
...
:The text was updated successfully, but these errors were encountered: