From 061eb936bf06e96147aa8b9d1d8951af55ce37a7 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Sun, 11 Oct 2015 23:06:23 -0400 Subject: [PATCH] Document debug meta-language --- debug/info.rkt | 4 ++++ debug/scribblings/debug.scrbl | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 debug/info.rkt create mode 100644 debug/scribblings/debug.scrbl diff --git a/debug/info.rkt b/debug/info.rkt new file mode 100644 index 0000000..c9e55f0 --- /dev/null +++ b/debug/info.rkt @@ -0,0 +1,4 @@ +#lang info + +(define scribblings '(["scribblings/debug.scrbl" ()])) + diff --git a/debug/scribblings/debug.scrbl b/debug/scribblings/debug.scrbl new file mode 100644 index 0000000..1e21089 --- /dev/null +++ b/debug/scribblings/debug.scrbl @@ -0,0 +1,41 @@ +#lang scribble/manual + +@title{debug} + +source code: @url{https://github.com/AlexKnauth/debug} + +A racket meta-language for debugging, based on sugar/debug. + +@section{#lang debug} + +@defmodule[debug #:lang]{ +A meta-language (like @racketmodname[at-exp]) that allows for quick debugging +shorthands to a program written in any racket-based language that looks at the +readtable. +} + +To debug the value of an expression, simply put debug in front of the language +at the top of the file (for instance @hash-lang[] @racketmodname[debug] +@racketmodname[racket]), and put @litchar{#R}, @litchar{#RR} or @litchar{#RRR} +in front of the expression. + +@itemize[ +@item{@bold{@litchar{#R}} reports the value and returns it} +@item{@bold{@litchar{#RR}} reports the value with a line number and returns it} +@item{@bold{@litchar{#RRR}} reports the value with the file and line number, and returns it} +] + +Examples: +@codeblock{ +#lang debug racket +#R(+ 1 2) +;(+ 1 2) = 3 +;3 +} + +@codeblock{ +#lang debug racket +(+ 1 2 #R(* 3 4)) +;(* 3 4) = 12 +;15 +}