VegaLite.jl icon indicating copy to clipboard operation
VegaLite.jl copied to clipboard

Alternative functional composition

Open davidanthoff opened this issue 5 years ago • 5 comments

@tkf had another idea here.

For now I'll put on the backlog and think about it.

davidanthoff avatar Dec 28 '19 20:12 davidanthoff

Replying to https://github.com/queryverse/VegaLite.jl/pull/227#issuecomment-569450659

This made me wonder if it makes sense to use Tuple{Any,NamedTuple} for this.

Hm, but that adds another level of parenthesis, and I'm trying hard to reduce those...

Does it? ("age:o", (scale = (rangeStep = 17,),)) has as many parentheses as vlfrag("age:o", (scale = (rangeStep = 17,),)).

tkf avatar Dec 28 '19 22:12 tkf

But you can do vlfrag("age:o", scale = (rangeStep = 17,)), which is one less level of parentheses, right?

davidanthoff avatar Dec 28 '19 22:12 davidanthoff

Ah, yes, I forgot that.

tkf avatar Dec 28 '19 22:12 tkf

Hi, new here. I'm very naive, but I'm wondering why it can't be functions with keywords and let the type system sort it out. Something like this

vlplot(
    bar(),
    x("month(date):o", axis(title="Month of the year")),
    y("count()"),
    color(:weather,
        scale(domain=["sun","fog","drizzle","rain","snow"],
            range=["#e7ba52","#c7c7c7","#aec7e8","#1f77b4","#9467bd"]
        ),
        legend(title="Weather type")
    )
)

jotwin avatar May 18 '20 23:05 jotwin

I think that was actually how VegaLite.jl was designed many years ago :) One problem is that we now have to create all these functions, and many of them have names that we really don't want in the global namespace (a function called x seems like a bad idea).

davidanthoff avatar Jun 04 '20 03:06 davidanthoff