Stack Exchange
writing my own version of `in` as an Arc macro
In Arc there's a macro called in
> (let x 1
    (in x 4 5 6))
nil
> (let x 1
    (in x 1 5 6))
t

that checks if its first parameter is equal to any of the rest. I want a version of this that takes a parameter plus a list (semantically identical to Python's in), so I wrote:
(assign weak-tens* '(11 12))

(mac in? (elt lst)
  (cons 'in (cons elt lst)))

(def transform-deck (deck)
     (map [if (in? _ weak-tens*) #\T _] deck))

output:
arc> (load "main.arc")
*** redefining in?
map: contract violation
  expected: list?
  given: '(_ . weak-tens*)
  argument position: 2nd
  other arguments...:
   #<procedure:ac-niltree>


What version of Arc are you using? I don't see anything wrong but I'm a bit sleepy. Try taking a look at the result of (macex1 '(inl 1 '(1 2))). You could also try defining it as (mac inl (elt lst) (cons 'in (cons elt lst))) and see if it makes a difference.

Er, I just updated with my full code.

To answer your immediate question, you can use mem, as follows:
arc> (let x 3
    (mem x '(1 2 3 4)))
(3 4)

Also, there's no reason this should be a macro. It doesn't do anything that requires a macro.
But let's look at why the macro doesn't work:
arc> (macex1 '(in? 1 '(1 2 3)))
(in 1 quote (1 2 3))

Ah, we're putting the value "quote".
Here's how we want the code to expand:
(in? 1 '(1 2 3))

should expand to:
(in 1 1 2 3)

But as mentioned, we don't even want this to be a macro in the first place. Ignoring mem, it could be written as follows:
(def in? (elt lst)
     (if (no lst)
         nil
       (is elt ;;if we've found the element
           (car lst))
       t
       (in? elt (cdr lst)))) ;;otherwise recurse

