let cities = ["London", "San Francisco", "Tokyo", "Barcelona", "Sydney"] let sortedCities = sort(cities) { $0 < $1 } if let indexOfLondon = find(sortedCities, "London") { println("London is city number (indexOfLondon + 1) in the list") } This couple of sentences reminded me of: bash -> let syntax java -> println perl -> $0, $1, lamda synctax the var func stuff looks javascript. This looks pretty nuked and mutated. Hopefully after a couple of apps we will find it is easier than objective c.
,
【在 g*****g 的大作中提到】 : Thanks, it looks like Javascript more than anything else to me. Regardless, : I am sure Objective-C is phasing out.
【在 c***d 的大作中提到】 : let cities = ["London", "San Francisco", "Tokyo", "Barcelona", "Sydney"] : let sortedCities = sort(cities) { $0 < $1 } : if let indexOfLondon = find(sortedCities, "London") { : println("London is city number (indexOfLondon + 1) in the list") : } : This couple of sentences reminded me of: : bash -> let syntax : java -> println : perl -> $0, $1, lamda synctax : the var func stuff looks javascript.
Not really. This language uses class based inheritance, Javascript has no " class" concept, everything is object and it adopts prototype based inheritance.
,
【在 g*****g 的大作中提到】 : Thanks, it looks like Javascript more than anything else to me. Regardless, : I am sure Objective-C is phasing out.
K*y
30 楼
好听
N*n
31 楼
Looks like they just copied PYTHON & ML and make it OO.
【在 c***d 的大作中提到】 : let cities = ["London", "San Francisco", "Tokyo", "Barcelona", "Sydney"] : let sortedCities = sort(cities) { $0 < $1 } : if let indexOfLondon = find(sortedCities, "London") { : println("London is city number (indexOfLondon + 1) in the list") : } : This couple of sentences reminded me of: : bash -> let syntax : java -> println : perl -> $0, $1, lamda synctax : the var func stuff looks javascript.
T*a
32 楼
丝微特!!
g*g
33 楼
Scala flavored JS, inheritance, type matching, optional. Closure looks like JS.
【在 Y**G 的大作中提到】 : Not really. This language uses class based inheritance, Javascript has no " : class" concept, everything is object and it adopts prototype based : inheritance. : : ,
x*n
34 楼
墙裂要求天天LG回唱一个!不奔粉丝们不答应!!!! :P
c*9
35 楼
外表像,但是强类型。
,
【在 g*****g 的大作中提到】 : Thanks, it looks like Javascript more than anything else to me. Regardless, : I am sure Objective-C is phasing out.
O*r
36 楼
非常温暖。
r*g
37 楼
let variable 不可变,是从 ML 里来的。
【在 c***d 的大作中提到】 : let cities = ["London", "San Francisco", "Tokyo", "Barcelona", "Sydney"] : let sortedCities = sort(cities) { $0 < $1 } : if let indexOfLondon = find(sortedCities, "London") { : println("London is city number (indexOfLondon + 1) in the list") : } : This couple of sentences reminded me of: : bash -> let syntax : java -> println : perl -> $0, $1, lamda synctax : the var func stuff looks javascript.
Y*d
38 楼
再听再顶茉莉mm的完美演绎,陶醉~~~~
Y*G
39 楼
so let variable is final? Doing closure like this is stealing from java anonymous class..., however, not stealing the most recent version of java...
It's OO and I have not seen any dynamic madness that Javascript has so it's good enough to code large backend projects. Apple's server side technology stinks tho. HOHO.
I never liked JS the language itself due to its dynamic typying, but hey, there are so many static languages that can be compiled to js, even C/C++, so JS as an client-side engine is damn good. Just try to avoid writing js by hand as much as you can, let the compilers do the job.
【在 N********n 的大作中提到】 : : It's OO and I have not seen any dynamic madness that Javascript : has so it's good enough to code large backend projects. Apple's : server side technology stinks tho. HOHO.
Perl Version. use v5.20; use List::MoreUtils qw(first_index); my @cities = ("London", "San Francisco", "Tokyo", "Barcelona", "Sydney"); my @sortedCities = sort { $a cmp $b } @cities; # sort @cities <=> sort { $a cmp $b } @cities; # in perl sort, default is string sort if ( my $indexOfLondon = first_index { $_ eq "London" } @sortedCities) { say "London is city number " . ($indexOfLondon + 1) . " in the list"; }
【在 c***d 的大作中提到】 : let cities = ["London", "San Francisco", "Tokyo", "Barcelona", "Sydney"] : let sortedCities = sort(cities) { $0 < $1 } : if let indexOfLondon = find(sortedCities, "London") { : println("London is city number (indexOfLondon + 1) in the list") : } : This couple of sentences reminded me of: : bash -> let syntax : java -> println : perl -> $0, $1, lamda synctax : the var func stuff looks javascript.
【在 c***d 的大作中提到】 : let cities = ["London", "San Francisco", "Tokyo", "Barcelona", "Sydney"] : let sortedCities = sort(cities) { $0 < $1 } : if let indexOfLondon = find(sortedCities, "London") { : println("London is city number (indexOfLondon + 1) in the list") : } : This couple of sentences reminded me of: : bash -> let syntax : java -> println : perl -> $0, $1, lamda synctax : the var func stuff looks javascript.
【在 Y**G 的大作中提到】 : Not really. This language uses class based inheritance, Javascript has no " : class" concept, everything is object and it adopts prototype based : inheritance. : : ,