Re: [racket-users] Implementing a lazy for/stream using for/fold/derived and delimited control

2015-05-20 Thread Konrad Hinsen
On 20/05/2015 04:24, Alexis King wrote: I'm trying to implement a for/stream loop using for/fold/derived that will return a lazy stream, as would be expected. One way to do this is by using delimited control, which is what I'm currently trying. If there's an easier way, let me know, but I'd

Re: [racket-users] Implementing a lazy for/stream using for/fold/derived and delimited control

2015-05-20 Thread Alexis King
I've never particularly loved racket/generator's interface, but you're right that it could be a useful base for this sort of abstraction. I do explicitly want a stream, but I could use in-generator in tandem with sequence-stream to get that. That said, I would still be interested in figuring

[racket-users] Systematic Program Design by Gregor Kiczales on edx.org

2015-05-20 Thread Stefan Schmiedl
Gregor Kiczales is offering a course on Systematic Program Design (https://www.edx.org/course/systematic-program-design-part-1-core-ubcx-spd1x) starting June 2. It promises to be an extended and improved reincarnation (three! parts) of the coursera offering. Racket (with various Student

[racket-users] Re: [racket][web] How to make security-guard work with servlets

2015-05-20 Thread Jay McCarthy
The Racket feature of a 'security guard' is not what you want, I think. It prevents a block of Racket code from doing things like accessing the file system or the network. It is used, for example, by evaluation sandboxes to protect against un-trusted user code. I don't think you want to run your

Re: [racket-users] Storing functions in a hash

2015-05-20 Thread Matthias Felleisen
Yes, this is over-engineered. What do you not like about (define h1 (hash 'foo (lambda () (random 100)) 'bar (lambda () (random 500 (displayln h1) (displayln ((hash-ref h1 'foo))) (displayln ((hash-ref h1 'foo))) (displayln ((hash-ref h1 'bar))) (displayln ((hash-ref h1 'bar)))

[racket-users] Storing functions in a hash

2015-05-20 Thread j b
I'm new to Racket/Scheme/Lisp. In addition to learning how to use the language, I also want to do it the Racket way. I am trying to put functions into a hash so I could call them using a hash key lookup (I just use 'random' as a filler in this example for what I really want. I have it

Re: [racket-users] Re: Implementing a lazy for/stream using for/fold/derived and delimited control

2015-05-20 Thread Matthew Flatt
At Tue, 19 May 2015 20:33:57 -0700, Alexis King wrote: As I've continued to experiment with this, I've run into something that I don't really understand. I've managed to come up with this snippet of code. (define (do prompt-tag) (define (loop element continue) (if continue

Re: [racket-users] Storing functions in a hash

2015-05-20 Thread Norman Gray
j b, hello. Depending on what this is a cut-down version of, I think you may have slightly over-engineered it. On 2015 May 20, at 13:41, j b phra...@gmail.com wrote: ; function definition helper (define-syntax-rule (define-hash-function f p ...) (define (f) (lambda () p ...))) This

Re: [racket-users] RACO : how to build a shared fPIC library?

2015-05-20 Thread Matthew Flatt
As you say, you can build the Racket executable using shared libraries by configuring with `--enable-shared`. Then, when you create an executable with `raco exe`, you end up with a smaller executable that refers to the shared libraries. I'm not sure how much that will save, since an executable

Re: [racket-users] Racket should not cancel an OS shutdown

2015-05-20 Thread Michael Tiedtke
Thank you very much!! Returning NSTerminateNow in the handler works fine me ... Il giorno 20/mag/2015, alle ore 16.44, Matthew Flatt ha scritto: It's been a few years since I last looked at this. If I remember correctly, the problem is a mismatch between the `racket/gui` model of

[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] Re: Specifying a contract for the end of a list

2015-05-20 Thread Alexander D. Knauth
Would an append/c combinator be a good generalization of this? I’ve already made an append/c combinator that works with just flat-contracts, but is there a good way to make it work for chaperone contracts? https://github.com/AlexKnauth/match-string/blob/master/match-string/main.rkt#L205

Re: [racket-users] Doing pattern matching by reader macro

2015-05-20 Thread Alexander D. Knauth
Here’s one way to do something like that with a macro: https://github.com/AlexKnauth/define-match-spread-out/blob/master/define-match-spread-out/main.rkt And using it: https://github.com/AlexKnauth/define-match-spread-out/blob/master/define-match-spread-out/tests/test.rkt On May 18, 2015, at

Re: [racket-users] RACO : how to build a shared fPIC library?

2015-05-20 Thread DEGAT Yann
the way osv.io works : the system doesn't have a userspace. there's a single memory address space in which the system boots, and at the end of the init, the only OS process makes a call to the main function of the shared library that has been added to the system. it's not able to spawn any new

Re: [racket-users] Racket should not cancel an OS shutdown

2015-05-20 Thread Matthew Flatt
It's been a few years since I last looked at this. If I remember correctly, the problem is a mismatch between the `racket/gui` model of eventspaces and the way that shutdown notifications and responses work in Cocoa. The mismatch makes it difficult for `racket/gui` to defer its answer to the OS

[racket-users] How to fill a shape with a texture using 2htdp/image or similar?

2015-05-20 Thread Daniel Prager
2htdp/image makes it easy to draw all sorts of solid shapes (triangles, squares, stars, etc.) and fill them with a solid color. But say I want to fill with a texture (say from a bitmap loaded from a file). I could brute-force it by creating a separate stencil image, converting both to pixels and

[racket-users] [racket][web] How to make security-guard work with servlets

2015-05-20 Thread WarGrey Gyoudmon Ju
Hello Jay, and Racketeers. What the original problem is: I want my pure Racket Web Server listens on port 80, and this server allows per-user dynamic content. As a security problem, no comprehensive solutions exists, it is a big topic of system administration. In real world, the racket web

[racket-users] Re: [racket][web] How to make security-guard work with servlets

2015-05-20 Thread WarGrey Gyoudmon Ju
On Wed, May 20, 2015 at 7:09 PM, Jay McCarthy jay.mccar...@gmail.com wrote: The Racket feature of a 'security guard' is not what you want, I think. It prevents a block of Racket code from doing things like accessing the file system or the network. It is used, for example, by evaluation

Re: [racket-users] How to fill a shape with a texture using 2htdp/image or similar?

2015-05-20 Thread Robby Findler
2htdp/image doesn't support that now, but the color argument of various functions there could be generalized to support a new brush struct (in the way that pen structs work for outline images) that had a bitmap field to do what you want. The internal helper function mode-color-brush would have to