From 348cd7976f697cdd32f7433131c81969b8ea3e31 Mon Sep 17 00:00:00 2001 From: Juan M Uys Date: Wed, 4 Nov 2015 11:13:33 +0000 Subject: [PATCH] provide example for in-directory --- .../scribblings/reference/sequences.scrbl | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/pkgs/racket-doc/scribblings/reference/sequences.scrbl b/pkgs/racket-doc/scribblings/reference/sequences.scrbl index d82c0bb81d..d73390911b 100644 --- a/pkgs/racket-doc/scribblings/reference/sequences.scrbl +++ b/pkgs/racket-doc/scribblings/reference/sequences.scrbl @@ -384,7 +384,31 @@ each element in the sequence. content of a directory, use the result of @racket[directory-list] as a sequence. -@history[#:changed "6.0.0.1" @elem{Added @racket[use-dir?] argument.}]} +@history[#:changed "6.0.0.1" @elem{Added @racket[use-dir?] argument.}] + +Examples: + + @racketblock[ + (code:comment @#,t{Given a directory tree:}) + (code:comment @#,t{}) + (code:comment @#,t{ /example}) + (code:comment @#,t{ ├── a}) + (code:comment @#,t{ │ ├── alpha}) + (code:comment @#,t{ │ └── apple}) + (code:comment @#,t{ ├── b}) + (code:comment @#,t{ │ └── beta}) + (code:comment @#,t{ └── c}) + (code:comment @#,t{}) + (code:comment @#,t{Output:}) + (code:comment @#,t{}) + (code:comment @#,t{/example/c}) + (code:comment @#,t{/example/b}) + (code:comment @#,t{/example/b/beta}) + (code:comment @#,t{/example/a}) + (code:comment @#,t{}) + (let ([f (lambda (path) (regexp-match? #rx"/example/b.*" (path->string path)))]) + (for ([p (in-directory "/example" f)]) + (printf "~a\n" p)))]} @defproc*[([(in-producer [producer procedure?])