Having a Monday on a Wednesday....
I am trying to get the assoc value of a list. The problem is sometimes the value I am looking for is upper case and other times not, while the list is upper/lower case. I am wanting to use mapcar to convert the 1st value in each part of the list to uppercase during the assoc.
Example -
(setq Value "TEXT2")
(setq Mylist (list (list "Text1" "Line 1") (list "Text2" "Line 2") (list "Text3" "Line 3")))
(assoc Value Mylist)
;returns nil
I can't figure out the rest of the following -
(setq ValueFound (assoc (strcase Value) (mapcar .........
Hope this is clearer than mud.
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
@Anonymous wrote:Having a Monday on a Wednesday....
I am trying to get the assoc value of a list. The problem is sometimes the value I am looking for is upper case and other times not, while the list is upper/lower case. I am wanting to use mapcar to convert the 1st value in each part of the list to uppercase during the assoc.
Example -
(setq Value "TEXT2")
(setq Mylist (list (list "Text1" "Line 1") (list "Text2" "Line 2") (list "Text3" "Line 3")))
(assoc Value Mylist)
;returns nil
I can't figure out the rest of the following -
(setq ValueFound (assoc (strcase Value) (mapcar .........
Hope this is clearer than mud.
Something like this:
(assoc (strcase value) (mapcar '(lambda (x)(cons (strcase car x)(cdr x))) mylist))
@Anonymous wrote:Something like this:
(assoc (strcase value) (mapcar '(lambda (x)(cons (strcase car x)(cdr x))) mylist))
(assoc (strcase value) (mapcar '(lambda (x)(cons (strcase (car x))(cdr x))) mylist))
Probably should give pbejse the credit for the solution instead of yourself. Otherwise others reading the thread will be confused.