Re: [racket-users] How to get a "green bar" (or similar) on passing tests?

2016-03-05 Thread Alex Knauth
There's also this DrRacket plug-in which works with rackunit to highlight 
passing tests in green and highlight failing tests in red, as you type:
https://github.com/miraleung/racketeer 

I thought it would be worth sharing.

> On Mar 6, 2016, at 12:08 AM, Daniel Prager  wrote:
> 
> Thank-you Stephen
> 
> I had tried to get it to work at the level of test-cases (which I still can't 
> grok), but not test-suites.
> 
> Those examples would make worthy additions to the docs.
> 
> 
> Much obliged
> 
> Dan


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] How to get a "green bar" (or similar) on passing tests?

2016-03-05 Thread Daniel Prager
Thank-you Stephen

I had tried to get it to work at the level of test-cases (which I still
can't grok), but not test-suites.

Those examples would make worthy additions to the docs.


Much obliged

Dan

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] How to get a "green bar" (or similar) on passing tests?

2016-03-05 Thread Stephen Chang
Do you mean something like?

#lang racket
(require rackunit)
(require rackunit/gui)
(define tests
  (test-suite
   "my tests"
   (test-equal? "check 1" 1 1)
   (test-equal? "check 2" 2 2)))
(test/gui tests)

But that will pop a window. Alternatively,

#lang racket
(require rackunit)
(require rackunit/text-ui)

(define tests
  (test-suite
   "my tests"
   (test-equal? "check 1" 1 1)
   (test-equal? "check 2" 2 2)))
(run-tests tests)

produces:

2 success(es) 0 failure(s) 0 error(s) 2 test(s) run
0

where 0 is the number of unsuccessful tests.



On Sat, Mar 5, 2016 at 11:43 PM, Daniel Prager
 wrote:
> Is there a way to get a successful run of RackUnit tests to give a bit of
> encouragement?
>
> E.g. 12 out of 12 tests passed.
>
> The regular set-up seems to follow the "no news is good news" philosophy.
>
> Also, I couldn't figure out how to summon the rackunit/gui test runner
> (which may be what I want). What does a minimal example look like?
>
> Many thanks
>
> Dan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] How to get a "green bar" (or similar) on passing tests?

2016-03-05 Thread Daniel Prager
Is there a way to get a successful run of RackUnit tests to give a bit of
encouragement?

E.g. 12 out of 12 tests passed.

The regular set-up seems to follow the "no news is good news" philosophy.

Also, I couldn't figure out how to summon the rackunit/gui test runner
(which may be what I want). What does a minimal example look like?

Many thanks

Dan

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] DrR: meta-q just worked!

2016-03-05 Thread Leif Andersen
 I am too, thank you.

Although it seems to split words from there open parenthesis. For example:

```
hello (some text)
```

Can be come (if it needs to split the line):

```
hell (
some text)
```

This is problematic because scribble seems to interpret the line break
as a space, and thus putting a space between `(` and `some`. Perhaps
it would make more sense to keep `(` attached with the word it is
with?

~Leif Andersen


On Sat, Mar 5, 2016 at 9:14 AM, Jens Axel Søgaard  wrote:
> Is there a way to set the paragraph width to 80 (it seems to be set to 60)?
>
> /Jens Axel
>
>
> 2016-03-04 21:06 GMT+01:00 Robby Findler :
>>
>> Lei Wang actually implemented it. I gave him some advice about it, but
>> it was his work. I'm very happy he did it too!
>>
>> https://github.com/LeiWangHoward
>>
>> Robby
>>
>>
>> On Fri, Mar 4, 2016 at 10:31 AM, Matthias Felleisen
>>  wrote:
>> >
>> > Thank you Robby. He added this a while back because it was my primary
>> > complaint about scribble in dr.
>> >
>> >
>> > On Mar 4, 2016, at 10:40 AM, "'John Clements' via Racket Users"
>> >  wrote:
>> >
>> >> I was editing scribble code, and by reflex, typed meta-q to reflow the
>> >> text. I was somewhat astonished when it worked. Is this a recent
>> >> change?
>> >>
>> >> I think I take DrRacket for granted way too often. Many, many thanks
>> >> for
>> >> an awesome IDE.
>> >>
>> >> John
>> >>
>> >>
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups "Racket Users" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an email to racket-users+unsubscr...@googlegroups.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Racket Users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an email to racket-users+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> --
> Jens Axel Søgaard
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Is it possible to implement generics to an already defined struct?

2016-03-05 Thread Andrew Kent
When you define a generic interface, you can specify defaults for _any_
kind of value you want.

Here is a small example that might be useful (which is really just the
example here

tweaked to be simpler and handle a struct (foo) that didn't define an
implementation of the generic interface when it was defined):

#lang racket
(require racket/generic)

(struct foo (bar) #:transparent)

(define-generics printable
(gen-print printable [port])
#:defaults ([string?
 (define/generic super-print gen-print)
 (define (gen-print s [port (current-output-port)])
   (fprintf port "String: ~a" s))]
[foo?
 (define/generic super-print gen-print)
 (define (gen-print f [port (current-output-port)])
   (fprintf port "Foo's bar: ~a" (foo-bar f)))]))

(gen-print (foo "hi"))

One downside to this is if you're doing a lot of these you'll pay more in
dispatch time than if you can define them directly in the initial struct
definition.

-Andrew

On Sat, Mar 5, 2016 at 1:20 PM, Ronie Uliana  wrote:

> Sorry for the beginner question :(
>
> I'm learning Racket and it is an amazing language. Documentation is great,
> but I couldn't find this.
>
> Let's say I have a struct defined somewhere I have no control:
>
> (struct blah (x y))
>
> Now, in my module, I have this generics:
>
> (define-generics my-thing
>   (level my-thing))
>
> Is it possible to make "blah" to implement "my-thing"? So I can use it
> like:
>
> (level (blah 1 2))
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Is it possible to implement generics to an already defined struct?

2016-03-05 Thread Ronie Uliana
Sorry for the beginner question :(

I'm learning Racket and it is an amazing language. Documentation is great, but 
I couldn't find this.

Let's say I have a struct defined somewhere I have no control:

(struct blah (x y))

Now, in my module, I have this generics:

(define-generics my-thing
  (level my-thing))

Is it possible to make "blah" to implement "my-thing"? So I can use it like:

(level (blah 1 2))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] DrR: meta-q just worked!

2016-03-05 Thread Jens Axel Søgaard
Is there a way to set the paragraph width to 80 (it seems to be set to 60)?

/Jens Axel


2016-03-04 21:06 GMT+01:00 Robby Findler :

> Lei Wang actually implemented it. I gave him some advice about it, but
> it was his work. I'm very happy he did it too!
>
> https://github.com/LeiWangHoward
>
> Robby
>
>
> On Fri, Mar 4, 2016 at 10:31 AM, Matthias Felleisen
>  wrote:
> >
> > Thank you Robby. He added this a while back because it was my primary
> complaint about scribble in dr.
> >
> >
> > On Mar 4, 2016, at 10:40 AM, "'John Clements' via Racket Users" <
> racket-users@googlegroups.com> wrote:
> >
> >> I was editing scribble code, and by reflex, typed meta-q to reflow the
> >> text. I was somewhat astonished when it worked. Is this a recent change?
> >>
> >> I think I take DrRacket for granted way too often. Many, many thanks for
> >> an awesome IDE.
> >>
> >> John
> >>
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-- 
Jens Axel Søgaard

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Racket 6.4 very slow

2016-03-05 Thread Matthew Flatt
Here's a recap of a few points, now that I've spent some time
investigating the issue.


Replicating the problem and detecting debugging mode:

If you start DrRacket fresh or create a new tab and paste

(define (total n)
  (for/sum ([x (in-range (+ 1 n))]) x))
(time (total 10))

into the interactions window, then it runs at non-debugging speed.
After clicking "Run" (with an empty program), the interactions window
runs the example with debugging speed.

That difference seems confusing, and it might explain why some had
trouble seeing the example run slowly.

In any case, I agree with the suggest that making DrRacket more clearly
display its current mode could be helpful.


Performance with debugging enabled:

I've made some compiler improvements that cut the debugging-mode time
for the example in half.

I don't think a factor of 10 is completely out of line for a program
that counts up to a billion and adds a pair of small numbers along the
way. Those are such small and optimizable steps that demanding extra
transparency is bound to get in the way. More typical/useful programs
see a smaller cost, because they use larger primitives and spend more
time in libraries.

Even for traditional Scheme benchmarks --- which are written using
minimal bits of the language so that there's little opportunity to hide
behind macro expansions or libraries --- most programs run in debug
mode with slowing factors in the x1.5 to x4 range. That seems
consistent with my experience running unoptimized C for debugging.


Improving the way debugging instrumentation works:

Since the example uses `for/sum`, it should benefit from spending its
time in a library abstraction that is not in debugging mode, as it did
in v6.2 and earlier.

I have an idea for restoring v6.2-like debugging, and I've replied to
Vincent's `syntax-original?` question on the dev list. (Everyone is
welcome to participate there, of course).

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.