[racket-users] Combining contract checking with normalization?

2022-03-06 Thread Alexis King
Hello, As a user of the Racket contract system, I sometimes find myself thinking about the potential utility of “coercing” or “canonicalizing” contracts. In Racket programs, we often idiomatically allow values to be provided to a function in a non-canonical form for the sake of convenience. One ex

Re: [racket-users] Re: The history of hygiene for definition contexts

2021-07-29 Thread Alexis King
On Thu, Jul 29, 2021 at 12:53 PM Michael Ballantyne < michael.ballant...@gmail.com> wrote: > The second example you give becomes more natural if you've considered > simpler cases of macros in definition contexts first > I agree that breaking the macro into two parts—one of which inserts a binder

[racket-users] The history of hygiene for definition contexts

2021-07-28 Thread Alexis King
Hi all, I recently posted two tricky hygiene puzzles on Twitter , reproduced below for completeness: (let ([x 'outer]) (define-syntax-rule (m a) (let ([a 'inner]) x)) (m x)) (let ([x 'outer]) (define-sy

Re: [racket-users] Can I get the behavior of `overment` followed by `augride` with a single class?

2021-07-25 Thread Alexis King
On Mon, Jul 19, 2021 at 11:08 AM Matthew Flatt wrote: > Are there other useful variants that are not currently supported (at least > directly)? > I think the answer to this is “no.” My reasoning follows. >From the perspective of subclasses, superclass methods come in three sorts: overridable, a

[racket-users] Can I get the behavior of `overment` followed by `augride` with a single class?

2021-07-16 Thread Alexis King
Hello, While doing some OOP in Racket today, I found myself in a situation that would benefit from two seemingly contradictory things: 1. I want to be able to override a superclass method, and I want to be certain that I get to handle the method before any of my subclasses do. This s

[racket-users] Re: [ANN] megaparsack 1.4 — support for user-defined parser state

2021-07-04 Thread Alexis King
Addendum: the docs are now built, so you can read more at these two links: - https://docs.racket-lang.org/megaparsack/state.html - https://docs.racket-lang.org/megaparsack/reference.html#%28part._parser-parameters%29 On Sun, Jul 4, 2021 at 2:21 AM Alexis King wrote: > Hi all, >

[racket-users] [ANN] megaparsack 1.4 — support for user-defined parser state

2021-07-04 Thread Alexis King
Hi all, As some of you may know, I am the maintainer of the Megaparsack package, a Parsec-style parser combinator library. Though it’s mostly been in maintenance mode for some time, the latest release adds a significant new feature: *user-defin

Re: [racket-users] ask the type of a value (partial solution)

2020-08-03 Thread Alexis King
> On Aug 3, 2020, at 11:48, Hendrik Boom wrote: > > Still, it would be nice to find out how to get this information more > directly instead of relying on functions that do much more than > what I was asking for. In general, there aren’t any. The ability of struct->vector to extract a symbolic

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

2020-08-03 Thread Alexis King
In general, the answer is “no,” mostly because it’s not clear in Racket what “the type of a value” means. It’s difficult to come up with a definition that would be useful enough to satisfy your criterion of not “having to guess it first.” Consider: suppose you had a hypothetical `type-of` operat

Re: [racket-users] Why does this counter behave differently in different runtimes?

2020-06-17 Thread Alexis King
This is quite curious. It appears to be a compiler bug. Here’s a very slightly smaller test case: #lang racket/base (define count! (let ([i 0]) (λ () (begin0 (set! i (add1 i)) (+ i) (count!) The fully-expanded program looks fine, so i

Re: [racket-users] identifier used out of context

2020-06-07 Thread Alexis King
> On Jun 7, 2020, at 17:44, Sorawee Porncharoenwase > wrote: > > Wow, so block is currently buggy?! > This issue isn’t with `block`, per se (though `block` could cooperate more nicely with definition context expansion to avoid this problem). You can reproduce it without any first-class defin

Re: [racket-users] How to change package name on the package index?

2020-06-04 Thread Alexis King
> On Jun 4, 2020, at 21:23, Siddhartha Kasivajhula wrote: > > I'd prefer to avoid that since (1) it would lose the package metadata and (2) > it could be off the package index for up to a day (the package index refresh > cycle) during which time other packages depending on it would be broken T

Re: [racket-users] Testing for Packages

2020-05-26 Thread Alexis King
> On May 26, 2020, at 21:36, Robert Postill wrote: > > One thing that troubled me was that the tests seemed to be dependant on the > package already being installed. I think this is very common within the Racket ecosystem. I would guess that very few packages are consciously designed to be “re

Re: [racket-users] Hunting a possible fsemaphore-post/wait bug

2020-05-24 Thread Alexis King
I realized a little while after writing my previous message that I was probably misinterpreting you. I was envisioning you using box-cas! on a box containing a functional queue, so there would be no need to synchronize. You’d just pull the queue out of the box, functionally update it, and use bo

Re: [racket-users] Hunting a possible fsemaphore-post/wait bug

2020-05-24 Thread Alexis King
> On May 24, 2020, at 02:10, Dominik Pantůček > wrote: > > At first I was surprised that you are basically suggesting using > spinlocks (busy-wait loops) instead of futex-backed (at least on Linux) > fsemaphores. That is a waste of CPU time. Performing CAS operations in a loop isn’t really dire

Re: [racket-users] rackunit and logging

2020-05-23 Thread Alexis King
> On May 23, 2020, at 08:53, Shriram Krishnamurthi wrote: > > Alex, thanks for that information. I'm going to go investigate that next. Related to that, I just remembered the existence of rackunit/text-ui and rackunit/gui, which implement two different reporters for RackUnit test cases/suites.

Re: [racket-users] rackunit and logging

2020-05-23 Thread Alexis King
> On May 22, 2020, at 18:47, Shriram Krishnamurthi wrote: > > As an aside, I'm not entirely sure what `test-log!` is there for. Presumably > it's to record in the log "tests" run by operations that are not part of > rackunit? I'm curious how people have used it. Other people have answered othe

Re: [racket-users] Do I misunderstand set! ?

2020-04-23 Thread Alexis King
> On Apr 23, 2020, at 21:15, Hendrik Boom wrote: > > (fprintf anomaly "resEEEulttyope was ~s~n" resulttype) > (fprintf anomaly "set resulttyoe to ~s~n" ty) > `(set! resulttype ty) > (fprintf anomaly "resEEulttyope now ~s~n" resulttype) (Re-sending this because I f

Re: [racket-users] How to find source file loaded by/relevant for (require )?

2020-03-27 Thread Alexis King
I recommend Ryan Culpepper’s whereis package: https://docs.racket-lang.org/whereis/index.html It provides both a programmatic interface and a raco command. Alexis > On Mar 27, 2020, at 03:56, Marc Kaufmann wrote: > > Hi, > > I am trying to s

Re: [racket-users] questions about top-level-bind-scope in root-expand-context

2020-03-23 Thread Alexis King
> On Mar 23, 2020, at 13:46, George Neuner wrote: > > I've run into this problem before ... I don't recall the official > explanation, but my takeaway was that Racket does not permit you to > directly *export* a value - you have to export a function or macro > that produces the value. > > E.g.,

Re: [racket-users] Starting racket with at-exp

2020-03-02 Thread Alexis King
The -l option loads a module path. As `racket --help` documents, `-l ` is equivalent to `-e '(require (lib ""))'`. Since (require (lib "at-exp racket")) won’t help you much, neither will `-l 'at-exp racket'`. I’m not totally sure why you thought `-l` was the right option here, but it doesn’t set

Re: [racket-users] how to adapt BC code for Racket CS?

2020-02-23 Thread Alexis King
> On Feb 23, 2020, at 18:28, Matthew Flatt wrote: > > None of Racket BC, Racket CS, or Chez Scheme by itself will optimize > away the unused loop argument. That kind of interprocedural dead-code > elimination is out of reach for the current compilers, except to the > degree that inlining turns th

Re: [racket-users] how to adapt BC code for Racket CS?

2020-02-22 Thread Alexis King
I have a related but distinct question about the blog post: I’m curious what guarantees I can come to expect from the Racket CS optimizer. The post includes the following example: (for/fold ([v #f]) ([i (in-range N)]) i) On both Racket BC and Racket CS, I’d expect the optimizer to turn this

Re: [racket-users] Megaparsack and where errors happen

2020-02-21 Thread Alexis King
Hi Matt, I think you probably want to read this section of the docs: https://docs.racket-lang.org/megaparsack/parsing-branching.html#%28part._.Backtracking_with_caution%29 The core idea is that `try/p` is a heavy hammer. It causes any failure inside its scope to backtrack, so you might end up a

Re: [racket-users] Breaking semaphores

2020-01-18 Thread Alexis King
Oh: something more ambitious that I would enjoy having would be an implementation of IVars and LVars to avoid needing to think about locking entirely. > On Jan 18, 2020, at 05:00, Alexis King wrote: > >  > I would use mutexes in relatively standard ways, I think, to prot

Re: [racket-users] Breaking semaphores

2020-01-18 Thread Alexis King
my day job involves working on > concurrency frameworks. Specific use cases are more what I'm after. For > instance, what would you like to use mutexes for? > >> On Sat, Jan 18, 2020 at 2:34 AM Alexis King wrote: >> Oh, an addendum: I would be remiss not to mention the

Re: [racket-users] Breaking semaphores

2020-01-18 Thread Alexis King
ions.html> > On Jan 18, 2020, at 04:27, Alexis King wrote: > > I don’t personally have any problems with Racket’s semaphore interface as it > exists today. I think having the choice of whether or not to enable breaks > mostly makes sense as something the ambient environment control

Re: [racket-users] Breaking semaphores

2020-01-18 Thread Alexis King
hore would either enable breaks, or check that breaks or > disabled, or neither of those? > > On Sat, Jan 18, 2020 at 1:45 AM Alexis King <mailto:lexi.lam...@gmail.com>> wrote: > No, I don’t think so, and here’s why: imagine a library provides an > abstraction that intern

Re: [racket-users] Breaking semaphores

2020-01-18 Thread Alexis King
indifferent to whether breaking is enabled? > > On Sat, Jan 18, 2020 at 1:28 AM Alexis King <mailto:lexi.lam...@gmail.com>> wrote: > Actually, I change my mind, I can trivially think of a case where it’s fine: > if you’re just using a semaphore as an event. One thread waits

Re: [racket-users] Breaking semaphores

2020-01-18 Thread Alexis King
mebody else can or somebody can confirm that it's not a good > API precedent. I'm trying to build some concurrency libraries > <https://github.com/jackfirth/rebellion/issues/397> and I'd like to be sure > there isn't some important use case I'm missing.

Re: [racket-users] Breaking semaphores

2020-01-18 Thread Alexis King
gt; certainly wrong. If car and cdr can check their arguments by default, > shouldn't semaphores guard against misuse too? > > On Sat, Jan 18, 2020 at 1:04 AM Alexis King <mailto:lexi.lam...@gmail.com>> wrote: > It is guaranteed to leave the semaphore in a consisten

Re: [racket-users] Breaking semaphores

2020-01-18 Thread Alexis King
eaks?". What's the actual use case for calling semaphore-wait (and not > semaphore-wait/enable-break) while breaks are enabled? > > On Sat, Jan 18, 2020 at 12:47 AM Alexis King <mailto:lexi.lam...@gmail.com>> wrote: > Killing a thread is different from breaking a thr

Re: [racket-users] Breaking semaphores

2020-01-18 Thread Alexis King
Killing a thread is different from breaking a thread. Killing a thread kills the thread unrecoverably, and no cleanup actions are run. This usually isn’t what you want, but there’s always a tension between these kinds of things: defensive programmers ask “How do I make myself unkillable so I can

Re: [racket-users] fcontrol and dynamic-wind

2019-11-30 Thread Alexis King
> On Nov 30, 2019, at 20:52, Matthew Flatt wrote: > > They are, as long as any invoked `dynamic-wind` thunks are safe in > atomic mode. (After all, `unsafe-abort-current-continuation/no-wind` > and `unsafe-call-with-composable-continuation/no-wind` were created to > support `unsafe/try-atomic`.)

Re: [racket-users] fcontrol and dynamic-wind

2019-11-30 Thread Alexis King
> On Nov 30, 2019, at 09:23, Matthew Flatt wrote: > > There's not a safe way. In many cases, Racket lets you write new things > that have the power of built-in through unsafe APIs --- and it turns > out that there are unadvertised procedures (provided by the primitive > `#%unsafe` module) for thi

[racket-users] fcontrol and dynamic-wind

2019-11-30 Thread Alexis King
Hello, I have been playing with implementing algebraic effects using delimited control, and Dorai Sitaram’s `fcontrol` and `%` operators are a natural fit. For example, it’s straightforward to implement McCarthy’s `amb` operator using them: (define amb-tag (make-continuation-prompt-tag 'amb)

Re: [racket-users] GUI (get-directory)

2019-11-21 Thread Alexis King
> On Nov 21, 2019, at 11:21, James Platt wrote: > > If we can direct more of the energy of this community into, not just > improving the documentation, but the way we do documentation, it would be a > major improvement. Requiring lots of parentheses doesn't bother me. Lack of > infix notatio

Re: [racket-users] Custom scribble renderers and xref information

2019-11-17 Thread Alexis King
Thanks for the prompt reply! > On Nov 17, 2019, at 11:15, Matthew Flatt wrote: > > Making mutual references work is the job of info-in and info-out files. > Document A's info-out file is the info-in file for any document that > needs to reference document A. Yes, you have to run to a fixed point

[racket-users] Custom scribble renderers and xref information

2019-11-17 Thread Alexis King
I’ve been playing on and off with writing a custom scribble renderer for a blog, and my experiments have mostly been fine, but I am very confused about xref information. I want to use a URL fragment format for my blog that is different from the one used by the Racket documentation, but I would a

Re: [racket-users] Modeling a context-sensitive evaluation context with PLT Redex?

2019-11-09 Thread Alexis King
> On Nov 9, 2019, at 09:18, Jay McCarthy wrote: > > "remember that an evaluation context is just a way of describing more > succinctly what you could otherwise define by hand as a big, > complicated relation on individual terms." Yes, that makes sense — I wasn’t really considering what it would

Re: [racket-users] Modeling a context-sensitive evaluation context with PLT Redex?

2019-11-09 Thread Alexis King
t/redex/tree/master/redex-examples/redex/examples/delim-cont > 3. http://www.ccs.neu.edu/home/stchang/pubs/Chang-Felleisen-ESOP2012.pdf > > -- > Jay McCarthy > Associate Professor @ CS @ UMass Lowell > http://jeapostrophe.github.io > Vincit qui se vincit. > > > -- >

[racket-users] Modeling a context-sensitive evaluation context with PLT Redex?

2019-11-09 Thread Alexis King
Hello, I am trying to model a (not quite algebraic) effect system in PLT Redex, but I’m struggling to encode my evaluation contexts into Redex’s pattern language. My question is best explained via example, so I’ll start with a bog-standard call-by-value lambda calculus: (define-language la

Re: [racket-users] Typed Racket needs annotation to realize (Mutable-HashTable Symbol Symbol) is of a more general type

2019-11-06 Thread Alexis King
The point Sam is making is about the variance of Mutable-HashTable specifically. Its relationship to the HashTable supertype is a red herring (which is why changing the type to Mutable-HashTable didn’t help). Immutable data structures, like lists and immutable hash tables, are covariant in thei

Re: [racket-users] Need a scribble identity wrapper. A no-op.

2019-11-03 Thread Alexis King
Use the search box in the documentation: https://docs.racket-lang.org/search/index.html?q=elem > On Nov 3, 2019, at 18:34, Hendrik Boom wrote: > > On Sun, Nov 03, 2019 at 02:46:42PM -0800, William J. Bowman wrote: >> I think ‘elem’ will d

Re: [racket-users] Does match against list traverse the whole list?

2019-10-29 Thread Alexis King
> On Oct 29, 2019, at 12:41, Christopher Lemmer Webber > wrote: > > But the documentation says that the `list?` predicate is O(n). I’m not sure where you’re seeing that, but the documentation actually says just the opposite. Specifically, it says this: > This procedure effectively takes const

Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread Alexis King
> On Oct 25, 2019, at 11:34, David Thrane Christiansen > wrote: > > I'm not sure why Guile returns #t for this. If pairs are mutable there, then > it could lead to aliasing problems. The Scheme standard has historically left the behavior of mutation on quoted values unspecified to permit prec

Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread Alexis King
Unlike eq? on symbols, eq?’s behavior on quoted lists is unspecified, so I do not think there is a significantly deeper reason than “that isn’t what the current implementation chooses to do.” Whether the answer is #t or #f could change tomorrow, on a different VM, on a different architecture, or

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-13 Thread Alexis King
The syntax error I'm > getting here isn't particularly enlightening. > > Once again, I really appreciate any help here. > > -- Jonathan > > On Saturday, October 12, 2019 at 2:28:05 PM UTC-4, Alexis King wrote: > I believe your two syntax classes are identical, except

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-12 Thread Alexis King
n't. > > Once again, thanks for taking the time to explain this! > > -- Jonathan > > On Thursday, October 10, 2019 at 11:17:53 PM UTC-4, Alexis King wrote: > tl;dr: You need to use an ellipsis, so your pattern should be ((~between > x:integer 3 3) ...). A (much) more

Re: [racket-users] Syntax pattern to match a sequence with x identical elements?

2019-10-10 Thread Alexis King
tl;dr: You need to use an ellipsis, so your pattern should be ((~between x:integer 3 3) ...). A (much) more detailed explanation of why follows. ~between is an ellipsis-head pattern. The most common ellipsis-head pattern, ~optional, also works as a plain head pattern, but ~between does not. What

Re: [racket-users] read-eval-print-loop, #%top-interaction, and define

2019-09-24 Thread Alexis King
> On Sep 24, 2019, at 23:01, Jesse Alama wrote: > > The question is: we do we get the error with define if we know that step is > undefined? Shouldn't we learn, first, that step is undefined? The top level is hopeless. Unlike in a module, an unbound identifier at the top level is not a syntax

Re: [racket-users] Is it possible to sell commercial use rights to an open source Racket package?

2019-08-28 Thread Alexis King
> On Aug 28, 2019, at 11:54, Neil Van Dyke wrote: > > If someone violates (their non-lawyer interpretation of) the Racket license, > in a conspicuous manner like you suggest, would they not expect the SFC to > send them a nastygram -- perhaps if only for the SFC to show that they defend > the

Re: [racket-users] Is it possible to sell commercial use rights to an open source Racket package?

2019-08-23 Thread Alexis King
[1] > > [1] https://sfconservancy.org/blog/2014/jun/09/do-not-need-cla/ > <https://sfconservancy.org/blog/2014/jun/09/do-not-need-cla/> > > >> On 23 Aug 19, at 12:29 PM, Alexis King > <mailto:lexi.lam...@gmail.com>> wrote: >> >> Maybe so, but tha

Re: [racket-users] Is it possible to sell commercial use rights to an open source Racket package?

2019-08-23 Thread Alexis King
> On Aug 23, 2019, at 14:19, Matthew Butterick wrote: > > You're omitting some key facts. Maybe so, but that is, in fact, why I sent the email. I was hoping you could clue me in as to what I was missing. (Maybe it’s unfair of me to ask you for free legal analysis, but I don’t feel like it’s al

Re: [racket-users] Is it possible to sell commercial use rights to an open source Racket package?

2019-08-23 Thread Alexis King
> On Aug 23, 2019, at 13:03, Matthew Butterick wrote: > > In some cases, SFC takes ownership of trademarks and copyrights [1] which > means that in terms of license interpretation & enforcement, assumedly the > buck would now stop with them. AFAIK, copyright of the Racket codebase is not the

Re: [racket-users] Is it possible to sell commercial use rights to an open source Racket package?

2019-08-23 Thread Alexis King
Disclaimer: I am not a lawyer. (But, as others have mentioned, the answer is yes.) In the subject of your subject, you mention “an open source Racket package,” but in the body of your email, you talk about “an open source Racket project.” If you are genuinely talking about a Racket package (in

Re: [racket-users] Re: on-boarding new racketeers

2019-08-13 Thread Alexis King
Oh, come on. “Adding labels to repositories” and “adding issue templates” isn’t “increasing lock-in.” There’s no slippery slope here. I think the time and energy Stephen has dedicated to the community should be thanked and appreciated, not discouraged. I’m frustrated by the number of words you s

Re: [racket-users] Racket2 possibilities

2019-07-22 Thread Alexis King
> On Jul 22, 2019, at 14:16, Dexter Lagan wrote: > > A parens-less Racket2 would become Crystal. No it won’t. I am quite confident that Racket with any syntax will not be like any other language that currently exists. What other language has Racket’s advanced, robust compile-time metaprogramm

Re: [racket-users] Racket2 possibilities

2019-07-21 Thread Alexis King
> On Jul 21, 2019, at 00:19, Matthew Flatt wrote: > > I have in mind "Honu: Syntactic Extension for Algebraic Notation through > Enforestation", GPCE 2012. It shows how we can bridge the relatively linear > structure of non-() programs to the tree structure of S-expressions. > Specifically, th

Re: [racket-users] The case, and a proposal, for elegant syntax in #lang racket2

2019-07-16 Thread Alexis King
> On Jul 16, 2019, at 15:32, rocketnia wrote: > > I find it worrying that racket2 would be kicked off with infix syntax > (something which I think of as an unnecessary sticking point in the way of > prospective macro writers and language designers, and hence a move *toward* > elitism *as oppos

Re: [racket-users] Racket2 and syntax

2019-07-14 Thread Alexis King
Well! While I am sure that everyone at RacketCon has already discussed this to death, and I’m sure there has been plenty of support to counterbalance the tomato-throwing, let me be the first to say something positive on the mailing list so the optics from here aren’t so gloomy: I find this idea

[racket-users] Avoiding needless work in `dynamic-wind` during downward jumps?

2019-06-02 Thread Alexis King
Is there any way for dynamic-wind to know about the context of the continuation being jumped to in order to skip doing useless work? To explain I mean and why I want such a thing, I have written some code that uses semaphores as mutexes, and most of my code acquires the mutex using call-with-se

Re: [racket-users] New Package: Dynamic FFI - Write C Code Inline

2019-06-01 Thread Alexis King
This looks extremely cool. Thanks for your hard work—I will probably give this a try next time I use the FFI. Alexis > On Jun 1, 2019, at 14:06, David Benoit > wrote: > > Hi All, > > I've recently released a new library > for dynamically ge

Re: [racket-users] Trouble writing unhygienic macro

2019-05-27 Thread Alexis King
> On May 27, 2019, at 22:28, Jonathan Simpson wrote: > > I may be missing something, but I didn't think I could use the name as valid > syntax since this is the form that is creating it. If passing a symbol in > would work then I could potentially change my lexer to do that instead of a > stri

Re: [racket-users] What is the difference between foo/c and foo? when creating contracts?

2019-05-22 Thread Alexis King
Your intuition is right, but let me make it more precise: foo? is used when something is a flat contract, and foo/c is used otherwise. Flat contracts only check first order properties of values, which is a technical term that captures what you mean by “general nature.” The important distinction

Re: [racket-users] What is the difference between foo/c and foo? when creating contracts?

2019-05-22 Thread Alexis King
Your intuition is right, but let me make it more precise: foo? is used when something is a flat contract, and foo/c is used otherwise. Flat contracts only check first order properties of values, which is a technical term that captures what you mean by “general nature.” The important distinction

Re: [racket-users] How would you implement autoquoted atoms?

2019-04-23 Thread Alexis King
I find this email fascinating, as about three weeks ago, Spencer Florence and I discussed something almost identical, from the module path + symbol protocol all the way down to the trouble with `quote`. I had been intending to experiment with implementing the idea at some point, but I already ha

[racket-users] Defeating Racket’s separate compilation guarantee

2019-04-21 Thread Alexis King
Hello all, I just published a blog post on defeating Racket’s separate compilation guarantee. While I don’t imagine such a thing is actually a good idea, I think the path to getting there is interesting anyway, and it touches lots of different parts of the Racket system. For those who are inter

Re: [racket-users] Re: catch and bind an unbound id in a macro

2019-04-20 Thread Alexis King
The third argument to identifier-binding, top-level-symbol?, controls the result of identifier-binding when the identifier is bound to a top-level binding (and both the REPL and sandboxed evaluators are kinds of top-level evaluation). The docs elaborate this way: > The result is (list source-id)

Re: [racket-users] [macro help] How can I render a parenthesized set of elements optional?

2019-02-15 Thread Alexis King
Jon is right. Here’s an explanation why. Think of `...` as a postfix operator. It repeats what comes before it a certain number of times. In order for `...` to know how many times to repeat the previous head template, it looks inside the head template for any attributes bound at the appropriate

Re: [racket-users] Why ChezScheme?

2019-02-09 Thread Alexis King
> On Feb 9, 2019, at 16:49, Hendrik Boom wrote: > > Just wndering -- What was the original purpose in moving Racket to Chez? You probably want to read Matthew’s original email on the subject, from about two years ago: https://groups.google.com/d/msg/racket-dev/2BV3ElyfF8Y/4RSd3XbECAAJ Alexis

Re: [racket-users] Are the terms "function" and "procedure" synonymous in Racket?

2019-01-13 Thread Alexis King
Disclaimer: this answer is extremely non-authoritative. I think that, in Racket, the terms are used more or less interchangeably. The technical term is “procedure”, but as you point out, the term “function” is also used to mean the same thing. I don’t believe there is any distinction there that

Re: [racket-users] Communicating the purpose of Racket (was: hackernews)

2018-12-29 Thread Alexis King
> On Dec 29, 2018, at 21:32, Philip McGrath wrote: > >> Respectfully, I would also concentrate on Rackets web presence. If I was to >> google any of the popular languages, I would find the answer to these >> questions in spades, with real life applications, and examples. You can >> also comp

Re: [racket-users] How to disallow certain characters in identifiers?

2018-12-10 Thread Alexis King
I think your initial instinct was right: if you want to change the lexical structure of your language, the right place to start is in the reader. The reader is the part of Racket’s language facilities that interprets the structure of sequences of characters, and your notion of dotted identifiers

Re: [racket-users] How do I launch a REPL in the context of a file?

2018-11-30 Thread Alexis King
> On Nov 30, 2018, at 08:23, Sam Tobin-Hochstadt wrote: > > I'm not sure why `-e` doesn't evaluate in the same namespace as the > REPL, but if you put `(enter! "my-file.rkt")` in `enter.rktl` then: I’m curious about this, too. At first I thought it was just a misfeature, not necessarily a bug,

Re: [racket-users] cons-specific optimizations?

2018-11-28 Thread Alexis King
> On Nov 28, 2018, at 07:15, Matthew Flatt wrote: > > Yes, that's special handling for pairs in the sense that the > traditional Racket implementation takes advantage of leftover bits in a > pair object, and it uses two of them for "is a list" and "not a list". > > Racket-on-Chez doesn't have th

Re: [racket-users] Destructuring a list in (for ...)

2018-11-23 Thread Alexis King
The trouble, sadly, is that this grammar is ambiguous. In (for ([(x y) s]) ) should (x y) be parsed as a single match pattern or as two binders for a two-valued sequence (such as one produced by in-hash, for example)? You could make it unambiguous in various ways, such as by requiring

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

2018-11-06 Thread Alexis King
> 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 actually supposed to raise an error, it’s j

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

2018-11-05 Thread Alexis King
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 latter isn’t. Using reflective operations,

[racket-users] Higher-order units

2018-10-17 Thread Alexis King
Imagine I have the following signature: (define-signature collector^ [(contracted [item/c contract?] [collect (-> item/c ... item/c)])]) Writing a unit that exports this signature is easy. For example, here’s one that sums its arguments: (define-unit sum-collector@

Re: [racket-users] Scribble xref links in frog

2018-10-08 Thread Alexis King
IIRC, --redirect-main only applies to packages installed in installation scope, not packages installed in user scope. I don’t know why this is the case, and I don’t know if it’s a bug or a (mis)feature, I just vaguely remember running into that problem before when using --redirect-main. You migh

Re: [racket-users] Racket-on-Chez snapshots

2018-10-02 Thread Alexis King
> On Oct 1, 2018, at 13:07, Brett Gilio wrote: > > Hey, could you provide a resource with more information on Chez possibly > replacing the Racket VM? I haven't been keeping up to date on this. >From an interaction between Greg Trzeciak and Matthew Flatt on the slack >channel: > Greg: is there

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

2018-09-25 Thread Alexis King
(Sorry, Paulo, for the duplicate message; I forgot to Reply All the first time.) This is sort of subtle. When we consider a macro-enabled language, we often imagine that `expand` takes a program with some phase ≥1 code, expands all the macros in the program by running the phase ≥1 code, and produc

Re: [racket-users] colon keywords

2018-09-19 Thread Alexis King
I’m surprised this hasn’t been discussed yet: Alex Knauth has a set of meta-languages that add support for :kw or kw: syntax for keywords to arbitrary #langs (assuming they use readtables). http://docs.racket-lang.org/colon-kw/index.html Whether or not actually using these meta-languages is

Re: [racket-users] [Racket Users] Macros and literals question

2018-09-17 Thread Alexis King
> On Sep 17, 2018, at 12:21, Kevin Forchione wrote: > > That seems to be the nature of macros, and I’m not sure what the solution to > that paradox is, apart from perhaps building a symbol/function hash table as > part of a define. Presumably Racke does something like that for eva & > namespac

Re: [racket-users] How do I get negative blame information?

2018-09-10 Thread Alexis King
I think the answer here really is “don’t use `contract` directly”. The actual implementation of the contract system does some fancy rebinding of my-func when you use define/contract, turning this: (define/contract x ctc rhs) into this: (define x-awaiting-neg (let ([tmp rhs]) (l

Re: [racket-users] How to handle define forms in a scribble-like language

2018-08-16 Thread Alexis King
You might find make-wrapping-module-begin from syntax/modbeg useful here: http://docs.racket-lang.org/syntax/module-helpers.html#%28def._%28%28lib._syntax%2Fwrap-modbeg..rkt%29._make-wrapping-module-begin%29%29 Alexis > On Aug 16, 2018, at 18:58, Vityou wrote: > > I'm attempting to make a l

Re: [racket-users] all-fields-visible? attribute of struct-id -- What is it?

2018-08-16 Thread Alexis King
> On Aug 16, 2018, at 15:35, David Storrs > wrote: > > struct-id from (require syntax/parse/class/struct-id) has an > all-fields-visible? attribute. I've looked around and can't figure > out what would cause a field to not be visible. Can someone point me > to the relevant part of the FM? Un

Re: [racket-users] What are disappeared-uses?

2018-08-16 Thread Alexis King
> On Aug 16, 2018, at 15:25, David Storrs > wrote: > > I see 'record-disappeared-uses' and 'with-disappeared-uses' in the > docs, but there's nothing that makes clear what you would use them > for. Some digging around on the mailing list suggests that they allow > Dr Racket to draw an arrow to a

Re: [racket-users] Testing & global variables

2018-08-07 Thread Alexis King
I guess I’ll take the bait and give the obvious-but-unhelpful answer, “Don’t use global variables.” :) I’m joking, but only just barely. It seems difficult to give concrete advice without knowing more details about your program and why you felt it was necessary to use global mutable state in the f

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 function’

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] 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 bo

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 pr

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 produc

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: >> http://docs.racket-lang.org/gtp-util/index.html#%28def._%28%28lib._gtp-util%2Fmain

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 gene

[racket-users] On Richard P. Gabriel’s “The Structure of a Programming Language Revolution”

2018-04-18 Thread Alexis King
Hello all, I have a rather different sort of question to ask about from my usual fare. A month or two ago, I read an essay written by Richard P. Gabriel and published at Onward! 2012 called “The Structure of a Programming Language Revolution”. The essay itself is available here to those interested

[racket-users] Reimplementing Hackett’s type language: expanding to custom core forms in Racket

2018-04-15 Thread Alexis King
Hello all, I wrote a blog post about my recent experience rewriting the implementation of Hackett’s internal type representation, and on writing languages that expand to custom core forms in Racket in general. For those interested in Hackett and/or (ab)uses of some of the lesser-known features of

Re: [racket-users] Question about Racket design philosophy: returning (void)

2018-04-10 Thread Alexis King
> On Apr 10, 2018, at 14:00, David Storrs > wrote: > > Aside from I/O, I can't think of too many cases where (void) is the > intuitively correct or most useful return value, but it is extremely > common throughout the built-in Racket functions. I'm not sure where > you're drawing the lines on 'A

  1   2   3   4   >