[racket-users] REPL printing importance?

2019-09-10 Thread Jack Firth
Survey question: how important is it that values print nicely at a REPL? Do 
any of you have pet peeves in this area, or cases you wished Racket handled 
better? Tales of woe gladly welcomed!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/a52b7215-15c2-4538-8024-ba2de2d5e5df%40googlegroups.com.


Re: [racket-users] no TR support for streams?

2019-09-10 Thread 'John Clements' via Racket Users
Oh! and in fact, you already bundled it as a pkg: 
https://pkgs.racket-lang.org/package/typed-racket-stream

Thanks!

John

> On Sep 7, 2019, at 2:23 PM, Alex Knauth  wrote:
> 
> 
>> On Sep 6, 2019, at 1:04 PM, 'John Clements' via Racket Users 
>>  wrote:
>> 
>> Perhaps I just don’t know how to search the racket docs correctly, but IIUC 
>> there’s no support for Streams in the current TR implementation? I just want 
>> to use stream-cons, empty-stream, stream-first, and stream-rest. I guess the 
>> easy workaround is just to use thunks to roll my own stream, but I’m 
>> wondering if I’m missing something obvious?
> 
> You can wrap `stream-cons`, etc. in contracts and keep the original stream 
> data type, but it's trickier than wrapping a normal function, and involves:
>  - an untyped file which imports the macros and exports "function-ized" 
> versions of the macros
>  - a typed file which imports those function-ized things with require/typed, 
> then exports new versions of the macros in terms of the functions
> 
> And looks something like like these two files:
> ; untyped-stream-function-ized.rkt
> #lang racket
> (provide stream-cons/fn)
> (require racket/stream)
> (define (stream-cons/fn a b)
>   (stream-cons (a) (b)))
> 
> ; typed-stream.rkt
> #lang typed/racket
> (provide stream-cons)
> (require/typed "untyped-stream-function-ized.rkt"
>   [stream-cons/fn (All (a) (-> (-> a) (-> (Sequenceof a)) (Sequenceof a)))])
> (define-simple-macro (stream-cons a b)
>   (stream-cons/fn (thunk a) (thunk b)))
> 
> This is the strategy I used for my `typed-racket-stream` repository:
> https://github.com/AlexKnauth/typed-racket-stream
> 
> I wanted to do this instead of "rolling my own" stream library because I 
> wanted to be able to share the same stream data-structure as existing untyped 
> racket files.
> 
> Alex Knauth
> 
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/50960124-B18A-445F-9511-5899E60D9A86%40knauth.org.



-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/2102ff51-b1e3-49a8-8348-c023dc83d960%40mtasv.net.


Re: [racket-users] transparency in Pict

2019-09-10 Thread George Neuner


On 9/10/2019 11:23 AM, Jens Axel Søgaard wrote:
Den tir. 10. sep. 2019 kl. 17.04 skrev Hendrik Boom 
mailto:hend...@topoi.pooq.com>>:


On Tue, Sep 10, 2019 at 03:23:43PM +0200, Jens Axel Søgaard wrote:

> I have extended "clipped" to handle regions defined by more than
one path.
> Now (clipped c ... p) will make a region from the curves c ...
and use
> the region to clip the pict p. Most common uses:
>
>    (clipped c p)          the part of p inside c
>    (clipped c1 c2 p)   the part of p between c1 and c2 (if c2 is
inside c1)

Does that mean the part of p that is inside c1 and outside c2? (which
would be meaningful even if c1 and c2 intersect?  That might happen
because of numerical instability.)


Whether is point is inside or outside the region given by the
two curves is decided by the "winding rule". See the
discussion on fill (which also uses the winding rule):

https://docs.racket-lang.org/metapict/index.html?q=metapict#%28def._%28%28lib._metapict%2Fdraw..rkt%29._fill%29%29

For filling with the even-odd rule I have an eofill, but I haven't 
written an eoclipped yet.


/Jens Axel


Just a couple of points relevant to using regions in general:

 - any region can be selected as the clipping region for drawing.

 - a region can be created from any closed figure: a rectangle, an 
ellipse, a looping point path, etc.


 - a region can be created by combining other regions using union, 
subtraction, and intersection.


 - a single region can cover multiple disjoint areas.

And a hint:
If you are attempting to "shade" objects by painting them with a partly 
transparent brush, you may (and probably will) end up with Moire 
patterns where objects overlay / intersect each other.  The way to apply 
shade without worrying about Moire is to create a single region that 
simultaneously covers all the to-be-shaded areas, and then to fill/paint 
that region with your chosen shading brush.


YMMV,
George

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/d201f4a1-5de0-e540-c1ae-8ac02c4d981e%40comcast.net.


Re: [racket-users] transparency in Pict

2019-09-10 Thread Jens Axel Søgaard
Den tir. 10. sep. 2019 kl. 17.04 skrev Hendrik Boom :

> On Tue, Sep 10, 2019 at 03:23:43PM +0200, Jens Axel Søgaard wrote:
>


> > I have extended "clipped" to handle regions defined by more than one
> path.
> > Now (clipped c ... p) will make a region from the curves c ... and use
> > the region to clip the pict p. Most common uses:
> >
> >(clipped c p)  the part of p inside c
> >(clipped c1 c2 p)   the part of p between c1 and c2 (if c2 is inside
> c1)
>
> Does that mean the part of p that is inside c1 and outside c2? (which
> would be meaningful even if c1 and c2 intersect?  That might happen
> because of numerical instability.)
>

Whether is point is inside or outside the region given by the
two curves is decided by the "winding rule". See the
discussion on fill (which also uses the winding rule):

https://docs.racket-lang.org/metapict/index.html?q=metapict#%28def._%28%28lib._metapict%2Fdraw..rkt%29._fill%29%29

For filling with the even-odd rule I have an eofill, but I haven't written
an eoclipped yet.

/Jens Axel

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgwxKrkbuqT_RbHtmX1Oda%2BEY_876naVT%2BQ5GJO2NWqxFQ%40mail.gmail.com.


Re: [racket-users] transparency in Pict

2019-09-10 Thread Hendrik Boom
On Tue, Sep 10, 2019 at 03:23:43PM +0200, Jens Axel Søgaard wrote:
> Den tir. 10. sep. 2019 kl. 14.54 skrev George Neuner :
> 
> >
> > Or create a region with a hole through it and use it to clip the drawing.
> >
> 
> Great suggestion. That's much better than using pict->bitmap.
> 
> I have extended "clipped" to handle regions defined by more than one path.
> Now (clipped c ... p) will make a region from the curves c ... and use
> the region to clip the pict p. Most common uses:
> 
>(clipped c p)  the part of p inside c
>(clipped c1 c2 p)   the part of p between c1 and c2 (if c2 is inside c1)

Does that mean the part of p that is inside c1 and outside c2? (which 
would be meaningful even if c1 and c2 intersect?  That might happen 
because of numerical instability.)

> 
> The example now becomes:
> 
> #lang racket
> (require metapict metapict/polygons)
> 
> (define (cutout p x y r)
>   (defv (w h) (pict-size p))
>   (with-window (window 0 w 0 h)
> (clipped (rectangle (pt 0 0) (pt w h))
>  (circle (pt x y) r)
>  p)))
> 
> (set-curve-pict-size 400 400)
> (def p (brushcolor "red" (fill (regular-polygon 5
> (cutout p 200 200 50)
> 
> Before only one curve was supported and the result of clipped was the
> interior,
> so the old clipped couldn't cut holes.
> 
> /Jens Axel

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20190910150434.phffylfchq6ennlm%40topoi.pooq.com.


[racket-users] competition feedback

2019-09-10 Thread Stephen De Gabrielle
Hi Racketeers,

I included some optional questions in the voting for the community choice.
As the responses were anonymous, and generally very positive and/or
reasonable, I thought I’d share them with you.

I’d like to recruit a small team to run the next comp - ideally dividing up
the tasks so they are small and fun and not onerous.

Have a look at the responses and contact me directly if you are interested.

—-

*How could the competition be improved?*

· Minimise the clicks needed to see the contestants' pictures.

· More fish

· Suggest more libraries to inspire people to try.

· Have the pictures of each entry next to the choice boxes

· Require actual image output for all entries so it's easier to vote

· Include the output (picture) in the overview at the end of the
competition for those who don't want to bother with downloading and running
the code.

· Send fewer emails

· WITH MY ENTRY. IT WILL BE AWESOME. WOULD HAVE BEEN. WOULD WILLEN
BEENISH.

· I thought it was handled well.

· unclear if i need to use metapict for this or not



*Are there any other sorts of competition you would like to see?*

· Racket Gamejam competition - Racket low-level competition -
Racket retro competition

· Best Racket tutorial

· Live coding! (Though I probably would not participate myself, but
I'd be very eager to watch it!)

· Racket-based MUD

· Same thing, but using pict3d!

· "THOSE WITH MY ENTRIES THAT I HAVE  A CHANCE OF WINNING.

· I'm having a lot of fun with your form."

· I think the art competitions are great - perhaps animated stuff?



-- 


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAGHj7-%2BZS9ptnyQViyO9-_xLg%3D%3DKyMdhTWicFXacSWsAVcprAA%40mail.gmail.com.


Re: [racket-users] transparency in Pict

2019-09-10 Thread Jens Axel Søgaard
Den tir. 10. sep. 2019 kl. 14.54 skrev George Neuner :

>
> Or create a region with a hole through it and use it to clip the drawing.
>

Great suggestion. That's much better than using pict->bitmap.

I have extended "clipped" to handle regions defined by more than one path.
Now (clipped c ... p) will make a region from the curves c ... and use
the region to clip the pict p. Most common uses:

   (clipped c p)  the part of p inside c
   (clipped c1 c2 p)   the part of p between c1 and c2 (if c2 is inside c1)

The example now becomes:

#lang racket
(require metapict metapict/polygons)

(define (cutout p x y r)
  (defv (w h) (pict-size p))
  (with-window (window 0 w 0 h)
(clipped (rectangle (pt 0 0) (pt w h))
 (circle (pt x y) r)
 p)))

(set-curve-pict-size 400 400)
(def p (brushcolor "red" (fill (regular-polygon 5
(cutout p 200 200 50)

Before only one curve was supported and the result of clipped was the
interior,
so the old clipped couldn't cut holes.

/Jens Axel

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgzoXLWXnjjrJhzwyzPVgHpzW7gif%2BwN5WyGVWzb-FiB1w%40mail.gmail.com.


Re: [racket-users] transparency in Pict

2019-09-10 Thread George Neuner


Or create a region with a hole through it and use it to clip the drawing.
George


On 9/10/2019 8:12 AM, Robby Findler wrote:
Another trick I use is to crop the picture that is nominally below the 
image and then just draw it again, but this time on top.


Robby

On Mon, Sep 9, 2019 at 2:15 PM Jens Axel Søgaard 
mailto:jensa...@soegaard.net>> wrote:


You can use a path with an even-odd-fill to cut out parts.

An example:

#lang racket
(require metapict metapict/polygons)

(define (cutout p x y r)
  (defv (w h) (pict-size p))
  (with-window (window 0 w 0 h)
    (brushstipple (pict->bitmap p)
                  (eofill (rectangle (pt 0 0) (pt w h))
                          (circle x y r)

(set-curve-pict-size 400 400)
(def p (brushcolor "red" (fill (regular-polygon 5
(cutout p 200 200 50)

/Jens Axel

The result (the yellowish color is the background color in my editor):

image.png


Den man. 9. sep. 2019 kl. 20.20 skrev Hendrik Boom
mailto:hend...@topoi.pooq.com>>:

I'm wondering how to cut a transparent hole in something.

Say I have a rectangle and I want to make part of it
transparent so
that I cn see what's behind it.
Drawing a transparent rectangle on top of it won't workm
because it'll
just reveal the original rectangle.
The only way I cn see it to draw the original rectangle in
pieces,
careful avoiding the area I want to make transparent. (that
may be
tricky if the transparent area is, say, a circle).

Is there some convenient operation in Pict that can accomplish
this
more directly?  Kind of the union and intersection and
complementation
on constructive solid geometry, but now 2D.

My guess is no.  I haven't found it.  So I ask.

Maybe I'll need some other drawing tool than Pict. Suggestions
welcome.

-- hendrik

-- 
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
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/racket-users/20190909182018.74o322qfwehrmqaz%40topoi.pooq.com.



-- 
-- 
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
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/racket-users/CABefVgy0cxZD1dJv6dA51_rTEFqk3wu-zBSpGdQV-eD1fmurag%40mail.gmail.com

.

--
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 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdOMM1rPLCGyicrcEv50USDaHmtOs-hPo4r%2BaKCACAgJw%3Dw%40mail.gmail.com 
.


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/a8e5c22e-08d6-0839-1b22-cebe912aa409%40comcast.net.


Re: [racket-users] transparency in Pict

2019-09-10 Thread Robby Findler
Another trick I use is to crop the picture that is nominally below the
image and then just draw it again, but this time on top.

Robby

On Mon, Sep 9, 2019 at 2:15 PM Jens Axel Søgaard 
wrote:

> You can use a path with an even-odd-fill to cut out parts.
>
> An example:
>
> #lang racket
> (require metapict metapict/polygons)
>
> (define (cutout p x y r)
>   (defv (w h) (pict-size p))
>   (with-window (window 0 w 0 h)
> (brushstipple (pict->bitmap p)
>   (eofill (rectangle (pt 0 0) (pt w h))
>   (circle x y r)
>
> (set-curve-pict-size 400 400)
> (def p (brushcolor "red" (fill (regular-polygon 5
> (cutout p 200 200 50)
>
> /Jens Axel
>
> The result (the yellowish color is the background color in my editor):
>
> [image: image.png]
>
>
> Den man. 9. sep. 2019 kl. 20.20 skrev Hendrik Boom  >:
>
>> I'm wondering how to cut a transparent hole in something.
>>
>> Say I have a rectangle and I want to make part of it transparent so
>> that I cn see what's behind it.
>> Drawing a transparent rectangle on top of it won't workm because it'll
>> just reveal the original rectangle.
>> The only way I cn see it to draw the original rectangle in pieces,
>> careful avoiding the area I want to make transparent.  (that may be
>> tricky if the transparent area is, say, a circle).
>>
>> Is there some convenient operation in Pict that can accomplish this
>> more directly?  Kind of the union and intersection and complementation
>> on constructive solid geometry, but now 2D.
>>
>> My guess is no.  I haven't found it.  So I ask.
>>
>> Maybe I'll need some other drawing tool than Pict.  Suggestions welcome.
>>
>> -- hendrik
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/20190909182018.74o322qfwehrmqaz%40topoi.pooq.com
>> .
>>
>
>
> --
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CABefVgy0cxZD1dJv6dA51_rTEFqk3wu-zBSpGdQV-eD1fmurag%40mail.gmail.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdOMM1rPLCGyicrcEv50USDaHmtOs-hPo4r%2BaKCACAgJw%3Dw%40mail.gmail.com.