Hey, is there a scheduling/cron library for recurring tasks in Racket? I can’t find anything except for “deferred” which supports one-off tasks only
okay nevermind, cron-like behaviour can be achieved by pre-scheduling deferred calls a bit… :slightly_smiling_face:
@pocmatos I think your issue with linklets is based on a confusion between the --linklets
flag (create a bunch of linklets for a single file) and the -x
flag (extract a file and all its dependencies into a single linklet)
@samth ah! That’s probably it. I saw --expand
as well but the --linklets
flag was the one which sounded more like what I wanted. Thanks, I will give that a go!
The --linklets
flag is (I think) mostly for understand what the expander does; the -x
flag is useful for actually running the resulting program in specialized cases (as seen with bootstrapping the expander itself)
@samth with -x
, full command line: racket bootstrap-run.rkt -x -s -t /home/pmatos/Projects/redjacket/examples/factorial-input.rkt
it seems to be actually running my file:
...
compile: /home/pmatos/Projects/redjacket/examples/factorial.rkt
Enter a number:
ok, [("-e" "--expand") "Expand instead of running"
maybe expand is the solution…
shame, this as expected only actually does syntax expansion instead of generating the linklets.
yes, I think it does run the file; I’m not sure why
the usual solution is the obvious one of not having top-level expressions that do things
humm, that’s not good news. :disappointed:
@pocmatos what exactly do you plan to do with the linklet after extracting it?
most of the time, you can just take the exports and call one of them
I want to parse it for analysis.
what do you mean, take the exports?
if the linklet exports things, you can get those values and then call them
the linklet in this case is just a program, it exports nothing. Still, if I change my example so that instead of having expression at top-level, I just have a submodule main like so: #lang racket/base
(require "factorial.rkt")
(module+ main
(let loop ()
(printf "Enter a number: ")
(define n (read))
(cond
[(exact-positive-integer? n)
(printf "~a! = ~a~n" n (factorial n))]
[else
(printf "Invalid value~n")
(loop)])))
This is what I get from:
racket bootstrap-run.rkt -x -s -t /home/pmatos/Projects/redjacket/examples/factorial-input.rkt
compile: /home/pmatos/Projects/redjacket/examples/factorial.rkt
Getting #<path:/home/pmatos/Projects/redjacket/examples/factorial-input.rkt> at 0
linklet-directory->hash: contract violation
expected: linklet-directory?
given: #7.3.0.12expDmainconfigure-runtimeR;?lmainp�X��configure-runtime�!1#7.3.0.12expB#hasheq((0 . #s((source-linklet linklet 0) (linklet ((.get-syntax-liter...
context...:
/home/pmatos/Projects/LT-racket/racket/collects/racket/private/check.rkt:82:9: linklet-directory->hash
/home/pmatos/Projects/LT-racket/racket/src/expander/extract/module.rkt:21:0: get-compiled-module8
/home/pmatos/Projects/LT-racket/racket/src/expander/extract/get-linklet.rkt:23:2: get-linklets!
/home/pmatos/Projects/LT-racket/racket/src/expander/extract/main.rkt:28:0: extract25
"/home/pmatos/Projects/LT-racket/racket/src/expander/run.rkt": [running body]
temp37_0
for-loop
run-module-instance!125
for-loop
[repeats 1 more time]
run-module-instance!125
perform-require!78
will probably open an issue for this one.
Looks like -x
needs a cache directory specified by -c
to work right. Also, you’ll need -o
to get any output.
Does your work combine Racket and low-level systems programming? Consider submitting a short paper about your work to the PLOS ’19 workshop! —
Call for Papers: PLOS ’19: 10th Workshop on Programming Languages and Operating Systems http://plos-workshop.org/2019/
Sponsored by ACM SIGOPS / In conjunction with SOSP Paper submission deadline: August 9, 2019 Workshop: October 27, 2019
Historically, operating system development and programming language development went hand-in-hand. Today, although the systems community at large retains an iron grip on C, many people continue to explore novel approaches to OS construction based on new programming language ideas.
This workshop will bring together researchers and developers from the programming language and operating system domains to discuss recent work at the intersection of these fields. It will be a platform for discussing new visions, challenges, experiences, problems, and solutions arising from the application of advanced programming and software engineering concepts to operating systems construction, and vice versa.
Please visit the website for more info: http://plos-workshop.org/2019/