Author Topic: How to cond and or.?  (Read 2704 times)

0 Members and 1 Guest are viewing this topic.

MvdP

  • Guest
How to cond and or.?
« on: October 30, 2006, 08:31:40 AM »
I have this piece of code and it is working
Code: [Select]
(cond(
(and (= Allagen 1 )(= scale "1" ))
(progn
do stuff
)
))

but i want to add an OR in it but i can 't cant it work
This what i created
Code: [Select]
(cond(
(and (= Allagen 1 )(= scale "1" )
(or
(and (= Allagen 1 )(= scale "2" )))
(progn
do stuff
)
))
Is this possible...  if so what am i doing wrong.?




CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to cond and or.?
« Reply #1 on: October 30, 2006, 08:36:25 AM »
Code: [Select]
(cond
  ((and (= allagen 1)
        (or (= scale "1") (= scale "2"))
   )
   ;;  (progn  <--<< not needed with COND
   do stuff
  )
)

PS
Here is some more info for you.
http://www.theswamp.org/index.php?topic=13046.msg158557#msg158557
« Last Edit: October 30, 2006, 08:41:52 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Patrick_35

  • Guest
Re: How to cond and or.?
« Reply #2 on: October 30, 2006, 08:58:08 AM »
Hi,
An another method

Code: [Select]
(cond
  ((and (= allagen 1)
        (member scale '("1" "2"))
   )
   do stuff
  )
)

@+

MvdP

  • Guest
Re: How to cond and or.?
« Reply #3 on: October 30, 2006, 10:45:17 AM »
Thank you both.I  try both options tomorrow.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: How to cond and or.?
« Reply #4 on: October 30, 2006, 11:03:30 AM »
Code: [Select]
(cond
  ((and (= allagen 1)
        (WCMATCH scale "1,2"))
   do stuff
  )
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to cond and or.?
« Reply #5 on: October 30, 2006, 11:11:13 AM »
And another.
Code: [Select]
(cond
  ((and (= allagen 1)
        (vl-position scale '("1" "2"))
   )
   do stuff
  )
)
And another.
Code: [Select]
(cond
  ((and (= allagen 1)
        (vl-string-search scale "1,2")
   )
   do stuff
  )
)

So many ways to skin the cat. :-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: How to cond and or.?
« Reply #6 on: October 30, 2006, 11:22:10 AM »
Code: [Select]
(cond
  ((VL-EVERY
     (function member)
     (list allagen scale)
     '((1) ("1" "2"))
   ) ;_  VL-EVERY
   do stuff
  )
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to cond and or.?
« Reply #7 on: October 30, 2006, 11:27:33 AM »
Evgeniy
That's a neat one.  8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: How to cond and or.?
« Reply #8 on: October 30, 2006, 11:29:09 AM »
Evgeniy
That's a neat one.  8-)
:-)
Code: [Select]
(cond
  ((VL-EVERY
     (function WCMATCH)
     (list (itoa allagen) scale)
     '("1" "1,2")
   ) ;_  VL-EVERY
   do stuff
  )
)