hello,
how can i match against a procedure,example:
(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
Use ==
.
(match (list container index1-or-keyword)
[(list c (== /)) "something with /"]
[(list c _) "else"])
1 Like
thank you ,it works in my code:
(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
1 Like