Author Topic: (challange - newbie) in between two numbers  (Read 7590 times)

0 Members and 1 Guest are viewing this topic.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
(challange - newbie) in between two numbers
« on: January 05, 2005, 11:07:09 AM »
I want a way to see if a number is inbetween to numbers.
For example:
Is the number 4 inbetween the numbers 2 89?

Write a lisp that will tell me. The lisp should return either "T" or "nil"

Rules: Make a post when you have your lisp complete. After three hours we will post our lisp solutions.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(challange - newbie) in between two numbers
« Reply #1 on: January 05, 2005, 11:40:10 AM »
I can name that tune in 23 characters.... of course I am not a newbie ..
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

whdjr

  • Guest
(challange - newbie) in between two numbers
« Reply #2 on: January 05, 2005, 11:40:51 AM »
Ah man.  Why you gotta go put rules on this one? :D

CADaver

  • Guest
(challange - newbie) in between two numbers
« Reply #3 on: January 05, 2005, 01:12:21 PM »
Quote from: Keith
I can name that tune in 23 characters.... of course I am not a newbie ..
Are you counting spaces?

dubb

  • Swamp Rat
  • Posts: 1105
(challange - newbie) in between two numbers
« Reply #4 on: January 05, 2005, 01:17:53 PM »
are there any hints...?

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
(challange - newbie) in between two numbers
« Reply #5 on: January 05, 2005, 01:28:05 PM »
Sure dubb, Use a logical test.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(challange - newbie) in between two numbers
« Reply #6 on: January 05, 2005, 01:41:57 PM »
Quote from: CADaver
Quote from: Keith
I can name that tune in 23 characters.... of course I am not a newbie ..
Are you counting spaces?


Counting spaces
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
(challange - newbie) in between two numbers
« Reply #7 on: January 05, 2005, 01:46:06 PM »
Okay, anyone done yet?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

whdjr

  • Guest
(challange - newbie) in between two numbers
« Reply #8 on: January 05, 2005, 01:57:26 PM »
Code: [Select]
(defun inbetween (num1 num2 num3)
  (and (> num1 num2)
       (< num1 num3)
  )
)


Here's mine.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
(challange - newbie) in between two numbers
« Reply #9 on: January 05, 2005, 02:03:53 PM »
< post deleted >
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
(challange - newbie) in between two numbers
« Reply #10 on: January 05, 2005, 02:04:27 PM »
Outstanding!

Why did you choose "and"?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

whdjr

  • Guest
(challange - newbie) in between two numbers
« Reply #11 on: January 05, 2005, 02:06:57 PM »
Quote from: Se7en
Outstanding!

Why did you choose "and"?


Because with and they both have to be true or it's false.
You did ask for a T or nil answer.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(challange - newbie) in between two numbers
« Reply #12 on: January 05, 2005, 02:13:21 PM »
Optimized for size ... functionalized ... essentially the same as Will's ...
Code: [Select]

(defun inbetween (@t @l @u)
  (and(< @l @t)(> @u @t))
)
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
(challange - newbie) in between two numbers
« Reply #13 on: January 05, 2005, 02:19:47 PM »
< post deleted >
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
(challange - newbie) in between two numbers
« Reply #14 on: January 05, 2005, 02:22:45 PM »
Quote from: whdjr
Because with and they both have to be true or it's false.
You did ask for a T or nil answer.


Aweosme!

Now, Can you tell me any problems you might see with this procedure the way it is?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org