trouble testing members in a foreach loop.

trouble testing members in a foreach loop.

mid-awe
Collaborator Collaborator
394 Views
3 Replies
Message 1 of 4

trouble testing members in a foreach loop.

mid-awe
Collaborator
Collaborator

Hi all,

 

I am having difficulty with:

 

(DEFUN C:TBOM ()
  (FOREACH I '("BOMPC_VENTURI" "BOMP3_VENTURI" "BOMPV_VENTURI" "BOMP3A" "bomcya" "BOMCYI" "BOMPCA" "BOM_dPC" "BOM_iPC" "BOM_ePC" "BOM_dP3" "BOM_iP3" "BOM_CiP3" "BOM_eP3" "BOM_dPV")
    (IF	(EVAL (MEMBER (STRCASE I) '("BOMPC_VENTURI" "BOMPCA" "BOM_DPC" "BOM_IPC" "BOM_EPC" "BOM_DPV")))
      (PRINC "\n\t => MATCH \n")
      (PRINC "\n\t => NOT MATCHED \n")
    )
  )
  (PRINC)
)

Obviously a simple test, but I am trying to get a match without regard to string case. 

 

Any help and/or suggestions are greatly appreciated (even if I'm missing something stupid 😉 ).

0 Likes
Accepted solutions (1)
395 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant
Accepted solution

Omit EVAL function. You're matching strings...

 

(DEFUN C:TBOM ()
  (FOREACH I '("BOMPC_VENTURI" "BOMP3_VENTURI" "BOMPV_VENTURI" "BOMP3A" "bomcya" "BOMCYI" "BOMPCA" "BOM_dPC" "BOM_iPC" "BOM_ePC" "BOM_dP3" "BOM_iP3" "BOM_CiP3" "BOM_eP3" "BOM_dPV")
    (IF	(MEMBER (STRCASE I) '("BOMPC_VENTURI" "BOMPCA" "BOM_DPC" "BOM_IPC" "BOM_EPC" "BOM_DPV"))
      (PRINC "\n\t => MATCH \n")
      (PRINC "\n\t => NOT MATCHED \n")
    )
  )
  (PRINC)
)
0 Likes
Message 3 of 4

mid-awe
Collaborator
Collaborator
Thank you. I guess I just needed another pair of eyes. 🙂

I greatly appreciate it.
0 Likes
Message 4 of 4

ВeekeeCZ
Consultant
Consultant

You're welcome 🙂

 

Actually, my explanation was wrong... IF function tests return of MEMBER function - which is in case of positive match a list (= true), otherwise nil. No place for EVAL function.

0 Likes