Fork me on GitHub
#off-topic
<
2022-11-25
>
Stuart14:11:46

I'm trying to calculate combinations. say I have a map like so

{
 :foo [1 2 nil]
 :bar [5 6 nil]
 :quax [7 8 nil]
}
I'd like to get out
[[1 5 7] [1 6 7] [1 nil 7] [2 5 7] [2 6 7] [2 nil 7]]
etc, but with all permutations. Does anyone know an existing library that does this before I try to write it myself ?

Stuart14:11:41

wait, can't I use a for

Stuart14:11:41

How would I get the keys out into the for vector ?

Stuart14:11:59

the number of keys in the map is goign to be variable

borkdude14:11:14

posted outside of the thread, but for completeness also here: clojure.math.combinatorics

Stuart14:11:38

this is gfives me what I want.

(for [f [1 2 nil]
        b [5 6 nil]
        q [7 8 nil]]
    [f b q]
    ))

p-himik14:11:43

@U013YN3T4DA How do you define the order of the keys?

Stuart14:11:28

oh yeah, i havent' thought about that. I definitely need to consider that.

Stuart14:11:00

I need to think about this more, thanks for the suggestions and I'll look into clojure.math.combinatorics too!

borkdude14:11:58

@U013YN3T4DA Are you doing advent of code? ;)

Stuart14:11:10

I'm not, sadly

skylize22:11:09

Interesting. Just used my settings for https://github.com/darkreader/darkreader to apply that to * on every page. We'll see if I notice the difference. 🙂

pez22:11:16

I added it to * in my VS Code. 😃

pez22:11:39

I don't want everything monospaced. That makes no sense outside code editors, to me. 😃

skylize23:11:31

Not outside editors, no. I said "across the board in Code". Meaning I've styled the UI of Code such that everything uses the same font, just in varying sizes.

skylize23:11:02

Though I also use that font in Waybar (my system status bar), and of course in Kitty (my terminal), and I have no titlebars on any windows. So NovaMono is really is most of what I see outside the browser. 😛

skylize23:11:05

I'm just such a huge fan of how rounded everything is. I find it relaxing, and easy to read in any context.

skylize23:11:25

I think the designer changed the font for some reason. I just noticed all the sharp corners at the ends in the photo I linked above. And Google fonts shows the same. The ligaturized version I use is built from an old variant where everything is rounded off. Except for intersections like in "t" or "f", there are no corners to be found anywhere in the entire glyph set. 😻

pez23:11:44

FYI: I used VS Code terminology there. A code editor is a pane in VS Code where source code is shown. So that's where I use monospaced fonts, for source code. For the rest of the VS Code UI, I want a non-monospaced font.

skylize23:11:02

:face_palm: Well, to me 95%, or more, of what is displayed is something that makes sense to me in monospace. The few exceptions are not important enough to be worth an exceptional font, and NovaMono is perfectly readable in those cases anyway.

pez16:11:08

I just learnt that the proper way to do this is to use:

font-variant-numeric: tabular-nums;
See: https://github.com/microsoft/vscode/pull/167310

skylize20:11:36

What's the difference?

pez20:11:08

> Whenever possible, font-variant shorthand property or an associated longhand property, font-variant-ligatures, font-variant-caps, font-variant-east-asian, font-variant-alternates, font-variant-numeric or font-variant-position should be used. This property is a low-level feature designed to handle special cases where no other way to enable or access an OpenType font feature exists. https://caniuse.com/?search=font-feature-settings

skylize20:11:35

That link doesn't seem to specify any difference. Only thing I notice is there exists such a thing as a "font-variant shorthand property". So my guess now is that one is fully equivalent to the other, just named in fewer characters?

pez20:11:53

The link explicitly says to avoid font-feature-settings in favor of font-variant-numeric. Motivating it with that the former is a low level thing to use only when the more specific API does not suffice Even if they have exactly the same effect, that is enough for me to favor the latter.

skylize20:11:02

Wow, that is terribly worded. I did not pick up on that at all until you clarified.

pez20:11:58

I agree it is a mouthful. Almost seems like it is meant for a machine to read, rather than a human. 😃

😄 1
pez16:11:08

I just learnt that the proper way to do this is to use:

font-variant-numeric: tabular-nums;
See: https://github.com/microsoft/vscode/pull/167310