Re: [racket] lexer priority

2014-07-23 Thread Jon Zeppieri
On Thu, Jul 24, 2014 at 1:11 AM, Mangpo Phitchaya Phothilimthana wrote: > That's not ideal because if there is white space after BB#0:, it will match > COMMENT again. Is there a better way to do this? Factor out the difference? (line-comment (re-: (re-& (re-: ";" (re-* (char-complement #\newline

Re: [racket] lexer priority

2014-07-23 Thread Mangpo Phitchaya Phothilimthana
That's not ideal because if there is white space after BB#0:, it will match COMMENT again. Is there a better way to do this? On Wed, Jul 23, 2014 at 10:05 PM, Jon Zeppieri wrote: > Sorry, I sent that early by mistake. More below: > > On Thu, Jul 24, 2014 at 1:02 AM, Jon Zeppieri wrote: > > You

Re: [racket] lexer priority

2014-07-23 Thread Jon Zeppieri
Sorry, I sent that early by mistake. More below: On Thu, Jul 24, 2014 at 1:02 AM, Jon Zeppieri wrote: > Your example string is "\n; BB#0;\n" > So, I'd expect the lexer to match: > - whitespace > - line-comment > > Yes, `block-comment` matches, but `line-comment' ... gives the longer match, becau

Re: [racket] lexer priority

2014-07-23 Thread Jon Zeppieri
Your example string is "\n; BB#0;\n" So, I'd expect the lexer to match: - whitespace - line-comment Yes, `block-comment` matches, but `line-comment On Thu, Jul 24, 2014 at 12:46 AM, Mangpo Phitchaya Phothilimthana wrote: > Hi, > > I try to write a lexer and parser, but I cannot figure out how to

[racket] lexer priority

2014-07-23 Thread Mangpo Phitchaya Phothilimthana
Hi, I try to write a lexer and parser, but I cannot figure out how to set priority to lexer's tokens. My simplified lexer (shown below) has only 2 tokens BLOCK, and COMMENT. BLOCK is in fact a subset of COMMENT. BLOCK appears first in the lexer, but when I parse something that matches BLOCK, it al

Re: [racket] serialization of math/array

2014-07-23 Thread Matthias Felleisen
OK. I am beginning to wonder whether we're missing something in the contract world. On Jul 23, 2014, at 12:00 PM, Sam Tobin-Hochstadt wrote: > De-serializing an array of numbers and then passing it to typed code > would produce a wrapper, not a first-order check, and so would be very > e

Re: [racket] serialization of math/array

2014-07-23 Thread Sam Tobin-Hochstadt
De-serializing an array of numbers and then passing it to typed code would produce a wrapper, not a first-order check, and so would be very expensive. What you want is something that can tell that the untyped reference is dead after value is passed to typed code, so that a first-order check can be

Re: [racket] typed racket and unions of vector types

2014-07-23 Thread Sam Tobin-Hochstadt
This could be made to typecheck via a variety of methods: - We could add something ad-hoc to `vector-ref`. - We could add use-site variance to Typed Racket, so that it could tell that `vector-ref` is covariant (while `vector-set!` would be contra-variant). - We could do something less ad-hoc that

Re: [racket] serialization of math/array

2014-07-23 Thread Sam Tobin-Hochstadt
That really depends what the contracts are, and if they're first-order. Sam On Wed, Jul 23, 2014 at 11:45 AM, Matthias Felleisen wrote: > > Will these costs dominate the cost of I/O here? > > > On Jul 23, 2014, at 11:37 AM, Sam Tobin-Hochstadt > wrote: > >> Unfortunately, I think that strategy

Re: [racket] serialization of math/array

2014-07-23 Thread Matthias Felleisen
Let's assume we serialize arrays of numbers, which is what I assume the background to the question is. In that case, the answer isn't all that obvious to me. On Jul 23, 2014, at 11:47 AM, Sam Tobin-Hochstadt wrote: > That really depends what the contracts are, and if they're first-order.

Re: [racket] serialization of math/array

2014-07-23 Thread Matthias Felleisen
Will these costs dominate the cost of I/O here? On Jul 23, 2014, at 11:37 AM, Sam Tobin-Hochstadt wrote: > Unfortunately, I think that strategy would incur substantial overhead > for things like serialization of large arrays. > > Sam > > On Wed, Jul 23, 2014 at 11:28 AM, Matthias Felleisen

Re: [racket] typed racket and unions of vector types

2014-07-23 Thread Neil Toronto
On 07/20/2014 02:08 PM, Alexander D. Knauth wrote: I ran into this when trying to do vector-ref on a value of type In-Indexes from math/array. If I do something like this: #lang typed/racket (: v : (U (Vectorof Index) (Vectorof Integer))) (define v #(0)) (ann (vector-ref v 0) Integ

Re: [racket] serialization of math/array

2014-07-23 Thread Sam Tobin-Hochstadt
Unfortunately, I think that strategy would incur substantial overhead for things like serialization of large arrays. Sam On Wed, Jul 23, 2014 at 11:28 AM, Matthias Felleisen wrote: > > On Jul 23, 2014, at 11:10 AM, Neil Toronto wrote: > >> On 07/16/2014 10:25 AM, Berthold Bäuml wrote: >>> Hi, >

Re: [racket] serialization of math/array

2014-07-23 Thread Matthias Felleisen
On Jul 23, 2014, at 11:10 AM, Neil Toronto wrote: > On 07/16/2014 10:25 AM, Berthold Bäuml wrote: >> Hi, >> >> will there be serialization support for math/array and math/matrix in the >> near future? As far as I understand in principle it should be possible at >> leas in a straight forward

Re: [racket] serialization of math/array

2014-07-23 Thread Neil Toronto
On 07/16/2014 10:25 AM, Berthold Bäuml wrote: Hi, will there be serialization support for math/array and math/matrix in the near future? As far as I understand in principle it should be possible at leas in a straight forward way as there are already the routines array->list and list->array.

Re: [racket] Unbound identifier bug in contracts?

2014-07-23 Thread Brian Adkins
Wow, quick work! Thanks :) One of the many things that drew me to Racket was seeing Eli's relentless announcements of new Racket releases on comp.lang.lisp, and elsewhere, over the years which left an impression of a language that is being, and likely to continue to be, actively developed. Ther