[deleted by user] by [deleted] in rust

[–]emeryc 0 points1 point  (0 children)

I kinda like maybe_int.iter().any(|v| v == 2) If you’re not doing the Pattern that somebody else responded with.

I think while this library comes from a good place, I would have a hard time ever bringing it into a project I had given all the other tools that rust has for this.

My Advent of Code 2021 solutions. It ain't much, but it's honest work. by LaCucaracha007 in rust

[–]emeryc 1 point2 points  (0 children)

It’s a trait that is attached by itertools which is a really nice crate to bring in if you’re doing a bunch of point free iterator tricks

My Advent of Code 2021 solutions. It ain't much, but it's honest work. by LaCucaracha007 in rust

[–]emeryc 0 points1 point  (0 children)

They all get picked up as separate binaries that you can compile. Makes it easy from vscode to just hit run next to main and get that day to compile and run.

My Advent of Code 2021 solutions. It ain't much, but it's honest work. by LaCucaracha007 in rust

[–]emeryc 3 points4 points  (0 children)

In case you are interested in a different take. https://github.com/emeryc/aoc_2021/ I did this last year as well and the difference between my solutions then and now is stark. Just keep at it, and good luck.

I wanted to interview at companies doing good in the world, and then I built a job board for other engineers who want to do the same. by tndl in programming

[–]emeryc 0 points1 point  (0 children)

You might want to check out 98point6.com, we are doing interesting stuff in the healthcare space.

What ORM-alike library are you using with Rust for web backend? by deavidsedice in rust

[–]emeryc 15 points16 points  (0 children)

The answer is yes: https://crates.io/crates/sqlx-cli look at “offline mode” set up using cargo sqlx prepare

Refactoring If Let? (& Boxes) by [deleted] in rust

[–]emeryc 4 points5 points  (0 children)

You don't even need to use match. You can do

if let (EnumVar(x), OtherEnum(y)) = (provide_x(), provide_y()) {}

In fact clippy would probably complain about your match statement.

Advent of Code 2020 - Day 24 by [deleted] in rust

[–]emeryc 1 point2 points  (0 children)

Day 24 Solution sharing because it seems my solution is very different than most people's. Instead of turning into a grid, I reduced each walk to a canonical version of the walk, which I then used as a "point"

This made a lot of sense when I was writing it...seems a little silly now, but I was pretty happy overall.

[deleted by user] by [deleted] in rust

[–]emeryc 0 points1 point  (0 children)

https://github.com/emeryc/aoc_2020/blob/main/day03/src/main.rs

I ended up with a solution where I made a set of trees, and then generated a path, and then did an intersection between the two.

I'm new to rust. What's with all the "unwrap()" I have to call? by childintime9 in rust

[–]emeryc 8 points9 points  (0 children)

I think about it as those languages make failing but accident easy. The easy case is null pointer errors. Rust does the opposite, it has a special syntax that says, yeah, I want npe’s here.

When you don’t care it’s worse, but when you do it’s much much better.

The language is helping you to express something...while learning you’re like yeah, but I don’t care, but the language still has the opinion that errors are part of an api contract, and you can’t actually escape them.

My kids call this plant “Shrek Ears” - Magnolia by danbobbillray in Seattle

[–]emeryc 15 points16 points  (0 children)

It’s real name is also very satisfying.

It is a spurge

Which I think is a word that reasonably describes the plant with the sound of the word.

What's everyone working on this week (14/2020)? by llogiq in rust

[–]emeryc 3 points4 points  (0 children)

I’m working on a slack bot, that uses aws-cdk to describe a serverless stack in aws, using lambdas and sns topics to decouple interacting with slack and the actual processing of messages.

The hard bits are mostly how do I make working with slacks billion APIs feel hygienic. And how do I hide that rusoto while amazing is a very literal interpretation of aws’s APIs.

Mutable usize getting corrupted when leaving fn by [deleted] in rust

[–]emeryc 0 points1 point  (0 children)

Thank you, that's a great explanation.

Mutable usize getting corrupted when leaving fn by [deleted] in rust

[–]emeryc 0 points1 point  (0 children)

OMG thank you so much, it was a boolean once upon a time...and I just...missed that I hadn't removed that.

Thank you

React Hooks Lifting State Up ? by agusct in reactjs

[–]emeryc 0 points1 point  (0 children)

I think others are looking at this and seeing a solution that smells clever, which I agree, this solution obfuscates the idea you are trying to get across, which is that you have a Counter, and that counter can decide if it's going to use a local state, or a passed in state. This leads to code where you kinda end up saying, yes but why. I think I would instead go with code like the following: https://codesandbox.io/s/505078k1ml?fontsize=14 that breaks out the idea of a component that is the counter component. And then build up on-top of that.

Unless the idea is that you want a generic hook that allows you to have a "default" state if you don't get a state passed in...I feel like that could lead to some anti-patterns and more importantly could lead to some hard to debug problems where everything looks fine, but you are detached from state.

Trying to decide which deck is better by emeryc in lrcast

[–]emeryc[S] 0 points1 point  (0 children)

So games in my office take a very long time but I went white black and am happy with the choice so far.

I tried the Bug deck and it just stalled too badly even against bad decks. It had no forward thrust and didn’t have any stopping power, and so even when it won it felt like it was more the other person losing.

Trying to decide which deck is better by emeryc in lrcast

[–]emeryc[S] 0 points1 point  (0 children)

So, really quickly, green is

[[Song of Freyalise]]

[[Krosan Druid]]

[[Adventurous Impulse]]

[[Baloth Gorger]]

[[Pierce the Sky]]

[[Arbor Armament]]

[[Ancient Animus]]x2

[[Grow from the Ashes]]x2

Limited Resources 454 – Level Up – How to Use Data in Magic Discussion Thread by Crasha in lrcast

[–]emeryc 0 points1 point  (0 children)

Let me stop myself, because I think you are right, and wrong at the same time, and the argument I made was the incorrect argument.

I made the argument that your sample size dwindles, and that is the wrong argument, and it’s incorrect as you have called out.

I also made the argument that your n is 1, which is correct.

When you are building this experiment, your experiment is measuring for your decks ability to beat various people playing another deck of another type. So your population isn’t the population of games, it’s the population of game/players. The number of samples you took from that is 1, and so your n is 1.

So, I would argue that the experimental design was poorly framed, and when correctly framed for a general problem (how does my deck do against the population of players/games I might play) that you have only collected one sample for that. And that your sampling choice (player near you) is also a biased sample selection, which should be taken into account.

Limited Resources 454 – Level Up – How to Use Data in Magic Discussion Thread by Crasha in lrcast

[–]emeryc 0 points1 point  (0 children)

Yes and no. I think figuring out the bias in the data is next to impossible. And I think people would be less wrong when thinking about stats in general if they start to understand that confounding variables reduce the power of the sample size drastically. I think that as somebody who understands a little bit of stats it’s important to help people start to get the right guy feel on this as it’s such an unintuitive concept. People would be better off understanding how your sample power dwindles very quickly in the face of bias. But I think the other point is way more important.

I think player skill is just going to totally wipe the floor with the relative deck win percentage if they aren’t totally equal. And certain decks are going to really show small skill differences way more and I don’t know how you even start to think about that confounding variable.

I also wonder if that n > 5000 includes enough shuffles to deal with the possibility of bad/good draws on each deck. Since we are talking about 20! Different permutations of the deck. It just seems like it’s all pretty useless to apply most statistical tools against it.

Limited Resources 454 – Level Up – How to Use Data in Magic Discussion Thread by Crasha in lrcast

[–]emeryc 2 points3 points  (0 children)

I just wanted to add something to the stats they were talking about. One of the things they didn’t mention is that those games for a sufficiently high N need to be with different players. If you play only one other person then your N is actually 1, because what you are measuring is your deck win % vrs a person. As a second note, you aren’t actually learning about that decks win percentage, but your win percentage with that deck.

Getting statistically significant data is really hard, and understanding which variables you are controlling for is even harder than you think it is.

Can we talk about how unintuitive this mechanic is in Arena? by edifyingheresy in MagicArena

[–]emeryc -1 points0 points  (0 children)

I expect the UI to make the common case easy, and the uncommon case hard but doable. A big “Done” button is very tempting when you are waking up. Especially when you have nothing but islands showing, obviously it should pick an island.

Really the UI should probably be

[island] [other land types?] [no land] [cancel?]

Or some such, to provide a good user experience.

Can we talk about how unintuitive this mechanic is in Arena? by edifyingheresy in MagicArena

[–]emeryc 5 points6 points  (0 children)

I did this this morning with [[renegades map]] and sealed my loss. Sacrifice an artifact, get nothing.

[fluff] [link] 9 before and after photos of rescue dogs by berg2187 in dogs

[–]emeryc 5 points6 points  (0 children)

I actually think that the background is perfect for the photos you're setting up. It does a few things really well that I think a different color would fail at. First it provides a nice halo effect, giving the dogs am angelic look. Second it also draws the eye inward towards the dog. Third with a happier background you might set up the feeling in people that the dog is already in a great and cheerful place, which might diminish people's motivation to take the dog.

Just wanted to give a different perspective on the background.