# Match a procedure

**URL:** <https://racket.discourse.group/t/match-a-procedure/2048>\
**Category:** General\
**Created:** [June 28, 2023, 12:21am UTC](https://racket.discourse.group/t/match-a-procedure/2048 "2023-06-28T00:21:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [June 28, 2023, 12:21am UTC](https://racket.discourse.group/t/match-a-procedure/2048/1 "2023-06-28T00:21:55Z")

</div>

hello,

how can i match against a procedure,example:

```scheme
(match (list container index1-or-keyword
       ((list c /) "something with /")
       ((list c p) "else")

```

it will put index1-or-keyword in / and that not what i want, i just want it to check that index1-or-keyword is /

if i quote index1-or-keyword and / it will match but if i have an expression in index1-or-keyword it will not be evaluated and cause error after in code.

Damien

---

<div class="post-metadata">

**Author:** ![sorawee](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@sorawee](https://racket.discourse.group/u/sorawee)\
**Post date:** [June 28, 2023, 2:18am UTC](https://racket.discourse.group/t/match-a-procedure/2048/2 "2023-06-28T02:18:51Z")

</div>

Use [`==`](https://docs.racket-lang.org/reference/match.html#%28form._%28%28lib._racket%2Fmatch..rkt%29._~3d~3d%29%29).

```scheme
(match (list container index1-or-keyword)
  [(list c (== /)) "something with /"]
  [(list c _) "else"])

```

---

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [June 28, 2023, 8:54am UTC](https://racket.discourse.group/t/match-a-procedure/2048/3 "2023-06-28T08:54:24Z")

</div>

thank you ,it works in my code:

```scheme
(match (list container index1-or-keyword index2-or-keyword)
	      
	      ((list c (== /) (== /)) (displayln "T[/ /]"))
	      ((list c i1 (== /)) (displayln "T[i1 /]"))
	      ((list c (== /) i2) (displayln "T[/ i2]"))
	      ((list c i1 i2) (let ((value expr)) ;; to avoid compute it twice
				
				;; normal case
				(if (vector? c)
				    (function-array-n-dim-set! c value (reverse (list i1 i2))) ;;(array-n-dim-set! array value i1 i2)
				    (array-set! c i1 i2 value))
				   
				value)))

```

i try to find something equivalent to Guile now...

Regards,  
Damien
