Author Topic: Challenge ( cylinder volume )  (Read 5980 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Challenge ( cylinder volume )
« Reply #15 on: March 31, 2006, 07:04:04 PM »
Late to the party as usual, but here is my late entry.
Code: [Select]
(* (/ pi 4)
   (expt (progn (initget 7) (getdist "\nDiameter: ")) 2)
   (progn (initget 7) (getdist "\nHeight: ")))
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.

LE

  • Guest
Re: Challenge ( cylinder volume )
« Reply #16 on: March 31, 2006, 07:13:42 PM »
I must admit too.... I forgot about the usage of progn  :oops:

RbtDanforth

  • Guest
Re: Challenge ( cylinder volume )
« Reply #17 on: March 31, 2006, 08:26:45 PM »
Expt! that was what I was missing! :cry:

Code: [Select]
(* (expt (getdist "radius?")2) pi (Getdist "Height"))

(*) doesn't need a progn, and if someone types in "George" it is their problem.

Now the tricky bit would be to draw the cylinder at the same time! :-P

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Challenge ( cylinder volume )
« Reply #18 on: April 01, 2006, 04:57:50 AM »
(apply '(lambda (a b) (* pi a a b 0.25)) (mapcar '(lambda (a) (initget 7) (getdist a)) '("Diameter?" "Height?")))

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Challenge ( cylinder volume )
« Reply #19 on: April 01, 2006, 08:46:57 AM »
Good stuff! That poor cat got skinned a bunch'a ways didn't it.  :-)
TheSwamp.org  (serving the CAD community since 2003)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Challenge ( cylinder volume )
« Reply #20 on: April 01, 2006, 10:28:26 AM »
I don't know how you come up with these challenges Mark. Very creative.
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.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Challenge ( cylinder volume )
« Reply #21 on: April 01, 2006, 10:37:12 AM »
I don't know how you come up with these challenges Mark. Very creative.

It ain't easy! Wish I was talented enough to challenge the big guns.  :-)

And for all those reading this, don't be shy, write your own challenges and post them.
TheSwamp.org  (serving the CAD community since 2003)