Drkcore

14 10 2009 Scala Tweet

Scalaをさわりはじめた

おもむろに。

scala> var increase = (x: Int) => x + 1     
increase: (Int) => Int = <function>
scala> val l = List(1,2,3,4,5)
l: List[Int] = List(1, 2, 3, 4, 5)
scala> l map increase
res3: List[Int] = List(2, 3, 4, 5, 6)
scala> l.map(increase)
res5: List[Int] = List(2, 3, 4, 5, 6)

map 関数 listじゃなくてlist map 関数なのね

gauche

gosh> (map (lambda (x) (+ x 1)) '(1 2 3 4 5))
(2 3 4 5 6)

clojure

user=> (map (fn [x] (+ x 1)) [1 2 3 4 5])
(2 3 4 5 6)

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021