Closed guicho271828 closed 7 years ago
This was a surprise for me while using Trivia for building an algorithm. However,
(is (eql 3 (match '(1 2 3) ('(1 _ a) a))))
(is (eql 3 (match #(1 2 3) (#(1 _ a) a))))
this behavior has been present in Optima and I will preserve this behavior. I almost got bitten by my own product :)
Looking twice, this was indeed I was bitten by myself. Thinking about it...
I would like to ask someone's opinion... @fare ? I summarized the point below: https://github.com/guicho271828/trivia/wiki/Known-Differences#extended-semantics-of-constant-patterns
Uh, shouldn't (quote (a))
be the same as '(a)
and thus (list 'a)
? If you want non-constant, you should be using fare-quasiquote, it was designed exactly for that: `(,a)
. Or if you don't want a special readtable, still (quasiquote ((unquote a))
.
I can understand why the situation sucks with arrays, though. I blame the CL standard (itself constrained by backward compatibility)
Thanks. It should be a result of an excessive extrapolation when I implemented the structure/array literal patterns, I clearly didn't think enough. I will fix the commits soon.
It compiles to
(list a)
instead, and theeq
-test against the symbola
is not performed.