Subject: | |
From: | |
Reply To: | |
Date: | Sun, 17 Feb 2008 11:24:16 +0000 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On 17 Feb 2008, at 00:50, Christopher Green wrote:
> One of the things AS spoiled me with from early on is
> "whose clauses" (apparently also known as the by-test
> reference form). My question is, for those of you who
> reeeeally know other scripting/programming languages,
> what other languages have this funcionality as a basic
> feature??
Yes, they're cool. But most languages have something similar at a
basic feature, although probably less wordily expressed than English-
like AppleScript. In newLISP, for example, a distant cousin of
AppleScript, you can do much with lists:
set alist to {"this", "is", "a", "list", "of", "strings"} -- an
AppleScript list
(set 'alist '("this" "is" "a" "list" "of" "strings")) ; a
newLISP list
For example, find all list elements that satisfy a simple regex filter:
(filter (fn (e) (find "i[^n]" e 0)) alist)
-> ("this" "is" "list")
ie anything where an "i" is not followed by "n". Or find any strings
that come after "is" in the ASCII sorting order and upper-case them:
(find-all "is" alist (upper-case $0) <)
-> ("THIS" "LIST" "OF" "STRINGS")
AppleScript used not to be able to do this with its own lists. I don't
know if it now can in Leopard...?
There's always good old SQL:
"select * from periodic_table where discovered < 1900 and
percentage_in_earth_crust > 2"
|
|
|