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

0 Members and 1 Guest are viewing this topic.

JohnK

  • Administrator
  • Seagull
  • Posts: 10652
(challange - newbie) in between two numbers
« Reply #15 on: January 05, 2005, 02:24:25 PM »
...you just told them the answer!?
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 #16 on: January 05, 2005, 02:29:26 PM »
All that means is that as a programmer you need to code it properly.  duh.. :D

SMadsen

  • Guest
(challange - newbie) in between two numbers
« Reply #17 on: January 05, 2005, 03:15:57 PM »
All that means is that programmers in Seattle are leaving big security holes in MSIE :D

Oh, no one saw my contribution? :lol:

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(challange - newbie) in between two numbers
« Reply #18 on: January 05, 2005, 03:22:35 PM »
precisely ... The rules were followed .... the numbers were given and the code was written to match the numbers, not the other way around. Of course, it IS good practice to code to many scenarios, BUT if you quantify the syntax and code to that, the overhead is significantly lower.

It is always best to code to the simplest form, otherwize you end up creating bloatware just like Microsoft, I remember when Windows could be loaded on a 100MB drive and have tons of extra space... now you are required a minimum of 2GB just to install windows where 8Mb of memory was sufficient for most programming 10 years ago, now you almost MUST have 512Mb. The issue has to do with the size of the code and the gobs of things put in the code that are designed to circumvent user stupidity.

To "fix" the code so the user can enter the range values .. use this:
Code: [Select]

(defun inbetween (@t @l @u)
  (and(< (min @l @u) @t)(> (max @l @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

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
(challange - newbie) in between two numbers
« Reply #19 on: January 05, 2005, 04:07:02 PM »
To determine if x is between a and b ...

(< a x b)

What am I missing?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

SMadsen

  • Guest
(challange - newbie) in between two numbers
« Reply #20 on: January 05, 2005, 04:53:30 PM »
Quote from: MP
What am I missing?

Sequence of arguments is all. Not necessarily an issue as much as a convenience, I would say.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
(challange - newbie) in between two numbers
« Reply #21 on: January 05, 2005, 05:18:18 PM »
Cool MP, good to see you.
Here is your code the other way. :)
Code: [Select]
(defun between (mid start end) (< start mid end))

(between 5 1 10)
(between 1 3 10)
(between 5 8 10)
(between 5 5 10)

T
nil
nil
nil
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.

JohnK

  • Administrator
  • Seagull
  • Posts: 10652
(challange - newbie) in between two numbers
« Reply #22 on: January 05, 2005, 09:43:19 PM »
Hey MP, Hows life been treating ya?

Well this thread was about the newbies, but it kinda got overrun a bit.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org