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

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!bionet!raven.alaska.edu!nuntius
  2. From: ffdkl@acad3.alaska.edu (Dan LaSota)
  3. Newsgroups: comp.sys.mac.hypercard
  4. Subject: Re: FUNCTION problem
  5. Message-ID: <1992Jul30.170541.4378@raven.alaska.edu>
  6. Date: 30 Jul 92 17:05:41 GMT
  7. References: <1992Jul29.220023.13149@newshost.lanl.gov>
  8. Sender: news@raven.alaska.edu (USENET News System)
  9. Organization: University of Alaska Computer Network
  10. Lines: 61
  11. Nntp-Posting-Host: zowie.gi.alaska.edu
  12. X-Useragent: Nuntius v1.1
  13.  
  14.  
  15.  
  16. In article <1992Jul29.220023.13149@newshost.lanl.gov> David Simmons,
  17. davids@gardener.lanl.gov writes:
  18.  
  19. >function decide (day)
  20. >  if trunc((day/7)*7) = day then
  21. >     put trunc(day/7) into day
  22. >  else
  23. >     put trunc((day/7) + 1) into day
  24. >  end if
  25. >  return day
  26. >end decide
  27.  
  28. take the parenthesis away from the 'day' parameter
  29. word 3 of line 1 of your function handler.
  30.  
  31. I think HyperCard is calling decide again to interpret the decide
  32. function as soon as it tries to interpret the decide function.
  33. A good way to recurse too much!
  34.  
  35. Something like this
  36.  
  37. function decide day
  38.   if trunc((day/7)*7) = day then
  39.      put trunc(day/7) into day
  40.   else
  41.      put trunc((day/7) + 1) into day
  42.   end if
  43.   return day
  44. end decide
  45.  
  46. But this is shorter (gets rid of a line)
  47.  
  48. function decide day
  49.   if trunc((day/7)*7) = day then
  50.      return trunc(day/7)
  51.   else
  52.      return trunc((day/7) + 1)
  53.   end if
  54. end decide
  55.  
  56. this is more to the point
  57.  
  58. function decide day
  59.   if trunc(day) = day then
  60.      return trunc(day/7)
  61.   else
  62.      return trunc((day/7) + 1)
  63.   end if
  64. end decide
  65.  
  66. this is perhaps better
  67.  
  68. function decide day
  69.    add 1 to day
  70.    return day div 7
  71. end decide
  72.  
  73. Later,
  74. Dan
  75.