home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!rphroy!caen!hellgate.utah.edu!lanl!davids
- From: davids@gardener.lanl.gov (David Simmons)
- Newsgroups: comp.sys.mac.hypercard
- Subject: FUNCTION problem
- Message-ID: <1992Jul29.220023.13149@newshost.lanl.gov>
- Date: 29 Jul 92 22:00:23 GMT
- Sender: news@newshost.lanl.gov
- Organization: Los Alamos National Laboratory
- Lines: 55
- Originator: davids@feynman.lanl.gov
-
-
- Hi!
-
- I may just be totally dense when it coems to functions, but I can't
- seem to make this one work (surprise! ;-)).
-
- This is a function to return the number of the week, given a date, as
- in "Week 29" for July 27th (or whatever...I can't tell you what week
- July 27th is in because the friggin' function won't work!)
-
- This script used to give accurate week numbers when it *wasn't* a
- function, just a simple script acting on global variables. Since
- I'm trying to eliminate as many globals as possible, I thought it
- might be nice to re-write it as a function--or simply transfer it to
- a function. The lines for calculation are *exactly* the same as they
- were in the original script.
-
- It is called thusly:
-
- on foo
- <commands>
- put decide (day) into weekNo
- <more commands>
- end foo
-
- the function is ....
-
- 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
-
- No matter what I do, I get the message "Too much recursion". I have
- even commented out *everything* and inserted a line "put day + 1 into day"
- as the ONLY executable line, and I still get "too much recursion".
-
- Anyone who can help bail me out of another one of my bone-headed messes
- will be greatly appreciated. I read, and re-read the section on user-defined
- functions in Goodman's book, but it doesn't help.
- --
-
- David G. Simmons "There's no problem so awful that you can't
- davids@lanl.gov add some guilt to it and make it even worse!"
- -Calvin
- If I said it, LANL didn't...
-
- --
-
- David G. Simmons "There's no problem so awful that you can't
- davids@lanl.gov add some guilt to it and make it even worse!"
- -Calvin
-