Re: [racket] handin-server install problem: gnu-gunzip bad header

2014-04-03 Thread Breanndán Ó Nualláin
Thanks for the suggestion Robby but no luck, I'm afraid. DrRacket gives the error below. Although it then claims to complete the installation, the server button doesn't appear even after a restart. From the error message it seems that gnu-unzip expects the first two bytes of the file to be #o037

[racket] substring without the copy

2014-04-03 Thread Spencer Florence
Is there any way to perform `substring` without creating a new string? I'm working with lots of very large and (for all intents and purposes) immutable strings and would like to avoid the extra allocations and copy time. --Spencer Racket Users list: http://lists.racket-lan

Re: [racket] About genericity...

2014-04-03 Thread Alexander D. Knauth
Is this sort of like what you mean?: (define dup (my-match-lambda*)) (my-match-lambda-add-clause! dup [(list (? string? s)) (string-append s s)]) (my-match-lambda-add-clause! dup [(list (? integer? n)) (list n n)]) (check-equal? (dup "Hello") "HelloHello") (check-equal? (dup 10) '(10 10)) Here’

[racket] array documentation examples render as error text

2014-04-03 Thread John Clements
Grr… I meant to send this earlier. In documentation for functions such as array-axis-expand, the docs render the example evaluation results as a horrible block of error text rather than the correct answer; it looks like is related to issues with typed racket. See attached screenshot.Please disregar

Re: [racket] array documentation examples render as error text

2014-04-03 Thread Sam Tobin-Hochstadt
Fortunately, this has been fixed (thanks to Asumu), as you can now see in the snapshots: http://www.cs.utah.edu/plt/snapshots/current/doc/math/array_fold.html?q=array#%28def._%28%28lib._math%2Farray..rkt%29._array-axis-expand%29%29 Sam On Thu, Apr 3, 2014 at 6:16 PM, John Clements wrote: > Grr…

Re: [racket] instantiating multiple sandboxes with gui's

2014-04-03 Thread Robby Findler
I think the main missing thing is that the thread you're requiriing the user's program on should be under the control of the custodian. In other words, you'll want to create a new eventspace (under the new custodian) and queue a callback over to it to require the user's program. Robby On Thu, Ap

Re: [racket] instantiating multiple sandboxes with gui's

2014-04-03 Thread Greg Hendershott
So the background for Spencer's question was a problem with my Emacs racket-mode when using racket/gui/base. There's a long-ish bug report comment thread. If you want to read it, at all, you might want to skip to the last few comments, here: https://github.com/greghendershott/racket-mode/issues

[racket] Testing "impossible" branches in the code

2014-04-03 Thread Mikko Tiihonen
Hi, I've spent some time on the following problem, and would like to ask for your help: I'm writing a critical piece of an application, and would like to ascertain in a "belt and suspenders" kind of way that I get a customized exception if something goes wrong. The approach I have used is bas

Re: [racket] free-id-table. Is it a bug?

2014-04-03 Thread Ryan Culpepper
On 04/03/2014 12:42 PM, Roman Klochkov wrote: Thank you! Now I understand how to do it right. > but then the code it produces (the definition) changes the binding of ID Then why code without (module+ ..) works fine? Even in REPL all is fine. The short answer is that it sometimes worked b

Re: [racket] free-id-table. Is it a bug?

2014-04-03 Thread Roman Klochkov
Thank you! Now I understand how to do it right. > but then the    code it produces (the definition) changes the binding of ID Then why code without (module+ ..) works fine? Even in REPL all is fine. Thu, 03 Apr 2014 09:37:33 -0400 от Ryan Culpepper : >On 04/03/2014 01:26 AM, Roman Klochkov wr

Re: [racket] Racket/class, inherit-field all

2014-04-03 Thread Roman Klochkov
I didn't mean first-class. I did mean "only runtime". In python it is hard to check (no macroses...). But in Common Lisp, top-level defclass is accessible during macro-expansion. In Scala and Nemerel AFAIK classes also are accessible (with introspection)  from macros body. Thu, 3 Apr 2014 10:

Re: [racket] Confused about define-values(-for-export) forms in define-signature

2014-04-03 Thread Matthias Felleisen
On Apr 3, 2014, at 9:04 AM, Matthew Flatt wrote: > In other words, defining a variable in a signature is a lot like > defining a method in an Java interface. Defining `y` as a constant is > not especially useful If you follow the Java precedent, it is somewhat useful to have interfaces that d

Re: [racket] free-id-table. Is it a bug?

2014-04-03 Thread Jens Axel Søgaard
Thanks for the counterexample. /Jens Axel 2014-04-03 15:46 GMT+02:00 Ryan Culpepper : > On 04/03/2014 05:51 AM, Jens Axel Søgaard wrote: >> >> It seems the table needs to be created with #:phase -1. >> >> Since syntax-case uses a fender expression I added >> a begin in save-and-define, but it wo

Re: [racket] Racket/class, inherit-field all

2014-04-03 Thread Matthias Felleisen
On Apr 3, 2014, at 9:12 AM, Roman Klochkov wrote: > > classes in Racket are themselves *runtime* values > > Thank you. Now I understand. I don't remember any language with classes, > except Racket with such feature. It turns out almost all dynamically typed languages treat class in a first-c

Re: [racket] free-id-table. Is it a bug?

2014-04-03 Thread Ryan Culpepper
On 04/03/2014 05:51 AM, Jens Axel Søgaard wrote: It seems the table needs to be created with #:phase -1. Since syntax-case uses a fender expression I added a begin in save-and-define, but it works either way (because free-id-table-set! returns a non-false value). #lang racket (require (for-synt

Re: [racket] free-id-table. Is it a bug?

2014-04-03 Thread Ryan Culpepper
On 04/03/2014 01:26 AM, Roman Klochkov wrote: #lang racket (require (for-syntax syntax/id-table)) (define-for-syntax table (make-free-id-table)) (define-syntax (save-and-define stx) (syntax-case stx () [(_ ID) (free-id-table-set! table #'ID 1) #'(define ID 1)])) The problem is that s

Re: [racket] free-id-table. Is it a bug?

2014-04-03 Thread Roman Klochkov
Thank you. This works. But why (load a) and (module+ test (load a)) have different phases for `a'? Thu, 3 Apr 2014 11:51:15 +0200 от Jens Axel Søgaard : >It seems the table needs to be created with #:phase -1. > >Since syntax-case uses a fender expression I added >a begin in save-and-define, but

Re: [racket] Racket/class, inherit-field all

2014-04-03 Thread Roman Klochkov
> classes in Racket are themselves *runtime* values Thank you. Now I understand. I don't remember any language with classes, except Racket with such feature. Usually, either a class is a type, so it is defined in compile-time, or there no classes at all and objects just built on a prototype.

Re: [racket] Confused about define-values(-for-export) forms in define-signature

2014-04-03 Thread Matthew Flatt
At Thu, 3 Apr 2014 02:49:23 -0400 (EDT), dfel...@ccs.neu.edu wrote: > > A `define-values` in a signature adds a definition to any *importing* > > context (in contrast to `define-values-for-export` which adds a > > definition in any *exporting* context). The `define-values/invoke-unit` > > form "imp

Re: [racket] Fwd: Re[2]: Racket/class, inherit-field all

2014-04-03 Thread David T. Pierson
On Tue, Apr 01, 2014 at 09:07:01PM +0400, Roman Klochkov wrote: > But may I at least look in compile time what fields the class have? I'm not particularly knowledgable about classes, but... I think the answer is "no". That is what Matthias was showing with his answer. One thing that I didn't se

Re: [racket] free-id-table. Is it a bug?

2014-04-03 Thread Jens Axel Søgaard
It seems the table needs to be created with #:phase -1. Since syntax-case uses a fender expression I added a begin in save-and-define, but it works either way (because free-id-table-set! returns a non-false value). #lang racket (require (for-syntax syntax/id-table)) (define-for-syntax table (mak

Re: [racket] About genericity...

2014-04-03 Thread Roman Klochkov
Or even simpler  (define (dup a)   (cond     [(string? a) (string-append a a)]     [(integer? a) (list a a)]) :-) I think, Alejandro wanted to add clauses in different places (generic in one module, added method in another, for example). Thu, 3 Apr 2014 20:11:36 +1100 от Daniel Prager : >Her

Re: [racket] About genericity...

2014-04-03 Thread Daniel Prager
Here's an out-of-the-box option, using Racket's pattern matching with the (? predicate) form: (define/match (dup a) [((? string?)) (string-append a a)] [((? integer?)) (list a a)]