Re: [racket] Best typed/racket representation for bitfield of width 125?

2014-09-05 Thread Sam Tobin-Hochstadt
If you type check the file on a 64-bit system like yours, but then ran it on a 32-bit system, the fixnum range would change, making that number into a bignum. Sam On Sep 6, 2014 8:37 AM, "John Clements" wrote: > Is this a bug, or just a known limitation of typed racket? It looks like a > fixnum

Re: [racket] Best typed/racket representation for bitfield of width 125?

2014-09-05 Thread John Clements
Is this a bug, or just a known limitation of typed racket? It looks like a fixnum can be up to 2^61, but the type checker for integer literals doesn't like them. This program: #lang typed/racket (require racket/fixnum) (define (ensure-fixnum i) (cond [(fixnum? i) i] [else (error 'ensur

Re: [racket] typed racket cps, state machines

2014-09-05 Thread Matthias Felleisen
Would this do for you: #lang typed/racket (require typed/rackunit) (define-type Answer Boolean) (: find (All (α) (-> (-> α Boolean) (Listof α) (-> (Listof α) Answer) (-> Answer) Answer))) (define (find pred? l sk fk) (cond [(empty? l) (fk)] [(pred? (first l)) (sk l)] [else (fin

Re: [racket] Continuation marks

2014-09-05 Thread Matthias Felleisen
A continuation represents the rest of the computation with respect to a sub-computation, e.g., a procedure call. After a return from a procedure call, anything having to do is gone. In Racket, you can grab this continuation, including pieces from sub-sub-computations within the extent of the

Re: [racket] Submodules can't be imported in same file?

2014-09-05 Thread Sean Kanaley
Oh of course, I had inverted the hierarchy of modules. Your way is much more logical, thanks. I got too sidetracked into what exactly module+ does... On Fri, Sep 5, 2014 at 6:29 PM, Greg Hendershott wrote: > The following approach works for me. Would that do what you need? > > ;; - mod.rkt

Re: [racket] Submodules can't be imported in same file?

2014-09-05 Thread Greg Hendershott
The following approach works for me. Would that do what you need? ;; - mod.rkt - #lang racket (module private racket (define (secret) 'foo) (provide secret)) (require 'private) (define (wrapper) (secret)) (provide (all-defined-out)) ;; Note that all-defined-out will not provi

[racket] Continuation marks

2014-09-05 Thread Gustavo Massaccesi
I'm trying to add a continuation mark inside a function, but I want that the new mark to be visible after the functions returns. (Mostly for curiosity, not an actual problem.) I want something like this: ;-- #lang racket/base (define (display-cm-x) (displayln (continuation-mark-set->list

Re: [racket] Snapshot builds

2014-09-05 Thread Matthew Flatt
At Thu, 4 Sep 2014 20:48:43 +0100, Steve Lloyd wrote: > I recently ‘discovered’ (thanks to a tweet from @dkvansnickajr) the snapshot > builds for ARM6 built on Raspbian. > Previously I’d been recommending people try out Racket on RasPi via the > source+built packages route, but realise they migh

Re: [racket] Submodules can't be imported in same file?

2014-09-05 Thread Sean Kanaley
(reply to all) Right but that doesn't work from within the file, only at REPL or another file. #lang racket (module+ invisible (provide x) (define x 3)) (require (submod "." invisible)) doesn't work Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Submodules can't be imported in same file?

2014-09-05 Thread Anthony Carrico
Look at the grammer in http://docs.racket-lang.org/reference/require.html, you use something like (submod "." wrap). -- Anthony Carrico signature.asc Description: OpenPGP digital signature Racket Users list: http://lists.racket-lang.org/users

Re: [racket] typed racket cps, state machines

2014-09-05 Thread Anthony Carrico
On 09/05/2014 11:48 AM, Matthias Felleisen wrote:> > 1. Your programs don't look like conventional cps... I have distilled my "cps-ish" examples too far away from any context. A concrete example of this pattern would be searching. The direct style is: (findf proc lst) -> any/c When I say "cps-is

[racket] Submodules can't be imported in same file?

2014-09-05 Thread Sean Kanaley
Hello, For ease of exporting wrapper functions I am trying to do something like #lang racket (module wrap racket or module+ wrap (provide (all-defined-out)) ) (require 'wrap) (provide (all-from-out 'wrap)) With (module wrap racket ...), (require 'wrap) works but the stuff to be wrapped i

Re: [racket] typed racket cps, state machines

2014-09-05 Thread Matthias Felleisen
1. Your programs don't look like conventional cps. Perhaps you're thinking 2-way continuations (as in Prolog implementations). 2. Don't use polymorphism. Just use (define (halt) (printf "done") (halt)) as the proper halt continuation, often falsely called initial continuation. 3. Think about

[racket] typed racket cps, state machines

2014-09-05 Thread Anthony Carrico
Thanks for occasional help learning typed racket on IRC. I'm still finding the pitfalls that await those of us used to dynamically typed programs. The other day I posted some cps patterns I figured out: http://pasterack.org/pastes/49759 Extending that to simple state machines that loop through

Re: [racket] Understanding error in use of submodule in my language

2014-09-05 Thread Marco Monteiro
Thanks, Matthew. I fixed it by not expanding the module* form in the local-expand, i.e. I used (list #'module*) as the third argument to local-expand. Cheers, Marco On Fri, Aug 22, 2014 at 4:38 PM, Matthew Flatt wrote: > I think this may be a problem in macro expansion with submodules. > > Th