home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / hypercar / 2916 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  2.1 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!rphroy!caen!hellgate.utah.edu!lanl!davids
  2. From: davids@gardener.lanl.gov (David Simmons)
  3. Newsgroups: comp.sys.mac.hypercard
  4. Subject: FUNCTION problem
  5. Message-ID: <1992Jul29.220023.13149@newshost.lanl.gov>
  6. Date: 29 Jul 92 22:00:23 GMT
  7. Sender: news@newshost.lanl.gov
  8. Organization: Los Alamos National Laboratory
  9. Lines: 55
  10. Originator: davids@feynman.lanl.gov
  11.  
  12.  
  13. Hi!
  14.  
  15. I may just be totally dense when it coems to functions, but I can't
  16. seem to make this one work (surprise! ;-)).
  17.  
  18. This is a function to return the number of the week, given a date, as
  19. in "Week 29" for  July 27th (or whatever...I can't tell you what week
  20. July 27th is in because the friggin' function won't work!)
  21.  
  22. This script used to give accurate week numbers when it *wasn't* a 
  23. function, just a simple script acting on global variables.  Since
  24. I'm trying to eliminate as many globals as possible, I thought it
  25. might be nice to re-write it as a function--or simply transfer it to
  26. a function.  The lines for calculation are *exactly* the same as they 
  27. were in the original script.
  28.  
  29. It is called thusly:
  30.  
  31. on foo
  32.   <commands>
  33.   put decide (day) into weekNo
  34.   <more commands>
  35. end foo
  36.  
  37. the function is ....
  38.  
  39. function decide (day)
  40.   if trunc((day/7)*7) = day then
  41.      put trunc(day/7) into day
  42.   else
  43.      put trunc((day/7) + 1) into day
  44.   end if
  45.   return day
  46. end decide
  47.  
  48. No matter what I do, I get the message "Too much recursion".  I have
  49. even commented out *everything* and inserted a line "put day + 1 into day"
  50. as the ONLY executable line, and I still get "too much recursion".
  51.  
  52. Anyone who can help bail me out of another one of my bone-headed messes
  53. will be greatly appreciated.  I read, and re-read the section on user-defined
  54. functions in Goodman's book, but it doesn't help.
  55. -- 
  56.  
  57. David G. Simmons        "There's no problem so awful that you can't
  58. davids@lanl.gov             add some guilt to it and make it even worse!"
  59.                         -Calvin
  60. If I said it, LANL didn't...
  61.  
  62. -- 
  63.  
  64. David G. Simmons        "There's no problem so awful that you can't
  65. davids@lanl.gov             add some guilt to it and make it even worse!"
  66.                         -Calvin
  67.