Re: [racket-users] Affecting the errors generated by syntax-parse

2015-07-25 Thread Stephen Chang
I haven't played with the example in detail, but do you want the cut
operator here?

http://docs.racket-lang.org/syntax/stxparse-patterns.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7e!%29%29

On Sat, Jul 25, 2015 at 9:55 AM, Jens Axel Søgaard
jensa...@soegaard.net wrote:
 Hi All,

 The syntax-parse form can often generate sensible errors based on the
 progress made
 during the attempt to match a pattern against a syntax-object. Given
 multiple choices
 the choice where the maximum progress was made is used to generate the
 error message.

 Is there a way to tell syntax-parse, that a given choice is to be used as
 the source
 of the error, if the match fails?

 A concrete example: In the toy language below a top-level form can be a
 definition
 or an expression. The malformed definition (define (foo 3) x) is not a legal
 definition -- it is however clear that the user intended to write a
 definition,
 since the form begins with (define ...). During matching syntax-parse
 makes more progress under the assumption that the definition is a sequence
 expression, so the error message becomes: begin expected.

 How can I stop the matching prematurely when the (define ...) is seen?

 /Jens Axel

 #lang racket
 ;;;
 ;;; URLANG
 ;;;

 ; In the grammar below x stands for a non-keyword identifier

 ; program::= top-level-form ...
 ; top-level-form ::= definition | expr

 ; definition ::= (define (x x ...) body)
 ; body   ::= expr

 ; expr   ::= datum | reference | application | sequence
 ; reference  ::= x
 ; application::= (x0 x ...)
 ; sequence   ::= (begin expr ...)

 ; keyword::= define | begin

 ; datum  ::= fixnum

 ; identifier an identifier that is not a keyword
 ; fixnum an integer between -2^53 and 2^53

 (require syntax/parse)

 (define min-fixnum (- (expt 2 53)))
 (define max-fixnum(expt 2 53))

 (define (Fixnum? r)
   (and (number? r) (integer? r)
(= min-fixnum r max-fixnum)))

 (define-syntax-class Fixnum
   #:opaque
   (pattern d
#:fail-unless (Fixnum? (syntax-e #'d)) #f))

 (define-syntax-class Datum
   (pattern (~or d:Fixnum)))

 (define-syntax-class Keyword
   #:literals (begin define)
   (pattern (~or begin define)))

 (define-syntax-class Id
   (pattern (~and x:id
  (~not y:Keyword

 (define-syntax-class Reference
   (pattern x:Id))

 (define-syntax-class Application
   #:literals (define)
   (pattern (e:Expr ...)))

 (define-syntax-class Sequence
   #:literals (begin)
   (pattern (begin e0:Expr e:Expr ...)))

 (define-syntax-class Definition
   #:literals (define)
   (pattern (define (name:Id a:Id ...) body:Body)))


 (define-syntax-class Body
   (pattern b:Expr))

 (define-syntax-class Expr
   (pattern (~or e:Datum
 e:Application
 e:Reference
 e:Sequence)))

 (define-syntax-class TopLevelForm
   (pattern (~or t:Definition
 t:Expr)))

 (define-syntax-class Program
   (pattern (p:TopLevelForm ...)))

 ;;; The following expressions show some legal
 ;;; constructs that are matched correctly.

 (syntax-parse #'3
   [d:Datum 'datum])

 (syntax-parse #'3
   [e:Expr 'expr])

 (syntax-parse #'(define (a x) x)
   [t:TopLevelForm 'toplevelform])

 (syntax-parse #'((define (foo x y) (+ x 1)) (foo 3))
   [p:Program 'program])

 ;;; The malformed definition (define (a 4 x) x) is
 ;;; correctly rejected as a toplevel form, but the
 ;;; automatically generated error is not as intended.

 (syntax-parse #'(define (a 4 x) x)
   [t:TopLevelForm 'toplevelform])

 --
 You received this message because you are subscribed to the Google Groups
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Correction: Half-life was *not* written in a Lisp after all.

2015-07-25 Thread Michael Titke

On 25/07/2015 14:02, Hendrik Boom wrote:

On Sat, Jul 25, 2015 at 12:04:07AM +, John Carmack wrote:

Half-life was written in C on my Quake 1 codebase.

Thank you for the correction.  Now I get to wonder what the truth
behind the rumour was.  Evidently not half-life.

-- hendrik



There is some open source game with a really gentle license and the 
wonderful name of Abuse.
It contains a Lisp interpreter game engine, level editor and some hidden 
great artwork. But it's only
2d parallax scrolling not real 3d. Wanna recreate Mario Bros? Go for 
it - all those cute little pixel

grafix are still there ...

--
You received this message because you are subscribed to the Google Groups Racket 
Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Affecting the errors generated by syntax-parse

2015-07-25 Thread Jens Axel Søgaard
Hi All,

The syntax-parse form can often generate sensible errors based on the
progress made
during the attempt to match a pattern against a syntax-object. Given
multiple choices
the choice where the maximum progress was made is used to generate the
error message.

Is there a way to tell syntax-parse, that a given choice is to be used as
the source
of the error, if the match fails?

A concrete example: In the toy language below a top-level form can be a
definition
or an expression. The malformed definition (define (foo 3) x) is not a legal
definition -- it is however clear that the user intended to write a
definition,
since the form begins with (define ...). During matching syntax-parse
makes more progress under the assumption that the definition is a sequence
expression, so the error message becomes: begin expected.

How can I stop the matching prematurely when the (define ...) is seen?

/Jens Axel

#lang racket
;;;
;;; URLANG
;;;

; In the grammar below x stands for a non-keyword identifier

; program::= top-level-form ...
; top-level-form ::= definition | expr

; definition ::= (define (x x ...) body)
; body   ::= expr

; expr   ::= datum | reference | application | sequence
; reference  ::= x
; application::= (x0 x ...)
; sequence   ::= (begin expr ...)

; keyword::= define | begin

; datum  ::= fixnum

; identifier an identifier that is not a keyword
; fixnum an integer between -2^53 and 2^53

(require syntax/parse)

(define min-fixnum (- (expt 2 53)))
(define max-fixnum(expt 2 53))

(define (Fixnum? r)
  (and (number? r) (integer? r)
   (= min-fixnum r max-fixnum)))

(define-syntax-class Fixnum
  #:opaque
  (pattern d
   #:fail-unless (Fixnum? (syntax-e #'d)) #f))

(define-syntax-class Datum
  (pattern (~or d:Fixnum)))

(define-syntax-class Keyword
  #:literals (begin define)
  (pattern (~or begin define)))

(define-syntax-class Id
  (pattern (~and x:id
 (~not y:Keyword

(define-syntax-class Reference
  (pattern x:Id))

(define-syntax-class Application
  #:literals (define)
  (pattern (e:Expr ...)))

(define-syntax-class Sequence
  #:literals (begin)
  (pattern (begin e0:Expr e:Expr ...)))

(define-syntax-class Definition
  #:literals (define)
  (pattern (define (name:Id a:Id ...) body:Body)))


(define-syntax-class Body
  (pattern b:Expr))

(define-syntax-class Expr
  (pattern (~or e:Datum
e:Application
e:Reference
e:Sequence)))

(define-syntax-class TopLevelForm
  (pattern (~or t:Definition
t:Expr)))

(define-syntax-class Program
  (pattern (p:TopLevelForm ...)))

;;; The following expressions show some legal
;;; constructs that are matched correctly.

(syntax-parse #'3
  [d:Datum 'datum])

(syntax-parse #'3
  [e:Expr 'expr])

(syntax-parse #'(define (a x) x)
  [t:TopLevelForm 'toplevelform])

(syntax-parse #'((define (foo x y) (+ x 1)) (foo 3))
  [p:Program 'program])

;;; The malformed definition (define (a 4 x) x) is
;;; correctly rejected as a toplevel form, but the
;;; automatically generated error is not as intended.

(syntax-parse #'(define (a 4 x) x)
  [t:TopLevelForm 'toplevelform])

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Affecting the errors generated by syntax-parse

2015-07-25 Thread Jens Axel Søgaard
Hi Stephen,

Thanks for testing this. Turns out I had removed a #:opaque in Definition
while cleaning up
the example before sending the mail. Now I get the same error as you.

With

(define-syntax-class Definition
  #:opaque
  #:literals (define)
  (pattern (define (name:Id a:Id ...) body:Body)))

I get the wrong error (because #:opaque shortens the progress).

I had experimented with ~! as in:

(define-syntax-class Definition
  #:opaque
  #:literals (define)
  (pattern (define ~! (name:Id a:Id ...) body:Body)))

but the #:opaque ruins the effect of ~! here (not sure why).


Sorry for the noise,
Jens Axel



2015-07-25 16:55 GMT+02:00 Stephen Chang stch...@ccs.neu.edu:

 Actually, I dont get the begin expected error that you mention. I'm
 getting:

 define: expected identifier
   parsing context:
while parsing Id
while parsing Definition
while parsing TopLevelForm in: 4

 with the 4 highlighted, which seems correct since it comes from using
 the Definition class?

 On Sat, Jul 25, 2015 at 10:51 AM, Stephen Chang stch...@ccs.neu.edu
 wrote:
  I haven't played with the example in detail, but do you want the cut
  operator here?
 
 
 http://docs.racket-lang.org/syntax/stxparse-patterns.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7e!%29%29
 
  On Sat, Jul 25, 2015 at 9:55 AM, Jens Axel Søgaard
  jensa...@soegaard.net wrote:
  Hi All,
 
  The syntax-parse form can often generate sensible errors based on the
  progress made
  during the attempt to match a pattern against a syntax-object. Given
  multiple choices
  the choice where the maximum progress was made is used to generate the
  error message.
 
  Is there a way to tell syntax-parse, that a given choice is to be used
 as
  the source
  of the error, if the match fails?
 
  A concrete example: In the toy language below a top-level form can be a
  definition
  or an expression. The malformed definition (define (foo 3) x) is not a
 legal
  definition -- it is however clear that the user intended to write a
  definition,
  since the form begins with (define ...). During matching syntax-parse
  makes more progress under the assumption that the definition is a
 sequence
  expression, so the error message becomes: begin expected.
 
  How can I stop the matching prematurely when the (define ...) is seen?
 
  /Jens Axel
 
  #lang racket
  ;;;
  ;;; URLANG
  ;;;
 
  ; In the grammar below x stands for a non-keyword identifier
 
  ; program::= top-level-form ...
  ; top-level-form ::= definition | expr
 
  ; definition ::= (define (x x ...) body)
  ; body   ::= expr
 
  ; expr   ::= datum | reference | application |
 sequence
  ; reference  ::= x
  ; application::= (x0 x ...)
  ; sequence   ::= (begin expr ...)
 
  ; keyword::= define | begin
 
  ; datum  ::= fixnum
 
  ; identifier an identifier that is not a keyword
  ; fixnum an integer between -2^53 and 2^53
 
  (require syntax/parse)
 
  (define min-fixnum (- (expt 2 53)))
  (define max-fixnum(expt 2 53))
 
  (define (Fixnum? r)
(and (number? r) (integer? r)
 (= min-fixnum r max-fixnum)))
 
  (define-syntax-class Fixnum
#:opaque
(pattern d
 #:fail-unless (Fixnum? (syntax-e #'d)) #f))
 
  (define-syntax-class Datum
(pattern (~or d:Fixnum)))
 
  (define-syntax-class Keyword
#:literals (begin define)
(pattern (~or begin define)))
 
  (define-syntax-class Id
(pattern (~and x:id
   (~not y:Keyword
 
  (define-syntax-class Reference
(pattern x:Id))
 
  (define-syntax-class Application
#:literals (define)
(pattern (e:Expr ...)))
 
  (define-syntax-class Sequence
#:literals (begin)
(pattern (begin e0:Expr e:Expr ...)))
 
  (define-syntax-class Definition
#:literals (define)
(pattern (define (name:Id a:Id ...) body:Body)))
 
 
  (define-syntax-class Body
(pattern b:Expr))
 
  (define-syntax-class Expr
(pattern (~or e:Datum
  e:Application
  e:Reference
  e:Sequence)))
 
  (define-syntax-class TopLevelForm
(pattern (~or t:Definition
  t:Expr)))
 
  (define-syntax-class Program
(pattern (p:TopLevelForm ...)))
 
  ;;; The following expressions show some legal
  ;;; constructs that are matched correctly.
 
  (syntax-parse #'3
[d:Datum 'datum])
 
  (syntax-parse #'3
[e:Expr 'expr])
 
  (syntax-parse #'(define (a x) x)
[t:TopLevelForm 'toplevelform])
 
  (syntax-parse #'((define (foo x y) (+ x 1)) (foo 3))
[p:Program 'program])
 
  ;;; The malformed definition (define (a 4 x) x) is
  ;;; correctly rejected as a toplevel form, but the
  ;;; automatically generated error is not as intended.
 
  (syntax-parse #'(define (a 4 x) x)
[t:TopLevelForm 'toplevelform])
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Racket Users group.
  To unsubscribe from this group and stop receiving emails from it, 

Re: [racket-users] Affecting the errors generated by syntax-parse

2015-07-25 Thread Stephen Chang
Actually, I dont get the begin expected error that you mention. I'm getting:

define: expected identifier
  parsing context:
   while parsing Id
   while parsing Definition
   while parsing TopLevelForm in: 4

with the 4 highlighted, which seems correct since it comes from using
the Definition class?

On Sat, Jul 25, 2015 at 10:51 AM, Stephen Chang stch...@ccs.neu.edu wrote:
 I haven't played with the example in detail, but do you want the cut
 operator here?

 http://docs.racket-lang.org/syntax/stxparse-patterns.html?q=syntax-parse#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7e!%29%29

 On Sat, Jul 25, 2015 at 9:55 AM, Jens Axel Søgaard
 jensa...@soegaard.net wrote:
 Hi All,

 The syntax-parse form can often generate sensible errors based on the
 progress made
 during the attempt to match a pattern against a syntax-object. Given
 multiple choices
 the choice where the maximum progress was made is used to generate the
 error message.

 Is there a way to tell syntax-parse, that a given choice is to be used as
 the source
 of the error, if the match fails?

 A concrete example: In the toy language below a top-level form can be a
 definition
 or an expression. The malformed definition (define (foo 3) x) is not a legal
 definition -- it is however clear that the user intended to write a
 definition,
 since the form begins with (define ...). During matching syntax-parse
 makes more progress under the assumption that the definition is a sequence
 expression, so the error message becomes: begin expected.

 How can I stop the matching prematurely when the (define ...) is seen?

 /Jens Axel

 #lang racket
 ;;;
 ;;; URLANG
 ;;;

 ; In the grammar below x stands for a non-keyword identifier

 ; program::= top-level-form ...
 ; top-level-form ::= definition | expr

 ; definition ::= (define (x x ...) body)
 ; body   ::= expr

 ; expr   ::= datum | reference | application | sequence
 ; reference  ::= x
 ; application::= (x0 x ...)
 ; sequence   ::= (begin expr ...)

 ; keyword::= define | begin

 ; datum  ::= fixnum

 ; identifier an identifier that is not a keyword
 ; fixnum an integer between -2^53 and 2^53

 (require syntax/parse)

 (define min-fixnum (- (expt 2 53)))
 (define max-fixnum(expt 2 53))

 (define (Fixnum? r)
   (and (number? r) (integer? r)
(= min-fixnum r max-fixnum)))

 (define-syntax-class Fixnum
   #:opaque
   (pattern d
#:fail-unless (Fixnum? (syntax-e #'d)) #f))

 (define-syntax-class Datum
   (pattern (~or d:Fixnum)))

 (define-syntax-class Keyword
   #:literals (begin define)
   (pattern (~or begin define)))

 (define-syntax-class Id
   (pattern (~and x:id
  (~not y:Keyword

 (define-syntax-class Reference
   (pattern x:Id))

 (define-syntax-class Application
   #:literals (define)
   (pattern (e:Expr ...)))

 (define-syntax-class Sequence
   #:literals (begin)
   (pattern (begin e0:Expr e:Expr ...)))

 (define-syntax-class Definition
   #:literals (define)
   (pattern (define (name:Id a:Id ...) body:Body)))


 (define-syntax-class Body
   (pattern b:Expr))

 (define-syntax-class Expr
   (pattern (~or e:Datum
 e:Application
 e:Reference
 e:Sequence)))

 (define-syntax-class TopLevelForm
   (pattern (~or t:Definition
 t:Expr)))

 (define-syntax-class Program
   (pattern (p:TopLevelForm ...)))

 ;;; The following expressions show some legal
 ;;; constructs that are matched correctly.

 (syntax-parse #'3
   [d:Datum 'datum])

 (syntax-parse #'3
   [e:Expr 'expr])

 (syntax-parse #'(define (a x) x)
   [t:TopLevelForm 'toplevelform])

 (syntax-parse #'((define (foo x y) (+ x 1)) (foo 3))
   [p:Program 'program])

 ;;; The malformed definition (define (a 4 x) x) is
 ;;; correctly rejected as a toplevel form, but the
 ;;; automatically generated error is not as intended.

 (syntax-parse #'(define (a 4 x) x)
   [t:TopLevelForm 'toplevelform])

 --
 You received this message because you are subscribed to the Google Groups
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Prebuilt Android NDK racket?

2015-07-25 Thread Matthew Flatt
At Sat, 25 Jul 2015 19:58:05 +, John Carmack wrote:
 Anyone got one handy?  Lazily attempting to avoid the day of frustration that 
 usually comes from touching anyone else's NDK project...

Untested, but possibly useful:

 http://www.cs.utah.edu/~mflatt/tmp/racket-6.2-arm-android-19-in-place.tgz

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Extending list-box functionality

2015-07-25 Thread Matthew Flatt
At Thu, 23 Jul 2015 19:57:52 -0700 (PDT), copycat wrote:
 On Thursday, July 23, 2015 at 2:50:37 PM UTC+8, copycat wrote:
  With a list box, i can select multiple items by holding onto my mouse and 
 dragging. I'll like to add on other features to the list box like being able 
 to drag the rows to reorder them, or to change the list-box values directly 
 by 
 clicking and editing. How can i do this? I'm not sure where in the code i can 
 change the behavior of on-subwindow-event to include this feature. 
  
  (define/augment on-subwindow-event receiver event) also doesn't work.
 
 After looking a bit i found this:
 
 https://developer.gnome.org/gtk2/stable/gtk2-GtkTreeView-drag-and-drop.html
 
 I am willing to try my hand at it. Would it be possible for me to edit
  
 `mred/private/wx/win32/list-box`,
 `mred/private/wx/gtk/list-box`,
 
 to support this functionality? (And if so how long would it take)

My guess is that it will be challenging to get click-to-edit behavior
to work on all three platforms (Unix/X, Windows, and OS X). Dragging
elements to reorder might be easier, but my guess is that it still
won't be easy.

The `mrlib/hierlist` library may be an easier starting point, since
it's built on top of the editor infrastructure. That should make
click-to-edit easy, and implementing dragging would be manual but
cross-platform. The `mrlib/hierlist` library has its own drawbacks,
however, such as a lack of support for columns.

If you only care about one or two platforms, it may be easiest to use
the raw Gtk or Windows API. You can add raw widgets with a GUI
otherwise implemented with `racket/gui` through methods like
`get-handle` and `get-client-handle`.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Scribble: referencing struct fields

2015-07-25 Thread Matthew Flatt
At Thu, 23 Jul 2015 15:07:53 -0700, Jordan Johnson wrote:
 What are the appropriate function and the preferred practice for referring to 
 struct fields in a Scribble document? For example, if I’m writing the 
 defstruct* body text and want to say, “the x field is intended for blah blah 
 blah”, is @racket[x] the right way to typeset the field name “x”?

Yes, that's what I do. Currently, referencing a field that way doesn't
trigger any links or color, but probably it should one day.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Prebuilt Android NDK racket?

2015-07-25 Thread John Carmack
Anyone got one handy?  Lazily attempting to avoid the day of frustration that 
usually comes from touching anyone else's NDK project...


-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Correction: Half-life was *not* written in a Lisp after all.

2015-07-25 Thread Joel McCracken
Crash bandicoot is the one example I know. Is that what you were thinking of?

Sent from my iPhone

 On Jul 25, 2015, at 8:02 AM, Hendrik Boom hend...@topoi.pooq.com wrote:
 
 On Sat, Jul 25, 2015 at 12:04:07AM +, John Carmack wrote:
 Half-life was written in C on my Quake 1 codebase.
 
 Thank you for the correction.  Now I get to wonder what the truth 
 behind the rumour was.  Evidently not half-life.
 
 -- hendrik
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Pict circle radius

2015-07-25 Thread Jack Firth
So the documentation says that (circle 100) produces a circle with radius 100. 
However, (pict-width (circle 100)) produces 100 instead of 200, so apparently 
it's a circle with diameter 100 and radius 50? Is this a misdocumented 
function, or am I missing something embarrassingly obvious?

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Macro to extract select subexpressions into other locations

2015-07-25 Thread Jack Firth
On Monday, July 20, 2015 at 5:03:55 PM UTC-7, Jack Firth wrote:
 I'm trying to create a way to automatically turn test cases into examples. 
 I'd like a macro that turns this:
 
 (extract-expressions
  (module+ test
(check-equal? (extract-expression (square 5)) 25)
(check-equal? (extract-expression (square -5)) 25))
  (module+ doc
@defproc[(square [x real?]) real?]{
  Returns the square of @racket[x], the result of
  multiplying @racket[x] by itself.
  @examples[#:eval evaluator (include-extracted-expressions)]}))
 
 into this:
 
 (begin
   (module+ test
 (check-equal? (square 5) 25))
   (module+ doc
 @defproc[(square [x real?]) real?]{
   Returns the square of @racket[x], the result of
   multiplying @racket[x] by itself.
   @examples[#:eval evaluator (square 5) (square -5)]}))
 
 That's the general idea anyway. I want to be able to gather arbitrary 
 expressions inside a region and copy them into some other marked place 
 inside the expressions. How exactly do I go about doing this, and how should 
 I do it properly?

Re Alex: I ended up with some functions that just walk the syntax tree and 
strip them out, seemed rather gross but it was all I could think of

Re Matthias: That definitely sounds better, at this stage I'm just fooling 
around with all the possible approaches I can think of to get a better feel for 
how the different forms behave.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Pict circle radius

2015-07-25 Thread Robby Findler
Where do you see that documentation? This seems to say diameter:

http://docs.racket-lang.org/pict/Basic_Pict_Constructors.html?q=circle#%28def._%28%28lib._pict%2Fmain..rkt%29._circle%29%29

Robby

On Sat, Jul 25, 2015 at 9:49 PM, Jack Firth jackhfi...@gmail.com wrote:
 So the documentation says that (circle 100) produces a circle with radius 
 100. However, (pict-width (circle 100)) produces 100 instead of 200, so 
 apparently it's a circle with diameter 100 and radius 50? Is this a 
 misdocumented function, or am I missing something embarrassingly obvious?

 --
 You received this message because you are subscribed to the Google Groups 
 Racket Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to racket-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Pict circle radius

2015-07-25 Thread Robby Findler
Yeah, it's confusing. :(

Robby

On Sat, Jul 25, 2015 at 10:22 PM, Jack Firth jackhfi...@gmail.com wrote:
 Indeed it turns out I was missing something embarrassingly obvious. I was 
 looking at the docs for the 2htdp/image functions, but using the pict 
 functions.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Pict circle radius

2015-07-25 Thread Jack Firth
Indeed it turns out I was missing something embarrassingly obvious. I was 
looking at the docs for the 2htdp/image functions, but using the pict functions.

-- 
You received this message because you are subscribed to the Google Groups 
Racket Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.