Nothing is better to enhance your skills than to solve a task as the excellent one you've chosen. When it's done you'll be a beginner no more
Maybe I can explain the code I posted in a little more detail. Picking values from a table on the basis of a few parameters (minwdt and majwdt) is comparable to a 'select case' case. Functions like COND and IF can do the job as you just showed, but if you had hell writing all those IF's then imagine what it'll be like next time new standards for intersection visibility arrive. Besides, execution-wise it's slow and codewise it's not very clear.
If you look at the table that you are querying, you'll notice that you have two parameters and then four possible values. This can be set up like this:
minwdt majwdt A B C D
48 48 53 6 6 42
48 51 39 5 5 31
...
60 48 46 6 6 50
60 51 33 4 4 37
...
This means that if you can lookup minwdt in the table then you'll end up having x choices that only depends on majwdt. Subsequently, if you can lookup majwdt among those x choices then you'll hit a result.
How to set this up in a list? Well, AutoLISP has an excellent lookup-function called ASSOC. You use it all the time when looking up entity definition data. It looks for the first value in a list and returns the entire list if it's a match.
You could for example do this, where minwdt and majwdt are the first two item in each sublist:
(setq table (list (list 48 48 53 6 6 42)(48 51 39 5 5 31)(list 60 48 46 6 6 50)))
-> ((48 48 53 6 6 42)(48 51 39 5 5 31)(60 48 46 6 6 50))
(assoc 48 table)
-> (48 48 53 6 6 42)
So far so good. ASSOC enables you to lookup minwdt of 48. Querying the next item in the list could yield a match for majwdt. But ASSOC only returns the first sublist it encounters that has 48 as the first item - and you will have at least 5 sublists with 48 as CAR item.
So, trick is to return all possible values where minwdt can be 48:
(setq table (list (list 48 (list 48 53 6 6 42)(list 51 39 5 5 31))(list 60 (list 48 46 6 6 50))))
-> ((48 (48 53 6 6 42)(51 39 5 5 31))(60 (48 46 6 6 50)))
(assoc 48 table)
-> (48 (48 53 6 6 42)(51 39 5 5 31))
Now you have all possible matches for minwdt = 48. Next step is simply to look for majwdt among those matches. First you'll have to remove the first item in the returned list with CDR and then perform ASSOC again:
(setq match (cdr (assoc 48 table)))
-> ((48 53 6 6 42)(51 39 5 5 31))
(assoc 51 match)
-> (51 39 5 5 31)
Removing the first item (which is majwdt) from this list will give you a clean list of values for A, B, C and D:
(cdr (assoc 51 match))
-> (39 5 5 31)
Doing these tasks in one sweep is what was included in the posted code:
(cdr (assoc 51 (cdr (assoc 48 table))))
-> (39 5 5 31)
You don't have to worry about the MAPCAR that follows if you want to save the trickier stuff till later. It can be written like this instead:
(setq a (car match)
b (cadr match)
c (caddr match)
d (cadddr match)
)
... or ...
(setq a (nth 0 match)
b (nth 1 match)
c (nth 2 match)
d (nth 3 match)
)