[racket-users] Re: truly stand-alone Windows ".exe"s

2018-03-27 Thread Alex Harsanyi

I have version 6.90.0.23 installed from a few days ago, which appears to be 
the latest version available at  http://pre.racket-lang.org/, and "raco 
exe" does not accept the '--embed-dlls' option. Have these changes not been 
released in a snapshot yet?

Best Regards,
Alex.

On Monday, March 26, 2018 at 10:18:29 PM UTC+8, Matthew Flatt wrote:
>
> The latest snapshot build at 
>
>  http://pre.racket-lang.org/ 
>
> adds an `--embed-dlls` option for `raco setup` for use on Windows. The 
> new flag causes the generated ".exe" file to contain a copy of ".dll" 
> files that would otherwise need to be packaged with the ".exe". 
>
> If there are no other files needed by the executable --- if the program 
> contains no `define-runtime-path`s for files other than DLLs, and so on 
> --- then an ".exe" with embedded DLLs can run all by itself on another 
> machine. 
>
>
> The `--embed-dlls` flag should work for most DLLs, including all of the 
> DLLs in the main Racket distribution, but it won't work for everything. 
> Embedded DLLs are linked using the technique described at 
>
>  https://www.joachim-bauch.de/tutorials/loading-a-dll-from-memory/ 
>
> and using Joachim Bauch's MemoryModule library. It won't work, for 
> example, with DLLs that use thread-local variables (but many DLLs avoid 
> those, since the system `LoadLibrary` function also didn't work for 
> them prior to Windows Vista). 
>
>
> DrRacket's "Create Executables" doesn't yet include an option like 
> `--embed-dlls`, but it will soon. If it works as expected, we'll also 
> make `--embed-dlls` automatic for "Create Executables" for the teaching 
> languages. 
>
>

-- 
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] Profiling places

2018-03-27 Thread 'Paulo Matos' via Racket Users
Hello,

I was trying to confirm my suspicion that profile needs to be manually
setup in each place for profiling.

So I created (based on the example in the manual)

;; places-profile.rkt
#lang racket

(define (main)
  (define p
(dynamic-place "any-double.rkt" 'place-entry))

  (for ([i (in-range 1000)])
(define l (build-list (random 100) (lambda (_) (random 100
(place-channel-put p l)
(printf "~a: ~a: ~a~n" i l (place-channel-get p

(main)

;; any-double.rkt
#lang racket

(provide place-entry)

(define (any-double? l)
  (for/or ([i (in-list l)])
(for/or ([i2 (in-list l)])
  (= i2 (* 2 i)

(define (place-entry ch)
  (let loop ()
(define l (place-channel-get ch))
(define l-double? (any-double? l))
(place-channel-put ch l-double?)
(loop)))


Then in the command line:
$ raco profile --all-threads --use-errortrace --total places-profile.rkt
...
Profiling results
-
  Total cpu time observed: 142ms (out of 432ms)
  Number of samples taken: 7 (once every 20ms)


   Caller
Idx  Total Self  Name+src Local%
 ms(pct)   ms(pct) Callee

[1]  39(27.4%)  0(0.0%)  (main ...) ...e/pmatos/tmp/places-profile.rkt:12:0
   (for ...) [2]  100.0%

   (main ...) [1] 100.0%
[2]  39(27.4%)  0(0.0%)  (for ...) /home/pmatos/tmp/places-profile.rkt:7:2
   (printf ...) [3]   100.0%

   (for ...) [2]  100.0%
[3]  39(27.4%)  0(0.0%)  (printf ...) ...pmatos/tmp/places-profile.rkt:10:4
   (place-channel-get ...) [4]100.0%

   (printf ...) [3]   100.0%
[4]  39(27.4%) 39(27.4%) (place-channel-get ...) ...laces-profile.rkt:10:29



I didn't expect this to work, i.e. to get profiling information for
any-double? procedure. I am now wondering if there's any example out
there on how to actually perform the profiling. From the docs, I can
imagine how I could setup something like this:

1. setup a profile command line argument that's passed to places-profile.rkt
2. send a flag indicating if we need profiling in any-double?
3. then use profile-thunk on the function if profiling is required, or
nothing if profiling is not required.

Is this a possibility or is there something out there to make this
easier? Also, profile-thunk says that:
"To track all threads, specify a non-#f value for the threads?
argument—this will execute the computation in a fresh custodian, and
keep track of all threads under this custodian."

But what happens if the place itself creates its own custodian to launch
threads?

Kind regards,

-- 
Paulo Matos

-- 
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] Profiling places

2018-03-27 Thread 'Paulo Matos' via Racket Users


On 27/03/18 14:55, 'Paulo Matos' via Racket Users wrote:
> 
> 1. setup a profile command line argument that's passed to places-profile.rkt
> 2. send a flag indicating if we need profiling in any-double?
> 3. then use profile-thunk on the function if profiling is required, or
> nothing if profiling is not required.
> 

I have attempted this:
;; places-profile.rkt

#lang racket

(define (main)
  (define p
(dynamic-place "any-double.rkt" 'place-entry))

  ;; enable profiling
  (place-channel-put p #t)

  (for ([i (in-range 1000)])
(define l (build-list (random 1) (lambda (_) (random 100
(place-channel-put p l)
(place-channel-get p))

  (place-kill p))

(main)

;; any-double.rkt

#lang racket

(require profile)
(require profile/render-text)

(provide place-entry)

(define (any-double? l)
  (for/or ([i (in-list l)])
(for/or ([i2 (in-list l)])
  (= i2 (* 2 i)

(define (place-entry ch)
  (define profile? (place-channel-get ch))

  (profile-thunk
   (thunk
(let loop ()
  (define l (place-channel-get ch))
  (define l-double? (any-double? l))
  (place-channel-put ch l-double?)
  (loop)))
   #:periodic-renderer (list 4 render)
   #:use-errortrace? #t
   #:threads #t))



Unfortunately, every 4 secs I see:
Profiling results
-
  Total cpu time observed: 185393ms (out of 188238ms)
  Number of samples taken: 3727 (once every 50ms)


Caller
Idx  TotalSelfName+srcLocal%
 ms(pct)  ms(pct)   Callee



Absolutely no results. Why?

Also, if I reduce the number of iterations in places-profile.rkt to
1000, and remove the periodic-render, there's absolutely no output from
the profiler. Is this related with the killing of the place via
place-kill? Is there a nice way to kill a place and still preserve
profiling information?

-- 
Paulo Matos

-- 
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: truly stand-alone Windows ".exe"s

2018-03-27 Thread Matthew Flatt
I should have bumped the version number when adding `--embed-dlls`, but
I didn't. So, even though it's still version 6.90.0.23, `--embed-dlls`
is in snapshots starting with the ones built on March 26.

At Tue, 27 Mar 2018 03:38:28 -0700 (PDT), Alex Harsanyi wrote:
> 
> I have version 6.90.0.23 installed from a few days ago, which appears to be 
> the latest version available at  http://pre.racket-lang.org/, and "raco 
> exe" does not accept the '--embed-dlls' option. Have these changes not been 
> released in a snapshot yet?
> 
> Best Regards,
> Alex.
> 
> On Monday, March 26, 2018 at 10:18:29 PM UTC+8, Matthew Flatt wrote:
> >
> > The latest snapshot build at 
> >
> >  http://pre.racket-lang.org/ 
> >
> > adds an `--embed-dlls` option for `raco setup` for use on Windows. The 
> > new flag causes the generated ".exe" file to contain a copy of ".dll" 
> > files that would otherwise need to be packaged with the ".exe". 
> >
> > If there are no other files needed by the executable --- if the program 
> > contains no `define-runtime-path`s for files other than DLLs, and so on 
> > --- then an ".exe" with embedded DLLs can run all by itself on another 
> > machine. 
> >
> >
> > The `--embed-dlls` flag should work for most DLLs, including all of the 
> > DLLs in the main Racket distribution, but it won't work for everything. 
> > Embedded DLLs are linked using the technique described at 
> >
> >  https://www.joachim-bauch.de/tutorials/loading-a-dll-from-memory/ 
> >
> > and using Joachim Bauch's MemoryModule library. It won't work, for 
> > example, with DLLs that use thread-local variables (but many DLLs avoid 
> > those, since the system `LoadLibrary` function also didn't work for 
> > them prior to Windows Vista). 
> >
> >
> > DrRacket's "Create Executables" doesn't yet include an option like 
> > `--embed-dlls`, but it will soon. If it works as expected, we'll also 
> > make `--embed-dlls` automatic for "Create Executables" for the teaching 
> > languages. 
> >
> >
> 
> -- 
> 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] Behavior of image-color? function

2018-03-27 Thread 若草春男
Hi, everyone.

I'm using 2htdp/image and I wonder the color description.

DrRacket version 6.12

> (require 2htdp/image)
> (image-color? "red") ; will #t
#t
> (image-color? 1) ; will #f
#f
> (image-color? (color 0 0 0 0)) ; will #t
#t
> (image-color? "pale") ; I don't know about this.
#t
> (image-color? "racket") ; will #f
#t
> (image-color? "#00") ; I don't know about this.
#t

And, look at the uploaded picture.
Please match the behavior between the rectangle and image-color? functions.

Thanks,
Haruo Wakakusa

-- 
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] Behavior of image-color? function

2018-03-27 Thread Robby Findler
Any string is considered an image-color, but if it is not a color
that's known, it is turned into black.

Is that the question?

If so, I will update the documentation to clarify.

Note that the list of colors is behind the link on "color-database<%>".

Robby


On Tue, Mar 27, 2018 at 9:41 AM, 若草春男  wrote:
> Hi, everyone.
>
> I'm using 2htdp/image and I wonder the color description.
>
> DrRacket version 6.12
>
>> (require 2htdp/image)
>> (image-color? "red") ; will #t
> #t
>> (image-color? 1) ; will #f
> #f
>> (image-color? (color 0 0 0 0)) ; will #t
> #t
>> (image-color? "pale") ; I don't know about this.
> #t
>> (image-color? "racket") ; will #f
> #t
>> (image-color? "#00") ; I don't know about this.
> #t
>
> And, look at the uploaded picture.
> Please match the behavior between the rectangle and image-color? functions.
>
> Thanks,
> Haruo Wakakusa
>
> --
> 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] Behavior of image-color? function

2018-03-27 Thread Philip McGrath
It looks like 2htdp/image accepts all strings as legal color values, but
"if a string or symbol color name is not recognized, black is used in its
place." In particular, note that (rectangle 20 20 "solid" "#ffe303")
produces the same image as (rectangle 20 20 "solid" "#00"). Strings are
interpreted as color names: support for hex strings is not built in (though
it is easy to add, and I have implemented it a few times).

If you need to be able to test whether a particular string is recognized as
a color, it looks like the find-color method of color-database<%> will help
you, though note that 2htdp/image handles "transparent" as a special case,
in addition to the strings recognized by the-color-database. The
racket/class object system is not part of the teaching languages, but all
of the recognized color strings are listed and illustrated in the docs (
http://docs.racket-lang.org/draw/color-database___.html), so it is easy to
write a function known-color-name? in pure BSL. Here's one way to implement
it:

#lang htdp/BSL

(define known-color-strings
  ;; from: (send the-color-database get-names)
  (list "aliceblue"
"antiquewhite"
"aqua"
"aquamarine"
"azure"
"beige"
"bisque"
"black"
"blanchedalmond"
"blue"
"blue violet"
"blueviolet"
"brown"
"burlywood"
"cadet blue"
"cadetblue"
"chartreuse"
"chocolate"
"coral"
"cornflower blue"
"cornflowerblue"
"cornsilk"
"crimson"
"cyan"
"dark gray"
"dark green"
"dark olive green"
"dark orchid"
"dark slate blue"
"dark slate gray"
"dark turquoise"
"darkblue"
"darkcyan"
"darkgoldenrod"
"darkgray"
"darkgreen"
"darkkhaki"
"darkmagenta"
"darkolivegreen"
"darkorange"
"darkorchid"
"darkred"
"darksalmon"
"darkseagreen"
"darkslateblue"
"darkslategray"
"darkturquoise"
"darkviolet"
"deeppink"
"deepskyblue"
"dim gray"
"dimgray"
"dodgerblue"
"firebrick"
"floralwhite"
"forest green"
"forestgreen"
"fuchsia"
"gainsboro"
"ghostwhite"
"gold"
"goldenrod"
"gray"
"green"
"green yellow"
"greenyellow"
"honeydew"
"hotpink"
"indian red"
"indianred"
"indigo"
"ivory"
"khaki"
"lavender"
"lavenderblush"
"lawngreen"
"lemonchiffon"
"light blue"
"light gray"
"light steel blue"
"lightblue"
"lightcoral"
"lightcyan"
"lightgoldenrodyellow"
"lightgray"
"lightgreen"
"lightpink"
"lightsalmon"
"lightseagreen"
"lightskyblue"
"lightslategray"
"lightsteelblue"
"lightyellow"
"lime"
"lime green"
"limegreen"
"linen"
"magenta"
"maroon"
"medium aquamarine"
"medium blue"
"medium forest green"
"medium goldenrod"
"medium orchid"
"medium sea green"
"medium slate blue"
"medium spring green"
"medium turquoise"
"medium violet red"
"mediumaquamarine"
"mediumblue"
"mediumforestgreen"
"mediumgoldenrod"
"mediumorchid"
"mediumpurple"
"mediumseagreen"
"mediumslateblue"
"mediumspringgreen"
"mediumturquoise"
"mediumvioletred"
"midnight blue"
"midnightblue"
"mintcream"
"mistyrose"
"moccasin"
"navajowhite"
"navy"
"oldlace"
"olive"
"olivedrab"
"orange"
"orange red"
"orangered"
"orchid"
"pale green"
"palegoldenrod"
"palegreen"
"paleturquoise"
"palevioletred"
"papayawhip"
"peachpuff"
"peru"
"pink"
"plum"
"powderblue"
"purple"
"red"
"rosybrown"
"royalblue"
"saddlebrown"
"salmon"
"sandybrown"
"sea green"
"seagreen"
"seashell"
"sienna"
"silver"
"sky blue"
"skyblue"
"slate blue"
"slateblue"
"slategray"
"snow"
"spring green"
"springgreen"
"steel blue"
"steelblue"
"tan"
"teal"
"thistle"
"tomato"
"turquoise"
"violet"
"violet red"
"violetred"
"wheat"
"white"
"whitesmoke"
"yellow"
"yellow green"
"yellowgreen"))

(define (known-color-name? arg)
  (if (symbol? arg)
  (known-color-name? (symbol->string arg))
  (and (string? arg)
  

Re: [racket-users] Profiling places

2018-03-27 Thread Vincent St-Amour
On Tue, 27 Mar 2018 07:55:08 -0500,
'Paulo Matos' via Racket Users wrote:
> 
> I was trying to confirm my suspicion that profile needs to be manually
> setup in each place for profiling.

Right. Each place has its own separate runtime, and the profile only
spans a single runtime.

> Is this a possibility or is there something out there to make this
> easier? Also, profile-thunk says that:
> "To track all threads, specify a non-#f value for the threads?
> argument―this will execute the computation in a fresh custodian, and
> keep track of all threads under this custodian."
> 
> But what happens if the place itself creates its own custodian to launch
> threads?

In this case, thread refers to Racket's concurrency mechanism; this is
unrelated to places.

On Tue, 27 Mar 2018 08:15:19 -0500,
'Paulo Matos' via Racket Users wrote:
> 
> 
> 
> On 27/03/18 14:55, 'Paulo Matos' via Racket Users wrote:
> > 
> > 1. setup a profile command line argument that's passed to places-profile.rkt
> > 2. send a flag indicating if we need profiling in any-double?
> > 3. then use profile-thunk on the function if profiling is required, or
> > nothing if profiling is not required.
> > 
> 
> I have attempted this:
> [...]

I get profiling information (including periodic reports) when I disable
errortrace mode in `profile-thunk`.

The errortrace mode requires the use of the errortrace compile-handler,
without which there's nothing for the profiler to observe.

`raco profile --use-errortrace` sets it, as does `racket -l errortrace
-t places-profile.rkt`. However, neither of those work on your example.

Could places be interfering with the compile-handler?

Vincent

-- 
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] sharing an awesome plot - warms the cockles of my heart

2018-03-27 Thread Geoffrey Knauth
This was a fun thread, thanks to everyone for sharing the plots, and for 
pointing out pasterack.org!

-- 
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] Behavior of nested ellipses

2018-03-27 Thread Justin Pombrio
I'm surprised by the behavior of using a pattern variable under one set of 
ellipses in the pattern, and under two sets of ellipses in the template:

#lang racket

(require (for-syntax syntax/parse))

(define-syntax (test stx)
  (syntax-parse stx
[(_ (x y ...) ...) #''(top (list (x y) ...) ...)]))

(test (a 1 2 3)
  (b 4 5 6)
  (c 7 8 9))

I would expect this to produce:

'(top (list (a 1) (a 2) (a 3))
  (list (b 4) (b 5) (b 6))
  (list (c 7) (c 8) (c 9)))

But instead, it produces:

'(top (list (a 1) (b 2) (c 3))
  (list (a 4) (b 5) (c 6))
  (list (a 7) (b 8) (c 9)))

I'm surprised by this for two reasons:
- What I thought was the obvious implementation for matching/substituting 
with ellipses produces the top answer.
- It breaks some properties that I would expect ellipses to have, such as:

(define-syntax-rule (test (P ...)) (list Q ...))
(test (T1 T2))
===
(define-syntax-rule (test P P*) (list Q Q*))
(test T1 T2)

; for all patterns P and templates Q and terms T1 and T2, where P* and Q* 
are a renamed version of P and Q.

Is this the expected behavior? And is there a good reason for it?

Cheers,
Justin

-- 
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] Behavior of nested ellipses

2018-03-27 Thread Matthias Felleisen

> On Mar 27, 2018, at 4:01 PM, Justin Pombrio  wrote:
> 
> I'm surprised by the behavior of using a pattern variable under one set of 
> ellipses in the pattern, and under two sets of ellipses in the template:
> 
> #lang racket
> 
> (require (for-syntax syntax/parse))
> 
> (define-syntax (test stx)
>   (syntax-parse stx
> [(_ (x y ...) ...) #''(top (list (x y) ...) ...)]))
> 
> (test (a 1 2 3)
>   (b 4 5 6)
>   (c 7 8 9))
> 



Let’s agree that x stands for a, b, c and y stands for 1,2,3 and 4,5,6 and 
7,8,9. 

So what does (x y) … mean: 

 — iterate over both x and y, which yields (list (a 1) (b 3) (c 3))
 — fix x and iterate over y, which would give you (list (a 1) (a 2) (a 3))

You need to make this choice independent of context once you have confirmed 
that there are “enough” ellipses. 

Once you have made the choice you can iterate over the “free” list and you get 
one of the two results. 

Why do you think that the law below wouldn’t hold in the presence of the chosen 
behavior? 






> I would expect this to produce:
> 
> '(top (list (a 1) (a 2) (a 3))
>   (list (b 4) (b 5) (b 6))
>   (list (c 7) (c 8) (c 9)))
> 
> But instead, it produces:
> 
> '(top (list (a 1) (b 2) (c 3))
>   (list (a 4) (b 5) (c 6))
>   (list (a 7) (b 8) (c 9)))
> 
> I'm surprised by this for two reasons:
> - What I thought was the obvious implementation for matching/substituting 
> with ellipses produces the top answer.
> - It breaks some properties that I would expect ellipses to have, such as:
> 
> (define-syntax-rule (test (P ...)) (list Q ...))
> (test (T1 T2))
> ===
> (define-syntax-rule (test P P*) (list Q Q*))
> (test T1 T2)
> 
> ; for all patterns P and templates Q and terms T1 and T2, where P* and Q* are 
> a renamed version of P and Q.
> 
> Is this the expected behavior? And is there a good reason for it?
> 
> Cheers,
> Justin
> 
> -- 
> 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] Behavior of nested ellipses

2018-03-27 Thread Ryan Culpepper

On 03/27/2018 10:01 PM, Justin Pombrio wrote:
I'm surprised by the behavior of using a pattern variable under one set 
of ellipses in the pattern, and under two sets of ellipses in the template:


|
#lang racket

(require(for-syntax syntax/parse))

(define-syntax (test stx)
(syntax-parse stx
[(_ (x y ...)...)#''(top (list (x y) ...) ...)]))

(test (a 123)
(b 456)
(c 789))
|

I would expect this to produce:

|
'(top (list (a 1) (a 2) (a 3))
       (list (b 4) (b 5) (b 6))
       (list (c 7) (c 8) (c 9)))
|

But instead, it produces:

|
'(top (list (a 1) (b 2) (c 3))
       (list (a 4) (b 5) (c 6))
       (list (a 7) (b 8) (c 9)))
|

I'm surprised by this for two reasons:
- What I thought was the obvious implementation for 
matching/substituting with ellipses produces the top answer.

- It breaks some properties that I would expect ellipses to have, such as:

|
(define-syntax-rule (test (P ...))(list Q ...))
(test (T1 T2))
===
(define-syntax-rule (test P P*)(list Q Q*))
(test T1 T2)

;forall patterns P andtemplates Q andterms T1 andT2,whereP*andQ*are a 
renamed version of P andQ.

|


This has extra parens or is missing dots or something. As it is, the top 
test takes 1 argument and the bottom test takes two.



Is this the expected behavior? And is there a good reason for it?


A variable must participate in as many of the implicit maps in the 
template as its ellipsis depth from the *pattern* (call that depth D). 
If it occurs at a greater depth in the template, there are three obvious 
choices: participate in the outermost D maps, participate in the 
innermost D maps, or reject the template. At some point, someone decided 
to go with the innermost maps.


It's actually more complicated that that, because a variable can occur 
at multiple depths in the same template. Consider this example:


  > (with-syntax ([(x ...) #'(1 2 3)])
  #'((x x ...) ...))
  #

Instead of the property you were expecting, you get the following 
property: If T is a "fully-saturated" template (all variables occur wrt 
T at a depth >= their binding depths), then T always produces the same 
output, even when you put it in a larger template with more ellipses.


I think it might have been helpful back in the R5RS days, when 
"portable" macros were limited to syntax-rules, and this decision made a 
very limited system slightly more flexible. (To clarify, I'm not sure 
that R5RS specified this behavior, but I think it was a common extension 
to syntax-rules, whereas with-syntax was not.)


Nowadays, I would rather rewrite the macro to use with-syntax than rely 
on this "feature". I've implemented it twice, and I still have to stop 
and think through it.


Ryan

--
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] Behavior of nested ellipses

2018-03-27 Thread Ryan Culpepper

On 03/27/2018 11:46 PM, Ryan Culpepper wrote:

On 03/27/2018 10:01 PM, Justin Pombrio wrote:
I'm surprised by the behavior of using a pattern variable under one 
set of ellipses in the pattern, and under two sets of ellipses in the 
template:

[...]


BTW, it looks like Macro-By-Example[1] describes the behavior that you 
expected. See the definitions in the second column of page 4.


Ryan

[1] "Macro-By-Example: Deriving Syntactic Transformations from their 
Specifications" by Eugene Kohlbecker and Mitchell Wand. 
ftp://www.cs.indiana.edu/pub/techreports/TR206.pdf


--
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] compile-zo: date for newly created .zo file ... is before source-file date ... which appears to be in the future

2018-03-27 Thread Greg Trzeciak
I started receiving weird errors while installing packages (any package I 
tested so far)

The error below was returned while installing package - my local time was 
around 0:44 at the time:

> compile-zo: date for newly created .zo file 
(C:\Users\Grzegorz\AppData\Roaming\Racket\6.12\pkgs\pollen-count\compiled\tmp15221906401522190640548
 
@ 2018-3-28 1:44:0) is before source-file date 
(C:\Users\Grzegorz\AppData\Roaming\Racket\6.12\pkgs\pollen-count\info.rkt @ 
2018-3-28 2:43:58), which appears to be in the future

I am just running "raco setup" and it looks like one pure mess with these 
errors and their consequences.

Any ideas what could have caused it? I will probably have to do a fresh 
install of Racket unless there is another way.

G.

-- 
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: compile-zo: date for newly created .zo file ... is before source-file date ... which appears to be in the future

2018-03-27 Thread Greg Trzeciak
Forgot to mention - my setup is: Racket 6.12 on Windows 10... could be some 
recent Windows update?

-- 
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] Behavior of nested ellipses

2018-03-27 Thread Justin Pombrio
I think I found a clearer way of talking about this. This rule:

(define-syntax-rule
(test (x y ...) ...)
'(((x y) ...) ...))

Has more than one possible meaning. But it can be clarified using explicit 
subscripts. It could mean either this (which is what I expected):

(define-syntax-rule
(test (x_j y_j_i ...i) ...j)
'(((x_j y_j_i) ...i) ...j))

Or this (which is what Racket does):

(define-syntax-rule
(test (x_j y_j_i ...i) ...j)
'(((x_i y_j_i) ...i) ...j))

I'm surprised that x's subscript changed between the pattern and the 
template.

Ryan, thanks for the interesting example. Made explicit, it becomes:

((x_j x_i ...i) ...j)

although figuring out how to label that was tricky and I don't know how to 
do it in general, or even if it can be done for all valid syntax rules.

Matthias: the algorithm I was thinking of is the Macro-by-Example algorithm 
that Ryan pointed out, which is neither of yours. Decompose the environment 
at the outer ellipsis. I take back my claim that it's the most obvious 
algorithm, though.

On Tuesday, March 27, 2018 at 6:05:12 PM UTC-4, Ryan Culpepper wrote:
>
> On 03/27/2018 11:46 PM, Ryan Culpepper wrote: 
> > On 03/27/2018 10:01 PM, Justin Pombrio wrote: 
> >> I'm surprised by the behavior of using a pattern variable under one 
> >> set of ellipses in the pattern, and under two sets of ellipses in the 
> >> template: 
> >> [...] 
>
> BTW, it looks like Macro-By-Example[1] describes the behavior that you 
> expected. See the definitions in the second column of page 4. 
>
> Ryan 
>
> [1] "Macro-By-Example: Deriving Syntactic Transformations from their 
> Specifications" by Eugene Kohlbecker and Mitchell Wand. 
> ftp://www.cs.indiana.edu/pub/techreports/TR206.pdf 
>

-- 
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.