guicho271828 / trivia

Pattern Matcher Compatible with Optima
Other
334 stars 22 forks source link

Match type specifier #137

Open q3cpma opened 2 years ago

q3cpma commented 2 years ago

Hello and sorry in advance if the answer if right under my nose. Is it possible to match the argument as a type specifier instead of using the argument's type?

Something to do the equivalent of:

(let ((x '(simple-array fixnum (3))))
  (cond
   ((subtypep x 'list) ...)
   ((subtypep x 'vector) ...)))

which I use in some personal sequence functions that take a result type argument (like map).

guicho271828 commented 2 years ago

See type-r

q3cpma commented 2 years ago

On Fri Aug 12, 2022 at 3:20 PM CEST, Masataro Asai wrote:

See type-r

Thanks, that's what I wanted. Shouldn't it be in the trivia wiki?