Association in general Lisp

There is a structure in the following format:

(setq dist '(((1 1) 1) ((0 2) 3) ((1 2) 1) ((2 3) 3) ((3 5) 4))) 

Is there any function that, if I call

 (myf '(0 2)) 

could give me

 3 

or

 ((0 2) 3) 

Something like the opposite of assoc

+6
lisp common-lisp
source share
1 answer

I do not understand why this is called inverse ASSOC.

 (assoc '(0 2) dist :test #'equal) > ((0 2) 3) 

ASSOC seems to work fine if you change the test function so that the lists used as keys are tested correctly.

+8
source share

All Articles