Re: [racket-users] Separate compilation/caching for Scribble?

2020-03-25 Thread William J. Bowman
We're getting a little far from my real question, since caching the examples is
IMHO a hack to cache the most expensive part of the computation, while the whole
'doc ought to be cachable, but

I forgot what my own code was doing.
That's basically what I'm doing:
(define (make-cached-eval name . rest)
  (define ev
(make-log-based-eval
 (cachefile name)
 (if (file-exists? (cachefile name))
 'replay
 'record)))
  (for ([r rest])
(ev r))
  ev)

I'm using with-cache's `cachefile` just to generate and manage the file path, so
it ends up in have a good place.
I was trying to do something more complex earlier, but it didn't work.

On Wed, Mar 25, 2020 at 09:59:15PM +0100, Ryan Culpepper wrote:
> I'm not clear on what `with-cache` is doing in this setup, but it seems
> like a potential source of errors. If the goal is to automatically use
> `'replay` if the log file exists and `'record` otherwise, why not do the
> following?
> 
> (make-log-based-eval the-log-file (if (file-exists? the-log-file)
> 'replay 'record))
> 
> Ryan
> 
> 
> On Wed, Mar 25, 2020 at 8:57 PM William J. Bowman 
> wrote:
> 
> > On Wed, Mar 25, 2020 at 08:51:18PM +0100, Ryan Culpepper wrote:
> > > You can use `raco make` (or `raco setup` for docs of installed packages)
> > to
> > > compile the Scribble files, but that won't compile the examples. Those
> > are
> > > dynamically evaluated when the Scribble documents are run.
> > Yeah, I was thinking of "compilation" as in caching the output document
> > from
> > each module.
> >
> > > For `make-log-based-eval`, are you using a separate evaluator (and
> > separate
> > > log file) for each Scribble file?
> > Yes. However, I'm using `with-cache` and a wrapper to detect whether a
> > cache
> > file exists (separate cache file each evaluator), and use 'replay mode if
> > the
> > cache file exists, so I don't have to manually switch to 'replay mode, or
> > manually re-record if I alter an example (instead, just clear the cache).
> >

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200325220252.GA31619%40williamjbowman.com.


Re: [racket-users] Separate compilation/caching for Scribble?

2020-03-25 Thread Ryan Culpepper
I'm not clear on what `with-cache` is doing in this setup, but it seems
like a potential source of errors. If the goal is to automatically use
`'replay` if the log file exists and `'record` otherwise, why not do the
following?

(make-log-based-eval the-log-file (if (file-exists? the-log-file)
'replay 'record))

Ryan


On Wed, Mar 25, 2020 at 8:57 PM William J. Bowman 
wrote:

> On Wed, Mar 25, 2020 at 08:51:18PM +0100, Ryan Culpepper wrote:
> > You can use `raco make` (or `raco setup` for docs of installed packages)
> to
> > compile the Scribble files, but that won't compile the examples. Those
> are
> > dynamically evaluated when the Scribble documents are run.
> Yeah, I was thinking of "compilation" as in caching the output document
> from
> each module.
>
> > For `make-log-based-eval`, are you using a separate evaluator (and
> separate
> > log file) for each Scribble file?
> Yes. However, I'm using `with-cache` and a wrapper to detect whether a
> cache
> file exists (separate cache file each evaluator), and use 'replay mode if
> the
> cache file exists, so I don't have to manually switch to 'replay mode, or
> manually re-record if I alter an example (instead, just clear the cache).
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CANy33qnePkB3LERw-s8kmGWi4e%2B0T%3D%3D0Tgy%3Da5mHE9odkpFFrQ%40mail.gmail.com.


Re: [racket-users] Separate compilation/caching for Scribble?

2020-03-25 Thread William J. Bowman
On Wed, Mar 25, 2020 at 08:51:18PM +0100, Ryan Culpepper wrote:
> You can use `raco make` (or `raco setup` for docs of installed packages) to
> compile the Scribble files, but that won't compile the examples. Those are
> dynamically evaluated when the Scribble documents are run.
Yeah, I was thinking of "compilation" as in caching the output document from
each module.

> For `make-log-based-eval`, are you using a separate evaluator (and separate
> log file) for each Scribble file?
Yes. However, I'm using `with-cache` and a wrapper to detect whether a cache
file exists (separate cache file each evaluator), and use 'replay mode if the
cache file exists, so I don't have to manually switch to 'replay mode, or
manually re-record if I alter an example (instead, just clear the cache).

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200325195723.GN26958%40williamjbowman.com.


Re: [racket-users] Separate compilation/caching for Scribble?

2020-03-25 Thread Ryan Culpepper
You can use `raco make` (or `raco setup` for docs of installed packages) to
compile the Scribble files, but that won't compile the examples. Those are
dynamically evaluated when the Scribble documents are run.

For `make-log-based-eval`, are you using a separate evaluator (and separate
log file) for each Scribble file?

Ryan

On Wed, Mar 25, 2020 at 7:56 PM William J. Bowman 
wrote:

> Does Scribble support separate compilation or some kind of caching and I'm
> just
> missing it?
>
> I'm building a multi-page website using Scribble, with many @examples that
> take
> a while to run.
> If I touch *any page*, all the other pages have to rebuild, re-running the
> long
> running examples.
>
> I've hacked up a caching system for examples using make-log-based-eval and
> with-cache, but it's completely unreliable, occasionally giving 'could not
> replay log' when nothing has changed in that file.
>
> Am I missing something?
>
> --
> William J. Bowman
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/20200325185631.GK26958%40williamjbowman.com
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CANy33q%3DZ7nfiF%3DqntgSnaD%3D8%2B4L%3DR4CTb73K_T8mzfoXJxXrFQ%40mail.gmail.com.


[racket-users] Separate compilation/caching for Scribble?

2020-03-25 Thread William J. Bowman
Does Scribble support separate compilation or some kind of caching and I'm just
missing it?

I'm building a multi-page website using Scribble, with many @examples that take
a while to run.
If I touch *any page*, all the other pages have to rebuild, re-running the long
running examples.

I've hacked up a caching system for examples using make-log-based-eval and
with-cache, but it's completely unreliable, occasionally giving 'could not
replay log' when nothing has changed in that file.

Am I missing something?

-- 
William J. Bowman

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200325185631.GK26958%40williamjbowman.com.