Re: [racket-users] Hygiene for a curried macro

2020-09-30 Thread Ryan Culpepper
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

Re: [racket-users] querying MS SQL Server with db-lib (ODBC)

2020-09-19 Thread Ryan Culpepper
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" > >

Re: [racket-users] querying MS SQL Server with db-lib (ODBC)

2020-09-19 Thread Ryan Culpepper
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

Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Ryan Culpepper
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

Re: [racket-users] Incorporating Markdown documents into Scribble

2020-09-13 Thread Ryan Culpepper
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

Re: [racket-users] difference in struct printing from default #:transparent versus make-constructor-style-printer

2020-09-03 Thread Ryan Culpepper
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

Re: [racket-users] Can Racket implement LockedMagicDoor example of MIXEDJAVA?

2020-08-12 Thread Ryan Culpepper
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

Re: [racket-users] Can Racket implement LockedMagicDoor example of MIXEDJAVA?

2020-08-11 Thread Ryan Culpepper
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

Re: [racket-users] macro hiding in raco expand

2020-08-10 Thread Ryan Culpepper
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

Re: [racket-users] ask the type of a value

2020-08-03 Thread Ryan Culpepper
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

Re: [racket-users] telling apart files ending with a newline

2020-07-30 Thread Ryan Culpepper
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

Re: [racket-users] Why am I not fully releasing this SSL listener?

2020-07-24 Thread Ryan Culpepper
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

Re: [racket-users] How can I increase expansion+compilation speed?

2020-07-20 Thread Ryan Culpepper
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

Re: [racket-users] Embedded racket (cs) question

2020-07-13 Thread Ryan Culpepper
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

Re: [racket-users] Changing the charset/encoding when using the db library

2020-07-11 Thread Ryan Culpepper
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,

Re: [racket-users] Are Regular Expression classes Unicode aware?

2020-07-11 Thread Ryan Culpepper
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

Re: [racket-users] Are Regular Expression classes Unicode aware?

2020-07-09 Thread Ryan Culpepper
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

Re: [racket-users] Re: DB hangs with postgres and broken network link

2020-07-03 Thread Ryan Culpepper
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

Re: [racket-users] Wills, plumbers, and checking if a port is closed

2020-06-30 Thread Ryan Culpepper
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)

Re: [racket-users] Re: note about parsing speed of xml vs sxml?

2020-06-28 Thread Ryan Culpepper
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

Re: [racket-users] Poor documentation of List*

2020-06-03 Thread Ryan Culpepper
`(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

Re: [racket-users] What is the purpose of "compact" code paths in print.c?

2020-05-28 Thread Ryan Culpepper
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

Re: [racket-users] Exception throwing in web-server

2020-05-25 Thread Ryan Culpepper
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 > >

Re: [racket-users] Re: Exception throwing in web-server

2020-05-25 Thread Ryan Culpepper
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

Re: [racket-users] Re: local variables are hyperlinked in scribble/manual

2020-05-25 Thread Ryan Culpepper
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

Re: [racket-users] Make your computer talk in Racket on Windows in 5 lines

2020-05-16 Thread Ryan Culpepper
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.

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

2020-03-25 Thread Ryan Culpepper
) '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

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)

Re: [racket-users] Implementation of paraeters

2020-03-02 Thread Ryan Culpepper
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

Re: [racket-users] How to convert String to Integer

2020-02-11 Thread Ryan Culpepper
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 >

Re: [racket-users] Rolling dice game

2020-02-03 Thread Ryan Culpepper
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

Re: [racket-users] Opening unix domain socket with SOCK_SEQPACKET in Racket?

2020-01-28 Thread Ryan Culpepper
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

Re: [racket-users] Create an identifier in syntax

2020-01-23 Thread Ryan Culpepper
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

Re: [racket-users] Help me understand FFI callouts in this context?

2019-10-24 Thread Ryan Culpepper
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:

Re: [racket-users] How do I secure secrets in memory?

2019-09-27 Thread Ryan Culpepper
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

Re: [racket-users] syntax-parse ellipsis question

2019-09-21 Thread Ryan Culpepper
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

Re: [racket-users] Racket Jupyter/nextJournal

2019-08-14 Thread Ryan Culpepper
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, 

Re: [racket-users] Name of undefined identifier as string in macro

2019-08-03 Thread Ryan Culpepper
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

Re: [racket-users] Can I use the macro stepper to debug an infinite expansion loop?

2019-07-29 Thread Ryan Culpepper
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

Re: [racket-users] DrRacket UI question ...

2019-07-21 Thread Ryan Culpepper
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

[racket-users] CFP: 4th Workshop on Meta-Programming Techniques and Reflection (Meta'19), Co-located with SPLASH 2019

2019-07-15 Thread Ryan Culpepper
Scholliers, Ghent University ### Program Committee Nada Amin, University of Cambridge, UK Edwin Brady, University of St Andrews, UK Andrei Chis, Feenk, Switzerland David Thrane Christiansen, Galois, Portland, Oregon, USA Tom Van Cutsem, Bell Labs, Belgium Ryan Culpepper, Czech Technical University

Re: [racket-users] problem with current-error-port in scribble interaction

2019-06-27 Thread Ryan Culpepper
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

Re: [racket-users] Racket SIGSEGV during FFI call

2019-06-26 Thread Ryan Culpepper
On 6/26/19 6:34 AM, Christopher Howard wrote: Hi, I have a project going to make Racket bindings to the libhackrf C library installed on my Debian 9 system. I have successfully made and used bindings to around a dozen procedures in the library. However, when I get to the first really important

Re: [racket-users] exercise 1, racket school 2018

2019-06-17 Thread Ryan Culpepper
On 6/17/19 4:20 PM, Robert Girault wrote: I was able to do the first half of exercise 1 (see sources at the end of this message) --- write a macro computing some information at run-time. The second half is to write the same macro, but computing some information at compile-time --- I couldn't do

Re: [racket-users] Getting JSON to work with the DB module

2019-04-23 Thread Ryan Culpepper
It is not possible, unfortunately. You must do the conversion to and from strings yourself. I've thought about adding a hook for additional conversions based on declared types, but there's no declared type information at all for parameters, and the declared type for results is fragile: a

Re: [racket-users] how do I clear this FFI-related build error?

2019-04-23 Thread Ryan Culpepper
On 4/23/19 23:14, Matthew Butterick wrote: Some code relies on the `harfbuzz` library, like so: (define-runtime-lib harfbuzz-lib   [(unix) (ffi-lib "libharfbuzz" '("1" ""))]   [(macosx) (ffi-lib "libharfbuzz.0.dylib")]   [(windows) (ffi-lib "libharfbuzz-0.dll")]) Though this works on my

Re: [racket-users] db module 'query' does not return insert-id

2019-04-23 Thread Ryan Culpepper
On 4/22/19 20:36, David Storrs wrote: > (require db) > (define db (postgresql-connect  ...args...)) > (simple-result-info (query db "insert into collaborations (name) values ('foojalskdsfls')")) '((insert-id . #f) (affected-rows . 1)) From the docs on the 'simple-result' struct:

Re: [racket-users] db module + SQLite driver + 'ON CONFLICT' = syntax error

2019-04-19 Thread Ryan Culpepper
On 4/18/19 23:53, David Storrs wrote: On Thu, Apr 18, 2019 at 5:42 PM Ryan Culpepper <mailto:ry...@ccs.neu.edu>> wrote: Use "INSERT OR IGNORE" instead. See https://sqlite.org/lang_conflict.html, 3rd paragraph. Yep.  Unfortunately, this was a simplified case of w

Re: [racket-users] db module + SQLite driver + 'ON CONFLICT' = syntax error

2019-04-19 Thread Ryan Culpepper
Use "INSERT OR IGNORE" instead. See https://sqlite.org/lang_conflict.html, 3rd paragraph. Ryan On 4/18/19 23:28, David Storrs wrote: On Thu, Apr 18, 2019 at 4:48 PM Jon Zeppieri > wrote: It might well be the SQLlite version. This is a pretty new feature.

Re: [racket-users] Help with evaluation of examples in Scribble

2019-03-11 Thread Ryan Culpepper
On 3/10/19 4:16 PM, Matt Jadud wrote: Oh! Thank you, Matthew. I see. So, I'm running into the sandbox... as in, the sandbox is doing what it should, and as a result, it is preventing the networked accesses that I've added to my documentation. That's awfully obvious (now that it is put that

Re: [racket-users] How do I (de)serialize PKI keys for storage?

2018-12-18 Thread Ryan Culpepper
On 12/18/18 23:36, David Storrs wrote: I'm trying to persist public/private keys to our database and having some trouble: Welcome to Racket v6.11. > (require crypto crypto/gcrypt) > (crypto-factories gcrypt-factory) > (define key (generate-private-key 'rsa)) > key (object:gcrypt-rsa-key%

Re: [racket-users] Creating truly unique instances of structure types?

2018-11-06 Thread Ryan Culpepper
On 11/6/18 11:31 AM, Alexis King wrote: On Nov 5, 2018, at 20:01, Ryan Culpepper wrote: You could use a chaperone to prohibit `struct-info` Good point! I had forgotten that `struct-info` is a chaperoneable operation. This isn’t ideal, though, since I don’t think `struct-info` is ever

Re: [racket-users] Creating truly unique instances of structure types?

2018-11-05 Thread Ryan Culpepper
On 11/5/18 5:26 PM, Alexis King wrote: To my knowledge, there are two main techniques for creating unique values in Racket: `gensym` and structure type generativity. The former seems to be bulletproof — a value created with `gensym` will never be `equal?` to anything except itself – but the

Re: [racket-users] Compilation/Embedding leaves syntax traces

2018-09-25 Thread Ryan Culpepper
On 9/25/18 1:11 PM, Alexis King wrote: [] Personally, I would appreciate a way to ask Racket to strip all phase ≥1 code and phase ≥1 dependencies from a specified program so that I can distribute the phase 0 code and dependencies exclusively. However, to my knowledge, Racket does not

Re: [racket-users] Using match on hash tables with optional keys

2018-08-31 Thread Ryan Culpepper
On 8/31/18 4:28 AM, Greg Hendershott wrote: A general trick for optional values with match is something like (or pat (app (λ _ default-value) pat)). But that doesn't work for hash-table which uses [pat path] for each mapping. (At least I couldn't see how.) Here's _a_ way you could write this as

Re: [racket-users] Where to put scribblings in 'multi package?

2018-08-29 Thread Ryan Culpepper
On 08/29/2018 12:37 PM, Erich Rast wrote: I have a preliminary scribbling for the manual of a multi source package, but it doesn't show up in Racket's main documentation when I install the package locally. Here is the directory structure: appy | |--info.rkt |--appy | |--

Re: [racket-users] FFI Trouble (file streams, variadic functions)

2018-08-27 Thread Ryan Culpepper
. -Philip On Mon, Aug 27, 2018 at 8:03 AM Ryan Culpepper <mailto:ry...@ccs.neu.edu>> wrote: On 08/27/2018 02:13 PM, Philip McGrath wrote: > I am hoping for some help debugging a problem I'm having writing FFI > bindings for libxml2. > > I am tryin

Re: [racket-users] FFI Trouble (file streams, variadic functions)

2018-08-27 Thread Ryan Culpepper
On 08/27/2018 02:13 PM, Philip McGrath wrote: I am hoping for some help debugging a problem I'm having writing FFI bindings for libxml2. I am trying to use the function `xmlValidateDtd`, which (predictably) validates an XML document against a DTD. To support error reporting, the first

Re: [racket-users] Confusion about attributes of struct-id

2018-08-16 Thread Ryan Culpepper
On 08/16/2018 06:04 PM, David Storrs wrote: The struct-id syntax class from syntax/parse/class/struct-id is puzzling me.  Given this preamble: (require (for-syntax syntax/parse/class/struct-id syntax/parse syntax/parse/experimental/template

Re: [racket-users] ssax:make-parser

2018-05-16 Thread Ryan Culpepper
On 05/15/2018 11:36 PM, John Clements wrote: Interestingly, it looks like this change is a deliberate one, made by Ryan Culpepper back in 2011. Here’s the relevant commit: commit 738bf41d106f4ecd9111bbefabfd78bec8dc2202 Author: Ryan Culpepper <ry...@racket-lang.org> Date: Tue Nov 22 02

Re: [racket-users] Jupyter Racket Kernel - iracket

2018-05-03 Thread Ryan Culpepper
On 05/01/2018 09:33 PM, Graham Dean wrote: PR submitted :) PR merged. Thanks! 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

Re: [racket-users] how to match unbound identifier as literal in `syntax-parse`?

2018-04-03 Thread Ryan Culpepper
Here's one way: (~and z:id (~fail #:unless (free-identifier=? #'z #'zeta) "expected the identifier `zeta`")) Another way is to make a syntax class (either specifically for `zeta` or parameterized by the identifier) that does the same check. Ryan On 4/3/18 8:33 AM,

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

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 [(_

Re: [racket-users] Storing JSON into PostgreSQL 10

2018-03-16 Thread Ryan Culpepper
On 03/16/2018 11:28 PM, David Storrs wrote: I'm noticing that when I store jsexpr?s into PostgreSQL 10 I end up with them as strings, not as actual JSONB data.  I've read the docs and tried every combination of typecasting / methods of writing that I can think of but nothing ends up working. 

Re: [racket-users] Output Port Shenanigans

2018-03-14 Thread Ryan Culpepper
On 03/14/2018 06:16 PM, Lehi Toskin wrote: On Wednesday, March 14, 2018 at 10:10:20 AM UTC-7, Matthew Butterick wrote: probably it requires a combination of peek + read, or copying the port. That may be true, but I've been messing around getting *anything* to print from inside that

Re: [racket-users] syntax/parse is not hygienic

2018-03-05 Thread Ryan Culpepper
On 03/04/2018 09:40 PM, Alexis King wrote: [... context ...] Still, with all this context out of the way, my questions are comparatively short: 1. Is this lack of hygiene well-known? I did not find anything in Ryan’s dissertation that explicitly dealt with the question, but I

Re: [racket-users] Generating automatic testsuites using a macro

2018-02-23 Thread Ryan Culpepper
On 2/23/18 3:36 PM, 'Paulo Matos' via Racket Users wrote: On 23/02/18 15:13, 'Paulo Matos' via Racket Users wrote: That's true, thanks for pointing it out. I only just noticed you could generate test-suites and test-cases at runtime with make-testcase and make-testsuite. Therefore I will

Re: [racket-users] whither `splicing-parameterize`? or am I doing it wrong?

2018-01-24 Thread Ryan Culpepper
It might make sense to `(set! new-parameterization #f)` at the end so that the parameterization (and the values it holds) can be GC'd sooner when splicing-parameterize is used at top level or module level. Ryan On 1/24/18 6:00 AM, Alexis King wrote: Here is an implementation of a version of

Re: [racket-users] Cryptography routines in Racket

2017-12-31 Thread Ryan Culpepper
I have a crypto library in progress that I haven't released yet. The repo is at https://github.com/rmculpepper/crypto, but the repo is missing a lot of local commits and I won't be able to fix it until mid-January. If you want to try out the old version, you'll also need asn1-lib from

Re: [racket-users] confused about raco check-requires error

2017-11-21 Thread Ryan Culpepper
On 11/21/17 2:57 AM, Alex Harsanyi wrote: I'm trying to use the "raco check-requires" command to determine which requires I should remove from my source files, and the command fails when I include one of my files (the application compiles and runs fine). I managed to reproduce the case as

Re: [racket-users] okay for the stepper to blanket disarm all syntax?

2017-10-16 Thread Ryan Culpepper
On 10/16/2017 12:38 PM, 'John Clements' via users-redirect wrote: I’m in the process of trying to update the stepper to handle check-random, and I’m somewhat baffled by the amount of difficulty I’m running into in and around ‘syntax-disarm’. It occurs to me that it would probably be simpler

Re: [racket-users] Re: code reflection

2017-10-14 Thread Ryan Culpepper
On 10/14/2017 05:01 AM, George Neuner wrote: On 10/14/2017 3:00 AM, Jack Firth wrote: So is there a way ... from normal code ... to get at the locals of functions higher in the call chain?  Or at least the immediate caller? Some reflective capability that I haven't yet

Re: [racket-users] syntax-parse attributes in macro-generated macros

2017-09-18 Thread Ryan Culpepper
On 09/17/2017 01:00 AM, Philip McGrath wrote: [...] I have a macro like `example-macro`, but more complicated and with many, many more potential keyword arguments, so I wanted to write a macro that would let me define `example-macro` with a more declarative syntax, like this:

Re: [racket-users] Efficient & "nice" communication mechanism between Racket and other languages

2017-09-08 Thread Ryan Culpepper
On 09/07/2017 12:11 PM, Brian Adkins wrote: I'm considering having a group of programmers create micro-services in various programming languages to be glued together into a single application. I would like a communication mechanism with the following characteristics: * Already supported by

Re: [racket-users] Generate function defintions at compile time

2017-08-22 Thread Ryan Culpepper
On 08/22/2017 05:29 PM, hiph...@openmailbox.org wrote: Hello, I am writing a Racket library which will make it possible to control the Neovim text editor using Racket. People will be able to use Racket to control Neovim, as well as write plugins for Neovim in Racket.

Re: [racket-users] "Test did not clean up resources" message from GUI test runner

2017-08-21 Thread Ryan Culpepper
On 08/20/2017 09:28 PM, Alex Harsanyi wrote: I just noticed that the GUI test runner displays "test did not clean up resources" messages on my tests, but it is not clear to me what resources are not being cleaned up. I tried to reproduce the problem in the following test case: #lang

Re: [racket-users] Anyone using MongoDB 3.2.15 with DrRacket 6.9?

2017-08-07 Thread Ryan Culpepper
On 08/06/2017 05:49 PM, Cecil McGregor wrote: [...] What are other people using for a NoSQL racket experience? Are you looking for no schema or no ACID? If the latter, the git version of the db library now has experimental support for Apache Cassandra. Ryan -- You received this message

Re: [racket-users] chaining operations on bignum not scalable

2017-07-29 Thread Ryan Culpepper
On 07/29/2017 02:48 PM, rom cgb wrote: Hi, Probably due to all operations not being in-place, chaining operations on bignums is very costful. for example, using bitwise-bit-field[1] on bignums is atrocious. I also tried (define (reverse-bits n) (for/fold ([reversed 0])

Re: [racket-users] How do db handles interact with threads and parameters

2017-07-24 Thread Ryan Culpepper
On 7/24/17 9:11 AM, George Neuner wrote: Hi David, On 7/24/2017 8:18 AM, David Storrs wrote: What happens in the following code? (define dbh (postgresql-connect ...)) ;; Use the DBH in a new thread (thread (thunk (while ...some long-running condition... (sleep 1) ; don't flood the DB

Re: [racket-users] Struct declaration conflict if a file is required implicitly

2017-07-23 Thread Ryan Culpepper
On 07/23/2017 07:26 AM, Alejandro Sanchez wrote: Hello everyone, I am working on this project: https://gitlab.com/HiPhish/MsgPack.rkt/ I am writing test cases and I ran into a problem with my ‘ext’ structure. It is declared in the file ‘msgpack/main.rkt’, which is required in the file

Re: [racket-users] Catching syntax errors

2017-07-01 Thread Ryan Culpepper
Use `convert-syntax-error` from the `syntax/macro-testing` module: http://docs.racket-lang.org/syntax/macro-testing.html#(form._((lib._syntax%2Fmacro-testing..rkt)._convert-syntax-error)) Ryan On 06/30/2017 04:47 PM, Sam Waxman wrote: Hello, I'm trying to test whether or not certain

Re: [racket-users] break-thread + thread-wait can't be handled

2017-05-03 Thread Ryan Culpepper
On 5/3/17 10:41 PM, Eric Griffis wrote: Hello, I'm having trouble catching "terminate break" exceptions when combining break-thread with thread-wait. MWE 1: (with-handlers ([exn:break:terminate? writeln]) (let ([t (thread (lambda () (thread-wait (current-thread])

Re: [racket-users] Setting parameters between files does not work as expected

2017-04-25 Thread Ryan Culpepper
You might be interested in `dsn-connect` and the `data-source` structure (http://docs.racket-lang.org/db/connect.html#%28part._.Data_.Source_.Names%29). Ryan On 4/25/17 8:18 PM, David Storrs wrote: Great. Thanks, Phillip! On Tue, Apr 25, 2017 at 2:14 PM, Philip McGrath

Re: [racket-users] Reporting exceptions as though they came from the caller

2017-03-31 Thread Ryan Culpepper
On 03/31/2017 04:00 PM, David Storrs wrote: Imagine I have the following trivial module (ignore that things are defined out of sequence for clarity): #lang racket (define (foo arg) (_baz arg) ; do some checking, raise an exception if there's a problem ...do stuff... ) (define (bar

[racket-users] Re: prepared queries

2017-03-17 Thread Ryan Culpepper
On 3/15/17 12:41 AM, George Neuner wrote: Hi Ryan, Hope you enjoyed the snow day. Lost power here for a while, but fortunately no damage. I did :) My neighborhood didn't get much snow by volume, but what it did get was then rained/sleeted nearly into ice. On 3/13/2017 11:09 PM, Ryan

[racket-users] Re: prepared queries

2017-03-13 Thread Ryan Culpepper
On 03/13/2017 06:30 PM, George Neuner wrote: Hi Ryan, On 3/13/2017 5:43 PM, Ryan Culpepper wrote: Racket's db library always prepares a statement before executing it, even if there are no query parameters. When allowed, instead of closing the prepared statement immediately after executing

Re: [racket-users] Virtual connections, threads, and DSN extraction, oh my!

2017-03-13 Thread Ryan Culpepper
On 03/13/2017 04:56 PM, George Neuner wrote: On 3/13/2017 3:41 PM, David Storrs wrote: On Mon, Mar 13, 2017 at 2:04 PM, Ryan Culpepper <ry...@ccs.neu.edu <mailto:ry...@ccs.neu.edu>> wrote: If you are using `prepare` just for speed, it might help to know that most base conn

Re: [racket-users] Virtual connections, threads, and DSN extraction, oh my!

2017-03-13 Thread Ryan Culpepper
On 03/13/2017 03:16 PM, David Storrs wrote: [...] On Mon, Mar 13, 2017 at 2:49 PM, George Neuner > wrote: - It's also fine to pass the VC into other threads. It will be shared state between the threads, but the CP will keep their

Re: [racket-users] Virtual connections, threads, and DSN extraction, oh my!

2017-03-13 Thread Ryan Culpepper
On 03/13/2017 12:49 PM, David Storrs wrote: [...] Assuming I've understood all that correctly, my last question would be how to get around the 'can't do prepare with a virtual connection' issue for situations where I've been passed a connection (perhaps from third party code) and it might or

Re: [racket-users] Detecting EOT when reading a TCP port

2017-02-22 Thread Ryan Culpepper
read-line returns eof when the port is closed, which is completely different from sending byte 04 (or any other byte or sequence of bytes) over the port. ;; set up {client,server}-{in,out} ports (write-byte 4 client-out) (flush-output client-out) (read-byte server-in) ;; => 4

Re: [racket-users] Fun with keyword-apply

2017-02-08 Thread Ryan Culpepper
On 02/08/2017 04:41 PM, Dan Liebgold wrote: Hi all - I have an odd syntax I'm trying to maintain backward compatibility with, but I'd like to take advantage of keyword parameters to accommodate the presence/absence/ordering of those parameters. Here's an example of what I'm trying to do:

Re: [racket-users] Re: How to change text alignment in a text-field% and how to make text-field% read-only but still copy-able

2016-12-03 Thread Ryan Culpepper
On 12/03/2016 02:15 PM, Winston Weinert wrote: I managed to resolve the alignment question with the following lines: (define e (send my-text-field get-editor)) (send e auto-wrap #t) (send e set-paragraph-alignment 0 'center) However, I'm still at a loss how to make the text-field% read-only

[racket-users] server downtime

2016-11-20 Thread Ryan Culpepper
We will be performing maintenance on one of the PLT servers Monday afternoon. Some services will be unavailable during that time, including PLaneT, mailing list archives, and the old bug database. The main web pages, the package server, and the user and dev mailing lists should be unaffected.

Re: [racket-users] syntax-class composed of literals

2016-11-16 Thread Ryan Culpepper
On 11/16/2016 08:24 PM, Dan Liebgold wrote: FWIW, Eric Dobson wrote a very nice `define-literal-syntax-class` macro that is used extensively inside TR. https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/utils/literal-syntax-class.rkt Hmm... I can't quite

Re: [racket-users] syntax-class composed of literals

2016-11-16 Thread Ryan Culpepper
On 11/16/2016 07:51 PM, Vincent St-Amour wrote: FWIW, Eric Dobson wrote a very nice `define-literal-syntax-class` macro that is used extensively inside TR. https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/utils/literal-syntax-class.rkt Its companion

Re: [racket-users] syntax-class composed of literals

2016-11-16 Thread Ryan Culpepper
On 11/16/2016 07:42 PM, Dan Liebgold wrote: Literal sets can include datum-literals: (define-literal-set lits #:datum-literals (a b c) (d e)) Ah, oops I missed that keyword parameter. For question 1, that's probably the best way. If you want to suppress the printing of all of the

Re: [racket-users] syntax-class composed of literals

2016-11-16 Thread Ryan Culpepper
On 11/16/2016 06:11 PM, Dan Liebgold wrote: Hi, A couple questions about literals in syntax-parse: 1. I'd like to make a syntax-class that is just a set of literals (with a clear error for something not matching any literal). Is there a better way than this: http://pasterack.org/pastes/86722

Re: [racket-users] find-seconds daylight saving

2016-11-08 Thread Ryan Culpepper
On 11/08/2016 11:24 PM, George Neuner wrote: [...] - I need to turn the UTC datetimes on all the results back into local times with the right time zone Does the following do what you want? (require srfi/19) ;; date-at-tz : Date Integer -> Date ;; Returns date of equivalent instant in

Re: [racket-users] postgresql sql-timestamp problem - test.rkt (0/1)

2016-11-06 Thread Ryan Culpepper
On 11/06/2016 09:42 PM, George Neuner wrote: [...] The following in Racket gets it wrong. e.g., [...] => #(struct:sql-timestamp 2016 5 1 5 0 0 0 0) -> "2016-05-01 05:00:00Z" "2016-05-01 00:00:00-05" -> #(struct:sql-timestamp 2016 5 1 0 0 0 0 -18000) #(struct:sql-timestamp 2016 6 12 5 0 0 0 0)

  1   2   >