• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Best practices- nested loops or handlers or both
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best practices- nested loops or handlers or both


  • Subject: Re: Best practices- nested loops or handlers or both
  • From: Eric Geoffroy <email@hidden>
  • Date: Tue, 02 Nov 2004 14:48:32 -0800

Neil,

In the revised, improved simple loop, it returns d on the fifth line.
In my list of dates, the handler hits this line and stops processing that value after pushing it to Monday. It keeps evaluating the rest of the items I think. So far so good. (It's getting clearer)


Now I'm populating a new list with the results of the getNextBizDay(d) handler. It goes like this:

set lisa to {}
repeat with x in Dz -- skips any blanks in the Dz list
	if contents of x is not "" then
		set x to date x
		set end of lisa to my getNextBizDay(x)
	else
		set end of lisa to "" -- Keeps the items in order (important)
	end if
end repeat

Setting the end of my list named "Lisa" to the getNextBizDay handler fills it with the original unmodified dates. This is baffling to me.

Thanks for the help.
- Eric

On Nov 1, 2004, at 4:25 PM, Neil Faiman wrote:


But recursion is overkill in this example. A simple loop works just as well:


	on getNextBusinessDay(d)
		repeat while isWeekend(d) or isHoliday(d)
			d = d + 1
		end repeat
		return d
	end getNextBusinessDay

Regards,

	Neil Faiman


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Best practices- nested loops or handlers or both (From: Eric Geoffroy <email@hidden>)
 >Re: Best practices- nested loops or handlers or both (From: "Adam K. Wuellner" <email@hidden>)
 >Re: Best practices- nested loops or handlers or both (From: Eric Geoffroy <email@hidden>)
 >Re: Best practices- nested loops or handlers or both (From: Neil Faiman <email@hidden>)

  • Prev by Date: Re: Filemaker changes 04 to 1904
  • Next by Date: Re: Set the target_file without prompt?
  • Previous by thread: Re: Best practices- nested loops or handlers or both
  • Next by thread: Re: Best practices- nested loops or handlers or both
  • Index(es):
    • Date
    • Thread