This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-09
Channels
- # adventofcode (132)
- # announcements (19)
- # babashka (7)
- # babashka-sci-dev (6)
- # beginners (46)
- # calva (25)
- # chlorine-clover (5)
- # cider (2)
- # clara (17)
- # clj-kondo (93)
- # clojure (2)
- # clojure-dev (4)
- # clojure-europe (12)
- # clojure-losangeles (3)
- # clojure-nl (7)
- # clojure-uk (4)
- # clojurescript (29)
- # conjure (6)
- # core-async (8)
- # cursive (16)
- # data-science (7)
- # datomic (1)
- # exercism (4)
- # figwheel-main (8)
- # fulcro (9)
- # graphql (2)
- # helix (1)
- # introduce-yourself (3)
- # jobs (3)
- # lsp (4)
- # malli (20)
- # minecraft (3)
- # nextjournal (62)
- # off-topic (16)
- # overtone (34)
- # pathom (5)
- # polylith (10)
- # portal (1)
- # re-frame (104)
- # reagent (29)
- # reitit (1)
- # remote-jobs (2)
- # rum (3)
- # shadow-cljs (22)
- # spacemacs (2)
- # sql (10)
- # tools-deps (17)
- # vim (13)
https://github.com/quoll/cljs-math 0.1.0 is now out. This includes a full set of generative tests to compare cljs-math implementations on ClojureScript to the equivalent JVM functions, and fixes a few inconsistencies and bugs from 0.0.1. Special thanks to @borkdude for writing the ClojureScript repl access, and to @mfikes for detailed optimization advice. https://github.com/quoll/cljs-math
would you like to contribute those tests to Clojure? would be happy to add them
Well, they test that my implementations of the functions return the same values as the functions in java.lang.Math
. (First, by running them on the JVM, and then by running them against a cljs repl). Since Clojure’s implementation is just a wrapper around java.lang.Math
then I’m not sure that there’s much to contribute there?
well, that's why we didn't make them originally, but since you already did, would be happy to add the coverage
I can do the work to adapt them into the clojure test framework (not that much should be needed)
I'm creating a small Clojure dev library to record the inputs and outputs of functions. It does a bunch of spying in functions in other namespaces, so I named it NSA - Namespace Agency 🙂 Old scenario: • You're working on an API. To trigger a certain endpoint you have to execute 10 steps in a UI. • You change some code. You manually execute the UI steps again. Repeat. • At some point, you get tired of this and add a bunch of `(def x x)` lines to the function, and rerun it from there. New scenario: • You create a spy from the comfort of `<project root>/dev/user.clj` • You execute the UI steps manually, once. The spy records the input and output. • From then on you can: ◦ Get the first/last/nth result of calling the function, without actually calling it. ◦ Rerun the function with the latest input. ◦ Etc (anything you can think of, I guess) It's based on / inspired by `tortue/spy` Main differences with `tortue/spy`: • It changes the actual function instead of creating a spy that wraps it. • It has one atom containing the calls/responses of all spies, instead of 1 atom per spy. Very very early stage, but feedback is welcome. Also let me know if this already exists. Sauce: https://github.com/harryvederci/nsa
Thank you! Sounds useful :) You might want to look at https://github.com/clojure/tools.trace Maybe it can be useful for your library
Will do, thanks!
Thanks for the suggestions, I'll look into them to see how it fits in.
The main value nsa
has for me personally is that I don't have to alter a function its code in order to "spy" on its input/output, which keeps the codebase uncluttered.
Values within a function can't be spied on with nsa
(at least for now), but maybe if that's an issue it's an indicator that my functions are doing too much and that I have to split them up, after which I can unleash nsa
on them again 🙂
I appreciate the name! Though Bond is also a fine one :)
Haha, agreed! Thanks!
Another similar one: https://github.com/athos/Postmortem
nsa
’s API looks like a specialized version of instrument
in Postmortem.
i’m working on something similar: https://github.com/Cyrik/omni-trace you start the spy/trace from the outside and can even capture all outgoing calls from the function and if you want everything inside the function. works for clojurescript as well. oh and you get a pretty flamegraph to view your data. I guess i should extend docs and find a better spy name 😉
Oof, that inner trace feature looks nice! 👀
the inner trace is 90% debux. i just modified debux to be able to actually save the trace instead of printing and added a way to wrap the debux call around an existing function. there is no visualization for it yet, but you can just look at the output in the instrument/workspace atom. i’d love some more user feedback so if anything is missing i’m open to suggestions