------------------------------------------------------------------------------
# Auth: Christopher Stone (refactored from a handler by Matt Neuburg)
# dCre: 2017/04/14 11:49
# dMod: 2017/04/14 11:58
# Appl: Miscellaneous
# Task: Recursive Handler for filtering Numbers.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @List, @Manipulate, @Recursive, @Recursion, @Handler, @Filter, @Numbers
------------------------------------------------------------------------------
set theList to {"hey", 1, "ho", 2, 3}
set filteredList1 to filterNumbers(theList) -- handler
set filteredList2 to numbers of theList -- built-in AppleScript filter form
------------------------------------------------------------------------------
--» HANDLERS
------------------------------------------------------------------------------
on filterNumbers(theList)
if theList = {} then return theList
if {class of item 1 of theList} is in {real, integer, number} then
return {item 1 of theList} & (filterNumbers(rest of theList))
else
return filterNumbers(rest of theList)
end if
end filterNumbers
------------------------------------------------------------------------------