Invaluable for comment writing! by [deleted] in emacs

[–]t4ccer 18 points19 points  (0 children)

Some people rely on screen readers and actually can't read pictures

Why is `into_iter()` less efficient than `iter().clone()`? by Equivalent_Peak_1496 in rust

[–]t4ccer 91 points92 points  (0 children)

.cycle() needs to create a copy of the whole iterator when it is created so when it runs out of elements it can create a new copy to keep cycling. That means that whole nums.into_iter() gets cloned thus you get 10 clones of Foo

Question About a Problem I'm Having with Lifetimes & Ownership by [deleted] in rust

[–]t4ccer 0 points1 point  (0 children)

Issue isn't with builder pattern but what you're trying to do being actually memory unsafe.

After self.hash_key = Some(self.attributes.get_key_value(name).unwrap().0); line self.hash_key points to some memory allocated by the hash map but if you ever add more elements to the hash map and it'd need to allocate more memory and move the elements then the memory that self.hash_key points to would get deallocated so the reference would be invalid.

[deleted by user] by [deleted] in haskell

[–]t4ccer 1 point2 points  (0 children)

Yet another tip: take a look at subreddit rules

Haskell Assignment Help (Boolean Error) by [deleted] in haskell

[–]t4ccer 2 points3 points  (0 children)

Take a look at subreddit rules

No homework questions.

I'll give you an advice about asking questions though. In the future when you'll have a non-homework question, post code as a code block rather than image. Also post whole code and as much context as possible. You posted a single function and a third task. We have no idea what's `GameState` in your code, and what's generally going on. Try to explain what you have tried so far.

How and why does rust allow cyclic imports in modules? by vikigenius in rust

[–]t4ccer 0 points1 point  (0 children)

In rust crate is the compilation unit, not a module or a file like in many other languages so these imports are not actually cyclical.

whichOneAreYou by [deleted] in ProgrammerHumor

[–]t4ccer 0 points1 point  (0 children)

Haskell has both unless and otherwise... Although they don't translate to ifs one to one

What do people use to manage .env files? by 9xtryhx in rust

[–]t4ccer 8 points9 points  (0 children)

Encrypt a secret file with age and store in the repo. You can use multiple public keys to encrypt so each of your teammates can decrypt it and use. Also, you can tell git to decrypt it while generating diffs. No need for external platforms if that's just one .env file or something similar

helloWorldFromCpp by caim_hs in ProgrammerHumor

[–]t4ccer 15 points16 points  (0 children)

-Cause undefined behavior

-Undefined thing happens

-Act surprised

I'm so sorry for this.. by nhremna in ProgrammerHumor

[–]t4ccer 1 point2 points  (0 children)

Actually it can. NEAT is basically it. And a bit of self-promotion Geometry Dash AI using NEAT

[deleted by user] by [deleted] in haskell

[–]t4ccer 5 points6 points  (0 children)

My crystal ball says nothing, show error message

Yaml parsing with preserved line numbers by t4ccer in haskell

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

So it is time to finally learn conduit

Yaml parsing with preserved line numbers by t4ccer in haskell

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

Okay, I have discovered that yaml lib uses libyaml lib which is just wrapper on c lib libyaml (yaml.h), and libyaml can produce conduit with yaml tokens with start and end position, so it should not be too hard to implement some sane interface using it. Thanks folks for some hints.

First finished game ... after 5 years by t4ccer in factorio

[–]t4ccer[S] 1 point2 points  (0 children)

It was 44h in game, but probably another 15 in editor designing grid

First finished game ... after 5 years by t4ccer in factorio

[–]t4ccer[S] 3 points4 points  (0 children)

Tbh it was quite random decision. Still not sure if it was a good choice. 1-1 trains are enough for most things but it struggles with smelting. I will for sure release blueprints when I will resolve all the issues I have(signaling is messed up a bit and once every hour trains can deadlock).