Reputation: 235
Is there list operation such like
'(x y) '(1 2)
(substitution '(x y) '(1 2) (+ 'x 'y))
-> (each symbol relatively matched by number list, and substituted)
-> (x = 1, y = 2)
-> (+ 1 2)
-> 3
I cannot find any idea from reference.
http://docs.racket-lang.org/reference/pairs.html
Upvotes: 0
Views: 145
Reputation: 12033
If you are trying to represent a mapping between names and values (a "dictionary"), there are several ways to do it. Racket provides a hash type that can associate names to values. You can read about them in the Guide. There is a more generic approach to use dictionary-like values in Racket (described in the racket/dict library) that works across different data types, and not just hashes alone.
Upvotes: 1