From 86e19e0c0e1ce5cc0eef127000015437433a32fa Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 15 Feb 2017 15:36:13 -0800 Subject: [PATCH] document `stx-flatten` --- beautiful-racket-lib/br/scribblings/br.scrbl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/beautiful-racket-lib/br/scribblings/br.scrbl b/beautiful-racket-lib/br/scribblings/br.scrbl index e12449a..c098666 100644 --- a/beautiful-racket-lib/br/scribblings/br.scrbl +++ b/beautiful-racket-lib/br/scribblings/br.scrbl @@ -489,6 +489,23 @@ source-location information and properties. An alias for @racket[strip-context]. Uses the bindings from @racket[stx-source] to replace the bindings of all parts of @racket[stx-target], while preserving source-location information and properties. An alias for @racket[replace-context].} + +@defproc[ + (stx-flatten [stx syntax?]) + (listof syntax?)]{ + +Converts a hierarchical syntax object into a flat list of component syntax objects, discarding all the intervening structure. Useful when you need to get at the ``bottommost'' syntax objects. + +@examples[#:eval my-eval +(define my-stx #'(let ([x 42] + [y 25]) + (define (f z) (* x y z)) + (displayln (f 11)))) +(map syntax->datum (stx-flatten my-stx)) +] + +} + @section{Indentation} @defmodule[br/indent]