Clojure @ Taiwan

1 readers
2 users here now

This is the new version of discussion group, used to replace the exising Clojure TW facebook group.

founded 9 hours ago
MODERATORS
1
 
 

我最近又在自找麻煩,把 Conjure 的一些應用技研究清楚。

比方說,有一個問題,我就覺得很討厭。

假如我有一個變數 a ,它是複雜巢狀的 edn ,但是沒有格式化,我該如何讓它格式化?

我當然可以用 pprint 。結果我用了 pprint 在 Conjure 裡一跑之後,就變成了:

; (out) {:request
; (out)  {:id "req_4G0EF3GLB3jqRG",
; (out)   :idempotency_key "1ed6791e-0cd7-4116-ae47-fa3869188f8f"},
; (out)  :type "payment_intent.created",
; (out)  :created 1745399047,
; (out)  :pending_webhooks 2,

全部給我自動加上 ; (out) 。 會有這個現象是因為Conjure 遇到列印到 stdout 的時候,就會自動加上 ; (out)

看似如此簡單的問題,正確的解法是這樣子:

  1. (tap> variable_a)
  2. <localleader> vt

這樣子就搞定了,因為 Conjure 的 <localleader> vt 就有自帶 pretty print 。