Slide 1

Slide 1 text

graaaph: A Library To Help Me Learn Michael R. Bernstein / NYC Clojure / May 15, 2013 @mrb_bk / github.com/mrb 1

Slide 2

Slide 2 text

This Talk • Who Am I? • graaaph: The Library • Why? • Ruby • jruby-parser • Zippers • core.logic • Audience Participation 2

Slide 3

Slide 3 text

Who am I? • Mike Bernstein a.k.a. “mrb” • Self-taught programmer • MFA in Design and Technology from Parsons, studied under Golan Levin and Zach Lieberman • Former Computer Science Educator, 5th-12th grades including AP Java • FT Professional Developer for ~6 years • Day Job is Ruby, JavaScript, and Go, but mostly people 3

Slide 4

Slide 4 text

graaaph: Why? • To help me LEARN • I learn easily when I have a goal • Ruby lacks the tools we need • Clojure provides tools to make my goals simpler • An excuse to really dig into core.logic and relational programming in general • Likewise an excuse to learn and play with Zippers 4

Slide 5

Slide 5 text

5

Slide 6

Slide 6 text

graaaph: Ruby • Is very complicated • Parsing it is a nightmare (Ruby’s parse.y is over 11,000 LOC - https://github.com/ruby/ruby/blob/ trunk/parse.y) • Doesn’t have the same kind of IDE integration as other languages • No decent refactoring tools • Not much in the way of commonly available static analysis tools in general 6

Slide 7

Slide 7 text

graaaph: jruby-parser • A Ruby Parser written in Java • The same parser used by JRuby itself to parse Ruby Code • Takes Ruby Code and turns it into an AST format • AST has some nice built in visitor functions • Helped me understand how to work with trees better 7

Slide 8

Slide 8 text

graaaph: Zippers • Zippers are really cool! • Excellent resource by Alex Miller (@puredanger) http://www.ibm.com/ developerworks/library/j-treevisit/index.html • Helpful for walking the AST and producing a seqable data structure in Clojure • Had the cool side effect of showing me how to use metadata 8

Slide 9

Slide 9 text

graaaph: core.logic • I didn’t understand it, so I wanted to • Took me about a year to get any basic understanding, another year or so to start doing anything decent • Still not very good at it • But I’m trying really hard • And thankfully David Nolen is a mensch • graaaph is a good use case 9

Slide 10

Slide 10 text

graaaph: The Basic Idea code.rb Java AST clojure Zipper seq of maps ????? newcode.rb 10

Slide 11

Slide 11 text

Code Tour! 11

Slide 12

Slide 12 text

Questions? (I have some for you) 12

Slide 13

Slide 13 text

Thanks! michaelrbernstein@gmail.com twitter.com/mrb_bk github.com/mrb 13