As far as I can see, exporting `expand-clause` is ok.
Ideally, I think it should be exported from a new
`racket/for-transform` library, instead of used directly from
`racket/private/for`. Also, `expand-for-clause` might be a better name.
At Fri, 6 Sep 2013 00:45:40 -0400, Stephen Chang wrote:
Hi,
I just tried making a instance of insert-large-letters as a tool. I just
copied the code and added the tools stuff.
Seemed to work OK, but
- I turned it into normal racket as I didn't have time to learn typed
racket.
- I'm not confident enough with the core of DrRacket to remove the
Ugh - the list scrubbed my attachments. I'm guessing my options are to
submit pull request or make a planet package.
s.
On Fri, Sep 6, 2013 at 2:00 PM, Stephen De Gabrielle
stephen.degabrie...@acm.org wrote:
Hi,
I just tried making a instance of insert-large-letters as a tool. I just
I got the attachments, FWIW. Probably best, however, if someone were to
submit a pull request with the code still in TR and with the appropriate
removal of the current implementation. Otherwise, I think it has served its
purpose as a learning experiment and that's seems excellent.
Robby
On Fri,
thanks.
http://planet.racket-lang.org/display.ss?package=insert-large-letters.pltowner=spdegabrielle
--
Stephen De Gabrielle http://www.degabrielle.name/stephen
On Fri, Sep 6, 2013 at 2:35 PM, Robby Findler
ro...@eecs.northwestern.eduwrote:
I got the attachments, FWIW. Probably best,
#lang racket/base
(require (for-syntax racket/base
syntax/parse
syntax/for-body))
(define-syntax (for/print/good stx)
(syntax-parse stx
[(_ clauses . body)
(with-syntax ([([pre ...] [post ...]) (split-for-body stx #'body)])
(syntax
Among the bodys, besides stopping the iteration and preventing later body
evaluations, a #:break guard-expr or #:final guard-expr clause starts a new
internal-definition context.
I had the same thought process as Carl. I now understand the behavior
but I don't understand why it's needed? It
Ah - thank you! I think I finally understand how this works. To make
sure, I query the props like this:
~/apps/racket$ ./pkgs/plt-services/meta/props get drdr:command-line
pkgs/racket-pkgs/racket-test/tests/run-automated-tests.rkt
mzc -k ~s
This tells DrDr to make sure the file compiles
They have to be separate internal definition contexts in order for #:break
and #:final to be able to stop execution before the definitions themselves
get run.
Carl Eastlund
On Fri, Sep 6, 2013 at 2:31 PM, Stephen Chang stch...@ccs.neu.edu wrote:
Among the bodys, besides stopping the
On Fri, Sep 6, 2013 at 7:54 AM, Matthew Flatt mfl...@cs.utah.edu wrote:
As far as I can see, exporting `expand-clause` is ok.
Ideally, I think it should be exported from a new
`racket/for-transform` library, instead of used directly from
`racket/private/for`. Also, `expand-for-clause` might
It's useful when the condition for loop termination and the value of the
loop body both depend on some derived computation from the sequence
elements:
(for/list ([x (in-stream S)])
(define y (f x))
#:break (g? y)
(h y))
Ok I see, thanks. It does make things easier to read when the
Okay, I see what's going on here. It's very subtle though, and probably
deserves some explanation in split-for-body's documentation.
My first thought on seeing my non-fix version break here is that I can make
split-for-body break the same way. The problem is that my non-fix
separates the
Now that you've pushed this, it occurs to me why it's probably unsafe:
some `in-...' forms expand to unsafe operations, right?
If I'm right about that, then we should probably move the function to
`racket/unsafe/for-transform' and protect the export.
(Or, since I see that you put the library in
On Fri, Sep 6, 2013 at 2:43 PM, Stephen Chang stch...@ccs.neu.edu wrote:
On Fri, Sep 6, 2013 at 2:36 PM, Carl Eastlund c...@ccs.neu.edu wrote:
They have to be separate internal definition contexts in order for
#:break
and #:final to be able to stop execution before the definitions
All correct
On Fri, Sep 6, 2013 at 12:34 PM, David Vanderson
david.vander...@gmail.comwrote:
Ah - thank you! I think I finally understand how this works. To make
sure, I query the props like this:
~/apps/racket$ ./pkgs/plt-services/meta/props get drdr:command-line
Right, that's the issue with needing the (let () result) in my
define-syntax-rule version. I still didn't need split-for-body, which
doesn't guarantee there are no definitions in the post ... part. All it
guarantees to eliminate are #:final and #:break.
Carl Eastlund
On Fri, Sep 6, 2013 at
You're proving that (let () ...) is necessary, which I have explicitly
agreed with since the original email, but you have not yet demonstrated
that split-for-body is necessary. Here is the fix I have described twice
already, now explicitly put into the define-syntax-rule solution:
Is this function ever particularly necessary? Its intended use seems to be
like so:
(define-syntax (for/print stx)
(syntax-parse stx
[(_ clauses . body)
(with-syntax ([([pre ...] [post ...]) (split-for-body #'body)])
(syntax
(for clauses
pre ...
Sorry that I forgot to add the `let` while turning the code you sent
into a full example. Here's another try.
#lang racket/base
(require (for-syntax racket/base
syntax/parse
syntax/for-body))
(define-syntax (for/print/good stx)
(syntax-parse stx
19 matches
Mail list logo