Re: [racket-users] find-seconds daylight saving

2016-11-08 Thread Ryan Culpepper
On 11/08/2016 11:24 PM, George Neuner wrote: [...] - I need to turn the UTC datetimes on all the results back into local times with the right time zone Does the following do what you want? (require srfi/19) ;; date-at-tz : Date Integer -> Date ;; Returns date of equivalent instant in

[racket-users] Re: Round-tripping binary data through the web server

2016-11-08 Thread George Neuner
Hi David, On 11/8/2016 9:17 PM, David Storrs wrote: Thanks, George, that's helpful. How is your data being transported, though? You're returning a response object instead of an xexpr, but I don't see where it's being encoded. It's just a raw byte string, out of a database. It gets uploaded

Re: [racket-users] find-seconds daylight saving

2016-11-08 Thread George Neuner
Hi Jon, On 11/8/2016 6:28 PM, Jon Zeppieri wrote: George, these are not correct results. The UTC offset is correct, but the time fields are not -- under the assumption that you're trying to round-trip them unchanged. (But maybe that's not a correct assumption.) At any rate, I

Re: [racket-users] Selecting certain items from a list

2016-11-08 Thread Meino . Cramer
Hi Matthias, thanks for your reply ! :) I am learning a lot especially from examples like you gave me! :) Cheers Meino Matthias Felleisen [16-11-09 04:04]: > > > On Nov 8, 2016, at 9:36 PM, meino.cra...@gmx.de wrote: > > > > Hi, > > > > From a list of items I

Re: [racket-users] Selecting certain items from a list

2016-11-08 Thread Matthias Felleisen
> On Nov 8, 2016, at 9:36 PM, meino.cra...@gmx.de wrote: > > Hi, > > From a list of items I want to select certain items. The selecting > criterion is the index (nth item). > > From this list and from articles on the internet I think that indexing > a list and processing a list by index is not

[racket-users] Selecting certain items from a list

2016-11-08 Thread Meino . Cramer
Hi, >From a list of items I want to select certain items. The selecting criterion is the index (nth item). >From this list and from articles on the internet I think that indexing a list and processing a list by index is not a good idea -- at least it seems not to be very "lisp-y" or

[racket-users] Re: Round-tripping binary data through the web server

2016-11-08 Thread David Storrs
Thanks everyone. This was exactly what I needed to get my brain in gear. It's working now -- I really appreciate the help. On Tue, Nov 8, 2016 at 8:48 PM, David Storrs wrote: > > > On Tue, Nov 8, 2016 at 6:03 PM, George Neuner > wrote: > >> Hi

[racket-users] Round-tripping binary data through the web server

2016-11-08 Thread David Storrs
On Tue, Nov 8, 2016 at 6:03 PM, George Neuner > wrote: > Hi David, > > HTTP is printable characters only. In general you need to do something > like base64 encode raw byte data to get it across in any kind JSON wrapping.

[racket-users] Re: Round-tripping binary data through the web server

2016-11-08 Thread Jack Firth
HTTP headers are ASCII characters only (more accurately, ISO-8859-1 - slight differences from ASCII). So your protobuf message stored in the header may get bytes above the 127-character range of ASCII mangled. There's a few other issues here: 1. You're including the protobuf serialization in a

Re: [racket-users] find-seconds daylight saving

2016-11-08 Thread Jon Zeppieri
On Tue, Nov 8, 2016 at 6:26 PM, Jon Zeppieri wrote: > > > On Tue, Nov 8, 2016 at 6:18 PM, George Neuner > wrote: > >> >> On 11/8/2016 2:29 PM, Robby Findler wrote: >> >>> find-seconds returns a number, not a date? Maybe seconds->date is the >>> culprit

Re: [racket-users] find-seconds daylight saving

2016-11-08 Thread Jon Zeppieri
On Tue, Nov 8, 2016 at 6:18 PM, George Neuner wrote: > > On 11/8/2016 2:29 PM, Robby Findler wrote: > >> find-seconds returns a number, not a date? Maybe seconds->date is the >> culprit here? >> >> Robby >> > > Spoke too soon. 1 combination gets it right: (seconds->date >

Re: [racket-users] find-seconds daylight saving

2016-11-08 Thread George Neuner
On 11/8/2016 2:29 PM, Robby Findler wrote: find-seconds returns a number, not a date? Maybe seconds->date is the culprit here? Robby Spoke too soon. 1 combination gets it right: (seconds->date (find-seconds ... #F) #T). Note that (for me) Nov 6 should be DST [until 2AM], but Nov 7

Re: [racket-users] Round-tripping binary data through the web server

2016-11-08 Thread George Neuner
Hi David, HTTP is printable characters only. In general you need to do something like base64 encode raw byte data to get it across in any kind JSON wrapping. I'm not messing with XML, but I use the following for binary imagery: (send/back (if success ; succeeded

Re: [racket-users] POST requests never bound?

2016-11-08 Thread Ben Greenman
Here! https://github.com/racket/web-server/blob/master/web-server-doc/web-server/scribblings/dispatch.scrbl (If you install `raco-find-collection`, then running `raco fc web-server` should bring you close to the right place.) On Tue, Nov 8, 2016 at 4:38 PM, Luke wrote: >

Re: [racket-users] find-seconds daylight saving

2016-11-08 Thread George Neuner
On 11/8/2016 2:29 PM, Robby Findler wrote: find-seconds returns a number, not a date? Maybe seconds->date is the culprit here? Robby Possibly. But both functions take an optional local-time? parameter. The various combinations don't seem to affect the time zone wrt daylight saving.

Re: [racket-users] find-seconds daylight saving

2016-11-08 Thread Jon Zeppieri
I think Robby is right and the problem is here: https://github.com/racket/racket/blob/4ce947da74d09abc9cda10a14e7407cda9386a44/racket/src/racket/src/fun.c#L9876 Well, that and the next line. There's only a `return 1;` for the case where the given day-of-month is less than the DST change's

[racket-users] Round-tripping binary data through the web server

2016-11-08 Thread David Storrs
I'm still working with the protocol-buffers code in (planet murphy/protobuf). I want the web server to return a deserialized protocol buffer struct, then have the client deserialize it. I cannot make this work, and the problem is clearly due to the data being mangled by retrieving it from the

Re: [racket-users] All members of a list between two items

2016-11-08 Thread David Storrs
Right, I forgot about dropf and friends. I was looking at drop, which requires me to know the index. Yes, that works fine. Thanks. On Tue, Nov 8, 2016 at 4:56 PM, Vincent St-Amour < stamo...@eecs.northwestern.edu> wrote: > There's no built-in function that does exactly that. > > It's pretty

Re: [racket-users] All members of a list between two items

2016-11-08 Thread Vincent St-Amour
There's no built-in function that does exactly that. It's pretty straightforward to implement using a combination of `dropf` and `dropf-right`, though. Vincent On Tue, 08 Nov 2016 15:50:56 -0600, David Storrs wrote: > > Given a list of arbitrary data, I'd like to be able to say "look through

[racket-users] All members of a list between two items

2016-11-08 Thread David Storrs
Given a list of arbitrary data, I'd like to be able to say "look through the list for X and Y; give me everything between them." Ideally there would be a way to specify inclusive/exclusive on that. Example: (between-items '(a b c d e f) 'b 'e) => '(b c d e) Ideally it would also have a simple

Re: [racket-users] POST requests never bound?

2016-11-08 Thread Luke
I'd be happy to do do it. I've spent a little time digging around for the appropriate place, but nothing seems obvious. Would you (or someone else?) mind giving me a pointer to help me see where such an update most likely belongs? -- You received this message because you are subscribed to the

Re: [racket-users] find-seconds daylight saving

2016-11-08 Thread Robby Findler
find-seconds returns a number, not a date? Maybe seconds->date is the culprit here? Robby On Tue, Nov 8, 2016 at 12:32 PM, George Neuner wrote: > > Racket 6.6 on Windows 7. > > find-seconds is getting the time zone wrong when local-time? is #t. > Somehow it is in daylight

Re: [racket-users] Code in The Seasoned Schemer not accessible from REPL in Geiser or Dr. Racket

2016-11-08 Thread Matthias Felleisen
The proper way to reproduce the code is to enter the abbreviations for the TSS-specific functions and to ‘copy’ the code unaltered: #lang racket (define atom? symbol?) (define t #true) (define-syntax-rule (letcc k e) (call/cc (lambda (k) e))) (define rember1* (lambda (a l) (letrec

Re: [racket-users] Code in The Seasoned Schemer not accessible from REPL in Geiser or Dr. Racket

2016-11-08 Thread Vincent St-Amour
Ian, `oh` is indeed unbound inside the call to `call/cc`. `oh` is only bound within the body of the `lambda` that is on the right-hand side of the `letrec`; it is not bound in the body of the `letrec`, which is where the call to `call/cc` is. I don't have my copy of TSS handy. Did you make a

Re: [racket-users] POST requests never bound?

2016-11-08 Thread Matthew Butterick
On Nov 7, 2016, at 11:25 PM, Luke wrote: > Answer here for any other scheme illiterates that stumble over this. > [("sign-in") #:method "post" sign-in-post] I encourage you to post an example to the docs for `dispatch-rules`. There, your wisdom will have the greatest

[racket-users] Code in The Seasoned Schemer not accessible from REPL in Geiser or Dr. Racket

2016-11-08 Thread Ian Thomas
Hello list, I've been working through The Seasoned Schemer and have come across code that I can't access in the Racket REPL: specifically, the version of rember1* shown on p. 139 of the 17th chapter. I'm not sure why there is a complaint about the 'oh' variable being unbound in the last let

[racket-users] find-seconds daylight saving

2016-11-08 Thread George Neuner
Racket 6.6 on Windows 7. find-seconds is getting the time zone wrong when local-time? is #t. Somehow it is in daylight saving all through November. When local-time? is #f (UTC) the time zone and hour offset are correct. [At least for "fall back", didn't check "spring ahead"] (for* [(m '(11