Skip to content

Instantly share code, notes, and snippets.

View joshmarlow's full-sized avatar

Josh Marlow joshmarlow

View GitHub Profile
@joshmarlow
joshmarlow / defun-wrapped-error
Last active August 29, 2015 14:17
defun wrapper to assist newbies in debugging
(defparameter defun-super-debug t)
(defmacro defun-wrapped-error (name vars &rest body)
"
A wrapper around defun that will catch any error and note which function it comes from before
re-raising the error.
"
`(defun ,name ,vars
(handler-case
(progn
@joshmarlow
joshmarlow / gist:4001910
Created November 2, 2012 15:10
Random file for playing with ast
def f3(x):
return 3*x
def f4(x):
return 4*x
def f2a(x):
return 2*f3(x)
def f2b(x):
@joshmarlow
joshmarlow / gist:4001898
Created November 2, 2012 15:08
Playing with ast, matplotlib and networkx
import ast
import pprint
import networkx as nx
import matplotlib.pyplot as plt
class viz_walker(ast.NodeVisitor):
def __init__(self):
self.stack = []