Re: [racket-users] Using Greek Letters

2018-04-18 Thread Philip McGrath
(Forgot to reply all …) Assuming what you are referring to is the "LaTeX and TeX inspired keybindings" for DrRacket (https://docs.racket-lang.org/ drracket/Keyboard_Shortcuts.html#%28part._.La.Te.X_and_. Te.X_inspired_keybindings%29), you can insert the character "θ" by typing "\theta", then,

[racket-users] Segfault when using Graphical Debugger

2018-04-21 Thread Philip McGrath
In a particular module, I can consistently trigger a segfault by opening DrRacket's graphical debugger, setting a breakpoint, and evaluating an expression at the REPL. I am using Racket 6.12 on Mac OS 10.13.2: I have not (yet) tried to reproduce this on other platforms. Unfortunately I don't have

Re: [racket-users] Sequences in Typed Racket?

2018-04-22 Thread Philip McGrath
I hope there's a better way, but this works. The adapter submodule is needed because the normal `stream-cons` is a macro that expands into some private things that don't have types, and it requires that the rest expression produce a stream, not just any sequence. Note also, if you haven't worked

Re: [racket-users] Using serial-lambda to send lambdas to places

2018-04-15 Thread Philip McGrath
I think it would help to take a step back and think about what you're doing when you communicate with a place. As you know, places are effectively separate instances of the Racket VM: other than the explicit, low-level mechanisms like `make-shared-bytes`, they share no state at all, not even the

Re: [racket-users] Using serial-lambda to send lambdas to places

2018-04-15 Thread Philip McGrath
On Sun, Apr 15, 2018 at 2:51 PM, Zelphir Kaltstahl < zelphirkaltst...@gmail.com> wrote: > Having to write all things in terms of where things come from like in: > > > '([racket/base +] . [1 2]) > > is not ergonomic at all. > Absolutely! To be clear, I was not suggesting that you use that format

Re: [racket-users] Using serial-lambda to send lambdas to places

2018-04-15 Thread Philip McGrath
send-print-pch))) -Philip On Sun, Apr 15, 2018 at 3:08 PM, Philip McGrath <phi...@philipmcgrath.com> wrote: > On Sun, Apr 15, 2018 at 2:51 PM, Zelphir Kaltstahl < > zelphirkaltst...@gmail.com> wrote: > >> Having to write all things

Re: [racket-users] Installing packages

2018-04-23 Thread Philip McGrath
Yes. For some package , you can install it for your current user with the command "raco pkg install " or for the entire installation (which I often prefer) with "raco pkg install -i ". So, to install DrRacket, "raco pkg install drracket". Installing the document you linked to illustrates

Re: [racket-users] Sequences in Typed Racket?

2018-04-23 Thread Philip McGrath
e 10)]) fib) -Philip On Mon, Apr 23, 2018 at 3:10 PM, Philip McGrath <phi...@philipmcgrath.com> wrote: > It looks like you copied the code incorrectly: it should be (module > adapter racket ...), but you have (module adapter racket/stream ...). > > To get the special perform

Re: [racket-users] Sequences in Typed Racket?

2018-04-23 Thread Philip McGrath
Fibonacci > number to start counting. > > > On Sunday, April 22, 2018 at 10:48:12 AM UTC+2, Philip McGrath wrote: >> >> I hope there's a better way, but this works. The adapter submodule is >> needed because the normal `stream-cons` is a macro that expands into some

Re: [racket-users] Behavior of image-color? function

2018-03-27 Thread Philip McGrath
It looks like 2htdp/image accepts all strings as legal color values, but "if a string or symbol color name is not recognized, black is used in its place." In particular, note that (rectangle 20 20 "solid" "#ffe303") produces the same image as (rectangle 20 20 "solid" "#00"). Strings are

Re: [racket-users] error during prompt calculation: path->string: contract violation

2018-03-28 Thread Philip McGrath
The correct link seems to be https://github.com/racket/racket/issues/2023 (no final 0) -Philip On Wed, Mar 28, 2018 at 3:23 PM, Kieron Hardy wrote: > > An error report on the `enter!` problem would be welcome. >> >> > >> > D:\>racket >> > Welcome to Racket v6.12. >> > >

Re: [racket-users] Re: compile-zo: date for newly created .zo file ... is before source-file date ... which appears to be in the future

2018-03-28 Thread Philip McGrath
I don't really know, but a few thoughts: - I'm very suspicious about the daylight savings time possibility. Would you be comfortable sharing your specific timezone? - It might be helpful to see the results of file-or-directory-modify-seconds

[racket-users] typed/racket surprises

2018-04-02 Thread Philip McGrath
While experimenting with porting an typed program to Typed Racket, I encountered a few surprises. Some of these seem like they might be bugs, others missing features, and several probably are misunderstandings on my part. *1. struct subtyping doesn't work with #:type-name* The following program

Re: [racket-users] Why is there a space in the path to the Racket application on MacOSX?

2018-03-31 Thread Philip McGrath
My current approach is to put a file containing "/Applications/Racket v6.12/bin" in /etc/paths.d, which adds it to the default PATH for all users. Personally, I'm command-line-oriented enough that I try to avoid spaces and special characters in file names I'm likely to work with from the command

[racket-users] Another pkgs badge improvement, re needing documentation

2018-03-25 Thread Philip McGrath
While we're (sort of) on the subject of badges on pkgs.racket-lang.org: the "This package needs documentation" badge is mostly great, both as a producer and consumer of packages. I've encountered at least two types of cases, though, where packages may intentionally and justifiably lack

Re: [racket-users] Another pkgs badge improvement, re needing documentation

2018-03-26 Thread Philip McGrath
I'm realizing from this discussion that I'm not totally clear on how the distinction between source, built, binary, and binary library packages interacts with the lib/test/doc convention. (The packages I maintain all mix implementation, tests, and docs and are distributed as source.) Does, say, a

Re: [racket-users] Another pkgs badge improvement, re needing documentation

2018-03-26 Thread Philip McGrath
e commit that Conor Finegan made to > implement part of the idea that was rejected. > > Jay > > On Sun, Mar 25, 2018 at 5:49 PM, Philip McGrath > <phi...@philipmcgrath.com> wrote: > > While we're (sort of) on the subject of badges on pkgs.racket-lang.org: > the > > &quo

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

2018-03-16 Thread Philip McGrath
I suspect this may be an issue with your PostgreSQL schema. Racket uses the `jsexpr?` type for both the types "JSON" and "JSONB" at the PostgreSQL level.[1] Can you confirm that your column is defined with the "JSONB" type? [1]

Re: [racket-users] Prefab and mutable

2018-03-20 Thread Philip McGrath
a! #s(f 1 2) 5)`: set-f-a!: contract violation; given value instantiates a different structure type with the same name expected: f? given: '#s(f 1 2) -Philip On Tue, Mar 20, 2018 at 6:37 AM, 'Paulo Matos' via Racket Users < racket-users@googlegroups.com> wrote: > > > On 20/03

Re: [racket-users] Prefab and mutable

2018-03-20 Thread Philip McGrath
The reference section on "Reading Structures" has more relevant details: http://docs.racket-lang.org/reference/reader.html#%28part._parse-structure%29 -Philip On Tue, Mar 20, 2018 at 6:48 AM, Philip McGrath <phi...@philipmcgrath.com> wrote: > Given your definition of `(stru

Re: [racket-users] Prefab and mutable

2018-03-20 Thread Philip McGrath
Mutable values generally cannot be sent as messages on place channels. ("To a first approximation, place channels support only immutable, transparent values as messages." http://docs.racket-lang.org/reference/places.html The documentation for `place-message-allowed?` is also specific that only

Re: [racket-users] Just how hard would it be to add a mutable toplevel language to Racket?

2018-03-21 Thread Philip McGrath
You can already set! top level variables (or any variables) bound to functions. $ racket Welcome to Racket v6.12. > (define (f) 1) > (f) 1 > (set! f (lambda () 2)) > (f) 2 Alternatively, here is a little example of how you might define lambda-box: #lang racket (struct lambda-box ([proc

Re: [racket-users] not a number is a number

2018-03-22 Thread Philip McGrath
I think the introduction to the "Numbers" section is fairly clear that, from Racket's perspective, +nan.0 and +nan.f are inexact real numbers: https://docs.racket-lang.org/reference/numbers.html I do appreciate the irony of the names. Perhaps `(number? +nan.0)` could be added as another example

Re: [racket-users] Web server hits "Sorry, this page has expired. Please go back."

2018-10-14 Thread Philip McGrath
On Sun, Oct 14, 2018 at 5:30 AM George Neuner wrote: > You are absolutely correct that in typical usage globals are not closed > over ... normally they are considered mutable shared "communication" > state. > > However, I was speaking more generally: to be persisted long duration, > and be made

Re: [racket-users] Higher-order units

2018-10-17 Thread Philip McGrath
The way I have found to do this is to both use the `tag` form and explicitly rename all signature elements, e.g.: (define-unit twice-collector@ (import (tag base (prefix base: collector^))) (export collector^) (define item/c base:item/c) (define (collect . xs) (apply base:collect

Re: [racket-users] Web server hits "Sorry, this page has expired. Please go back."

2018-10-13 Thread Philip McGrath
On Sat, Oct 13, 2018 at 3:11 PM George Neuner wrote: > The web-server language helps in conserving memory because its > continuations can be serialized - stored in files, or in databases, etc. - > and so the program's continuation state(s) can be persisted to disk rather > than memory as in a

Re: [racket-users] Web server hits "Sorry, this page has expired. Please go back."

2018-10-13 Thread Philip McGrath
On Sat, Oct 13, 2018 at 4:02 PM Marc Kaufmann wrote: > If I understand correctly, the stateful servlet stores the continuation in > the RAM directly (probably in a form that is not that different from the > serialized one, but slightly more efficiently?), while the stateless > servlet writes

Re: [racket-users] Web server hits "Sorry, this page has expired. Please go back."

2018-10-13 Thread Philip McGrath
> > "Stateless servlets avoid this issue by making continuations serializable, > so they can be saved on the client, in a database, etc." > Does this mean I have to deal with managing them myself? > No, `#lang web-server` will manage the continuations for you, just as stateful servlets do. There

Re: [racket-users] Web server hits "Sorry, this page has expired. Please go back."

2018-10-13 Thread Philip McGrath
On Sat, Oct 13, 2018 at 6:32 PM George Neuner wrote: > Remember that a continuation is not a simple thing - in order to resume a > program from a particular point, the entire state of the current call chain > must be preserved: the globals, the call stack, the thread state, etc. ad > nauseam.

Re: [racket-users] Does Racket support tail call elimination?

2018-11-12 Thread Philip McGrath
As a descendant of Scheme, Racket has proper tail calls. Beyond that, in Racket, "there is no such thing as stack overflow; you can run out of memory if a computation involves too much context, but exhausting memory typically requires orders of magnitude deeper recursion than would trigger a stack

Re: [racket-users] Difficulty using subprocess

2018-11-15 Thread Philip McGrath
You can also use `file-stream-buffer-mode` instead of manually flushing the port: https://docs.racket-lang.org/reference/port-buffers.html#(def._((quote._~23~25kernel)._file-stream-buffer-mode)) -Philip On Thu, Nov 15, 2018 at 2:07 PM Brian Adkins wrote: > That was it - thanks! I guess I was

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

2018-11-06 Thread Philip McGrath
A variant on Alexis' example lets you circumvent Typed Racket's protections: #lang racket (module typed typed/racket (provide wrapper use) (struct wrapper ([v : Integer])) (: use (-> wrapper Integer)) (define (use w) (add1 (wrapper-v w (require racket/runtime-path)

Re: [racket-users] Re: Upgrading Racket

2018-10-03 Thread Philip McGrath
Seeing that you're on Mac, `which raco` should help to confirm what version of raco you have installed. (Interestingly, raco doesn't seem to support the `--version` flag, which I think it probably should. `racket --version` does work, but it's possible, albeit unlikely, that you could be have a

[racket-users] Racket-on-Chez snapshots

2018-10-01 Thread Philip McGrath
Would it be feasible and useful to start building Racket-on-Chez snapshots along with the other variants at https://pre.racket-lang.org? In light of the promising outlook for Chez replacing the current Racket VM in the relatively near future, I would be interested in starting to include it in my

Re: [racket-users] servlet development in REPL

2018-10-03 Thread Philip McGrath
While Jay and Sam have tried to answer the question you actually asked, my advice would be to approach this differently. When I am developing web server things interactively, I put them in the DrRacket definitions window and run the program with the "Run" button. You can then poke at the running

Re: [racket-users] Places code not using all the CPU

2018-10-08 Thread Philip McGrath
This is much closer to the metal than where I usually spend my time, but, if it terns out that multiple OS processes is better than OS threads in this case, Distributed Places might provide an easier path to move to multiple processes than using `subprocess` directly:

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

2018-09-26 Thread Philip McGrath
On Wed, Sep 26, 2018 at 1:36 AM Paulo Matos wrote: > I am keen on hearing about alternatives. The reason to do like this is > to minimize friction with clients. Clients in the area of development > tools expect something that they can execute and generally are not too > keen on scripty calls

Re: [racket-users] Licence guidance

2018-09-26 Thread Philip McGrath
If you want a permissive license, the FSF itself says that "Apache 2.0 is best" because it addresses patent issues: https://www.gnu.org/licenses/license-recommendations.html#small -Philip On Wed, Sep 26, 2018 at 4:32 PM Deren Dohoda wrote: > I put a package up but it has no license info in

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

2018-09-25 Thread Philip McGrath
On Tue, Sep 25, 2018 at 3:46 PM 'Paulo Matos' via Racket Users < racket-users@googlegroups.com> wrote: > OK, so I understand now that what I want is an unimplemented feature, > but in most compilers these days and certainly those based in LLVM and > GCC there's a feature called whole-program

[racket-users] Re-naming Scribble documents

2018-09-19 Thread Philip McGrath
I've renamed a Scribble file documenting a package, and now I'm getting warnings from `raco setup` of the form: "WARNING: duplicate tag:" [some tag from this document] "in: in:" [the document I just renamed]. Is there a cache somewhere that I need to delete? I've already tried using the

Re: [racket-users] Re-naming Scribble documents

2018-09-19 Thread Philip McGrath
I was specifying a collection, and `--tidy` did the trick! Thanks. -Philip On Wed, Sep 19, 2018 at 1:18 PM Matthew Flatt wrote: > At Wed, 19 Sep 2018 13:12:58 -0500, Philip McGrath wrote: > > I've renamed a Scribble file documenting a package, and now I'm getting > > warnings f

Re: [racket-users] Licence guidance

2018-09-24 Thread Philip McGrath
David linked above to https://download.racket-lang.org/license.html, where the Racket maintainers (who are not lawyers, and neither am I) explain their interpretation of how "linking" in the LGPL applies to Racket. I think it's worth copying here for the record: Since the LGPL license that Racket

Re: [racket-users] hackernews

2018-12-29 Thread Philip McGrath
On Sat, Dec 29, 2018 at 1:48 PM Tomasz Rola wrote: > Where does Racket belong? I understand Racket community no longer > considers themselves as part of Scheme landscape, but I am unable to > say where I get this impression from. If I am wrong, then the first > thing for anybody willing to

Re: [racket-users] Re: hackernews

2018-12-29 Thread Philip McGrath
On Sat, Dec 29, 2018 at 10:31 AM BD1 a wrote: > I may be out of place here as I am a total beginner to programing. > I think hearing from an absolute newcomer is very useful: ignorance is a non-renewable resource! Respectfully, I would also concentrate on Rackets web presence. If I was > to

Re: [racket-users] Functional augmenting

2019-01-04 Thread Philip McGrath
I can't think of "something similar in functional Racket" (of course you can write purely functional programs with racket/class, but I know what you mean). I think it would be fairly easy to implement "something similar," but I want to clarify what you have in mind, because augmentable methods

Re: [racket-users] Multiple places listening to a TCP port [was: Racket application servers]

2018-11-29 Thread Philip McGrath
On Sun, Nov 25, 2018 at 6:13 PM Matthew Flatt wrote: > At Sat, 24 Nov 2018 19:39:19 -0500, Philip McGrath wrote: > > On Fri, Nov 23, 2018 at 5:44 PM George Neuner > wrote: > > > > > Multiple (identical) server instances running on the same machine can > > >

Re: [racket-users] minor doc change proposal?

2018-11-29 Thread Philip McGrath
I can do it. -Philip On Thu, Nov 29, 2018 at 5:17 PM John Clements wrote: > I like your idea better than mine. Do you have time to make it a pull > request? If not, I’ll do it. > > John > > > On Nov 29, 2018, at 2:08 PM, Philip McGrath > wrote: > > > > I

Re: [racket-users] Re: What is the best way to daemonize a Racket program on linux?

2018-11-29 Thread Philip McGrath
To give you an example, here's a very basic systemd file that I use to run a Racket web server: /etc/systemd/system/ricoeur-portal.service [Unit] Description=Digital Ricoeur portal web server [Service] User=ricoeurd Group=ricoeurd AmbientCapabilities=CAP_NET_BIND_SERVICE

Re: [racket-users] minor doc change proposal?

2018-11-29 Thread Philip McGrath
I would find `true?` confusing, since it really means "truthy." For example, in Rackunit, `check-not-false` has this behavior, whereas `check-true` checks that the result is really `eq?` to `#t`. Personally, I think it might be better to clarify the documentation with more prose, rather than

Re: [racket-users] Re: What is the best way to daemonize a Racket program on linux?

2018-11-29 Thread Philip McGrath
rately, I can get > auto-restart etc. for free w/o having to code up a master Racket process > supervising N worker processes. > > On Thursday, November 29, 2018 at 5:17:38 PM UTC-5, Philip McGrath wrote: >> >> To give you an example, here's a very basic systemd file that

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

2018-11-23 Thread Philip McGrath
I actually have an experimental `in-match` macro, analogous to `in-value`: https://docs.racket-lang.org/adjutor/Experimental.html#(form._((lib._adjutor%2Fmain..rkt)._in-match)) One open question with my version (and one of the reasons I consider this experimental) is what should be done if one of

Re: [racket-users] Racket application servers

2018-11-23 Thread Philip McGrath
I'm not familiar with Ruby, so this is just some general information. The Racket web server already supports concurrency with its built-in green threads, so handling one request won't block the concurrent handling of another. (Not all languages' built-in web servers do this; I don't know about

Re: [racket-users] Racket application servers

2018-11-23 Thread Philip McGrath
I'm not sure if this was clear from what I said earlier, but I use the Racket web server without anything in front of it. In fact, Racket does SSL termination and serves as a proxy for non-Racket services. We have been completely satisfied with its performance and reliability. -Philip On Sat,

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

2018-11-23 Thread Philip McGrath
Depends on what `x` is, both symbolically and in terms of binding: (for/first ([(list _) #hash([(a) . 1])]) list) (define-match-expander x (syntax-rules () [(_ pat) (list pat)])) (match '(ok) [(x v) v]) -Philip On Fri, Nov 23, 2018 at 11:41 PM Greg Hendershott wrote: > > The

[racket-users] Multiple places listening to a TCP port [was: Racket application servers]

2018-11-24 Thread Philip McGrath
On Fri, Nov 23, 2018 at 5:44 PM George Neuner wrote: > Multiple (identical) server instances running on the same machine can > listen for connections on the same network port - an incoming client call > will be connected to only one of them. You only need to use different > ports when services

Re: [racket-users] Racket-on-Chez snapshot builds

2018-11-19 Thread Philip McGrath
If you use Travis CI with Greg's wonderful https://github.com/greghendershott/travis-racket script, as of this morning you can build against the Racket-on-Chez snapshots by adding a "RACKET_VERSION" of "HEADCS" to your build matrix. -Philip On Mon, Nov 19, 2018 at 5:06 PM Matthew Flatt wrote:

Re: [racket-users] What is the expected PLT package catalog refresh rate? Is it not refreshing now?

2018-11-19 Thread Philip McGrath
The package build server runs overnight, so the documentation should show up some time tomorrow morning. Maybe, though, it would be better if the catalog recognized that there is documentation in the "info.rkt" file and gave a more specific message when the only problem is that it just hasn't

Re: [racket-users] Re: Posting Events To Window Asynchronously From Different Thread?

2018-11-19 Thread Philip McGrath
There is a send-message-to-window function ( http://docs.racket-lang.org/gui/Windowing_Functions.html#%28def._%28%28lib._mred%2Fmain..rkt%29._send-message-to-window%29%29), though I've never used it, and it sounds like it is different from what you describe. -Philip On Mon, Nov 19, 2018 at 5:22

Re: [racket-users] web cells expiring unexpectedly quickly

2019-01-11 Thread Philip McGrath
On Thu, Jan 10, 2019 at 1:09 AM Jesse Alama wrote: > Playing around with stateless servlets, I find my web cells expiring > unexpectedly quickly. > I'm guessing you meant *stateful* servlets? Stateless web cells shouldn't expire. I will need to think about the rest more closely. -Philip --

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

2018-09-15 Thread Philip McGrath
Sure. For example: #lang racket (require syntax/parse/define rackunit) (define-syntax-parser foo [(_ arg:id) #''arg] [(_ arg:expr) #'arg]) (check-eqv? (foo 10) 10) (check-eq? (foo hello) 'hello) (check-pred procedure? (foo (λ (x) (* 2 x -Philip On Sat, Sep 15, 2018 at

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

2018-09-17 Thread Philip McGrath
It might help to know a bit more context about what you're trying to do. I think other Lisp-family languages use these terms in different ways, but in Racket it isn't usual to talk about a symbol being bound to something. A symbol is just a type of value (like an integer, a list, a vector, a

[racket-users] Performance for structs across typed–untyped boundaries

2018-09-17 Thread Philip McGrath
I have a fairly basic question about what checking is done when instances of structs defined in Typed Racket cross typed–untyped boundaries. For a concrete example, in the following program, I'm interested in the call to `container-append` from untyped code: #lang racket/base (module typed

Re: [racket-users] Reasons not to use match or define/match?

2018-12-19 Thread Philip McGrath
On Mon, Dec 17, 2018 at 4:08 PM Jens Axel Søgaard wrote: > However if you add a field to a struct foo, then you need to a new field > to all patterns matching foos. > If on the hand you used foo-bar then adding a field baz requires no > changes to the existing code. > You can avoid this issue

Re: [racket-users] Error handling for the GUI

2019-03-26 Thread Philip McGrath
As Ben pointed out, if the exception is a `real exn:fail:contract:blame`, you don't even need to parse the message string: #lang racket (define/contract (wants-exact x) (-> exact? exact?) x) (define/contract (wants-inexact x) (-> inexact? inexact?) x) (define (show-which-was-violated

Re: [racket-users] Does Racket have a sexp-syntax regular expressions?

2019-03-27 Thread Philip McGrath
You'll want to look at `parser-tools/lex-sre`: https://docs.racket-lang.org/parser-tools/Lexers.html#(mod-path._parser-tools%2Flex-sre) -Philip On Wed, Mar 27, 2019 at 8:45 AM zeRusski wrote: > No wait. I meant SRE-like to match strings, not TRX to match trees. Messed > up there, sorry > > --

Re: [racket-users] Re: How to install local dir package replacing pre-installed one

2019-04-05 Thread Philip McGrath
>From the output you showed, you seem to have only replaced the "rackunit" package, which is just a stub to depend on the "rackunit-lib", "rackunit-doc", "rackunit-gui," and "rackunit-plugin-lib", packages—those you still have installed in the installation default place. It also looks like you

[racket-users] Example "RealWorld" web application

2019-03-27 Thread Philip McGrath
The RealWorld project defines a simple but realistic client–server web application (a Medium-like blogging platform) for different front- and back-end frameworks to implement as an extended tutorial example. The API is standardized, so different front- and back-ends can be

Re: [racket-users] how to use union types

2019-02-25 Thread Philip McGrath
An alternative to figuring out how to satisfy the type checker is to use `cast`, e.g.: #lang typed/racket (require typed/json) (string-join (cast (string->jsexpr "[\"The\",\"quick\",\"brown\",\"fox\",\"...\"]") (Listof String))) Obviously this has pros and cons, the main pro being that it

Re: [racket-users] Use cases for tables and records

2019-02-22 Thread Philip McGrath
On Fri, Feb 22, 2019 at 8:14 AM Matt Jadud wrote: > However, I'm happy to push to Github as well as Bitbucket (which > apparently does not play well with the package distribution system?), so > that it can be poked at by others. > On Fri, Feb 22, 2019 at 8:47 AM Sam Tobin-Hochstadt wrote: >

Re: [racket-users] How to launch image display from racket REPL?

2019-03-16 Thread Philip McGrath
Here's one way: Welcome to Racket v7.2. > (require 2htdp/image racket/gui/base (only-in pict show-pict)) > (show-pict (empty-scene 100 100)) (The require of racket/gui/base seems to be needed for side-effect only, to prevent a "racket/gui/base is not available" error. That seems like it might be

[racket-users] Macros crossing documentation-time and run-time phases

2019-03-18 Thread Philip McGrath
Racket makes it easy to write macros that mix run-time code with various compile-time phases, using lexical scope to refer unambiguously to the correct binding for each identifier, including bindings that are not directly exported. Macro-generating macros are a great example, in that they expand

Re: [racket-users] Re: Simple conditional in web template

2019-03-18 Thread Philip McGrath
I don't use `include-template` (I've come to love x-expressions), but I believe this would work: @,(if #true @`{ This will be displayed if true } @`{ This will be displayed if false }) -Philip On Mon, Mar 18, 2019 at 11:48 AM Jérôme Martin wrote: > > On Monday, March 18, 2019

Re: [racket-users] Macros crossing documentation-time and run-time phases

2019-03-18 Thread Philip McGrath
On Mon, Mar 18, 2019 at 9:14 AM Matthew Flatt wrote: > I wonder whether the solution is an extension of `scribble/lp2` to > support a `require-for-chunk` form where `chunk` records any such > imports in its context and adds then to the stitched-together program. > > (require-for-chunk (only-in

Re: [racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Philip McGrath
I think it's fair to say that the Racket style guide is not as rigid as some other style guides for some other languages: as it says itself in the introduction, it "isn’t complete and it isn’t perfect" and is more a set of "guidelines and best practices" than binding universal rules. I think it is

Re: [racket-users] Running raco setup from within DrRacket?

2019-02-17 Thread Philip McGrath
I've written and use a `find-executable-path*` inspired by Emacs' `exec-path-from-shell` (which I'm pretty sure I learned about from Greg on this list) that gives the same API as `find-executable-path`, but with a special case for Mac OS:

Re: [racket-users] test user-interact function dont work

2019-02-17 Thread Philip McGrath
Well, if you call `(exit 0)`, your Racket program really will exit with code 0 without doing anything else: the function `exit` never returns, so, in your case, `execute` never returns, `refine-main` never returns, and Rackunit never gets a chance to look at any output it may or may not have

Re: [racket-users] Re: Loading foreign libraries on Windows

2019-02-12 Thread Philip McGrath
lly comes up > when a 32 bit application tries to load a 64 bit DLL. > > Alex. > > On Tuesday, February 12, 2019 at 2:18:55 PM UTC+8, Philip McGrath wrote: >> >> I'm encountering an issue using `ffi-lib` to load a DLL on Windows. The >> problem appears to be specific to

Re: [racket-users] Re: nested for loops and suggested alternatives

2019-02-10 Thread Philip McGrath
You may also want to look into the math/array and math/matrix libraries. -Philip On Sun, Feb 10, 2019 at 3:42 AM Alex Harsanyi wrote: > This line looks suspicious: > > (define results

Re: [racket-users] raco distribute creating too many subdirectories

2019-02-10 Thread Philip McGrath
I think this is probably a consequence of the quirk of `define-runtime-path` with directories that I reported at: https://github.com/racket/racket/issues/2336 I'm still not clear on whether the current behavior is intended and, if so, how one ought to do this sort of thing to work robustly with

Re: [racket-users] Wishlist for regexen: x mode, named captures, embeddable regexn

2019-02-11 Thread Philip McGrath
On Mon, Feb 11, 2019 at 2:32 PM David Storrs wrote: > It would be great if Perl's / pcre's "x" mode could be pulled into > Racket, ideally with modifiers on the end of the regexp instead of > inside it. This mode specifies that all whitespace in the pattern > should be ignored, so if you want

[racket-users] Loading foreign libraries on Windows

2019-02-11 Thread Philip McGrath
I'm encountering an issue using `ffi-lib` to load a DLL on Windows. The problem appears to be specific to Racket, as I seem to be able to load the same DLL from Python. Specifically, I'm trying to build platform-specific packages for libgit2. I can build the library and run its test suite

[racket-users] Pitfall for contracts with serializable structs

2019-02-05 Thread Philip McGrath
I was (relatively) recently bitten by an issue with putting contracts on serializable structs. What's worse, once I figured out what was going on, I realized that I'd run into this very issue before and even discussed it on this list

Re: [racket-users] Multipart HTTP requests

2019-01-29 Thread Philip McGrath
I've put up the code I mentioned for email-sending and a proxy server at https://github.com/LiberalArtist/multipart-writing-examples As noted, these are not general-purpose solutions to either of those problems—I know of a bunch of cases I don't cover, and I basically only have to use these with

Re: [racket-users] sxml vs xexpr frustrations

2019-02-01 Thread Philip McGrath
I've written a fair amount of XML processing code in Racket (sometimes one has to work with external standards and tools), and I thought I'd jump in to say that I've been content with xexpr. I don't mean that as a criticism of sxml, though: I happened to have learned xexpr first, and I've never

Re: [racket-users] Spritely awarded Samsung Stack Zero grant

2019-02-01 Thread Philip McGrath
Congratulations! This would be great news in any case, and it's even more exciting to know that you're doing it in Racket. -Philip On Thu, Jan 31, 2019 at 10:47 PM 'John Clements' via Racket Users < racket-users@googlegroups.com> wrote: > Truly excellent news! Can’t wait to hear about it at

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-01 Thread Philip McGrath
On the original question: Racket's struct types are generative (except for #:prefab structs), meaning that each time you evaluate a `struct` form (or, at a lower level, each time you call `make-struct-type`), the you create a fresh type distinct from all other types. That can be a bit confusing to

Re: [racket-users] Python's append vs Racket's append and helping novices understand the implications

2019-02-02 Thread Philip McGrath
I am certain people coming from Python are confused by this, since I was bitten by this very difference when I had to write some Python for the first time in a while. (What do you mean append has side-effects?!?) -Philip On Sat, Feb 2, 2019 at 10:30 AM Robby Findler wrote: > On Sat, Feb 2,

Re: [racket-users] Why would a value produced by eval-ing code not satisfy its type predicate? (Particularly, a SQL statement from the sql package)

2019-02-04 Thread Philip McGrath
On Sat, Feb 2, 2019 at 11:34 PM hashim muqtadir wrote: > > As long as you at least know the schema you're working with, you could > even generate select statements for all possible sets of columns at compile > time, and then just choose the right statement dynamically with a runtime > function.

Re: [racket-users] Multipart HTTP requests

2019-01-29 Thread Philip McGrath
I don't think there's a multipart-writing library yet, and it would be a great thing to have. I've written little multipart-writing functions for a small proxy server built on `http-sendrecv/url` and for sending email using `net/sendmail` with html and text/plain alternatives. I'm happy to share

Re: [racket-users] Real-world examples of XML usage?

2019-02-04 Thread Philip McGrath
On Mon, Feb 4, 2019 at 3:22 PM Neil Van Dyke wrote: > BTW, you *could* also do both XML and JSON. For example: for some Web > services, coming from a very complicated data model, IIRC, the > engineering process scenario was something like originally the > requirement was for XML, and then JSON

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

2019-06-05 Thread Philip McGrath
To add a bit to what Alexis said about flat contracts: On Wed, May 22, 2019 at 1:23 PM Alexis King wrote: > 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

Re: [racket-users] Typed Racket segmentation fault

2019-06-05 Thread Philip McGrath
ar`, then the program also works correctly. > > The program also works correctly with the JIT off, and under RacketCS. > > https://gist.github.com/samth/683042c4754c1c5ce284794b19dd37e3 > > > > On Wed, Jun 5, 2019 at 11:02 AM 'Paulo Matos' via Racket Users > > wrote:

Re: [racket-users] Typed Racket segmentation fault

2019-06-05 Thread Philip McGrath
On Wed, Jun 5, 2019 at 12:26 PM James Geddes wrote: > Annoyingly, my colleague had got the same speedup by using Numpy, but that > does require a change to the way one arranges the calculation (and the > change is unnatural, to my eye). > Also, that's cheating! Numpy is mostly written in C,

Re: [racket-users] Typed Racket segmentation fault

2019-06-05 Thread Philip McGrath
What version of Racket are you using? I get a segfault in 7.2, but 7.3 works for me. -Philip On Wed, Jun 5, 2019 at 10:42 AM James Geddes wrote: > Dear All, > > The following Typed Racket program is intended to produce an image of the > Mandelbrot set (but it doesn't bother actually displaying

Re: [racket-users] Re: Git-Backed Racket Packages, git archive

2019-06-13 Thread Philip McGrath
According to §2.2 Package Sources , for a Git package source in the syntax ‹scheme›://‹host›/.../‹repo›[.git][/][?path=‹path›][#‹rev›], "the package’s checksum is the hash identifying ‹rev› if ‹rev› is a branch or

Re: [racket-users] how to uninstall Racket 5.3.6?

2019-06-21 Thread Philip McGrath
One possibility is that you might have installed Racket via apt. A command like: sudo apt list --installed | grep racket should help to see if that is the case. If so, I think uninstalling the apt package would be sufficient. -Philip On Fri, Jun 21, 2019 at 3:23 PM Norman Ramsey wrote: > I

[racket-users] Reading comments

2019-04-28 Thread Philip McGrath
Is there a way to interpose on reading `#;`, `#|...|#`, and `#!` comments with the standard e-expression reader? I can override the handling of normal `;` line comments by adding a terminating macro to the reader, but adding dispatch macros for the others doesn't seem to work (see below). I

Re: [racket-users] Specializing functions accepting keywords

2019-07-11 Thread Philip McGrath
The easiest way I know is to use `curry`, since Alexis fixed its keyword argument support last year: #lang racket (define (fish #:name[name #f] #:color [color #f] #:studio

Re: [racket-users] Language-Specific Plugins: Toolbar button functionality to call drracket:eval:expand-program

2019-06-28 Thread Philip McGrath
If you're sure you want to get the raw program source and deal with it manually, you can use the method `get-definitions-text ` on the DrRacket

Re: [racket-users] Language-Specific Plugins: Toolbar button functionality to call drracket:eval:expand-program

2019-07-01 Thread Philip McGrath
On Mon, Jul 1, 2019 at 11:40 AM Thomas Dickerson < thomas_dicker...@alumni.brown.edu> wrote: > On Fri, Jun 28, 2019 at 5:50 PM Philip McGrath > wrote: > >> Again, this part works just fine. In particular, because of the way Racket's >> submodules >> <https:/

<    1   2   3   4   >