[racket-users] Change how to print builtins

2017-06-22 Thread Sam Waxman
Hello, I was having trouble figuring out how to get racket to print values however I wanted. In particular, I was hoping to make exact nums print as decimals and true print as true (and not #t or #true). It would also be nice if I could custom print procedures so that + printed as plain old +

Re: [racket-users] Racket APIs doesn't strip Byte Order Mark (BOM) when reading strings from UTF-8 files

2017-06-22 Thread Matthew Flatt
At Thu, 22 Jun 2017 14:59:35 -0700 (PDT), kay wrote: > There're files that starts with BOM. When reading from those files, it seems > all of Racket's I/O API don't know to strip the BOM, making them extremely > difficult to work with. I think that's the normal choice for UTF-8 readers. (Just

[racket-users] R7RS implementation's installation

2017-06-22 Thread Jean-Michel HUFFLEN
Dear Racket developers, On my personal computer, I successfully installed the package for the nonofficial implementation of R7RS in Racket. But I didn't this operation at my university, the answer is https://... proxy web incorrect address I searched the documentation but I

Re: [racket-users] Expanding a macro into multiple syntax objects (Defining two things with one macro)

2017-06-22 Thread Sam Waxman
Bizarre, I was for some reason very convinced that begin defined its own scope! I guess I usually called it in the positions in which it becomes an expression as opposed to being used in its special form with splicing. The macro is working like a charm now. Thanks, I thought the solution would

Re: [racket-users] Expanding a macro into multiple syntax objects (Defining two things with one macro)

2017-06-22 Thread Sam Caldwell
Are you sure that `begin` doesn't suffice for your needs? It has a somewhat unintuitive scoping behavior. From the docs [1] The begin form is special at the top level, at module level, or as a body after only internal definitions. In those positions, instead of forming an expression, the content

Re: [racket-users] Expanding a macro into multiple syntax objects (Defining two things with one macro)

2017-06-22 Thread Deren Dohoda
Hi Sam, ​I'm a little unclear on your intended use case since (begin ...) does splice defines, for instance: (define (add-something x) (begin (define one 1) (define two 2)) (+ x one two)) ;; Welcome to DrRacket, version 6.9 [3m]. Language: racket/base, with debugging; memory

[racket-users] Expanding a macro into multiple syntax objects (Defining two things with one macro)

2017-06-22 Thread Sam Waxman
Hello, It's simple enough to write a macro that defines something. (define-syntax-rule (my-define name binding) (define name binding)) But what if I would like to define multiple things? I.e. (define-syntax-rule (my-multiple-define name ... binding ...) (define name binding) ...) The

Re: [racket-users] Consulting parameters in #lang web-server servlets

2017-06-22 Thread Philip McGrath
Ok, I think I've got it, but just to make sure I'm not missing any subtleties, or else for the benefit of posterity, here's the version with thread cells. In "common.rkt": #lang racket (provide my-val call-with-my-val) (define cell:my-val (make-thread-cell #f #t)) (define (my-val)

Re: [racket-users] Is it possible with Scrible's @hyperlink, to open the linked document in a new webpage?

2017-06-22 Thread E . Cómer
On Wednesday, June 21, 2017 at 10:27:38 PM UTC-7, Ben Greenman wrote: > #lang scribble/manual > @require[ >   (only-in scribble/core style) >   (only-in scribble/html-properties attributes)] > > > @(define new-window-style >    (style #f (list (attributes '((target . "_blank")) > > >

Re: [racket-users] Some inconsistent behavior with mutable prefab structs

2017-06-22 Thread Deren Dohoda
Thanks Matthew, that's fascinating. So do you think I was encountering it due to something like background expansion and a test submodule with quoted reference cases in my checks or something else? Maybe having that file open while also working on a file that requires it? I looked over the source

Re: [racket-users] Some inconsistent behavior with mutable prefab structs

2017-06-22 Thread Matthew Flatt
This is a bug in prefab registration when an instance of the prefab is loaded via `read` before the `struct` declaration is encountered. In other words, putting '#s((indexable (2 #f)) 0 #f) at the *start* of the first module below and running in a fresh Racket or DrRacket will demonstrate the

Re: [racket-users] Code critique (of naive code) would be very appreciated

2017-06-22 Thread Glenn Hoetker
Thank you, everyone!! I've gained some nice big picture lessons and appreciate the welcome to the community. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[racket-users] Some inconsistent behavior with mutable prefab structs

2017-06-22 Thread Deren Dohoda
Hi Racketeers, I am having some frustrations dealing with mutable prefab structures, getting errors about attempting to mutate an immutable structure. I wish I could give you a sequence of simple steps that I know for sure would reproduce the problem but I have not found them. I thought I had one

Re: [racket-users] Consulting parameters in #lang web-server servlets

2017-06-22 Thread Jay McCarthy
On Thu, Jun 22, 2017 at 10:21 AM, Philip McGrath wrote: > I've come up with a (relatively) minimal example. > > In "common.rkt": >> >> #lang racket >> (provide my-param) >> (define my-param >> (make-parameter #f)) > > > In "servlet.rkt": >> >> #lang web-server >>

Re: [racket-users] Consulting parameters in #lang web-server servlets

2017-06-22 Thread Philip McGrath
I've come up with a (relatively) minimal example. In "common.rkt": > #lang racket > (provide my-param) > (define my-param > (make-parameter #f)) In "servlet.rkt": > #lang web-server > (require "common.rkt") > (provide start) > (define (start req) > (response/xexpr >`(html (head (title

Re: [racket-users] Scribble: is there a way to refer to a section by its number in HTML?

2017-06-22 Thread Dupéron Georges
My apologies, the code I just posted was missing a `reverse`. Here's the fixed version: @(define (sec-number→string tag #:doc [doc #f]) (delayed-element (λ (the-renderer the-part the-resolve-info) (define sec-tag (make-section-tag tag #:doc doc)) (define resolved-sec-tag

Re: [racket-users] Consulting parameters in #lang web-server servlets

2017-06-22 Thread Jay McCarthy
Hi Philip, I think I'd have to see more code to really tell what the problem is, but here are some thoughts: - A continuation captures the values of parameters at the time it is captured. So, if your parameterize is outside of the dispatcher that calls the continuation, then the code inside the

Re: [racket-users] Scribble: is there a way to refer to a section by its number in HTML?

2017-06-22 Thread Dupéron Georges
Thanks a lot! I was able to build an @sec-number-ref function. Here it is below. Matthew, since this is not a copy-paste of your code, I hope you won't see any problems if I place this in the public domain / CC0 license? @(define (sec-number→string tag #:doc [doc #f]) (delayed-element

Re: [racket-users] Scribble: is there a way to refer to a section by its number in HTML?

2017-06-22 Thread Matthew Flatt
At Thu, 8 Jun 2017 08:55:00 -0700 (PDT), Dupéron Georges wrote: > Generally it is nice to get the actual section title printed when using > @secref["mysection"]. However, in some cases it is a bit awkwards: > > Chapter State of the art presents related work. Chapter Implementation > explains in

Re: [racket-users] Controlling the installation-specific "Racket Documentation" page

2017-06-22 Thread Matthew Flatt
You can set "doc-site.css" and "doc-site.js" to customize the presentation of documentation. That's how http://docs.racket-lang.org/ adds the Racket logo to the top-right of the page, for example. When you re-render documentation via `raco pkg` and/or `raco setup`, they won't replace your

[racket-users] Consulting parameters in #lang web-server servlets

2017-06-22 Thread Philip McGrath
I'm encountering some strange behavior when using parameters with my (stateless) web servlets. I want to check the value of a cookie every time a request is made to my server and make a Racket value derived from the cookie's value available for use within the servlet code. Since this value