[racket-users] bracket generator

2019-03-20 Thread Ryan Kramer
Anyone need to pseudo-randomly generate a bracket for march madness (or any 
other occasion)? Here you go: 
https://gist.github.com/default-kramer/073b68122ea047ac46b33af20cb1eba1

The data I used is too averse to upsets for my taste. If I were going to 
generate another bracket, I would add some more chaos. But that's a 
personal preference.

Enjoy!

-- 
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] Generics: delegate to a parent

2019-03-20 Thread Matthew Butterick


> On Mar 20, 2019, at 7:09 AM, zeRusski  wrote:
> 
> Both implement the same generic interface. Far as I can tell dispatch will 
> choose marlin's implementation on that kind of instance. Is there a way for 
> me to delegate to fish's method from inside marlin's method with the same 
> name? I can introduce a level of indirection and extract fish's 
> implementation into a function that I could call from marlin's method but 
> that feels wrong somehow. 

I wouldn't say wrong — but I've found that the object system (which also 
cooperates with generics) is more convenient for describing these relationships.

-- 
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] color-maps for the plot package

2019-03-20 Thread Daniel Prager
Side note:

For people looking for aesthetically pleasing discrete color palettes,
check out the top two tools on this page:
http://www.play-crafts.com/blog/tools/

   1. *Palette builder *helps you select a few colors from a pleasing image
   2. *Color play* randomly creates palettes (the source allows you to
   specify n)

The main people behind the site and the tools — Anne Sullivan and Gillian
Smith — straddle art, craft, and computer science in their work.

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] color-maps for the plot package

2019-03-20 Thread Laurent
This is a fantastic idea, Alex. (While I'm at it, thanks for all your other
projects related to the GUI, they are really cool.)

I'm *very* much in favour of all your points, (1) to (4).

I've had uses of different colors scheme for academic papers, and the
default palette doesn't work well for me. I haven't tried the matplotlib
palettes, but my various attempts have never been entirely satisfactory.
Here's an excerpt from some of my stabs:
https://github.com/Metaxal/bazaar/blob/master/plot.rkt#L133
(this includes a palette generator to maximize color difference, line 376+,
which I find much better than the default palette, but it doesn't take into
account the specifics of the human eye.)

Just a side note: the #:color argument is already quite flexible and
accepts things like '(10 20 30), which is pretty nice.



On Wed, Mar 20, 2019 at 4:17 AM Alex Harsanyi 
wrote:

>
>
> On Wednesday, March 20, 2019 at 10:35:51 AM UTC+8, Ben Greenman wrote:
>>
>> > Could you (or Ben or Matt) elaborate on how do you see this work for
>> non
>> > plot programs?
>>
>> I'm thinking a color-map% object would define a possibly-infinite
>> sequence of colors that look nice in some way. The colors might be
>> useful anywhere where someone wants a "rainbow" of colors ... maybe
>> for:
>>
>> - fonts in a slideshow (colorblind-friendly? grayscale-friendly?),
>> - coloring the error messages made by a linter or program analyzer,
>> - drawing a sunset, etc.
>>
>
> The examples listed above might be better served by other color choosing
> mechanisms, for example, I have implemented some color manipulation code
> based
> on https://tallys.github.io/color-theory/, you can find it here:
> https://github.com/alex-hhh/data-frame/blob/master/private/colors.rkt .
> In
> particular the `pick-color` function might do something similar to what
> Pyret
> is using (as suggested by Justin Zamora).
>
> Other solutions are also possible, including using gradient color maps, but
> this is a larger scope that I originally planned for and I don't have
> the time to prepare and submit a patch for such changes.
>
> My proposal is more limited, to allow plot users to produce good looking
> plots
> with minimum effort.  What I propose is:
>
> (1) Add a mechanism (via parameters) to replace the `pen-colors` and
> `brush-colors` vectors in the plot package with custom defined colors.
> This
> means that the existing `->pen-color` and `->brush-color` functions would
> now
> return a different color depending on what `pen-colors` or `brush-colors`
> are
> installed.  This also has the benefit that the existing mechanism of
> specifying numbers for colors will now work with color maps:
>
> (plot (list (function sin -5 5 #:color 1)))
>
> (2) "Borrow" the qualitative color maps from matplotlib, so the user has
> some
> nice predefined set of colors to choose from for their plots.
>
> Also, possibly the following backwards incompatible changes:
>
> (3) change the default set of `pen-colors` and `brush-colors` to one of the
> new color maps, so the nicer colors are on by default.
>
> (4) change the default plot behavior so that a different color is chosen
> for
> each renderer, this means that things like the code below would result in
> different colors used for the `sin` and `cos` functions:
>
> (plot (list (function sin -5 5) (function cos -5 5)))
>
> If others think that (1) and (2) are worthwhile doing, I will submit a PR,
> so
> we can discuss the API an implementation over something more concrete.  I
> am
> open discussion for points (3) and (4).
>
> For the more broader color map changes, if the improvements are split up in
> small incremental tasks, I will be happy to help out, as time allows.
>
> Alex.
>
> --
> 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] Struct subtype with default/fixed value of super-type

2019-03-20 Thread Jérôme Martin
To go further, if you wonder how to make this work for `match` and
inheriting, see this stackoverflow question:
https://stackoverflow.com/questions/55262818/how-to-override-a-struct-constructor-while-still-providing-the-struct-metadata-f

On Mon, Mar 18, 2019 at 3:08 PM Marc Kaufmann 
wrote:

> While I did know that I could define my own, I was going to do it while
> providing-out another function make-fish and make-shark, but it's nice to
> know that this allows me to locally define make-fish, while it looks to the
> outside like (fish ...).
>
> Thanks to including sufficient numbers of mundane bugs in my code (all
> well-maintained in version control, for quick deployment on docker), I
> rarely get to worry about phases - it just isn't where the highest gains
> are. :-)
>
> On Mon, Mar 18, 2019 at 2:46 PM Jérôme Martin 
> wrote:
>
>> Once you discover that the default constructor for a struct is just a
>> simple procedure that was generated for you, it's not that big of deal to
>> just make your own and export it like this:
>>
>> (provide
>>   (except-out (struct-out fish) fish)
>>   (rename-out (make-fish fish)))
>>
>> All the code relying on it will still work.
>> Except I guess if you pass through different phase levels, it becomes a
>> bit more complicated because you have a syntax attached at compile-time to
>> the identifier. But that's another issue.
>> Correct me if I'm wrong.
>>
>> On Monday, March 18, 2019 at 2:11:46 PM UTC+1, Marc Kaufmann wrote:
>>>
>>> Yes, I saw that, the problem is that I want to be able to set a
>>> (potentially different) default value for the sub-type shark than for the
>>> sub-type guppy. So if I set the value to 'big for all `fish`, then I can't
>>> do that. Essentially, I'd need an #:auto for every sub-type, but the #:auto
>>> refers to a parent/super field.
>>>
>>> I'll just run with defining a custom constructor.
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Racket Users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/racket-users/TthsE0FZDB0/unsubscribe.
>> To unsubscribe from this group and all its topics, 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] Generics: delegate to a parent

2019-03-20 Thread zeRusski
Hi all.

I am trying to make good use of Generic Interfaces, but can't figure out if 
its at all possible to delegate calls up the struct inheritance chain. So, 
something like `call-next`, or even better maybe there's a way to do 
explicit dispatch? So something like having two structs:

(struct fish ())
(struct marlin (fancy))

Both implement the same generic interface. Far as I can tell dispatch will 
choose marlin's implementation on that kind of instance. Is there a way for 
me to delegate to fish's method from inside marlin's method with the same 
name? I can introduce a level of indirection and extract fish's 
implementation into a function that I could call from marlin's method but 
that feels wrong somehow. Am I asking too much from Racket generics?

Thanks

-- 
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] color-maps for the plot package

2019-03-20 Thread Jens Axel Søgaard
Den tir. 19. mar. 2019 kl. 23.03 skrev Alex Harsanyi :

> On Tuesday, March 19, 2019 at 9:53:23 PM UTC+8, Jens Axel Søgaard wrote:
>>
>> This is a great idea.
>>
>> It would be really nice to be able to use the colors also from non-plot
>> programs.
>>
>
> Could you (or Ben or Matt) elaborate on how do you see this work for non
> plot programs?
>

I would use it to draw graphs - but not using the built-in plot library.

/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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] color-maps for the plot package

2019-03-20 Thread Matt Jadud
>
>
> If others think that (1) and (2) are worthwhile doing, I will submit a PR,
> so
> we can discuss the API an implementation over something more concrete.  I
> am
> open discussion for points (3) and (4).
>
> For the more broader color map changes, if the improvements are split up in
> small incremental tasks, I will be happy to help out, as time allows.
>
>
1-4 sound like a solid foundation. If it was possible to have an API point
where a user can add (and then select) their own colormap, that would be
lovely. This would allow the described machinery to "just work" if I want
to explore the generation and use of colormaps other than those in the
library.

I've got an "all-puce" map in mind...

Thank you for the work and effort.

Cheers,
Matt

-- 
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.