The `uncaught-exception-handler` parameter controls the *bottom* of the
exception handler stack, so it won't override the exception handler
installed by Scribble's `interaction` form. If you use `with-handlers`
(or `call-with-exception-handler`) instead, it should work.
The
On 8/3/19 10:48 AM, Zelphir Kaltstahl wrote:
Hi!
I am trying to write a macro, which checks the name of an argument for
presence a substring. This is not the main purpose of the macro, but I
want to do different things depending on the substring being contained
or not contained.
Here is
On 8/14/19 2:57 PM, tbrooke wrote:
There has been some discussion about Racket on Jupyter. nextJournal is a
fairly new project for hosted notebooks that is written in Clojure and
has support for Clojure as well as several other languages. In addition
to Clojure they have templates for Julia,
The macro stepper *should* pop up a dialog after a certain (large)
number of steps and ask if you want to interrupt it and see the
expansion up to that point. For example, try this:
#lang racket
(define-syntax-rule (m) (m))
(m)
The dialog should show up in a second or two. It can't
On 7/21/19 10:41 PM, Tim Meehan wrote:
When hovering over names in a program that I downloaded to examine, I
noticed a purple question mark that I had not remembered seeing before.
I am used to hovering over a name and seeing where else it is used,
etc., but I don't remember seeing the purple
On 9/21/19 10:15 PM, Jonathan Simpson wrote:
Given this macro that I'm experimenting with:
(syntax-parse #'(1 2 2 a 2 2 b 2 c) [(1 (~seq n:nat ...+ x) ...) #'((n
... x) ...)])
How would I change it so that it returns #'(2 2 a 2 2 b 2 c) instead of
#'((2 2 a) (2 2 b) (2 c)) ?
I don't want
On 9/27/19 6:56 PM, Sage Gerard wrote:
I got sloppy here in a Stripe integration:
https://github.com/zyrolasting/stripe-integration/blob/master/main.rkt#L31
I'm not an InfoSec expert, but I know I'd like to secure the secret key
used here in memory instead of using a parameter.
I'd probably
On 10/25/19 12:45 AM, Sage Gerard wrote:
I am porting some C++ code to Racket that uses a function pointer.
C++ origin: See 294 through 306:
https://github.com/Erkaman/vulkan_minimal_compute/blob/master/src/main.cpp#L294
Racket destination:
A parameter object itself is essentially just a key. To get its value, you
first look up the current parameterization in the current continuation's
continuation-marks. The parameterization contains an immutable eq?-hash
mapping parameter keys to thread cells. The parameter's value is the value
of
On 2/3/20 12:31 PM, Wilzoo wrote:
Hi guys, so I am working on rolling dice game in GUI, the game rules
will be something like rolling 3 dices and then giving out points to 2
players based on the rolled values.
Im now stuck on the showing value in GUI. Basically what I need is to
show rolled
On 1/23/20 3:59 PM, Sean Kemplay wrote:
Hello,
I am exploring macros and am trying to define a variable at the top
level (with the goal in mind to dynamically define a group of functions
from a macro).
with-syntax works fine however I was just wondering if it is possible to
directly inject
On 1/29/20 12:14 AM, Milo Turner wrote:
Hello all,
I'm wondering if it's possible to open a unix domain socket with
SOCK_SEQPACKET in Racket? It looks like currently unix-socket-lib uses
SOCK_STREAM, and doesn't allow you to configure that flag. Is there a
reason for this, or would it be a
What should `(myconversion "apple")` return?
What should `(myconversion "12.3")` return?
What does `string->number` do in each of those cases?
Ryan
On Tue, Feb 11, 2020 at 11:34 AM Alain De Vos
wrote:
> I tried the following function to conver a String to an Integer.
>
> #lang typed/racket
>
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)
)
'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 co
I wrote a little flashcard program in Racket to help myself learn Czech
vocabulary (here: https://github.com/rmculpepper/racket-jazyk), and when
run on a Mac it uses `say` for audio. IIRC, I had to install extra "voice"
packages for Czech, but that consisted of clicking a few buttons in
Settings.
What should the splicing version do in the following case:
some text
@(markdown-inline "file-with-sections.md")
some trailing text
In particular, what should happen to the trailing text? Scribble doesn't
have a notion of returning to the top-level after a section. One
possibility would be
Okay, if I understand correctly, you would expect the trailing text in my
example to be appended to the final subsection from the file.
In that case, does it work if you simply remove the call to `decode-flow`
from the definition of `markdown-inline`? Then the function would
just return a list of
The Racket printer uses a separate property to determine whether a struct
is quotable. If you add
#:property prop:custom-print-quotable 'never
to the declarations of Int2 and Prim2, your program should produce the
output you expect. I'll add a note to the docs for
Yes, the behavior you're seeing is a consequence of hygiene, and you should
see the same behavior in other Scheme implementations.
When the expander gets to the `let-third` call, there is a `var` identifier
in the macro's template that is used as a binder, and there is a `var`
identifier in the
The last time I tested connecting to MS SQL Server on Windows (several
years ago), I think I was able to connect using some drivers but not
others. I was simultaneously trying to figure out authentication and the
connection string format, so once I got a working configuration I stopped
You can also use make-element-id-transformer, like this:
(define-syntax SET
(make-element-id-transformer
(lambda _ #'(racketvarfont "set"
Then Scribble will automatically replace SET within rendered code with the
element expression above.
Another trick is to break the
As I understand the HTTP protocol (that is, some but not lots), the most
reasonable thing for the server to do if it discovers an error after the
status code has been sent seems to be to just hang up and let the client
realize that *something* went wrong. I don't mean just truncate the output;
I
internet tells me that browsers don't support them.
Ryan
On Mon, May 25, 2020 at 9:48 PM Norman Gray
wrote:
>
> Ryan and Matthew, hello.
>
> On 25 May 2020, at 19:43, Ryan Culpepper wrote:
>
> > As I understand the HTTP protocol (that is, some but not lots), the
> >
Based on a quick look, I believe it has to do with serializing compiled
code, including quoted values embedded in compiled code. Serializing
compiled code uses the same entry point as the other printing functions.
For example, try this:
(write (compile '(quote (1 2 3
and compare the
tacontinuation-frame
>call-with-empty-metacontinuation-frame-for-swap
>
>
> I also confirmed using odbc-driver-connect directly that no connection is
> actually made. Do you have any other suggestions? Thanks again!
>
>
> --
> "Ad astra per alia porci"
>
>
This is a nice example of a macro design pattern that I think of as
"partial expansion with trampolining". You don't need to deal with the
internal definition context API, because you can return definitions to the
macro expander, let it handle their interpretation, and then resume your
work.
but beware, for
> (for-each
(lambda (x) (printf "~a: ~a\n" (~v x #:min-width 28) (struct->vector
x)))
(list "hello" (let () (struct string (n)) (string 5
"hello" : #(struct:string ...)
# : #(struct:string ...)
Ryan
On Mon, Aug 3, 2020
You can use the functions from macro-debugger/expand to do this (within
limits). Here's a very rough example program that reads one term from
stdin and shows its expansion with the given hiding policy (discarding
hygiene information---beware).
usage: racket expand.rkt < your-example-file.rkt
If I understand the docs correctly, the OS-specific handling is in
open-input-file, but it is not the default.
Here is an alternative to read-line that preserves line endings:
#lang racket/base
;; my-read-line : InputPort -> String
;; Like read-line, but preserves line ending.
;; Fails
On Wed, Aug 12, 2020 at 7:19 PM Siyuan Chen wrote:
> Dear Ryan,
>
> Thanks for your solution, it works nicely!
>
> But I still have some questions:
>
> For this particular problem of LockedMagicDoor, we can use `trait` to
> solve the `mixin` problem, but can we use the same method for more
I don't know of a way to solve that problem using the Racket class system
alone, but here is a solution that uses traits instead, which allow you to
rename the hook methods after the fact so they don't collide.
;;
(require racket/trait)
(define secure-trait
(trait
(inherit
If you want a regular expression that does match the example string, you
can use the \p{property} notation. For example:
> (regexp-match? #px"^\\p{L}+$" "h\uFFC3\uFFA9llo")
#t
The "Regexp Syntax" docs have a grammar for regular expressions with links
to examples.
Ryan
On Thu, Jul 9, 2020
Hi Curtis, thanks for the report. No, that isn't supposed to happen. I
haven't managed to reproduce a silent hang, and looking over the
virtual-connection code it looks like any errors (eg, TCP timeout) should
be propagated to the caller. On the other hand, I don't have a way of
simulating a
I don't know if it helps, but config:installation-name is a promise defined
by setup/private/dirs.
Ryan
On Mon, Jul 13, 2020 at 7:23 PM Matthew Flatt wrote:
> I'm not sure how it could be in `dynamic-require` itself, as opposed to
> a library that is loaded by `dynamic-require`, but it sounds
Here's a function that creates a thread that waits until a port is closed
and then prints a message:
(define (watch-for-port-close p)
(thread (lambda () (sync (port-closed-evt out)) (eprintf "port
closed\n"
For example:
(define out (open-output-string))
(watch-for-port-close out)
that there are some cases with scripts requiring multiple code
> points to render a single character such as Arabic with pronunciation marks
> e.g. دُ نْيَا. At the moment, I don’t have the time (or need) to
> investigate further.
>
> The depth of Racket’s Unicode support is i
The db library expects to talk to the MySQL server using utf8. If you
manage to change the connection encoding (eg with SET NAMES), it is likely
to confuse the db library and either corrupt data or make the connection
fail with an error.
Can you explain what you want to accomplish?
Ryan
On Sat,
Thanks Alex for pointing out the use of list->string. I've created a PR (
https://github.com/racket/racket/pull/3275) that changes that code to use
string ports instead (similar to Hendrik's suggestion, but the string port
handles resizing automatically). Could someone (John?) with some large XML
`(List* T)` is the same as `T`, just as `(list* x)` is the same as `x`
(whether `x` is a list or not).
> (require typed/racket)
> (list* 4 5 6)
- : (List* Positive-Byte Positive-Byte Positive-Byte)
'(4 5 . 6)
> (list* 6)
- : Integer [more precisely: Positive-Byte]
6
> (:type
If you create the ssl-listener with reuse?=true instead, like this
(define listener (ssl-listen port 5 #f #t ctx))
does the problem go away? If so, the error might happen because the OS
reserves the port number for a while after the listener is closed; see the
paragraph about TIME_WAIT in the
One thing to check is the size of the resulting bytecode file. When I
compiled it, I got a 911 KB .zo file. So the most likely reason is that
your macros are just producing a lot of code.
You can run the macro profiler (eg, `raco macro-profiler aw-schema.rkt`) to
get a summary of what macros
I would suggest avoiding exceptions and continuations and have a separate
parameter[*] that holds the current unexpected character handler. You'll
still have to figure out what kind of thing it returns (void, or a
replacement character, or a new input port?), but you have to do that
anyway.
The
Based on what you have written so far, the `versions` macro has no
sub-expressions, so you shouldn't use `expr/c` at all. It requires version
bounds to be in the form of literal strings. So you could describe the
macro using a grammar as follows:
Expression ::= | (versions Version ...)
selection ...) #t]
> [_ #f])
>
> In this case, is it better form to use raise-syntax-error in a #:when
> pattern directive for a syntax class, or beneath a clause of syntax-parse?
> I suspect that syntax classes should not have an opinion about flow control.
>
> *~slg*
>
>
>
`make-ssl-connect@` automatically uses whatever versions of TLS the OpenSSL
library supports, including TLS 1.3 for recent versions of OpenSSL.
Ryan
On Fri, Dec 11, 2020 at 1:47 AM Sage Gerard wrote:
> I've seen articles say "SSL" when they mean "TLS". When I read the docs
> for
It's the consequence of two design goals:
1. The `module` form is separate from the `#%module-begin` syntax hook so
that the module's initial language can pick the hook macro that controls
the entire module body.
2. Racket's primitive syntax is designed so that it can be re-expanded.
(The
I'm trying to figure out how to use ffi/unsafe/os-thread to call a
long-running foreign function in an OS thread to avoid blocking other
Racket threads. I want to communicate the result of the foreign call to the
original Racket thread and have it wake up when the call completes.
Normally I could
On Tue, Jan 26, 2021 at 1:23 PM Matthew Flatt wrote:
> At Tue, 26 Jan 2021 10:25:42 +0100, Ryan Culpepper wrote:
> > This "works", but is it reliably safe to use place-channel-put from an OS
> > thread?
>
> No. It's not intended to work from an arbitrary OS threa
On Tue, Jan 26, 2021 at 3:06 PM Matthew Flatt wrote:
> At Tue, 26 Jan 2021 14:49:22 +0100, Ryan Culpepper wrote:
> > Thanks for the pointer! Those sound useful, but in the spirit of maximum
> > caution, is there a guarantee that the write to the box from the new OS
> > t
I'm not clear on what constraints you're working under with respect to
modules, but hopefully you can adapt this to your needs.
One option is to use a combination of `define-module-boundary-contract` (or
`define/contract`) and `define-match-expander` to bind a name that can be
used as a
Here are the three most convenient ways I know of to find that information
(which is "$RACKET/collects/racket/private/qq-and-or.rkt" in this specific
case):
If you use DrRacket, then open a file that uses `and`, right-click on an
occurrence of `and`, and choose "Open Defining File" (which changes
Sorry, I did miss those emails.
What do you see if you try (require taglib) after starting Racket with
logging for "ffi-lib"? For example:
$ PLTSTDERR="debug@ffi-lib" racket
unrelated logging
> (require taglib)
???
If it lists the file you pointed to in your email and says
It looks like there are two issues. One is the shared library's directory,
but the other is that the Racket library is looking for "libtag_c.so.0",
and you have "libtag_c.so.3.0". That is, it's looking for a version suffix
of "0", not "3.0" (see
Yes, since version 6.7 Racket automatically loads xrepl, which
automatically loads readline support (or libedit support, if readline-gpl
is not installed).
Ryan
On Sat, Mar 13, 2021 at 8:39 AM Tim Lee wrote:
> Is it possible that the documentation is outdated?
>
> According to
>
The `binary-rw` function from unstable/gui/redex library has some support
for optionally parenthesizing its arguments.
Ryan
On Wed, Feb 24, 2021 at 11:07 AM David Thrane Christiansen <
da...@davidchristiansen.dk> wrote:
> Hello all,
>
> I'm working on coding up a little language model in
Racket does not provide a way to do that.
You can use `openssl s_client -showcerts -connect host:port < /dev/null` to
get the server's certificate chain in PEM form (with other logs around it).
Of course, an attacker could intercept the connection and send you their CA
certificate instead. It
Yes, that's right.
Ryan
On Mon, Apr 12, 2021 at 4:23 PM Sage Gerard wrote:
> Understood, thank you. By "trusted location," do you mean a server with a
> certificate that operating systems already trust?
> On 4/12/21 10:15 AM, Ryan Culpepper wrote:
>
> Racket doe
Usually, if you want to refer to data files etc relative to the current
module's file, a good solution is to use `define-runtime-path`. It uses
`#%variable-reference` as the basis for its implementation, but adds other
features like cooperation with `raco exe` (see docs for
`define-runtime-path`
This is one of the few (IMO) legitimate uses of `eval`.
Your test suite should create a namespace, set it up by requiring your
language's module, and then eval interactions expressed as quoted
S-expressions or syntax objects. Here's a basic example for testing `match`:
#lang racket/base
101 - 160 of 160 matches
Mail list logo