-
Notifications
You must be signed in to change notification settings - Fork 19
Inline list pattern #103
Comments
I don't understand how they are convenient. Are they really important for many other people? |
If others don't find it convenient, don't worry about adding it. I just offer it as something you might consider adding. I use a shorthand for infix operators that create lists. As a result, this alternate pattern template is especially convenient when there are a lot of patterns. Trivial sampler here of the Common Lisp code is here: |
inline pattens are useful in general, not only for lists. (defpattern skip (n)
`(inline ,@(mapcar (constantly '_) (iota n))) ;; produces (inline _ _ _) for (skip 3)
(match x
((list x (skip 10) y) ...))
(match x
((list x _ _ _ _ _ _ _ _ _ _ y) ...)) This will save a lot of code when parsing a long list. |
This is already implemented in Trivia. |
The "list" and "list*" patterns are nice, but sometimes it's convenient to have them inline (so that the list itself doesn't need to be spliced in).
Consider adding these as built-in:
The text was updated successfully, but these errors were encountered: