[racket-users] reading writing the preamble of an XML file

2015-03-30 Thread Matthew Butterick
I understand that the preamble of an XML file (e.g., a first line like ?xml version=1.0 encoding=utf-8?) is not part of the X-expression representing that file. That's why in `response/xexpr`, there's an option for adding a preamble. [1] But with static XML files, I'm unclear about how

[racket-users] adapting workflow to `raco pkg install --clone ...`

2015-03-26 Thread Matthew Butterick
I'm confused about how local package development is supposed to work with `raco pkg install --clone`. This is turning into a deterrent to diagnosing fixing bugs, and an encouragement to post issues so others can fix them. In the dark ages, one would a) fork the main Racket repo on GitHub, b)

[racket-users] generating hyperlinks into Scribble docs

2015-04-19 Thread Matthew Butterick
This seems straightforward but I'm getting lost in the weeds: what's the simplest way to generate hyperlinks into Scribble docs on the web (without having to manually copy the URL)? For instance, the URL for `map` looks like this:

Re: [racket-users] generating hyperlinks into Scribble docs

2015-04-19 Thread Matthew Butterick
at 2:10 PM, Matthew Butterick m...@mbtype.com wrote: This seems straightforward but I'm getting lost in the weeds: what's the simplest way to generate hyperlinks into Scribble docs on the web (without having to manually copy the URL)? For instance, the URL for `map` looks like this: http

Re: [racket-users] reading writing the preamble of an XML file

2015-04-21 Thread Matthew Butterick
: Was there ever a resolution to this question? On Mon, Mar 30, 2015 at 2:12 PM, Matthew Butterick m...@mbtype.com wrote: I understand that the preamble of an XML file (e.g., a first line like ?xml version=1.0 encoding=utf-8?) is not part of the X-expression representing that file. That's why

[racket-users] writing a dual typed / untyped library

2015-05-06 Thread Matthew Butterick
A few notes about what I learned when converting my `sugar` library to a dual Typed Racket / Racket library (in part because of performance considerations). http://unitscale.com/mb/technique/dual-typed-untyped-library.html (Factual corrections welcome.) -- You received this message because

[racket-users] how to preserve predicates under TR no-check

2015-05-16 Thread Matthew Butterick
The idea of typed/racket/no-check is to disable typechecking, but in so doing, it also changes all type-based predicates to false. I suppose this oughtn't be surprising — if a predicate depends on a type, then without the type, the predicate cannot be true. But it also means that

Re: [racket-users] pkg-build report for the v6.2 release candidate

2015-05-17 Thread Matthew Butterick
FWIW I've had the same problem. Even though 'raco test -p pollen' shows no errors locally nor on Travis CI, the Racket build system produces a non-empty stderr test failure [1]. In my case, however, my test file [2] does not use check-exn (though it does use `system`) [1]

[racket-users] typecheck error with define-namespace-anchor in 6.1.1

2015-04-18 Thread Matthew Butterick
How would I clear this typecheck error under 6.1.1? This code: #lang typed/racket (define-namespace-anchor nsa) Produces this error: Type Checker: missing type for identifier; consider using `require/typed' to import it identifier: make-namespace-anchor from module: namespace.rkt in:

[racket-users] PLT policy on Travis CI bandwidth costs

2015-04-02 Thread Matthew Butterick
Should I be concerned about Travis CI's consumption of PLT bandwidth? Assuming the answer is yes, then question #2: what should I do about it? I just set up Travis CI on some of my Github projects (thanks Greg Hendershott for the Racket configuration script). IIUC every Travis build requires

Re: [racket-users] PLT policy on Travis CI bandwidth costs

2015-04-02 Thread Matthew Butterick
for bandwidth. Sam On Thu, Apr 2, 2015 at 12:26 PM, Matthew Butterick m...@mbtype.com wrote: Should I be concerned about Travis CI's consumption of PLT bandwidth? Assuming the answer is yes, then question #2: what should I do about it? I just set up Travis CI on some of my Github projects

Re: [racket-users] Re: [racket] making libraries work natively with both Racket Typed Racket

2015-04-02 Thread Matthew Butterick
, Vincent and Neil Toronto worked out a crazy way to do this with macros and submodules. I think the math library uses the technique they came up with. One of them should write a blog post about the technique. -Ian - Original Message - From: Matthew Butterick m...@mbtype.com

[racket-users] Scribble form for a documentation redirect?

2015-05-20 Thread Matthew Butterick
Suppose module foo provides `bar`, and module zam requires foo and also provides `bar` from foo. Further suppose that foo contains the main documentation for `bar`. When writing Scribble docs, I've noticed that `(require (for-label ...))` seems to resolve exported-name conflicts in favor of

Re: [racket-users] Racket v6.2

2015-06-23 Thread Matthew Butterick
PS The 'extra-pkgs' directory is a tiny bit special: http://docs.racket-lang.org/pkg/git-workflow.html?q=git#%28part._clone-link%29 On Tue, Jun 23, 2015 at 5:39 PM, Jay McCarthy jay.mccar...@gmail.com wrote: On Tue, Jun 23, 2015 at 4:26 PM, Anthony Carrico acarr...@memebeam.org wrote: On

Re: [racket-users] no plot zooming on local build--update procedure wrong?

2015-06-16 Thread Matthew Butterick
I've had the same issue with plot zooming not working from my git build. I don't have a theory but it at least suggests the problem may not be strictly localized. On Jun 16, 2015, at 1:10 PM, 'John Clements' via users-redirect us...@plt-scheme.org wrote: I notice that currently, plot

Re: [racket-users] 2 point about sribble

2015-05-28 Thread Matthew Butterick
-lang.org/scribble/builtin-css.html [2] http://docs.racket-lang.org/scribble/manual-css.html On Thu, May 28, 2015 at 2:43 PM, Greg Hendershott greghendersh...@gmail.com wrote: Matthew Butterick is the expert on this, but in the meantime here's some info I hope is mostly correct. The margin-note

Re: [racket-users] Iteration speed

2015-06-01 Thread Matthew Butterick
I've increasingly been using TR this way (= keeping code in a state where it can be easily toggled between typechecked and not). It works, though I'm still thinking about how to achieve better ergonomics with these issues, which don't have automatic solutions: Q1. How to toggle between `#lang

[racket-users] how to add file types to `raco test`?

2015-07-05 Thread Matthew Butterick
`raco test` will automatically test every .rkt and .scrbl file in a directory. Suppose I make `#lang foo` and thus many of my test files end with .foo. I would want all .foo files to be automatically tested as well. Is there a way to use info.rkt to tell `raco test` to add file types? (Should

Re: [racket-users] test submodules vs tests in separate file

2015-05-21 Thread Matthew Butterick
Are there any advantages/disadvantages of using test submodules vs separate test files? Or is it just a matter of personal preference? It looks like that test submodules are more convenient and flexible but I observed that test submodules increase the start up time of racket scripts. If

Re: [racket-users] test submodules vs tests in separate file

2015-05-22 Thread Matthew Butterick
Has this been an oversight? Do we need two official test submodules? One from the inside, and one from without. That’s a worthy point. I prefer to locate tests as close as possible to the code being tested. But the fact that 'raco test ...' and DrRacket only recognize a single submodule named

Re: [racket-users] test submodules vs tests in separate file

2015-05-22 Thread Matthew Butterick
wrote: DOn't forget $ raco test --submoulde matthew-s-tests On May 22, 2015, at 3:12 PM, Matthew Butterick m...@mbtype.com wrote: Has this been an oversight? Do we need two official test submodules? One from the inside, and one from without. That’s a worthy point. I prefer

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Matthew Butterick
-syntax stx 'sub)]) #'(#%module-begin (module sub-id racket/base (define x 2) (provide x)) (require sub-id) (provide (all-from-out sub-id)) body ...))]))) On Aug 15, 2015, at 6:21 PM, Matthew Butterick m

[racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Matthew Butterick
I have a #lang that does some funny stuff with #%module-begin (maybe too funny), the result being that when I run it in DrRacket, the `provide`d identifiers aren't visible at the top level: (module my-lang-module my-lang ... (define id 42) (provide id)) id id : undefined; cannot

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Matthew Butterick
No, the double-quoted ''sub doesn't work (triggers bad-syntax error). Nor does this (with quotes added to `sub-id` within the `require` and `provide` forms): (define-syntax my-module-begin (lambda (stx) (syntax-case stx () [(_ body ...) (with-syntax ([sub-id (datum-syntax stx

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Matthew Butterick
(datum-syntax #'x 'sub) (begin (module sub racket/base (provide y) (define y 3)) (require 'req-spec))) (m x) y On Aug 16, 2015, at 12:09 AM, Matthew Butterick m...@mbtype.com wrote: No, the double-quoted ''sub doesn't work (triggers bad-syntax error). Nor does

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-15 Thread Matthew Butterick
: http://www.mail-archive.com/racket-users@googlegroups.com/msg28031.html Although it could be a completely different problem, I don't know. On Aug 15, 2015, at 6:22 PM, Matthew Butterick m...@mbtype.com wrote: I have a #lang that does some funny stuff with #%module-begin (maybe too

[racket-users] contract error raised in 6.0, but not in 6.1 and 6.2?

2015-08-19 Thread Matthew Butterick
Below, I think `(func 42)` should raise exn:fail:contract, because `(func 42)` returns a number and the output contract for `func` specifies a boolean. And in 6.0 it does raise this error. But in 6.1 and 6.2, it does not. Why the discrepancy? #lang racket (provide

[racket-users] specifying extra compiled collection paths with info.rkt?

2015-08-21 Thread Matthew Butterick
The docs for `compile-collection-zos` [1] say that all files with the extension .rkt, .ss, or .scm in a collection are compiled and that within info.rkt, one can specify paths to omit with `compile-omit-paths`. Is there way to go the opposite direction — specify *extra* files that should be

Re: [racket-users] specifying extra compiled collection paths with info.rkt?

2015-08-21 Thread Matthew Butterick
of things to do. At Fri, 21 Aug 2015 09:51:08 -0700, Matthew Butterick wrote: The docs for `compile-collection-zos` [1] say that all files with the extension .rkt, .ss, or .scm in a collection are compiled and that within info.rkt, one can specify paths to omit with `compile-omit-paths

Re: [racket-users] specifying extra compiled collection paths with info.rkt?

2015-08-21 Thread Matthew Butterick
No, not as long as you're willing to push the envelope here. Goes without saying. FWIW the Pollen file extensions are not purely cosmetic. The Pollen renderer consumes Pollen source files and uses the extension (pm, pmd, pp, etc) to determine what kind of rendering is necessary. Of course

Re: [racket-users] how to wrap a #lang module for the REPL?

2015-08-16 Thread Matthew Butterick
you can also do that with a #%configure-runtime sudmodule (or something like that)? On Aug 15, 2015, at 5:08 PM, Matthew Butterick m...@mbtype.com wrote: Probably the wiser option. I'll see if I can adapt that solution. On Aug 15, 2015, at 4:31 PM, Alexander D. Knauth alexan

Re: [racket-users] A couple of questions about Neil's html reader/writer

2015-07-28 Thread Matthew Butterick
Yes, more or less. In an X-expression, an attribute list is the only element that's a list made of sublists. A list of embedded X-expressions, OTOH, will start with a symbol. To look at it another way, (cons symbol (list xexpr ...)) really amounts to (list symbol xexpr ...) which is just

[racket-users] http connection errors on pkg-build

2015-08-01 Thread Matthew Butterick
For the last couple of days my pollen builds have failed with this connection failed error. I don't see any other packages failing to download from GitHub, suggesting it's my fault. OTOH the supposedly defective URL works fine, so I'm not sure how to make the build server happier. Downloading

Re: [racket-users] how to add file types to `raco test`?

2015-07-28 Thread Matthew Butterick
/info.rkt On Thu, Jul 9, 2015 at 5:00 PM, Jay McCarthy jay.mccar...@gmail.com wrote: I think the right thing to do is just make an extension for the extension and/or the way the file list is built. I'll look into it on Monday. Jay On Thu, Jul 9, 2015 at 6:53 PM, Matthew Butterick m

Re: [racket-users] Using the draw and plot packages with other languages

2015-08-15 Thread Matthew Butterick
I don't do scientific computing, but it seems your question is to some degree about economic incentives. When you say maximize the profit, whose profit are you referring to? When you say minimize duplication of effort, whose labor costs are you referring to? And if this work is so valuable to

[racket-users] easy question about `free-identifier=?`

2015-07-24 Thread Matthew Butterick
According to the docs [1]: (let ([x 5]) (+ x 6)) Combining the lexical information from 'let' in the program above to 'x would not produce an identifier that is `free-identifier=?` to either 'x', since it does not appear in the scope of the 'x' binding. If so, then what is the flaw in

Re: [racket-users] Scribble undefined tags

2015-07-24 Thread Matthew Butterick
I’ve always found that it’s more reliable to use fully-qualified package names with `for-label`, e.g. (require (for-label jordan/package)) rather than (require (for-label main.rkt)) Once upon a time I had similar problems, and noticed that fully-qualified names is the habit used in many

[racket-users] using `module*` with the new macro expander

2015-07-19 Thread Matthew Butterick
This code works fine in the stable releases, but the new macro expander breaks it. I've scrutinized the updated docs for `module*` but I'm not clear why this would be so. #lang racket/base ;; non-macro version works fine (module* submod-name0 racket/base 42)

Re: [racket-users] using `module*` with the new macro expander

2015-07-20 Thread Matthew Butterick
The new expander treats submodules like everything else. Since `racket/math`, is macro-introduced while the body of the submodule `pi` is not, the import doesn't bind `pi`. For that matter, the initial `racket/base` import is also macro-introduced and doesn't bind `#%top` for `pi`. OK, this

Re: [racket-users] web-server: generating HTML with styles

2015-08-24 Thread Matthew Butterick
I haven't used the HTML module (though it is, AFAICT, intended for parsing HTML, not writing it). But the examples in the webserver docs (e.g., `send/back`) don't use that module. Instead, they construct responses out of X-expressions. Judging from your example, perhaps you are mixing up the

Re: [racket-users] web-server: generating HTML with styles

2015-08-24 Thread Matthew Butterick
PS on styling option 2) I should clarify the example of using an external style sheet. In addition to adding a 'class' or 'id' to the target, you'd also need to link in the external CSS, which you can do like this: `(html (head (link ((rel stylesheet)(type text/css)(media all)(href

[racket-users] Re: regexp question

2015-10-30 Thread Matthew Butterick
ed by Perl. On Friday, October 30, 2015 at 11:46:27 AM UTC-7, Tim Hanson wrote: > On Friday, October 30, 2015 at 7:21:58 PM UTC+1, Matthew Butterick wrote: > > To use \s as a matcher, you need #px not #rx: > > > > (define rx-empty-or-all-blank-string > >

Re: [racket-users] Re: Scribble-string->xexpr ?

2015-11-04 Thread Matthew Butterick
d regards, > > Stephen > > > [1] as an alternative I could just store my wiki pages as text files in a > git repository and get history for free but I wanted to keep it simple. > > > On Wed, 4 Nov 2015 at 02:27, Matthew Butterick <chro...@gmail.com> wrote: &

[racket-users] Re: Scribble-string->xexpr ?

2015-11-03 Thread Matthew Butterick
I found this task challenging too, so I made a Scribble-derived DSL that's natively oriented toward making X-expressions, for instance: #lang pollen/markup ◊title{Bottles --- ◊italic{Abridged}} ◊(apply itemlist (for/list ([n (in-range 100 0 -1)]) ◊item{◊(format "~a" n) bottles.}))

Re: [racket-users] Re: Scribble-string->xexpr ?

2015-11-04 Thread Matthew Butterick
'll have a look at the source for the pollen and scribble renderers to see > if I can separate reading a file from transforming markup. > > Thanks again > > Stephen > > > On Wed, 4 Nov 2015 at 15:42, Matthew Butterick <chro...@gmail.com> wrote: > I haven't spent muc

[racket-users] Re: regexp question

2015-10-30 Thread Matthew Butterick
To use \s as a matcher, you need #px not #rx: (define rx-empty-or-all-blank-string ;#rx"^[[:space:]]*$") #px"^\\s*$") See http://docs.racket-lang.org/reference/regexp.html?q=pregexp#%28elem._%28rxex._25%29%29 On Friday, October 30, 2015 at 11:15:08 AM UTC-7, Tim Hanson wrote: > hi, > > I

Re: [racket-users] Naming for generalization of find-min and find-max?

2015-10-12 Thread Matthew Butterick
> p.s. Although `find-most` is OK, IMO `find-` is usually a noise prefix > from the Department of Redundancy Department. Sort of like naming a > function `return-foo` instead of just `foo`. What else would a > function do except find or return foo? Agreed, but for this reason, `find-max` and

Re: [racket-users] how to add file types to `raco test`?

2015-07-09 Thread Matthew Butterick
://docs.racket-lang.org/raco/info_rkt.html?q=info.rkt On Jul 6, 2015, at 11:54 AM, Jack Firth jackhfi...@gmail.com wrote: On Sunday, July 5, 2015 at 4:51:22 PM UTC-7, Matthew Butterick wrote: `raco test` will automatically test every .rkt and .scrbl file in a directory. Suppose I make `#lang foo

[racket-users] unclear about this `parameterize` behavior

2015-08-30 Thread Matthew Butterick
In the example below, I'm curious about the reason for the difference between the behavior of the system parameter `error-print-width` and the custom parameter `my-param`. I understand why `my-param` doesn't take the parameterized value 'custom (= because `namespace-require` causes a fresh

[racket-users] Re: Best to ask here or on Stackoverflow from a language promotion perspective?

2015-12-09 Thread Matthew Butterick
> So, what is the best way? Neither will help promote the language, I'm afraid. But if you post your questions on this mailing list, it will bring the list a little more traffic, and thus, by your reasoning, make it a happier place. Whereas Stack Overflow will be depressing no matter what.

Re: [racket-users] Is there a way to return no value?

2015-12-11 Thread Matthew Butterick
PS. I'm assuming that you're using `eq?` here in deliberate preference to `equal?`. Because `eq?` is not reliable for string comparisons. > > #lang racket > > (require rackunit) > > (define (foo-3 x) (if (eq? x "foo") (list #t) empty)) > > (check-equal? (append-map foo-3 '(a b "foo" "bar"))

[racket-users] how to render scribble/lp2 with current manual style

2015-12-16 Thread Matthew Butterick
If you make these two Scribble files and click "Scribble HTML" in DrRacket, the second one (with `#lang scribble/manual) will render in the current manual style. But the first one (with `#lang scribble/lp2`) will render in the older manual style. This rendering issue surfaced on the list

[racket-users] pkg-build signals dependency error when there are no dependencies?

2015-12-16 Thread Matthew Butterick
Bug or feature? The pkg-build server claims my pollen-tfl package has "dependency problems." Yet the only "problem" seems to be that I've (deliberately) disabled compilation of the files: http://pkg-build.racket-lang.org/server/built/deps/pollen-tfl.txt I would think `raco setup` would be

Re: [racket-users] how to render scribble/lp2 with current manual style

2015-12-16 Thread Matthew Butterick
t; If you don't want to show a title, then it gets trickier. > > Maybe there should be a `scribble/lp-manual` to provide the manual > style in the same way as `scribble/manual`. > > At Wed, 16 Dec 2015 12:11:19 -0800, Matthew Butterick wrote: > > If you make these two Scr

[racket-users] Re: Letter spacing in slideshow

2015-12-17 Thread Matthew Butterick
A clue, perhaps, to tracking down the problem: It appears that the pairs that are being compressed — Pr, Re, Ty — are all pairs that have kerns applied (i.e., pair-specific spacing). Moreover, it looks like a systemic error in rendering the kerning (e.g., kern is being doubled) — notice how the

[racket-users] Re: Letter spacing in slideshow

2015-12-17 Thread Matthew Butterick
Whoops sorry, didn't see MFlatt's diagnosis. On Thursday, December 17, 2015 at 8:25:12 AM UTC-8, Matthew Butterick wrote: > A clue, perhaps, to tracking down the problem: It appears that the pairs that > are being compressed — Pr, Re, Ty — are all pairs that have kerns applied > (i

[racket-users] `raco setup` won't build docs when `compile-omit-paths` is 'all?

2015-12-17 Thread Matthew Butterick
Can't see how this would be a feature, but maybe I lack imagination: `raco setup` seemingly won't build docs when `compile-omit-paths` is 'all. For instance the "info.rkt" of this package specifies docs, but `compile-omit-paths` is 'all, and the docs are not built. raco pkg install

[racket-users] Re: Is there a way to return no value?

2015-12-10 Thread Matthew Butterick
Answer: Yes, if you redefine nothingness. You can exploit the fact that appending (or splicing) an empty list will cause it to disappear (meaning, no # residue). #lang racket (require rackunit) (define (foo-3 x) (if (eq? x "foo") (list #t) empty)) (check-equal? (append-map foo-3 '(a b "foo"

Re: [racket-users] Ligatures for monospace fonts in editors?

2016-01-02 Thread Matthew Butterick
Ligatures in coding fonts generally, and in Racket / DrRacket specifically, are a terrible idea. Even worse than `eval`. 1) In a Unicode-aware language like Racket, there's no way to visually distinguish a presentational use of a ligature from a syntactic use. For instance, these two strings

[racket-users] how to achieve internal cross-references in scribble/lp2

2015-12-29 Thread Matthew Butterick
Bug or insurmountable limitation? In the sample scribble/lp2 file below, the @racket[foo] reference at the end will *not* end up hyperlinked to the documentation for `foo` above it. I infer this is because `foo` and `bar` are treated as unbound identifiers. If you add @(require (for-label

Re: [racket-users] Simple regex question. How to match this: "[X] foo"

2016-01-09 Thread Matthew Butterick
> ...and extract the following strings: > "[X] Escape with Inoue-sensei" > "[X] Forget all these disloyal options and stick with Shikigami-sensei's > plan" > What method would you suggest for that? There's nothing wrong with `regexp-whatever`. But because Racket has so many good tools for list

Re: [racket-users] html parsing library does not handle 'article' tags -- any solutions?

2016-01-07 Thread Matthew Butterick
When we speak of "parsing HTML" we should distinguish between strict parsing (= explicit adherence to a given HTML spec) and permissive parsing (= converting an HTML-ish string into Racket data.) Both have their place. `article` became a valid HTML element in HTML5. IIUC the html library is a

Re: [racket-users] Advent of Code

2015-12-20 Thread Matthew Butterick
An adaptation of Jay's solution that turns every wire into a function that you can evaluate in the REPL. Plus: shorter. And dumber. Or cleverer? Thin line. https://gist.github.com/mbutterick/bc24a6291081b1ce0f31 On Saturday, December 19, 2015 at 11:53:52 AM UTC-8, Daniel Prager wrote: >

Re: [racket-users] Can scribble/lp2 typeset comments within chunks?

2015-12-22 Thread Matthew Butterick
of converting them to whitespace, why not just typeset them literally? Noob question complete On Dec 22, 2015, at 2:45 PM, Asumu Takikawa <as...@ccs.neu.edu> wrote: > On 2015-12-18 12:20:13 -0800, Matthew Butterick wrote: >> Third try: also tried scribble/comment-reader [2] but th

[racket-users] Can scribble/lp2 typeset comments within chunks?

2015-12-18 Thread Matthew Butterick
First try: seemingly not, because this file does not render to HTML with comments: ;;; #lang scribble/lp2 @chunk[<*> (define (f x) ; not g ;; amazing computation (* x x))] ;;; In HTML it becomes this: <*> ::= (define (f

Re: [racket-users] `raco setup` won't build docs when `compile-omit-paths` is 'all?

2015-12-17 Thread Matthew Butterick
17 Dec 2015 11:22:38 -0800, Matthew Butterick wrote: > > Can't see how this would be a feature, but maybe I lack imagination: `raco > > setup` seemingly won't build docs when `compile-omit-paths` is 'all. > > > > For instance the "info.rkt" of this package specifi

Re: [racket-users] change DrRacket syntax coloring per-source rather than per-lang?

2015-11-28 Thread Matthew Butterick
> But now that looked at the pollen docs, I see the issue. It looks like > you have to be able to run the config submodule of some program to be > able to figure out how to syntax color it I'm making progress with your suggested technique but hitting a dead end inside DrRacket. Here's what I've

Re: [racket-users] change DrRacket syntax coloring per-source rather than per-lang?

2015-11-28 Thread Matthew Butterick
o climb an additional learning curve (= of making their own sub-#lang). Easy things should be easy. > > Robby > > > On Sat, Nov 28, 2015 at 2:01 PM, Matthew Butterick <m...@mbtype.com> wrote: >>> But now that looked at the pollen docs, I see the issue. It looks l

Re: [racket-users] Flat Contract Value Generator

2016-06-06 Thread Matthew Butterick
On Jun 5, 2016, at 1:33 PM, Matthias Felleisen wrote: > when I taught a Sw Dev course and the students voted to use JSON as the data > exchange language. I always thought the reason you wisely prefer to keep politics out of programming was to avoid outcomes like this

Re: [racket-users] Learning by doing Typed Racket

2016-06-12 Thread Matthew Butterick
Some people, when confronted with a problem, think "I know, I'll use Typed Racket." Now they have (Pairof Problem Problem). On Jun 12, 2016, at 2:29 PM, Ben Greenman wrote: > Yeah I agree `inst` needs more documentation. > And as someone (Matthew B.?) suggested

Re: [racket-users] auto-defining variables mentioned in a program

2016-06-03 Thread Matthew Butterick
On Jun 2, 2016, at 11:47 AM, Jack Firth wrote: > - Have #%top somehow magically figure out if it should make a new box or > reuse an existing one for the identifier it's given. (call-with-future-miracle ...) I'll think about it more — but my hunch is this problem is

[racket-users] function to recreate source string from syntax object?

2016-06-11 Thread Matthew Butterick
This seems like something that has been done before, but I'm not sure where to look for it: I need something like `syntax->datum` — call it `syntax->source` — that uses the source locations and 'paren-shape property of the syntax to reconstitute the source with its whitespace (I suppose

Re: [racket-users] function to recreate source string from syntax object?

2016-06-11 Thread Matthew Butterick
On Jun 11, 2016, at 8:39 PM, Alex Knauth wrote: > > The syntax->string function from syntax/to-string formats a syntax object > with its whitespace and indentation, but doesn't look at the paren-shapes: Ah yes, thank you — I was so close. I think probably it should

[racket-users] auto-defining variables mentioned in a program

2016-06-02 Thread Matthew Butterick
I have a solution to this problem — is it legit, or is there some slick Rackety technique I'm missing? I'm making a toy #lang interpreter for Basic, which allows variables to be created with an assignment statement (like Python). The wrinkle in Basic is that the execution order of the lines

Re: [racket-users] auto-defining variables mentioned in a program

2016-06-02 Thread Matthew Butterick
On Jun 2, 2016, at 10:39 AM, Jack Firth wrote: > > I think you can do this by having your language provide it's own #%top syntax > that defines what to do with unknown variables. IIUC `#%top` can only provide fallback behavior at runtime, right? AFAICT it doesn't help

[racket-users] rebinding a macro-introduced identifier from afar?

2016-02-10 Thread Matthew Butterick
I suspect there's a simple way to do this, I just haven't done it before, so it does not appear simple. I tried a syntax parameter, and then I had two problems. Please consider this schematic example (no, I am not using macros to add): #lang racket (define-syntax-rule (foo) (+ x x))

Re: [racket-users] Expression-style printing and quotation: helpful or harmful?

2016-02-06 Thread Matthew Butterick
On Feb 5, 2016, at 7:00 PM, Alexis King wrote: > But everyone already knows all that. I only bring it up because I > monitor the [racket] tag on Stack Overflow[1] relatively closely, and a > whole lot of questions come up due to how people misunderstand the quote > form.

Re: [racket-users] Expression-style printing and quotation: helpful or harmful?

2016-02-07 Thread Matthew Butterick
BTW, as further evidence of Racket's comparative longevity and tenacity: the current pairs & lists explainer has been part of the online docs since v4.0, which was released — fact-checkers, you can correct me — before Stack Overflow even existed. So really, one canonical RTFM on the first day

Re: [racket-users] rebinding a macro-introduced identifier from afar?

2016-02-11 Thread Matthew Butterick
you put the val-id into the module via foo? Why is bar supposed to > do that? > > > > > On Feb 10, 2016, at 7:13 PM, Matthew Butterick <m...@mbtype.com> wrote: > >>>> You really want to parametrize foo over x for such things. (Or use a >>>> synta

Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-11 Thread Matthew Butterick
> Yes, thank you for mentioning them. I was actually thinking of starting with > SXML, but then turning it into a list of string fragments (with spaces left > for the dynamically generated parts) as a simplification step once I've > figured out where everything goes. But there are other

[racket-users] Re: Macros outline

2016-02-05 Thread Matthew Butterick
On Wednesday, February 3, 2016 at 11:37:39 AM UTC-8, Gavin McGimpsey wrote: > I'm hoping to expand it once I learn more about syntax-parse Macro humor — always best served dry. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe

Re: [racket-users] Re: Slack IRC bridge malfunctioning

2016-02-08 Thread Matthew Butterick
On Monday, February 8, 2016 at 10:25:50 AM UTC-8, Jack Firth wrote: > Slack's business model would be negatively affected by user data mining. They > operate on a "free for small hobbyist use, expensive for large corporate > use". Corporations do not like when you mine their data and are

[racket-users] list of macro & #lang resources

2016-01-27 Thread Matthew Butterick
For an upcoming project I'm assembling a list of articles & videos about making macros and #langs in Racket. These are the ones I've come across, but I welcome suggestions of others I've missed. Culpepper & Alvis: Basic Macrology http://rmculpepper.github.io/malr/basic.html Felleisen: Racket

Re: [racket-users] Process for providing new functions for the standard library

2016-02-25 Thread Matthew Butterick
On Wed, Feb 24, 2016 at 7:37 PM, Brian Adkins wrote: > As I get deeper into Racket, I expect I'll occasionally find a function > I'm used to having in the standard library of another language missing. I > can easily create my own packages for this sort of thing, but some

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

2016-01-23 Thread Matthew Butterick
> If you think (A) is the problem, then I think there's a > misunderstanding of HTTP responses. The Reason-Phrase is not mandated > to be anything in particular by the protocol---the client is not > required to even look at it and it can be replaced with anything. >

[racket-users] Re: (eqv? Racket-land Wonderland) -> #t

2016-02-15 Thread Matthew Butterick
On Monday, February 15, 2016 at 2:40:29 AM UTC-8, Nota Poin wrote: > Too powerful. It's a language that can define new languages from whole cloth. > It's a compiler of compilers. It's like trying to use a jet engine to propel > your tricycle. I would rather have a jet engine for my tricycle

Re: [racket-users] (eqv? Racket-land Wonderland) -> #t

2016-02-15 Thread Matthew Butterick
It's a question of perspective. A rocket-powered tricycle held the land speed record for 13 years. https://en.wikipedia.org/wiki/Blue_Flame_(automobile) On Feb 15, 2016, at 12:32 PM, Robby Findler <ro...@eecs.northwestern.edu> wrote: > On Mon, Feb 15, 2016 at 2:29 PM, Matthew But

Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-11 Thread Matthew Butterick
> Nota Poin wrote on 02/11/2016 04:48 AM: >> But there's no way I've ever been able to figure to produce generated text >> that is just a flat list of strings, if I ever want to have conditional >> decisions about what to go in that list. I'm supposing you know that Racket has at least two

Re: [racket-users] rebinding a macro-introduced identifier from afar?

2016-02-11 Thread Matthew Butterick
ct modules to require? > > On Thu, Feb 11, 2016 at 11:18 AM, Matthew Butterick <m...@mbtype.com> wrote: > > Why don't you put the val-id into the module via foo? Why is bar supposed > > to do that? > > > This is part of a larger pattern where I've got a basic `#%

Re: [racket-users] rebinding a macro-introduced identifier from afar?

2016-02-10 Thread Matthew Butterick
(make-rename-transformer #'foo)) ;; On Feb 10, 2016, at 2:52 PM, Matthias Felleisen <matth...@ccs.neu.edu> wrote: > > You really want to parametrize foo over x for such things. (Or use a syntax > parameter.) > > > On Feb 10, 2016, at 3:26 PM, Matthew B

Re: [racket-users] predicate as an atom within a regexp?

2016-03-18 Thread Matthew Butterick
er x) rest) x] [else 'no]) "42.3") On Mar 17, 2016, at 8:45 PM, Alex Knauth <alexan...@knauth.org> wrote: > There's a string-append match expander for that here, although it's pretty > slow right now. > http://docs.racket-lang.org/match-string/index.html > >

[racket-users] predicate as an atom within a regexp?

2016-03-18 Thread Matthew Butterick
What is the best approach to destructuring strings using predicates? For instance "match a substring for which `string->number` is true." I can approximate this using `regexp-match-positions` and stepping through possible substrings, testing until one matches, etc. But I notice that this

Re: [racket-users] colorizing code in html - scribble or the GUI?

2016-03-15 Thread Matthew Butterick
On Mar 15, 2016, at 4:11 PM, Sanjeev Sharma wrote: > is there a quick & dirty way to use scribble or the drracket GUI to generate > html for random code snippets? If you have Pygments installed, `pollen/unstable/pygments` and `pollen/template/html` can be used together

Re: [racket-users] predicate as an atom within a regexp?

2016-03-18 Thread Matthew Butterick
On Mar 17, 2016, at 2:05 PM, Andrew Gwozdziewycz wrote: > I am imagining an API that utilizes SCSH style regexes but allows you to do > something like this (fictional): > > (define-values (area prefix line) (sre-match (: (= digits 3) (_? "-") (= > digits 3) (_? "-") (=

Re: [racket-users] macros within expressions.

2016-04-06 Thread Matthew Butterick
> Expanding `y-coord` by itself leads to the error. I've tripped over this, so just to elaborate slightly. `syntax-id-rules` will work, but your current macro: ;;; (define-syntax y-coord (syntax-id-rules (map) [(map y-coord lst) (map (lambda (p)

[racket-users] my best idea ever: become a sponsor of RacketCon 2016

2016-04-12 Thread Matthew Butterick
I just sent $2000 to become a sponsor of this year's RacketCon. That's an increase from the $1500 I put in last year, and $1000 the year before that. I haven't been to all the RacketCons. But I know from going to the last few that Vincent St-Amour and Matthew Flatt have kept raising the bar.

Re: [racket-users] Questions about implementing a Lisp-2

2016-04-11 Thread Matthew Butterick
Messing with `current-namespace` seems like overkill, though maybe this approach is too naive for your needs, which just involves hiding the `defun` identifiers in the current namespace with a `defun:` prefix, then using `#%app` to pull them out again. #lang racket (require rackunit

[racket-users] why `read` vs. `read-syntax`?

2016-04-10 Thread Matthew Butterick
The docs describe the relationship this way: "In `read-syntax` mode, the result is always a syntax object ... wrapped around the sort of datum that `read` mode would produce." [1] Along those lines, I've yet to see a #lang where the `read` amounts to more than wrapping `read-syntax` with

Re: [racket-users] Racket -> HTML+JavaScript using Urlang and Ractive

2016-03-19 Thread Matthew Butterick
> and more ambitiously, a Racket (subset) ->JavaScript compiler (rjs), taking a > distinct approach from Whalesong. The short answer: +1 The longer: I am no fan of JavaScript, which I consider a brain-eating virus. [1] But IMO the "frameworkification" of JS has made it even worse. Yes, the

Re: [racket-users] Racket -> HTML+JavaScript using Urlang and Ractive

2016-03-19 Thread Matthew Butterick
When you put it that way, subjectively it still sounds good. I'd use it. But objectively I can't foresee that it would be a wise investment of anyone's Racket time. Let's face it: any web framework is lucky to live 5 yrs before developers tire of it and move onto the next thing, or browser

  1   2   3   >