[racket-users] Re: The Birth and Death of Units

2018-01-23 Thread ben.rudgers
To me, one of the redeeming qualities of units in Racket is that they make "the tent" bigger. Modules may usually be the right way in Racket, but the grace of Racket is that modules are not "The one true way" because the Racket community tends to eschew the OTW concept when it comes to computer

[racket-users] SIMPLE top-level binding semantics question

2018-01-23 Thread 'John Clements' via Racket Users
Stack overflow today led me to something … very strange. I feel like I must be missing something crushingly obvious. To reproduce: start racket at the command line or hit “run” on a definitions window containing only “#lang racket”. Then, paste: (define map (lambda (l f) (cond ((nu

Re: [racket-users] SIMPLE top-level binding semantics question

2018-01-23 Thread Matthias Felleisen
Huh? Serves you right for using the top level. It works fine if you place it in the definitions window :-) > Welcome to DrRacket, version 6.11.0.4--2017-12-18(-/f) [3m]. > Language: racket, with debugging; memory limit: 256 MB. > > (map '() add1) > '() > > (map '(1) add1) > '(2) > > (map '(1 2)

Re: [racket-users] SIMPLE top-level binding semantics question

2018-01-23 Thread Matthew Flatt
At 23 Jan 2018 15:57:34 -0500, "'John Clements' via Racket Users" wrote: > despite being inside of a binding of the name map That's the essence of the problem. Which things are in the scope of a top-level definition? For example, is the reference to `f` in the scope of a binding of `f` in (def

Re: [racket-users] SIMPLE top-level binding semantics question

2018-01-23 Thread 'John Clements' via Racket Users
Permission to paste this summary on Stack Exchange? > On Jan 23, 2018, at 1:20 PM, Matthew Flatt wrote: > > At 23 Jan 2018 15:57:34 -0500, "'John Clements' via Racket Users" wrote: >> despite being inside of a binding of the name map > > That's the essence of the problem. Which things are in t

Re: [racket-users] SIMPLE top-level binding semantics question

2018-01-23 Thread 'John Clements' via Racket Users
> On Jan 23, 2018, at 1:03 PM, Matthias Felleisen > wrote: > > > Huh? Serves you right for using the top level. It works fine if you place it > in the definitions window :-) Of course, and that’s what I told the poster on Stack Exchange. I was befuddled by the existing behavior, but I exp

Re: [racket-users] SIMPLE top-level binding semantics question

2018-01-23 Thread Matthew Flatt
Sure, with whatever improvements you'd like to make. At 23 Jan 2018 16:53:15 -0500, "John Clements" wrote: > Permission to paste this summary on Stack Exchange? > > > > On Jan 23, 2018, at 1:20 PM, Matthew Flatt wrote: > > > > At 23 Jan 2018 15:57:34 -0500, "'John Clements' via Racket Users" w

Re: [racket-users] SIMPLE top-level binding semantics question

2018-01-23 Thread 'John Clements' via Racket Users
Many thanks. > On Jan 23, 2018, at 1:56 PM, Matthew Flatt wrote: > > Sure, with whatever improvements you'd like to make. > > At 23 Jan 2018 16:53:15 -0500, "John Clements" wrote: >> Permission to paste this summary on Stack Exchange? >> >> >>> On Jan 23, 2018, at 1:20 PM, Matthew Flatt wr

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

2018-01-23 Thread Matthew Butterick
> On Jan 22, 2018, at 7:22 PM, Matthew Flatt wrote: > > I think I've never considered `splicing-parameterize` because > parameters can be mutated, but a `splicing-parameterize` form does make > sense. I imagine that it would be implemented by creating a > parameterization once, then pushing the

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

2018-01-23 Thread Matthew Flatt
If you want `splicing-parameterize` to compose with other macros that might implement definition forms, there's no fixed set of definition forms. The other splicing forms use `local-expand` to detect definition forms, since the small set of core definition forms can be reliably detected in expande

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

2018-01-23 Thread Matthias Felleisen
You want to head expand not just look at the raw words, because an expression can expand to (define-values (x …) …). You may wish to look at how modules, units, and classes are expanded — Matthias > On Jan 23, 2018, at 8:15 PM, Matthew Butterick wrote: > > >> On Jan 22, 2018, at 7:22 PM,

Re: [racket-users] Path to file in dynamic-place

2018-01-23 Thread Jack Firth
A rule of thumb you can follow to avoid tricky bugs like this: *never use string literals as dynamic module names.* Anywhere you see a dynamic / reflective function on modules called with a literal string, a contradiction exists between the programmer and the dynamic function: 1. The programmer

Re: [racket-users] Path to file in dynamic-place

2018-01-23 Thread Philip McGrath
When the thing you want to refer to at runtime is specifically a module, using define-runtime-module-path-index or define-runtime-module-path (also from racket/runtime-path) may be even better choice than define-runtime-path. -Philip On Tue, Jan 23, 2018 at 10:03 PM, Jack Firth wrote: > A rule

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

2018-01-23 Thread Alexis King
Here is an implementation of a version of splicing-parameterize that uses local-expand, a la other forms in racket/splicing: #lang racket (require (for-syntax syntax/kerncase) (for-meta 2 racket/base) syntax/parse/define) (begin-for-syntax (define-synt