Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile .? and ?: to Clojure tap> #162

Open
kloimhardt opened this issue Jun 24, 2024 · 0 comments
Open

Compile .? and ?: to Clojure tap> #162

kloimhardt opened this issue Jun 24, 2024 · 0 comments

Comments

@kloimhardt
Copy link

Summary:
tap> is a Clojure/babashka core functionality for logging. Compiling .? and ?: to Clojure tap> opens up extended data visualisation capabilities.

Details:
Basic tap> works by first registering some printing/logging function as a tap handler

(add-tap (bound-fn* clojure.pprint/pprint))

and then log some data through that handler

(tap> "Hello world")

A more sophisticated use case is the data inspecting library https://github.com/djblue/portal hooking into tap>. Start babashka with

bb -Sdeps '{:deps {djblue/portal {:mvn/version "0.56.0"}}}'

and in the Repl

user=> (require '[portal.api :as p])
nil
user=> (do     
  (.addShutdownHook (Runtime/getRuntime)
                    (Thread. (fn [] (p/close))))
  (def portal (p/open {:app true}))
  (add-tap #'p/submit))

with Chrome browser installed, a window opens automatically. Typing

user=> (tap> :hello)

shows the following screen

Screenshot 2024-06-24 at 16 48 48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant