Help me correct error in the book Applescript:the definitive guide

Hello ,
I have beeen fiddling with Applescript but as I want to “translate” my excel visualbasic procedures for excel 2008, I have decided to start from scratch and learn the language properly.
I am reading the book Applescript:the definitive guide. I have found errors in the sample scripts and have been able to correct them until I reached page 153 where I found this script:


on filter(L, crit)
	script filterer
		property criterion : crit
		on filter(L)
			if L = {} then return L
			if criterion(item 1 of L) then
				return {item 1 of L} & filter(rest of L)
			else
				return filter(rest of L)
			end if
		end filter
	end script
	return filterer's filter(L)
end filter
on isNumber(x)
	return ({class of x} is in {real, integer, number})
end isNumber
filter({"hey", 1, "ho", 2, 3}, isNumber)

Script debugger gives me an error"Expected expression but found command name." for the line
return filterer’s filter(L)
Can anyone corrects that script?
Thank you

Hi,

your found errors are probably terminology clashes (for further details read page 315 in Matt Neuburg’s book).
do you have installed the SatImage scripting addition?
In the Arrays suite, there is a filter command, which causes the error.
Change the name of the handler e.g. with an underline character at the beginning


on _filter(L, crit)
	script filterer
		property criterion : crit
		on _filter(L)
			if L = {} then return L
			if criterion(item 1 of L) then
				return {item 1 of L} & (_filter(rest of L))
			else
				return _filter(rest of L)
			end if
		end _filter
	end script
	return filterer's _filter(L)
end _filter
on isNumber(x)
	return ({class of x} is in {real, integer, number})
end isNumber
_filter({"hey", 1, "ho", 2, 3}, isNumber)

Thanks Stefan
Your script works.
I have not knowingly installed SatImage but a seach with spotlight gave me Satimage.osax. I suppose it is the culprit.

Satimage.osax is installed by the Smile’s installer.

Yvan KOENIG