Skip to content

Scriptor/clj-here

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clj-here

A simple tool to help debug nested expressions. Takes a function call and lets you insert various debugging-related keywords to inspect the various arguments being passed in the slime repl.

Usage

We'll use the following function call as the template. It's a simple call to prn and uses an imaginary function foo as an argument.

(ns clj-here-example)

(prn "hello" (foo :bar :baz))

The main function in clj-here is debug so we'll need to :use it and transform the call to foo to a call to debug like this:

(ns clj-here-example
  (:use [clj-here :only (debug)]))

(debug prn "hello" (foo :bar :baz))

:dbg-prn-last

The :dbg-prn-last keyword can be inserted after an argument to print it out.

(ns clj-here-example
  (:use [clj-here :only (debug)]))

(debug prn "hello" :dbg-prn-last (foo :bar :baz))
; Will print out "hello" in the repl

:break

The :break keyword creates a breakpoint in the middle of a function. It uses sldb and sets the locals as the all the arguments before it.

(ns clj-here-example
  (:use [clj-here :only (debug))))

(debug prn "hello" "bye" :break (foo :bar :baz))

In sldb this will result in:

Backtrace:
  0:             core.clj:6 clj-here.core/break
      Locals:
        ARG0 = "hello"
        ARG1 = "bye"

License

Copyright (C) 2012 Tamreen Khan

Distributed under the Eclipse Public License, the same as Clojure.

About

Tool to help with debugging nested expressions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published