home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!ames!bionet!raven.alaska.edu!nuntius
- From: ffdkl@acad3.alaska.edu (Dan LaSota)
- Newsgroups: comp.sys.mac.hypercard
- Subject: Re: FUNCTION problem
- Message-ID: <1992Jul30.170541.4378@raven.alaska.edu>
- Date: 30 Jul 92 17:05:41 GMT
- References: <1992Jul29.220023.13149@newshost.lanl.gov>
- Sender: news@raven.alaska.edu (USENET News System)
- Organization: University of Alaska Computer Network
- Lines: 61
- Nntp-Posting-Host: zowie.gi.alaska.edu
- X-Useragent: Nuntius v1.1
-
-
-
- In article <1992Jul29.220023.13149@newshost.lanl.gov> David Simmons,
- davids@gardener.lanl.gov writes:
-
- >function decide (day)
- > if trunc((day/7)*7) = day then
- > put trunc(day/7) into day
- > else
- > put trunc((day/7) + 1) into day
- > end if
- > return day
- >end decide
-
- take the parenthesis away from the 'day' parameter
- word 3 of line 1 of your function handler.
-
- I think HyperCard is calling decide again to interpret the decide
- function as soon as it tries to interpret the decide function.
- A good way to recurse too much!
-
- Something like this
-
- function decide day
- if trunc((day/7)*7) = day then
- put trunc(day/7) into day
- else
- put trunc((day/7) + 1) into day
- end if
- return day
- end decide
-
- But this is shorter (gets rid of a line)
-
- function decide day
- if trunc((day/7)*7) = day then
- return trunc(day/7)
- else
- return trunc((day/7) + 1)
- end if
- end decide
-
- this is more to the point
-
- function decide day
- if trunc(day) = day then
- return trunc(day/7)
- else
- return trunc((day/7) + 1)
- end if
- end decide
-
- this is perhaps better
-
- function decide day
- add 1 to day
- return day div 7
- end decide
-
- Later,
- Dan
-