• 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
distinctUnionOfArrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

distinctUnionOfArrays


  • Subject: distinctUnionOfArrays
  • From: Takaaki Naganoya <email@hidden>
  • Date: Fri, 13 Nov 2015 17:09:18 +0900

Hi All,

Can we use “distinctUnionOfArrays” with NSArray ?
It seems can’t do it...

<AppleScript>
-- Created 2015-11-13 by Takaaki Naganoya
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set aList to {players:{{aLabel:1, bLabel:2}, {aLabel:2, bLabel:3}, {aLabel:2, bLabel:4}}}

set aDict to current application's NSDictionary's dictionaryWithDictionary:aList
--> (NSArray) {​​​​​{​​​​​​​d:4, ​​​​​​​b:2, ​​​​​​​c:3, ​​​​​​​a:1​​​​​}, ​​​​​{​​​​​​​d:5, ​​​​​​​b:3, ​​​​​​​c:4, ​​​​​​​a:2​​​​​}, ​​​​​{​​​​​​​d:6, ​​​​​​​b:4, ​​​​​​​c:5, ​​​​​​​a:2​​​​​}​​​}

set aArray to aDict's valueForKeyPath:"players.aLabel"
--> (NSArray) {​​​​​1, ​​​​​2, ​​​​​2​​​}

set bArray to aDict's valueForKeyPath:"players.distinctUnionOfArrays.aLabel"
--> (NSArray) {​​​​​missing value, ​​​​​missing value, ​​​​​missing value​​​}
</AppleScript>

--
Takaaki Naganoya
email@hidden
http://piyocast.com/as/



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: distinctUnionOfArrays
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Load Script Problem
  • Next by Date: Re: distinctUnionOfArrays
  • Previous by thread: Re: Load Script Problem
  • Next by thread: Re: distinctUnionOfArrays
  • Index(es):
    • Date
    • Thread