
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
What's a good toString method for a deftype'd object in clojure
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
What's a good toString method for a deftype'd object in clojure
Depending on exactly what you're trying to do, the simplest way is to use defrecord: user=> (defr... Depending on exactly what you're trying to do, the simplest way is to use defrecord: user=> (defrecord Bag [state]) user.Bag user=> (def b (Bag. :foo)) #'user/b user=> b #:user.Bag{:state :foo} Though what you see above is from pr, not str: user=> (str b) "user.Bag@53e935f4" user=> (prn b) #:user.Bag{:state :foo} nil So we just make a change: user=> (defrecord Bag [state] Object (toString [bag] (p