Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Alexis King
> Ok. Yeah, if- branches aren't allowed to have definitions, or even sequences > of operations. You can get around this with begin Er, no you can’t... `begin` doesn’t create an internal definition context (or even a new scope). You can use an empty `let` instead: (define (f x) (if (even? x)

[racket-users] Re: Problems with building of Racket compiler with multiple threads

2015-09-23 Thread Juan Francisco Cantero Hurtado
What is the OS and the compiler? If you're using some unix-like OS, the output of "ulimit -a" would be useful. On 09/22/2015 10:34 AM, Дмитрий Кашин wrote: Dear all, I wanna notice that it was originally sent into us...@racket-lang.org mailing list, but it was rejected by list's moderator bec

[racket-users] Ambiguous binding error, and trying to add generic-interface inheritance

2015-09-23 Thread Alexander D. Knauth
I'm trying to add inheritance to generic interfaces: https://github.com/AlexKnauth/racket/tree/gen-extends But it's in a weird state where it's passing some of the time, (seemingly depending on how exactly I fiddle with it, compile it, rest

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Kaushik Ghose
Very neat! Thank you! Best -Kaushik On Wed, Sep 23, 2015 at 7:46 PM, Benjamin Greenman < benjaminlgreen...@gmail.com> wrote: > > On Wed, Sep 23, 2015 at 7:38 PM, Kaushik Ghose > wrote: > >> I haven't gotten to cond yet. > > > Ok. Yeah, if- branches aren't allowed to have definitions, or even > s

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Benjamin Greenman
On Wed, Sep 23, 2015 at 7:38 PM, Kaushik Ghose wrote: > I haven't gotten to cond yet. Ok. Yeah, if- branches aren't allowed to have definitions, or even sequences of operations. You can get around this with begin: (define (f x) (if (even? x) (/ x 2) (begin (define a (* x

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Kaushik Ghose
PS On Wed, Sep 23, 2015 at 7:38 PM, Kaushik Ghose wrote: > Hi! > > On Wed, Sep 23, 2015 at 7:33 PM, Benjamin Greenman < > benjaminlgreen...@gmail.com> wrote: > >> Could you post the "ugly" code? I'm curious because things like this >> compile fine: >> >> The ugly code looks like: (define (f x)

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Kaushik Ghose
Hi! On Wed, Sep 23, 2015 at 7:33 PM, Benjamin Greenman < benjaminlgreen...@gmail.com> wrote: > Could you post the "ugly" code? I'm curious because things like this > compile fine: > > (define (f-recur x y) > (cond ((< x 1) > 10) > (else >(define z 3) >(f-recur x y > > I'm d

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Benjamin Greenman
Could you post the "ugly" code? I'm curious because things like this compile fine: (define (f-recur x y) (cond ((< x 1) 10) (else (define z 3) (f-recur x y On Wed, Sep 23, 2015 at 7:25 PM, Kaushik Ghose wrote: > > On Wed, Sep 23, 2015 at 12:26 PM, Pierpaolo Bernardi >> wro

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Kaushik Ghose
> On Wed, Sep 23, 2015 at 12:26 PM, Pierpaolo Bernardi > wrote: > >> On Wed, Sep 23, 2015 at 6:18 PM, Kaushik Ghose >> wrote: >> >> > Can I have any statements in this block that I could have in a (define >> ...) >> > block? Can I have (defines ) for example? >> >> Yes, and yes :) >> > > Hmm. I

Re: [racket-users] Generating preorders

2015-09-23 Thread Jerzy Karczmarczuk
A general remark... Josh Grams solves the problem of -> Erich Rast wrote: >Someone on stackoverflow gave me a working implementation in Python 3 > >https://stackoverflow.com/questions/3269/ > >but it uses advanced features and I have no clue how to translate this >to Racket. Josh constructs

Re: [racket-users] Redex, traces and Graphviz

2015-09-23 Thread Robby Findler
Yes, but only in a fairly complex way. Your rendering function would have to call out to graphviz, get the results back as a png, use read-bitmap to get the png back into Racket, create an image snip and then insert that into the editor, using the more complex version of the `pp` argument. Here's

[racket-users] Redex, traces and Graphviz

2015-09-23 Thread Anton Podkopaev
Hello! I'm working on an operational semantics using PLT Redex. I use `traces` a lot to debug my semantics. To represent states in a nice way I'm using a pretty printer, but I want more -- I want to use Graphviz. Is it somehow possible to call Graphviz from my pretty printer, and incorporate a

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Kaushik Ghose
Thank you very much for your help! Best -Kaushik On Wed, Sep 23, 2015 at 12:26 PM, Pierpaolo Bernardi wrote: > On Wed, Sep 23, 2015 at 6:18 PM, Kaushik Ghose > wrote: > > > Can I have any statements in this block that I could have in a (define > ...) > > block? Can I have (defines ) for example

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Pierpaolo Bernardi
On Wed, Sep 23, 2015 at 6:18 PM, Kaushik Ghose wrote: > Can I have any statements in this block that I could have in a (define ...) > block? Can I have (defines ) for example? Yes, and yes :) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. T

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Kaushik Ghose
Hi! Thanks for your reply. > (define (f-recur x y) > (cond ((< x 1) > 10) > (else >... something complex > (f-recur x' y' > Can I have any statements in this block that I could have in a (define ...) block? Can I have (defines ) for e

Re: [racket-users] Question about structuring recursive code

2015-09-23 Thread Pierpaolo Bernardi
On Wed, Sep 23, 2015 at 3:20 PM, Kaushik Ghose wrote: > e.g. > > (define (f-recur x y) > (if (< x 1) > 10 > (f-recur-2 x y))) > > (define (f-recur-2 x y) > ... something complex here > (f-recur x' y') (define (f-recur x y) (cond ((< x 1) 10) (else

Re: [racket-users] Generating preorders

2015-09-23 Thread Erich Rast
You've just saved my day! Thanks a lot! Best, Erich On Wed, 23 Sep 2015 10:38:07 -0400 Josh Grams wrote: > On 2015-09-23 09:46AM, Erich Rast wrote: > >Someone on stackoverflow gave me a working implementation in Python 3 > > > >https://stackoverflow.com/questions/3269/ > > > >but it uses

Re: [racket-users] Generating preorders

2015-09-23 Thread Josh Grams
On 2015-09-23 09:46AM, Erich Rast wrote: >Someone on stackoverflow gave me a working implementation in Python 3 > >https://stackoverflow.com/questions/3269/ > >but it uses advanced features and I have no clue how to translate this >to Racket. Like this? #lang racket (define combinations ;

Re: [racket-users] Scribble: Typeset equations using Latex packages amsmath and amssym

2015-09-23 Thread Alexander D. Knauth
> On Sep 23, 2015, at 8:53 AM, Marc Kaufmann wrote: > #lang racket/base > > (require scribble/base > scribble/core) > > (provide equation*) > > (define (mymath start end . strs) > (make-element (make-style "relax" '(exact-chars)) `(,start ,@strs ,end))) > > (define (equation* . strs

Re: [racket-users] Re: More Racket Place abuse^H^H^H^H^H issues

2015-09-23 Thread Tim Brown
I have installed the patch, and my installation is now passing its stress test. FYI, I put a quick printf() in to show when the bc->link is null (i.e. when the bug would have manifested) -- it occurred 3 times in a run of 10M messages. Rare, indeed. Thanks for deaing with this so promptly. Tim

[racket-users] Question about structuring recursive code

2015-09-23 Thread Kaushik Ghose
Hi Folks, In recursive functions there is a termination clause that the function first tests for before proceeding. If the test clause succeeds an immediate value is returned, otherwise, a recursive call is made with some modification of input values. In much code the body of the recursive fun

[racket-users] Scribble: Typeset equations using Latex packages amsmath and amssym

2015-09-23 Thread Marc Kaufmann
Hi all, I had a hard time to get any equations into my scribble document, as writing \begin{equation*} f(x) = x^2 \end{equation*} would be turned into "$\backslash$begin...", which meant that it wouldn't actually show up as an equation but as garbage text with "begin{equation*}" and so on sho

Re: [racket-users] Generating preorders

2015-09-23 Thread Erich Rast
Thanks Robby and Vincent for the advice. Yes, I should have been more precise, I need to generate all *total preorders* of a given size. The task is equivalent to generating all weak orders. I think my idea to do this on the basis of permutations is flawed and I'll start from scratch but it would