Re: [racket-users] Standardizing the threading macro and organizing packages

2016-01-31 Thread Alexis King
> On Jan 29, 2016, at 21:55, Brian Adkins wrote: > > Was any consensus reached on this? I've been working through some exercises > in Racket that a friend is implementing in Elixir, and I just came across a > "method chaining" situation. I ended up simply writing a

Re: [racket-users] Re: Nesting structs – I'm confused!

2016-02-23 Thread Alexis King
> I'm not sure whether I should have known that the #:auto value would be the > same object, so to speak, across all instances. Is there a bigger picture, in > that respect, or is it just that structs happen to work that way, and other > data structures might not? A part of me just wants to

[racket-users] Using the web server without continuations?

2016-01-19 Thread Alexis King
I’ve been using the Racket web server, and I’m very pleased with how easy it’s been to get a simple working application. However, so far, I haven’t been using send/suspend or any of the other features that leverage continuations. I’ve been wondering: since I’m not using send/back (just returning

Re: [racket-users] Re: #"HTTP/1.1 500 Okay" ??

2016-01-23 Thread Alexis King
For what it’s worth, I ran into this myself during my recent experimentation with the webserver, and I was similarly surprised. Even seeing something like “200 Okay” struck me as different, since most servers seem to use the “200 OK” spelling. I’d always been curious about how those strings were

Re: [racket-users] Using the web server without continuations?

2016-01-19 Thread Alexis King
Perfect! That was my hope. One more question: if I did want to opt-in to continuations for just a single portion of my application, could I? The way I’ve been structuring my application is to have a module that serves as an entry point that calls serve/servlet and passes a dispatch function

[racket-users] Substitude a different value when providing an identifier?

2016-02-18 Thread Alexis King
I have a macro that creates a transformer binding. This binding has prop:procedure on it, so when used, it functions as a macro and expands into something else. This works great, but I have another requirement: when this binding is provided, I actually want to provide an entirely different value

[racket-users] Requiring parent modules within module* forms?

2016-03-11 Thread Alexis King
The documentation for module* would seem to indicate that submodules declared with module* can require their parent modules: > Like module, but only for declaring a submodule within a module, > and for submodules that may require the enclosing module. However, this doesn’t seem to actually work

Re: [racket-users] one-source-file package format

2016-03-12 Thread Alexis King
It might be worth noting that there was a thread on the racket-dev list a little while back that covered a similar topic about submodules and search paths: https://groups.google.com/d/msg/racket-dev/8BFT-RBDp9E/Y1xOCyf3nIMJ > On Mar 12, 2016, at 10:22, Jay McCarthy

Re: [racket-users] How to call a macro on each element of a list

2016-03-30 Thread Alexis King
> However, my problem is still not resolved because in all the suggestions > above, I still need to explicitly pass all the arguments to mysyn such as: > (mysyn 1 2 3). Is there a way to pass a list l by its name and not its > values. > For instance, If l is '(1 2 3) > I want to be able to

Re: [racket-users] IO in racket is painful

2016-03-22 Thread Alexis King
Honestly, judging from the responses in this thread, it would seem there may be a hole in Racket’s toolbox. Nothing I’ve seen so far is particularly stellar, especially since this is a problem that does not seem like it should be hard. It may be overkill for this use case, but I would probably

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Alexis King
> That's why I think of `match` as special: it has its own means of extending > its interface, namely with match expanders. > > What I'm curious about is the more general situation of composing macros that > hold identifiers. It is my understanding that this is what Jack Firth’s

[racket-users] Converting a list to a syntax object non-recursively?

2016-05-06 Thread Alexis King
Is there any way to create a new syntax object containing a list without recursively converting the list’s elements to syntax objects as well? I have some code where I wanted to use syntax objects as a convenient mechanism to tag arbitrary datums with source location information (and they will be

[racket-users] More DrRacket binding arrow woes

2016-05-07 Thread Alexis King
This is not the first time I have asked about the binding arrows on this mailing list, but I seem to have run into a new problem that has me completely stumped. I have written a #lang that uses an entirely custom implementation of read-syntax (it does not wrap Racket’s read-syntax in any way), and

Re: [racket-users] More DrRacket binding arrow woes

2016-05-07 Thread Alexis King
> So, the bindings are fine, and the syntax-original? property is fine. Is the > source location good, including the `syntax-source` field? > > I had a similar issue once, and it turned out that it was because the > `syntax-source` part of the source location was wrong. I had been using >

Re: [racket-users] Converting a list to a syntax object non-recursively?

2016-05-07 Thread Alexis King
> I'm not sure if this helps you, but if you have complete control over what > happens to it, you could wrap it in a struct first Yeah, that’s a good point, and it’s one I actually did think of after sending the email, though. Unfortunately, at that point, there’s little reason for me to be

[racket-users] Handling disappeared uses from within syntax classes

2016-07-26 Thread Alexis King
It is not uncommon for me, as a macro writer, to need to perform syntax-local-value on some identifier, then record the disappeared use in the resulting expansion. The syntax-local-value/record helper makes this much easier, but it still requires some manual failure logic. I was thinking it would

[racket-users] HTML sanitization

2016-07-16 Thread Alexis King
Has anyone written an HTML sanitizer in Racket? A naïve one is not too difficult, given that it’s possible to create a very simple whitelist of elements and attributes, but getting it completely right isn’t as easy at it seems. For example, I’d like to allow elements for the most part, but I’d

Re: [racket-users] Macros that use with-handlers

2016-07-16 Thread Alexis King
I don’t think you want to use a macro to do this. You could detect, at compile-time, whether or not the provided argument is a string within the macro. The best way to do this would probably be to use the “str” syntax class, which detects strings within a syntax-parse pattern. However, this has a

Re: [racket-users] Run Button interaction

2016-08-08 Thread Alexis King
> On Aug 8, 2016, at 1:19 AM, Normal Loone wrote: > > I tried using override instead of augment, and it works. > Problem is: It overrides it now ofc, which means the program is no longer > evaluated. If you want to override a method, but still perform its behavior,

Re: [racket-users] Require Transformers

2016-06-29 Thread Alexis King
Just for fun, if you want to be a little bit naughty, you can define a custom #%top transformer that will make unbound identifiers that are fully qualified automatically resolve to their imported values. Just do a little bit of processing on the unbound identifiers: #lang racket (require

Re: [racket-users] Confused about the get-info function for #langs

2016-06-29 Thread Alexis King
First of all, +1 for this stuff being confusing. I’ve been implementing a language lately that needs its own lexer, reader, runtime configuration, etc., and while the Racket docs are usually very good, this stuff is sprawled out across the guide, the reference, the docs for syntax/module-reader,

Re: [racket-users] Can’t get `raco setup --mode errortrace` to work

2017-02-01 Thread Alexis King
> On Feb 1, 2017, at 3:02 PM, Dan Liebgold > wrote: > > Actually I mean -j to racket.exe, as in --no-jit (for your last > invocation) Ah! Unfortunately, no, that does not help; the errortrace instrumentation never actually gets inserted at all when doing a parallel

Re: [racket-users] Producing syntax from a submodule

2017-02-01 Thread Alexis King
Syntax templates used in syntax transformers are effectively at “phase -1” relative to the phase they are defined at. For that reason, you need to insert a for-template require in your utils submodule: (module utils racket (require (for-template racket/base)) (provide bar-impl)

[racket-users] Can’t get `raco setup --mode errortrace` to work

2017-01-31 Thread Alexis King
I’m working on a project where having errortrace would be nice, but it’s a little too big to want to run without compiling anything at all. From the errortrace documentation, it seemed like `raco setup --mode errortrace` was just what I wanted, so I gave it a shot with a simple program. Here are

Re: [racket-users] Can’t get `raco setup --mode errortrace` to work

2017-02-01 Thread Alexis King
> On Feb 1, 2017, at 10:45 AM, Dan Liebgold wrote: > > Out of curiosity, does the -j option help here? Yes, good suggestion; it seems like maybe --mode doesn’t work with the parallel build. However, using -j 1 produces an error: $ raco setup -j 1 --mode

[racket-users] How does syntax-local-expand-expression work?

2017-01-27 Thread Alexis King
Given that Turnstile makes extremely heavy use of local-expand, it’s easy to imagine that the macro expander could traverse a single piece of syntax dozens of times when it really only needs to traverse it once. Looking at the docs, it seems like syntax-local-expand-expression is precisely

Re: [racket-users] whether to use gui framework

2016-09-06 Thread Alexis King
I don’t use the GUI stuff much, so take this with a grain of salt, but my guess is that you will definitely want to use framework if you need syntax coloring. The color:text% component does a lot of work to implement syntax coloring on top of the relatively primitive text% component (which is

Re: [racket-users] Using the base language’s get-info function with make-meta-reader

2016-09-08 Thread Alexis King
Alright, I’m finally taking a look at this (and looping the users list back in). I think, unfortunately, your (Alex’s) change isn’t quite sufficient: having access to the get-info function isn’t enough. The read and read-syntax functions need access to the lambda returned by the base language’s

Re: [racket-users] syntax-properties, local-expand, and a struct

2016-09-28 Thread Alexis King
> Unfortunately, there are probably many such buggy macros, since I don't think > most people have a clear idea when to copy properties when using > datum->syntax. This is key, and unfortunately I’m becoming more and more convinced that there’s no one good answer in the presence of the

[racket-users] Using the base language’s get-info function with make-meta-reader

2016-08-24 Thread Alexis King
When using make-meta-reader from syntax/module-reader, is it possible to access the “base” language’s get-info function from within the read or read-syntax wrapping functions? I’d like to adjust how a particular meta language is read based on a property on the base language. Currently, my guess

Re: [racket-users] #%plain-app prints as #%app, hindering debugging

2016-09-28 Thread Alexis King
The #%plain-app identifier is just a renamed version of #%app from '#%kernel, so it’s actually named #%app when initially defined. The racket/base version of #%app exists to handle keyword arguments, so racket/base exports the underlying version of #%app as #%plain-app. Of course, fully expanded

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Alexis King
> On Oct 25, 2016, at 1:33 PM, Dan Liebgold wrote: > > I use -I, -l, then -i but the resulting REPL has no #%top-interaction > bound... You need to put the -i flag first, so the command should look like: racket -iI -l The reason for this is buried towards

Re: [racket-users] Re: racket command line parameter

2016-10-25 Thread Alexis King
> On Oct 25, 2016, at 2:09 PM, Ryan Culpepper wrote: > > It sounds like you want the behavior of the `enter!` command. You can kind of > do that from the command line like this: > > racket -e '(enter! "your-module.rkt")' -i > > Ryan Note that if you have a #lang that

Re: [racket-users] racket command line parameter

2016-10-25 Thread Alexis King
The short answer is “no, but you can use -I to achieve a similar effect for some languages”. The longer answer is as follows. The way the REPL is configured is different from the way modules’ readers are configured. The #lang protocol is relatively simple — you provide read and read-syntax — but

Re: [racket-users] Identifier equality of identifiers stashed in preserved syntax properties

2016-10-26 Thread Alexis King
> On Oct 25, 2016, at 17:27, Ryan Culpepper wrote: > > Consider that (eval (list 'quote #'+)) also evaluates to a symbol, for about > the same reason. Yes, this does make sense, even if I couldn’t put it quite so nicely. :) > Try local-expanding either of these terms

[racket-users] Identifier equality of identifiers stashed in preserved syntax properties

2016-10-25 Thread Alexis King
In the language I am working on, I store identifiers in preserved syntax properties to attach type information to pieces of syntax. More specifically, I store identifiers inside prefab structs, which are then stored within preserved syntax properties. This seems to work fine when my program spans

Re: [racket-users] Identifier equality of identifiers stashed in preserved syntax properties

2016-10-25 Thread Alexis King
That makes sense; thank you for your quick reply. It might be possible to do something like what you describe, but I do have a little more context that makes this sort of tricky. I’m trying to not just store identifiers but also store prefab structs containing identifiers. The issue I’m running

Re: [racket-users] Identifier equality of identifiers stashed in preserved syntax properties

2016-10-27 Thread Alexis King
As a small followup to this, I managed to come up with the following hacky workaround, which seems to be working alright so far. Specifically, it’s a function that converts arbitrary preservable values into expressions that evaluate to themselves: (define preservable-property->expression

Re: [racket-users] git-checkout-credentials

2016-10-28 Thread Alexis King
The `raco pkg config` options are documented here: http://docs.racket-lang.org/pkg/cmdline.html#%28part._raco-pkg-config%29 (It might be a good idea to add the names of the individual options to the index so they can be searchable.) Specifically, the format is a series of username:password

Re: [racket-users] macros

2016-10-27 Thread Alexis King
First of all, #lang racket is not Scheme, nor does it claim to be. However, #lang r5rs does attempt to be Scheme, and it exhibits the same behavior as #lang racket in this case, so your question is still valid. I would argue that, in this case, Racket gets it right, and Bigloo and Kawa are

Re: [racket-users] Re: cvs-reading ?

2016-10-30 Thread Alexis King
This appears to be an issue with the comments on the first three lines interfering with the shebang line. Don’t include them, they’re only in the docs for illustrative purposes. In the meantime, I’ll update the documentation to remove that issue with the example. > On Oct 29, 2016, at 22:31,

[racket-users] Drawing arbitrary binding arrows with Check Syntax

2016-10-18 Thread Alexis King
I have a macro that does something that approximates binding. It looks like this: (∀ [α] (→ α α)) Obviously, I’d really like it if the αs had binding arrows drawn to them. The trouble, unfortunately, is that ∀ does not expand to a binding form at all; it is parsed in a single macro step to a

Re: [racket-users] unit testing syntax errors

2016-10-24 Thread Alexis King
Take a look at convert-compile-time-error and convert-syntax-error from syntax/macro-testing[1], which make it possible to defer syntax errors to runtime. The docs include examples for using them with rackunit’s check-exn form to make assertions about syntax errors. [1]:

Re: [racket-users] Error messages in DSL implementations

2016-10-24 Thread Alexis King
> On Oct 24, 2016, at 9:58 AM, Matthias Felleisen > wrote: > > This is an interesting class of errors. As Dimitry says, you might > be able to leave behind enough source code info when you generate > that code, so that it looks like > > (define foo (if (empty? blah) (error

Re: [racket-users] Drawing arbitrary binding arrows with Check Syntax

2016-10-19 Thread Alexis King
> On Oct 19, 2016, at 4:06 AM, Robby Findler > wrote: > > That's the best approach we currently have. Of course, we could support a new > property that was "connect srclocs" or something. Do you think it would make sense to have a property that uses

[racket-users] Contract on a parameter’s value as a function precondition?

2016-11-22 Thread Alexis King
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

Re: [racket-users] Contract on a parameter’s value as a function precondition?

2016-11-28 Thread Alexis King
That sounds promising, yes. Not being familiar with the guts of parameters, is there any way to implement this as a derived concept using the existing support in chaperone-procedure? As far as I can tell, parameters do not expose the continuation marks they use, and they also create thread cells,

Re: [racket-users] How to test that a file is syntactically correct, but don't run it

2016-11-26 Thread Alexis King
Many of the other answers here are good, but I want to try and give a couple more options and a little more context. First of all, in Racket, the phrase “syntactically correct” is a little bit vague. It could mean that a program is successfully parsed from text to s-expressions, which is the

Re: [racket-users] Contracts for functions that take only a rest arg

2016-11-01 Thread Alexis King
You have the order wrong for ->*. The #:rest option should come after the positional argument contracts, just before the return contract. Since this function has no positional optional arguments, you can either omit the optional positional argument contracts entirely: (->* () #:rest (listof

[racket-users] Properly annotating disappeared uses/bindings for substituted identifiers

2016-10-12 Thread Alexis King
I have a rather strange macro. My macro works just like lambda, except that it only accepts one argument, and inside the body of the lambda, it annotates all uses of that argument with a syntax property. The macro looks like this: (require (for-syntax racket/syntax

Re: [racket-users] syntax-property lost across module boundary (WAS: format-id doesn't preserve preserved?-edness of syntax-property?)

2016-12-13 Thread Alexis King
> On Dec 13, 2016, at 11:23 AM, 'William J. Bowman' via Racket Users > wrote: > > Notice that #'x is not the same identifier as x, and thus does not > have the same syntax-properties. I’m not convinced this is correct. If you insert println statements in the body

Re: [racket-users] ->i applies contract projections multiple times?

2016-12-15 Thread Alexis King
Many thanks to both of you for the explanation and examples. I admit I’ve seen that paper before, but I haven’t really taken the time to understand it. I haven’t spent the effort to understand all the notation being used, so much of the paper is pretty opaque to me. Maybe once I get some time I’ll

[racket-users] ->i applies contract projections multiple times?

2016-12-14 Thread Alexis King
This question comes from someone else on Stack Overflow, which they asked here: http://stackoverflow.com/q/41144374/465378 I think it’s likely that the people who can answer this are probably only on the mailing list, though, so I figured I’d ask it here. Basically, the ->i contract applies

Re: [racket-users] syntax-property lost across module boundary (WAS: format-id doesn't preserve preserved?-edness of syntax-property?)

2016-12-14 Thread Alexis King
> On Dec 14, 2016, at 7:14 AM, Matthew Flatt wrote: > > To summarize, don't try to attach syntax objects as property values > like that. I know this advice sounds ironic, given that the original > use of properties was for syntax-valued keys like 'origin. Properties > like

Re: [racket-users] ->i applies contract projections multiple times?

2016-12-16 Thread Alexis King
> On Dec 16, 2016, at 9:53 AM, Robby Findler > wrote: > > Picky would never assign blame to m1. The places where m1 would be > blamed would instead fall on, I think, m2. Ahh, I see. I was confused because I wasn’t paying enough attention to the blame information in

Re: [racket-users] ->i applies contract projections multiple times?

2016-12-16 Thread Alexis King
> On Dec 15, 2016, at 3:16 PM, Robby Findler > wrote: > > But if you want to know more about how they could be different, you > might want to consider this example from section 1 of the paper. It > will (randomly) assign blame to any of the three submodules. Hmm.

Re: [racket-users] literals vs datum-literals in syntax-parse

2017-01-10 Thread Alexis King
Basically, the difference is as follows: #:literals compares identifiers using free-identifier=?, but #:datum-literals compares them by using syntax-e and eq?. You can observe the difference using two extremely simple macros that only differ in their use of #:literals or #:datum-literals:

Re: [racket-users] Syntax for hash contracts

2016-12-01 Thread Alexis King
> On Dec 1, 2016, at 21:43, David Storrs wrote: > > The difference between a dictionary and a structure being that dictionaries > are easily extensible on the fly and structures are not? I'm curious -- what > are the elements of that design and what are the reasons?

Re: [racket-users] Syntax for hash contracts

2016-12-01 Thread Alexis King
> On Dec 1, 2016, at 16:29, David Storrs wrote: > > - This function returns #t because it is a simple test function intended to > get the hang of hash contracts... > - This function takes one argument... > - Which is a hash... > - Which has keys 'success, 'file-id,

Re: [racket-users] list->set behavior on lists of symbols

2016-12-28 Thread Alexis King
David’s explanation is good. Let me add a little bit more context. It is a common mistake to think that ' can be used as a shorthand form of the `list` function, but this is not the case. The quote form is a primitive, and it has very specific (if fairly simple) behavior with respect to

[racket-users] Stack traces for phase 1 errors?

2017-01-09 Thread Alexis King
I have run into a few situations lately where I would really appreciate stack traces for errors in my compile-time code. However, I can’t figure out how to get errortrace to work with errors that occur at compile-time. For example, here’s a simple program: #lang racket (begin-for-syntax

Re: [racket-users] How to write string-match?

2016-12-20 Thread Alexis King
> On Dec 20, 2016, at 07:54, Alex Knauth wrote: > > Oooh, that's pretty cool. Much better than my super-slow attempt. > > Should you make this into a package (I would certainly use it a lot) > or would it make more sense to add in a pull request to the existing >

Re: [racket-users] How to write string-match?

2016-12-20 Thread Alexis King
One relatively easy solution would be to just compile patterns to regular expressions and use Racket’s built-in match form. Writing this as a match-expander is fairly straightforward: #lang racket (require (for-syntax racket/string syntax/parse/experimental/template)

Re: [racket-users] beautiful-racket, contract-violation: expected: module-path? given ('planet ....)

2017-03-21 Thread Alexis King
The unlib package is an old PLaneT package, so it won’t show up when you run `raco pkg show`. It’s a dependency of the snooze package (also from PLaneT), which you appear to have installed. Unfortunately, the unlib package appears to have bitrotted, so it won’t build on modern Racket (due to

Re: [racket-users] Beautiful Racket v1.0

2017-03-16 Thread Alexis King
This is wonderful. I have not read through everything, but the bits that I have read are well-written, insightful, and fun. I don’t know if a book like this is enough to get people interested in building DSLs, but if it isn’t, I’m not sure what is. I’m a tiny bit sad (or should I say “bummed

Re: [racket-users] How to make unit test for error "unbound identifier"?

2017-04-26 Thread Alexis King
You can use convert-syntax-error from syntax/macro-testing to convert the syntax error to a runtime error, which can be caught by RackUnit: http://docs.racket-lang.org/syntax/macro-testing.html#%28form._%28%28lib._syntax%2Fmacro-testing..rkt%29._convert-syntax-error%29%29 Alexis > On Apr 25,

Re: [racket-users] Re: Readers and Namespaces

2017-08-17 Thread Alexis King
> On Aug 17, 2017, at 21:52, Sam Waxman wrote: > > On a related note, I've read that read-syntax is supposed to return a > syntax-object whose lexical context is stripped. Why is that? Doesn't > that make it impossible for the language to know the difference > between the

Re: [racket-users] threading macros

2017-06-25 Thread Alexis King
As written, the simple answer to your question is to use begin0 or begin, depending on if you are using ~> or ~>>. > (~> 3 (begin0 (displayln "hi!")) (* 2)) hi! 6 But as Greg mentions, this is not very useful, and it probably isn’t what you want, since the evaluated expression can

Re: [racket-users] What can I do with thread descriptors?

2017-05-25 Thread Alexis King
> On May 25, 2017, at 1:16 PM, David Storrs wrote: > > 1) What can I do with a thread descriptor? The section on Threads in the reference[1] includes all sorts of functions that operate on thread descriptors, including but not limited to thread-suspend, thread-resume,

Re: [racket-users] Multiple namespaces in Racket

2017-10-14 Thread Alexis King
> On Oct 13, 2017, at 18:52, Geoffrey Knauth wrote: > > Maybe do undisputedly?-evil name-mangling now to get things working, > then become a saint with a better solution down the road. Sometimes > I don't realize how to do something the "good" way until I've traveled > down

Re: [racket-users] Multiple namespaces in Racket

2017-10-15 Thread Alexis King
> On Oct 15, 2017, at 08:59, David Christiansen > wrote: > > What about keeping type bindings separate from program bindings as a > matter of phase? This seems to me to fit in with the Hindley-Milner > program, where types exist only at compile time only, and programs

Re: [racket-users] Multiple namespaces in Racket

2017-10-16 Thread Alexis King
I ended up spending the majority of my weekend working on this, and even after two days, it still doesn’t work quite right. My verdict is that it seems impossible to do perfectly seamlessly, but it seems possible (but maybe hard) to get 85% there. Here’s a (rather long) overview of what I tried

Re: [racket-users] Multiple namespaces in Racket

2017-10-13 Thread Alexis King
This is a cool demo! Unfortunately, I have been thinking about the problem you describe since last night, and I am still totally stumped. This is something that seems difficult or impossible to paper over with more macros because #%require and #%provide are, ultimately, given special treatment by

[racket-users] Multiple namespaces in Racket

2017-10-12 Thread Alexis King
In discussions with some people at (seventh RacketCon), I managed to solve a few open problems I had in my implementation of Hackett. One thing I didn’t get a good answer for, however, is implementing a language with multiple namespaces. Hackett is not dependently-typed, so it is pointless and

Re: [racket-users] Multiple namespaces in Racket

2017-10-12 Thread Alexis King
> On Oct 12, 2017, at 1:46 PM, Matthew Flatt wrote: > > You could put all the type exports in a submodule. Then, you do need > your own variant of `require`, but that variant can mostly just check > for the presence of a type submodule, much the way that TR or > `plai-typed`

Re: [racket-users] weak references and quoted values

2017-09-07 Thread Alexis King
My understanding is that quoted values are effectively interned, so they’ll never be garbage collected as long as the code containing the quoted expression is loaded. Here’s a program that hints at this: (define (make-quoted-value) '(1 . 2)) (eq? (make-quoted-value)

Re: [racket-users] Do futures actually work? What are they useful for?

2017-09-12 Thread Alexis King
> On Sep 12, 2017, at 7:57 AM, Matthias Felleisen > wrote: > > A word of caution on parallelism in general. Not too long ago, someone > in CS at an Ivy League school studied the use of parallelism across > different uses and applications. The goal was to find out how much

[racket-users] Do futures actually work? What are they useful for?

2017-09-11 Thread Alexis King
Yesterday, a user asked a question on Stack Overflow[1] about attempting to parallelize a solution to the n-queens problem. The program in question is short, so I can reproduce it here in its entirety: #lang racket ; following returns true if queens are on diagonals: (define

Re: [racket-users] using Racket web server behind Apache as proxied HTTPS app server

2017-09-26 Thread Alexis King
You almost certainly want to do SSL termination at the Apache level if you are running a Racket server behind Apache. This means that Apache will serve as a reverse proxy to your Racket web server, and all communications between Apache and the Racket process will be ordinary HTTP. When an HTTPS

Re: [racket-users] using Racket web server behind Apache as proxied HTTPS app server

2017-09-26 Thread Alexis King
> On Sep 26, 2017, at 5:04 PM, Matthew Butterick wrote: > > What about the new HTTP port that the Racket web server has opened? > Should that be secured somehow (e.g., firewall)? Yes. For any server exposed to the internet, you want to make sure to only whitelist the

Re: [racket-users] racket/match a dictionary

2017-10-11 Thread Alexis King
> On Oct 11, 2017, at 2:56 PM, George Neuner wrote: > > Hmm. For completeness? I'm having trouble imaging why you'd want to > match a literal hash table. Or boxes. The other options make more > sense. Oh well. Imagine you’re parsing some JSON. You could parse the

Re: [racket-users] racket/match a dictionary

2017-10-11 Thread Alexis King
> On Oct 11, 2017, at 11:10 AM, George Neuner > wrote: > > My (maybe wrong) reading of the docs suggests that to match a hash > table, the table must be defined inline in the match clause. This isn’t really accurate. The hash-table match pattern matches a hash table

Re: [racket-users] code reflection

2017-10-17 Thread Alexis King
I’ve noticed that the Racket macro system seems to have a reputation for being impenetrably complicated, which I do not fully understand. Hackett has, indeed, exposed a great deal of complexity, but Hackett is not an ordinary macro, and I found writing macros with syntax/parse to be quite pleasant

Re: [racket-users] Multiple namespaces in Racket

2017-10-17 Thread Alexis King
I’ve been continuing to work on this for the past two days, and I’ve managed to get a lot more working. I figured I’d write a (somewhat shorter) summary of what I have and haven’t solved. 1. The issue with module language imports still seems hopeless. 2. I managed to solve the submodule

Re: [racket-users] Multiple namespaces in Racket

2017-10-17 Thread Alexis King
> On Oct 17, 2017, at 20:11, Philip McGrath > wrote: > > It wouldn't solve the problem with shadowing `require`d identifiers, > but would having `#%module-begin` introduce the `require` (with proper > lexical context information), instead of doing it with the reader, >

Re: [racket-users] Multiple namespaces in Racket

2017-10-18 Thread Alexis King
> On Oct 18, 2017, at 8:09 AM, Matthias Felleisen > wrote: > > Wouldn’t something like this work for Hackett? I don’t think so. Perhaps it would be better illustrated with an example. First, consider the Hackett definition of, say, the `Maybe` type: (data (Maybe a)

Re: [racket-users] where does DrRacket get its environment variables on OS X?

2017-11-11 Thread Alexis King
> On Nov 11, 2017, at 08:17, Robby Findler > wrote: > > One example that lives on (in a zombie-like state) is the "search in > files" functionality Sort of off-topic, but I use the Search in Files option all the time, so don’t think nobody’s finding it useful!

Re: [racket-users] Multiple namespaces in Racket

2017-10-25 Thread Alexis King
> On Oct 18, 2017, at 1:08 PM, Matthias Felleisen > wrote: > > What I imagined was that you’d define @h-examples, which would > translate the former into the latter. — Matthias I finally did this and got everything working, mostly. I have opened a pull request with the

Re: [racket-users] Parametric composition?

2018-05-04 Thread Alexis King
Your composex macro is very similar to the various forms from the (as far as I can tell) fairly well-known threading package: http://docs.racket-lang.org/threading/index.html Disclaimer: I am the author of the threading package. In any case, there are some differences, but it has the same

Re: [racket-users] Unbound identifier error with syntax transformer that uses syntax-generating helper procedure

2018-05-08 Thread Alexis King
The short answer is that you need a (require (for-template racket/base)) in your utilities submodule: (module utilities racket/base (provide compile-test) (require (for-template racket/base)) (define (compile-test) #`(lambda (i) (displayln `(input: ,i) But this answer

Re: [racket-users] How to handle circular 'requires'

2018-05-14 Thread Alexis King
In addition to what Matthias says, you can also sometimes break these kinds of cycles using lazy-require, which defers the requiring the other module until it is first needed. This is simpler than using units and provides stronger guarantees than using callbacks, but it is a bit more ad-hoc than

Re: [racket-users] what do people use for number formatting?

2018-05-07 Thread Alexis King
I second ~r. It will round when given a precision. > On May 7, 2018, at 18:56, Stephen Chang wrote: > > Oops, I didnt see the rounding. > > On Mon, May 7, 2018 at 7:53 PM, Ben Greenman > wrote: >> I use this: >>

Re: [racket-users] question on quasisyntax/loc

2018-05-08 Thread Alexis King
This behavior is intentional, though it could perhaps be more clearly documented. The behavior is hinted at in the documentation for syntax/loc: > Like syntax, except that the immediate resulting syntax object takes > its source-location information from the result of stx-expr (which > must

Re: [racket-users] Questions on functional-setter generator macro

2018-05-26 Thread Alexis King
This isn’t a direct answer to your question, but as Matthias notes, my struct-update package already implements a macro that generates functional setters from structure definitions. Here’s a link to the documentation: http://docs.racket-lang.org/struct-update/index.html Of course, that isn’t

Re: [racket-users] Multiple namespaces in Racket

2017-10-27 Thread Alexis King
-to-hackett/ And with that, I’ll stop bumping this thread if nobody else replies to it — I just wanted to record the details of my solution to the problem for posterity. :) Thanks to everyone who helped, Alexis > On Oct 25, 2017, at 10:33 AM, Alexis King <lexi.lam...@gmail.com> > w

Re: [racket-users] Equivalent of dynamic-wind post-thunk for with-handlers

2018-01-24 Thread Alexis King
Based on your question, why not just use dynamic-wind in combination with with-handlers? Just keep in mind that the post-thunk could be called multiple times if there is a continuation jump into value-thunk, so you should also wrap the whole thing with call-with-continuation-barrier if it’s

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

2018-01-25 Thread Alexis King
> On Jan 25, 2018, at 16:45, Robby Findler > wrote: > > Isn't the last form already required to not be a definition? In that example, yes, but not always, and splicing-parameterize can’t be sure one way or the other. In this example, containing exclusively

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

2018-01-25 Thread Alexis King
> On Jan 24, 2018, at 12:57 AM, Ryan Culpepper > wrote: > > 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. The

[racket-users] Ownership semantics of string types in the FFI

2017-12-26 Thread Alexis King
I have some library that provides a function that produces a string: char* make_string(void); …and the library expects that I will eventually free the returned memory using a custom deallocator: void free_string(char*); …can and should I use the _string C type with ffi/unsafe to call

Re: Parameters considered often harmful (was: Re: [racket-users] Re: A (long) question regarding parameters and scope)

2018-08-03 Thread Alexis King
Maybe this isn’t really a direct response to the direction this thread has taken, but given the question proposed in the original message, I think it’s relevant to share a particular design pattern for parameters that seems to work well. In a number of different APIs provided by Racket, a

<    1   2   3   4   >