Re: [racket-users] Where is "PLT Games.exe" source code?

2016-11-23 Thread Ken Biondi
On Wednesday, November 23, 2016 at 12:11:44 PM UTC-8, Shu-Hung You wrote:
> Hi Ken, do you mean this? https://github.com/racket/games
> --Shu-Hung


Yes, thank you!

-- 
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] Where is "PLT Games.exe" source code?

2016-11-23 Thread Ken Biondi
On Wednesday, November 23, 2016 at 12:12:47 PM UTC-8, Jens Axel Søgaard wrote:
> https://github.com/racket/games
> 
> 
> 
> 2016-11-23 21:02 GMT+01:00 Ken Biondi :
> Where is the source code for "PLT Games.exe"?  I unsuccessfully searched 
> github for it.
> 
> 
> 
> --
> 
> 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...@googlegroups.com.
> 
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> 
> 
> -- 
> 
> -- 
> Jens Axel Søgaard

Thanks!

-- 
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] Where is "PLT Games.exe" source code?

2016-11-23 Thread Jens Axel Søgaard
https://github.com/racket/games

2016-11-23 21:02 GMT+01:00 Ken Biondi :

> Where is the source code for "PLT Games.exe"?  I unsuccessfully searched
> github for it.
>
> --
> 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.
>



-- 
-- 
Jens Axel Søgaard

-- 
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] Where is "PLT Games.exe" source code?

2016-11-23 Thread Shu-Hung You
Hi Ken, do you mean this? https://github.com/racket/games
--Shu-Hung

On Wed, Nov 23, 2016 at 2:02 PM, Ken Biondi  wrote:
> Where is the source code for "PLT Games.exe"?  I unsuccessfully searched 
> github for it.
>
> --
> 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] Where is "PLT Games.exe" source code?

2016-11-23 Thread Ken Biondi
Where is the source code for "PLT Games.exe"?  I unsuccessfully searched github 
for it.

-- 
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] Contract on a parameter’s value as a function precondition?

2016-11-23 Thread Scott Moore
Yes, we worked with Matthew to implement the necessary hooks in procedure 
chaperones (see the 'mark options that were added to the return value of 
wrapper-proc). For the contracts we were writing, we ended up using these 
continuation marks directly.  

To implement what you're looking for, a little extra work is required to link 
up the implementation of parameters with this mechanism to get at the 
appropriate continuation marks. One question there will be whether to integrate 
it with either the existing  
arrow contracts (carefully protecting access to the internals of the parameter 
implementation), or to just provide a standalone combinator. I would need to 
refresh my memory to see what exactly would need to be done for either.  

Cheers,  
Scott

On November 23, 2016 at 7:35:32 AM, Robby Findler 
(ro...@eecs.northwestern.edu(mailto:ro...@eecs.northwestern.edu)) wrote:

>  
> I think that Scott investigated adding support to chaperones that
> would make something like this work.
>  
> Robby
>  
>  
> On Tue, Nov 22, 2016 at 10:16 PM, Alexis King  wrote:
> > I have a function that requires a parameter be set to a value satisfying
> > a particular contract, but I don’t see any direct way to specify that
> > constraint using the contract system. It seems possible to emulate using
> > #:pre from ->* and ->i, but this has two problems: it doesn’t produce
> > very good error messages, and it doesn’t let me provide an arbitrary
> > contract.
> >  
> > The latter issue seems a little trickier to implement, since I don’t
> > think there’s any specific support in Racket’s existing interposition
> > layer. Neither impersonate-procedure nor impersonate-procedure* provide
> > any control over the dynamic extent of the call, so it isn’t possible to
> > adjust the parameterization. It’s possible to create an extremely simple
> > contract that creates an entirely new procedure instead of a chaperone
> > or impersonator:
> >  
> > (define (parameterization-> param-name param val/c)
> > (make-contract
> > #:name `(parameterization-> ,param-name
> > ,(contract-name val/c))
> > #:projection
> > (λ (blame)
> > (let ([blame* (blame-add-context
> > blame #:swap? #t
> > (format "the value of (~a)" param-name))])
> > (λ (val)
> > (λ args
> > (parameterize ([param (((contract-projection val/c) blame*)
> > (param))])
> > (apply val args
> >  
> > …but this seems like it probably has some drawbacks. Is there a better
> > way to do this? And in any case, would this be something useful to add
> > to ->* or ->i?
> >  
> > Alexis
> >  
> > --
> > 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.

-- 
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] Contract on a parameter’s value as a function precondition?

2016-11-23 Thread Robby Findler
I think that Scott investigated adding support to chaperones that
would make something like this work.

Robby


On Tue, Nov 22, 2016 at 10:16 PM, Alexis King  wrote:
> I have a function that requires a parameter be set to a value satisfying
> a particular contract, but I don’t see any direct way to specify that
> constraint using the contract system. It seems possible to emulate using
> #:pre from ->* and ->i, but this has two problems: it doesn’t produce
> very good error messages, and it doesn’t let me provide an arbitrary
> contract.
>
> The latter issue seems a little trickier to implement, since I don’t
> think there’s any specific support in Racket’s existing interposition
> layer. Neither impersonate-procedure nor impersonate-procedure* provide
> any control over the dynamic extent of the call, so it isn’t possible to
> adjust the parameterization. It’s possible to create an extremely simple
> contract that creates an entirely new procedure instead of a chaperone
> or impersonator:
>
>   (define (parameterization-> param-name param val/c)
> (make-contract
>  #:name `(parameterization-> ,param-name
>  ,(contract-name val/c))
>  #:projection
>  (λ (blame)
>(let ([blame* (blame-add-context
>   blame #:swap? #t
>   (format "the value of (~a)" param-name))])
>  (λ (val)
>(λ args
>  (parameterize ([param (((contract-projection val/c) blame*)
> (param))])
>(apply val args
>
> …but this seems like it probably has some drawbacks. Is there a better
> way to do this? And in any case, would this be something useful to add
> to ->* or ->i?
>
> Alexis
>
> --
> 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] Re: ANN: with-cache

2016-11-23 Thread Ben Greenman
By default, only values that can be serialized can be cached.
Can you call `(serialize )` on one of these structs?

If that is the problem, one fix is to add the `prop:serializable` property
to the struct definition.
http://docs.racket-lang.org/reference/serialization.html?q=prop%3Aserializable#%28def._%28%28lib._racket%2Fprivate%2Fserialize..rkt%29._prop~3aserializable%29%29

Either way, another fix is to define functions that convert instances of
the struct to s-expressions & use the #:read and #:write options for
with-cache

(define (frame->sexp f) )

(define (sexp->frame s) )

(with-cache "data.rktd"

  #:write frame->sexp

  #:read sexp->frame

  (lambda () ))


On Wed, Nov 23, 2016 at 5:46 AM, Alex Harsanyi 
wrote:

> Hi Ben,
>
> What types of values can be cached by with-cache?
>
> I tried to use it with a data-frame object I use in my application (wanted
> to check if it is faster to retrieve it from the filesystem than the
> database), but unfortunately it failed with:
>
> ; with-cache: Internal error: failed to make writable value from result
> '#(struct:object:data-frame% ...)'
>
> The object itself is essentially a collection of large (about 1 items)
> vectors (about 30 of them) plus some metadata.
>
> Thanks,
> Alex.
>
> On Wednesday, November 23, 2016 at 1:11:27 PM UTC+8, Ben Greenman wrote:
> > with-cache is a small package for saving the results of an expression to
> the filesystem
> >
> >
> >
> > #lang racket/base
> > (require pict with-cache)
> >
> >
> > (define (get-fish)
> >   (with-cache (cachefile "stdfish.rktd")
> > (λ () (standard-fish 100 50
> >
> >
> > (get-fish) ;; Builds a fish
> > (get-fish) ;; Reads a fish from "./compiled/with-cache/stdfish.rktd"
> >
> >
> >
> > Run the above with `racket -W info@with-cache file.rkt` to see when
> cache files get written and read.
> >
> >
> > By default, cached data is serialized, written in fasl format, and
> invalidated if read by a different version of the with-cache library. You
> can override all these options; the docs should explain how.
> >
> >
> >
> > Docs (latest update is yet to sync on the package server):
> > http://docs.racket-lang.org/with-cache/index.html
> >
> >
> >
> > Code:
> > https://github.com/bennn/with-cache
> >
> >
> >
> > History:
> > I started writing this code while working on a Scribble document with
> lots of picts in it. (Most of the picts were made by plot. Tweaking plot
> parameters led to the *current-cache-keys* parameter.)
> > William Bowman encouraged me to put an early version of this code on the
> package server.
> > Leif Andersen pointed out LOTS of places where the original code needed
> to improve.
>
> --
> 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] Re: ANN: with-cache

2016-11-23 Thread Alex Harsanyi
Hi Ben,

What types of values can be cached by with-cache? 

I tried to use it with a data-frame object I use in my application (wanted to 
check if it is faster to retrieve it from the filesystem than the database), 
but unfortunately it failed with:

; with-cache: Internal error: failed to make writable value from result 
'#(struct:object:data-frame% ...)'

The object itself is essentially a collection of large (about 1 items) 
vectors (about 30 of them) plus some metadata.

Thanks,
Alex.

On Wednesday, November 23, 2016 at 1:11:27 PM UTC+8, Ben Greenman wrote:
> with-cache is a small package for saving the results of an expression to the 
> filesystem
> 
> 
> 
> #lang racket/base
> (require pict with-cache)
> 
> 
> (define (get-fish)
>   (with-cache (cachefile "stdfish.rktd")
>     (λ () (standard-fish 100 50
> 
> 
> (get-fish) ;; Builds a fish
> (get-fish) ;; Reads a fish from "./compiled/with-cache/stdfish.rktd"
> 
> 
> 
> Run the above with `racket -W info@with-cache file.rkt` to see when cache 
> files get written and read.
> 
> 
> By default, cached data is serialized, written in fasl format, and 
> invalidated if read by a different version of the with-cache library. You can 
> override all these options; the docs should explain how.
> 
> 
> 
> Docs (latest update is yet to sync on the package server):
> http://docs.racket-lang.org/with-cache/index.html
> 
> 
> 
> Code:
> https://github.com/bennn/with-cache
> 
> 
> 
> History:
> I started writing this code while working on a Scribble document with lots of 
> picts in it. (Most of the picts were made by plot. Tweaking plot parameters 
> led to the *current-cache-keys* parameter.)
> William Bowman encouraged me to put an early version of this code on the 
> package server.
> Leif Andersen pointed out LOTS of places where the original code needed to 
> improve.

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