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

[trace] Add orchard.trace #284

Merged
merged 2 commits into from
Aug 14, 2024
Merged

[trace] Add orchard.trace #284

merged 2 commits into from
Aug 14, 2024

Conversation

alexander-yakushev
Copy link
Member

@alexander-yakushev alexander-yakushev commented Aug 14, 2024

Wanted to do this for a while. clojure.tools.trace has a bit ugly output for my taste and also adds a dependency for something simple enough that can live within Orchard. The API is compatible or almost compatible with clojure.tools.trace, so swapping one for another would be trivial.

My initial implementation of orchard.trace had pprint-like wrapping support and also configurable "spaciousness", but I decided to remove them for now for the sake of simplicity. This is something that could be added in the future if deemed necessary.

Output example:

(orchard.trace-test.sample-ns/fibo 5)
│ 
│ (orchard.trace-test.sample-ns/fibo 3)
│ │ 
│ │ (orchard.trace-test.sample-ns/fibo 1)
│ │ │ 
│ │ └─→ 1
│ │ 
│ │ (orchard.trace-test.sample-ns/fibo 2)
│ │ │ 
│ │ │ (orchard.trace-test.sample-ns/fibo 0)
│ │ │ │ 
│ │ │ └─→ 1
│ │ │ 
│ │ │ (orchard.trace-test.sample-ns/fibo 1)
│ │ │ │ 
│ │ │ └─→ 1
│ │ │ 
│ │ └─→ 2
│ │ 
│ └─→ 3
│ 
│ (orchard.trace-test.sample-ns/fibo 4)
│ │ 
│ │ (orchard.trace-test.sample-ns/fibo 2)
│ │ │ 
│ │ │ (orchard.trace-test.sample-ns/fibo 0)
│ │ │ │ 
│ │ │ └─→ 1
│ │ │ 
│ │ │ (orchard.trace-test.sample-ns/fibo 1)
│ │ │ │ 
│ │ │ └─→ 1
│ │ │ 
│ │ └─→ 2
│ │ 
│ │ (orchard.trace-test.sample-ns/fibo 3)
│ │ │ 
│ │ │ (orchard.trace-test.sample-ns/fibo 1)
│ │ │ │ 
│ │ │ └─→ 1
│ │ │ 
│ │ │ (orchard.trace-test.sample-ns/fibo 2)
│ │ │ │ 
│ │ │ │ (orchard.trace-test.sample-ns/fibo 0)
│ │ │ │ │ 
│ │ │ │ └─→ 1
│ │ │ │ 
│ │ │ │ (orchard.trace-test.sample-ns/fibo 1)
│ │ │ │ │ 
│ │ │ │ └─→ 1
│ │ │ │ 
│ │ │ └─→ 2
│ │ │ 
│ │ └─→ 3
│ │ 
│ └─→ 5
│ 
└─→ 8

@alexander-yakushev alexander-yakushev force-pushed the trace branch 2 times, most recently from 880bacd to af7181b Compare August 14, 2024 13:18
@bbatsov
Copy link
Member

bbatsov commented Aug 14, 2024

Looks good to me. Great work!

@alexander-yakushev alexander-yakushev merged commit d3c5057 into master Aug 14, 2024
58 checks passed
@alexander-yakushev alexander-yakushev deleted the trace branch August 14, 2024 16:46
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

Successfully merging this pull request may close these issues.

2 participants