Help with complicated if and or ??

Help with complicated if and or ??

DC-MWA
Collaborator Collaborator
842 Views
3 Replies
Message 1 of 4

Help with complicated if and or ??

DC-MWA
Collaborator
Collaborator

I'm working on this awesome building code analysis routine. It requires many cross lapping answers by the user.

I'm close. As always forgive my "Frankenlisping"

Need help with the following..

(= distcode 1030)(= 601TOC "1A");;when this is met

(= 602OCC "A")(= 602OCC "B")(= 602OCC "E")(= 602OCC "F-2")(= 602OCC "I")(= 602OCC "R")(= 602OCC "S-2")(= 602OCC "U") ;;for these

(progn (setq 602rating 1) (setq 602text1030 1) );;do this

 

Below is where I've ended up.

 

(if (and (= distcode 1030)(= 601TOC "1A")(or(= 602OCC "A")(= 602OCC "B")(= 602OCC "E")(= 602OCC "F-2")(= 602OCC "I")(= 602OCC "R")(= 602OCC "S-2")(= 602OCC "U")))
(progn (setq 602rating 1) (setq 602text1030 1) )
);end if

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

pbejse
Mentor
Mentor
(if (and (= distcode 1030)
         (= 601TOC "1A")
         (member 602OCC '("A" "B" "E" "F-2" "I" "R" "S-2" "U"))
    )
  (setq 602rating 1
        602text1030 1
  )
)
Message 3 of 4

dbhunia
Advisor
Advisor
Accepted solution

Hi

 


@DC-MWA wrote:

I'm working on this awesome building code analysis routine. It requires many cross lapping answers by the user.

I'm close. As always forgive my "Frankenlisping"

Need help with the following..

(= distcode 1030)(= 601TOC "1A");;when this is met

(= 602OCC "A")(= 602OCC "B")(= 602OCC "E")(= 602OCC "F-2")(= 602OCC "I")(= 602OCC "R")(= 602OCC "S-2")(= 602OCC "U") ;;for these

(progn (setq 602rating 1) (setq 602text1030 1) );;do this

 

Below is where I've ended up.

 

(if (and (= distcode 1030)(= 601TOC "1A")(or(= 602OCC "A")(= 602OCC "B")(= 602OCC "E")(= 602OCC "F-2")(= 602OCC "I")(= 602OCC "R")(= 602OCC "S-2")(= 602OCC "U")))
(progn (setq 602rating 1) (setq 602text1030 1) )
);end if


 

It can be done different way ......... your syntax  should be like.....(IF with "and" "or")

 

(if (and (= distcode 1030)(= 601TOC "1A"))
    (if (or(= 602OCC "A")(= 602OCC "B")(= 602OCC "E")(= 602OCC "F-2")(= 602OCC "I")(= 602OCC "R")(= 602OCC "S-2")(= 602OCC "U"))
	(progn (setq 602rating 1) (setq 602text1030 1))
    )
)

Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
Message 4 of 4

Kent1Cooper
Consultant
Consultant

@pbejse wrote:
(if (and (= distcode 1030)
         (= 601TOC "1A")
         (member 602OCC '("A" "B" "E" "F-2" "I" "R" "S-2" "U"))
    )….

Another similar approach:

 

(if
  (and
    (= distcode 1030)
    (= 601TOC "1A")
    (wcmatch 602OCC "A,B,E,F-2,I,R,S-2,U")
  )
  (setq
    602rating 1
    602text1030 1
  )
)
Kent Cooper, AIA