Drkcore

25 09 2009 Clojure Tweet

Programming Clojure chapter 2

2章はClojureの基本的な説明。

ProductName Programming Clojure (Pragmatic Programmers)
Stuart Halloway
Pragmatic Bookshelf / ¥ 3,198 ()
在庫あり。

キーワードは関数として使える。

user=> (defstruct book :title :author)
#'user/book
user=> (def b (struct book "Programming Clojure" "Stuart Halloway"))
#'user/b
user=> (b :title)
"Programming Clojure"

これは以下のようにキーワードが先にきても良い。

user=> (:title b)
"Programming Clojure"

namespacesの変更

(in-ns name)

meta-data

^が使える。

user=> ^#'str
{:ns #<Namespace clojure.core>, :name str, :file "clojure/core.clj",
 :line 322, :arglists ([] [x] [x & ys]), :tag java.lang.String,
 :doc "With no args, returns the empty string. With one arg x, 
 returns\n  x.toString().  (str nil) returns the empty string.
 With more than\n  one arg, returns the concatenation of the str 
 values of the args."}

About

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

Tag

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

Ad

© kzfm 2003-2021