[racket] HtDP data definitions in Scribble

2014-01-26 Thread Marco Morazan
Dear All, Is there an easy (as in first-year students can do it) way nicely render data definitions a la HtDP using Scribble? For instance, A word is a (listof symbol). @defproc[(correct-spelling [w word?]) word]{Returns a word.} Having word? and word refer to its data definition. -- Cheers

Re: [racket] selectively local-expand sub-expressions

2014-01-26 Thread Carl Eastlund
Oh, and note that I changed define-dsl-syntax to _not_ use define-syntax-rule. That's important, if you're going to use the value of variables used in macro expansion. The define-syntax-rule form protects its output; you can't disassemble it and then run parts of the result. You can print them,

Re: [racket] selectively local-expand sub-expressions

2014-01-26 Thread Carl Eastlund
You can do it like this: https://gist.github.com/carl-eastlund/8640925 Basically, you quasiquote the result of the expansion, and then you unquote variables when you hit them so that they are evaluated normally. Anything with an unbound variable will fail at expansion time. Carl Eastlund On

Re: [racket] selectively local-expand sub-expressions

2014-01-26 Thread Scott Klarenbach
Sorry, I was combining all the examples into one for brevity. x has 2 possible bindings (one in the module and one in the macro), y is bound in the module and closes over the macro, and z is unbound and therefore should result in an error since nothing can be done with it. ;; example 1 (as per ou

Re: [racket] selectively local-expand sub-expressions

2014-01-26 Thread Carl Eastlund
Scott -- I don't understand exactly what you're asking, at least not based on the example you wrote. You defined x and y, but the error is about z. Is this just a typo? Or are you expecting a value for z to come from somewhere? Carl Eastlund On Sun, Jan 26, 2014 at 1:01 PM, Scott Klarenbach wr

Re: [racket] Racket v5.92

2014-01-26 Thread Sam Tobin-Hochstadt
On Jan 26, 2014 4:15 PM, "Martin DeMello" wrote: > > > On Sat, Jan 25, 2014 at 9:55 AM, Ryan Culpepper wrote: >> >> Racket 5.92 has a new package system, including a catalog of >> hundreds of already-available packages. Please visit >> >> http://pkgs.racket-lang.org/ >> >> for an overview of th

Re: [racket] Racket v5.92

2014-01-26 Thread Martin DeMello
On Sat, Jan 25, 2014 at 9:55 AM, Ryan Culpepper wrote: > Racket 5.92 has a new package system, including a catalog of > hundreds of already-available packages. Please visit > > http://pkgs.racket-lang.org/ > > for an overview of the packages. > Exciting :) Quick question: a few of the entries

Re: [racket] Getting an expression to type

2014-01-26 Thread Eric Dobson
In that case you can use cast until we fix the bug. (cast p (All (A B) ((A -> B) -> (A -> B On Sun, Jan 26, 2014 at 11:34 AM, Spencer Florence wrote: > Unfortunately that was a simplified example. The in the program I'm writing, > the type isn't Number but (All (A B) ((A -> B) -> (A -> B))),

Re: [racket] Getting an expression to type

2014-01-26 Thread Spencer Florence
Unfortunately that was a simplified example. The in the program I'm writing, the type isn't Number but (All (A B) ((A -> B) -> (A -> B))), which I can't check for with a predicate as far as I know. On Sun, Jan 26, 2014 at 2:31 PM, Eric Dobson wrote: > That is definitely a bug, not sure exactly w

Re: [racket] Getting an expression to type

2014-01-26 Thread Eric Dobson
That is definitely a bug, not sure exactly what is going wrong though. Can you file a bug for this? In terms of getting your program to run, if you replace '(not (parameter? p))' with 'number?' it should work. On Sun, Jan 26, 2014 at 10:08 AM, Spencer Florence wrote: > I'm having difficulty gett

[racket] Getting an expression to type

2014-01-26 Thread Spencer Florence
I'm having difficulty getting the following code to type: #lang typed/racket (: test : ((U Number (Parameterof Number)) -> Number)) (define (test p) (if (not (parameter? p)) p (p))) But I get the error: > Type Checker: Expected Number, but got (U Complex (Parameterof Number)) in: p

Re: [racket] selectively local-expand sub-expressions

2014-01-26 Thread Scott Klarenbach
Thanks a lot Carl...this is very enlightening. If I could impose one last question before I go off and digest everything: What is the "correct" approach to capturing the runtime values of any references that may be bound by the enclosing environment, for splicing into the final recursively-expand

Re: [racket] adding an s-exp-format to plai-typed?

2014-01-26 Thread John Clements
On Jan 26, 2014, at 5:41 AM, Matthew Flatt wrote: > There's a `to-string` function already. If that isn't what you want, > then yes: submit a pull request. Nope, that's exactly what I want. I checked the docs near s-exps and near display, but not near the string primitives. Thanks, John ___

Re: [racket] adding an s-exp-format to plai-typed?

2014-01-26 Thread Matthew Flatt
There's a `to-string` function already. If that isn't what you want, then yes: submit a pull request. At Sat, 25 Jan 2014 18:22:53 -0800, John Clements wrote: > I want some way to transform an arbitrary s-expression to a string, for use > in > error messages in plai-typed. This is easy to add (

Re: [racket] Bytes and GC

2014-01-26 Thread Matthew Flatt
At Sun, 26 Jan 2014 09:59:17 +0400, Roman Klochkov wrote: > > > (define a #"abcd") > > (define a0 (cast (cast a _bytes _pointer) _pointer _bytes)) > > (eq? a a0) > #f > > (bytes-set! a0 2 33) > > a > #"ab!d" > > (immutable? a) > #t > So I have two different objects with the same pointer. Will ga

Re: [racket] make-sized-byte-string and GC

2014-01-26 Thread Matthew Flatt
This looks right as far as I can tell, except that you need to return `res` after the `memcpy`. At Sun, 26 Jan 2014 00:08:09 +0400, Roman Klochkov wrote: > So, to make string, that is freed by reciever, I should make something like > > (define _string/transfer >        (make-ctype _bytes >  

Re: [racket] make-sized-byte-string and GC

2014-01-26 Thread Matthew Flatt
At Sat, 25 Jan 2014 14:37:30 -0500, Ryan Culpepper wrote: > On 01/25/2014 01:28 PM, Roman Klochkov wrote: > > Is making bytestring from pointer adds the pointer to GC? > >  > > > > > (define x (malloc 'raw 10)) > > > x > > # > > > (define b (make-sized-byte-string x 10)) > > > (cpointer-gcable

[racket] Fwd: Re[2]: Client-side cookies

2014-01-26 Thread Roman Klochkov
(save-cookies! url (purify-port impure-port)) Воскресенье, 26 января 2014, 2:00 -08:00 от Duncan Bayne : >On Thu, Jan 9, 2014, at 05:08 PM, Roman Klochkov wrote: >> I'm making fully RFC6265 compliant cookie support for net/url and http. >>  https://github.com/Kalimehtar/client-cookies >> >>

Re: [racket] Client-side cookies

2014-01-26 Thread Duncan Bayne
On Thu, Jan 9, 2014, at 05:08 PM, Roman Klochkov wrote: > I'm making fully RFC6265 compliant cookie support for net/url and http. > https://github.com/Kalimehtar/client-cookies > > It is still pre-alpha, but, I hope, will be ready in 2-3 weeks. Roman, thanks - I've taken a look but I'm afraid

Re: [racket] Racket v5.92

2014-01-26 Thread Manfred Lotz
Hi Ryan, Could the following be added please so that it is available with 6.0? openssl will not be loaded in Fedora 19 and 20. (require openssl) fails and ssl-load-fail-reason shows: "ffi-lib: couldn't open \"libcrypto.so\" (libcrypto.so: cannot open shared object file: No such file or direct