Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/weavejester/hashp
A better "prn" for debugging
https://github.com/weavejester/hashp
clojure debugging
Last synced: 6 days ago
JSON representation
A better "prn" for debugging
- Host: GitHub
- URL: https://github.com/weavejester/hashp
- Owner: weavejester
- License: mit
- Created: 2019-12-14T03:56:35.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-17T13:06:18.000Z (over 1 year ago)
- Last Synced: 2024-11-03T04:06:18.854Z (11 days ago)
- Topics: clojure, debugging
- Language: Clojure
- Size: 21.5 KB
- Stars: 442
- Watchers: 10
- Forks: 23
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hashp
Hashp is a better `prn` for debugging Clojure code. Inspired by
projects like [Spyscope][], Hashp (ab)uses data readers to make it
easier to get useful debugging data sent to STDOUT.[spyscope]: https://github.com/dgrnbrg/spyscope
## Usage
Once installed, you can add `#p` in front of any form you wish to
print:```clojure
(ns example.core)(defn mean [xs]
(/ (double #p (reduce + xs)) #p (count xs)))
```It's faster to type than `(prn ...)`, returns the original result, and
produces more useful output by printing the original form, function
and line number:```
user=> (mean [1 4 5 2])
#p[example.core/mean:4] (reduce + xs) => 12
#p[example.core/mean:4] (count xs) => 4
3.0
```## Install
### Leiningen
Add the following to `~/.lein/profiles.clj`:
```edn
{:user
{:dependencies [[hashp "0.2.2"]]
:injections [(require 'hashp.core)]}}
```### Boot
Add the following to `~/.boot/profile.boot`:
```clojure
(set-env! :dependencies #(conj % '[hashp "0.2.2"]))(require 'hashp.core)
(boot.core/load-data-readers!)
```### Shadow-CLJS
Add the following to `shadow-cljs.edn`:
```clojure
{:dependencies [hashp "0.2.2"]
:builds {:app {:devtools {:preloads [hashp.core]}}}}
```Or alternatively via `~/.shadow-cljs/config.edn` and `--config-merge`:
`~/.shadow-cljs/config.edn`:
```clojure
{:dependencies [[hashp "0.2.2"]]}
```Run:
```
shadow-cljs watch app --config-merge '{:devtools {:preloads [hashp.core]}}'
```## License
Copyright © 2022 James Reeves
Released under the MIT license.