«前の日記(2017-06-25) 最新 次の日記(2017-06-27)» 編集

ToDo:

  • 99 深呼吸して、おちけつ (~12/31 あと287日)
  • 98 毎日アウトプットを重きにおいた目標をたてる (~12/31 あと287日)
  • 97 買物は行動を変えるもの・ことに限る (~12/31 あと287日)
  • 96 合理的な行動はときに我慢を強いる(~12/31 あと287日)

ɥozɐʞıɥ


2017-06-26 Clojure defprotocol/defrecord [長年日記]

_ [Clojure]defprotocol defrecord

少し時間があったので久しぶりにClojureの復習

user> (defprotocol MyInterface

(method01 [this])

(method02 [this a b]))

MyInterface

user> (defrecord MyClass [prop01 prop02]

MyInterface

(method01 [this] (println prop01))

(method02 [this a b] (println (str a b prop02))))

user.MyClass

user> (->MyClass "a" "b")

#user.MyClass{:prop01 "a", :prop02 "b"}

user> (def a (->MyClass "a" "b"))

#'user/a

user> (.method01 a)

a

nil

user> (.method02 a "d" "e")

deb

nil



2002|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|
«前の日記(2017-06-25) 最新 次の日記(2017-06-27)» 編集