Can we talk about the elephant in the room here? What possessed everyone to useC++ code:
instead of C++ code:
? C99 turns twenty next year...
|
|
# ¿ Jul 18, 2018 20:01 |
|
|
# ¿ Sep 16, 2024 11:02 |
Hey male shoegaze if you're getting exponential compilation times you should file an issue on the rust GitHub. They take solving that sort of thing pretty seriously so I'm sure they would be very interested in hearing about your case.
|
|
# ¿ Jul 19, 2018 17:29 |
jit bull transpile posted:Looks like X really gave it to ya
|
|
# ¿ Jul 20, 2018 01:39 |
LaTeX makes me so goddamn unreasonably mad. I just wanna make a flowchart for my paper, but somehow just importing TikZ (the standard package for this AFAICT) causes my paper to no longer compile. My hacky solution is to move all my flowchart generation to a wholly separate LaTeX project, then just include the PDF generated by that. Which isn't too bad; but it's so frustrating that I have to do that instead at all of it just working. And I guarantee that the whole problem would be fixed if LaTeX just had namespacing so that packages wouldn't define conflicting macros, but it doesn't so this sort of thing happens all the time. (LaTeX is technically a programming language so this post is technically on topic. I'd post it to the grad students thread or the LaTeX thread but people are way too serious there)
|
|
# ¿ Jul 26, 2018 01:13 |
Corla Plankun posted:i havent done latex in a while but when i was in grad school if i needed a chart i would make it as an svg with a more reasonable program and then include it as a pic in the latex doc I actually have that right now. The issue is that the fonts don't match, and one of the co-authors mentioned it in review.
|
|
# ¿ Jul 26, 2018 01:27 |
pangstrom posted:I have 2 friends who loving love LaTex and 1 who has that opinion (it sucks / is janky / causes workflow issues). Is there a Goon consensus on that because I have been using the 1 friend + laziness as an excuse not to go there. Last time I checked, the goon consensus was "it's terrible but also better than the other options" (which I would agree with). In a lot of scientific communities you don't really have a choice on whether to use it or not though, so it kind of doesn't matter whether it's good or bad. Honestly if it just had any sort of macro hygiene it would be loads better. But it doesn't and it's probably too late to add it now. e: beaten by goon consensus, almost word-for-word
|
|
# ¿ Jul 26, 2018 01:41 |
gonadic io posted:Lol what a li'l bitch Honestly it was more of a "fix if it's not too much of a pain" sort of thing. I guess maybe this is approaching the "it's too much of a pain" point, but I do need to make a few other changes to the flowchart so I might as well see if I can get this working while I'm at it.
|
|
# ¿ Jul 26, 2018 20:15 |
Corla Plankun posted:can you change the doc to match the svg instead? Nah, it's gotta match the journal template. Honestly, remaking the flowchart in a separate doc in latex is not such a hassle, and it'll come in handy anyways as I work this into my thesis (which I am writing concurrently). I just wanted to vent a little bit because, as previously stated, "latex makes me so goddamn unreasonably mad" with how brittle it is. Thanks everyone for listening to my venting and for the suggestions.
|
|
# ¿ Jul 27, 2018 00:04 |
MALE SHOEGAZE posted:looks like i've got myself a (limited, part time, contracting) rust job and i'm very pleased. in addition to rust i'll also get to put MIT on my resume which is cool, i think. Congrats!!! That is super cool
|
|
# ¿ Aug 6, 2018 21:58 |
cheque_some posted:What would you recommend for someone who is a self-taught terrible devopsing p-langing programmer but want to become a non-terrible programmer In addition to what other people have said, it can be pretty useful to learn by just studying what other people have done. IMO one of the best ways to do this is to find some friendly medium-sized open source project that you are interested in, go to their issues page, and pick a bug / small feature request and start working on it. Doing so will get you going through the project's code and seeing how it's laid out and organized, and you'll learn a ton from that. Plus, you'll feel really cool when they accept your pull request and you've improved the open source ecosystem in some small way.
|
|
# ¿ Aug 13, 2018 09:45 |
|
|
# ¿ Aug 15, 2018 17:36 |
For what it's worth this RFC just got accepted so rust's Error trait should improve soon™.
|
|
# ¿ Aug 25, 2018 00:58 |
I'm surprised that Go has pointers, although I guess I shouldn't be because it's so C-inspired. It's just I've never seen pointers in a garbage-collected language before. I'm guessing this means things in Go are copied on assignment / being passed to a function, and pointers are a way to explicitly avoid that copy? Is there ever a way to get a dangling pointer in Go, or does having a pointer to an object prevent that object from being garbage collected?
|
|
# ¿ Aug 31, 2018 17:20 |
DONT THREAD ON ME posted:this is the best info i can find really: Okay yeah after reading through that it looks like assignment and argument passing both invoke a shallow copy of the data, and there's no way to get a dangling pointer without using unsafe.Pointer. It's been a long time since I used Java so I can't remember how memory semantics work there. The only GC languages I commonly used nowadays are Python and Haskell. I've only recently felt like I really understood Python's assignment semantics and in Haskell things are generally immutable so it mostly doesn't matter whether things are copied deeply, shallowly, or not at all.
|
|
# ¿ Aug 31, 2018 17:43 |
DONT THREAD ON ME posted:speaking of assignment semantics, rvalue references are weird after doing rust. I pretty much agree with all of your impressions. C++ was the first language I got comfortable with, and I basically did it by reading through an Herb Sutter book followed by one of the Scott Meyers books (this was around 2010 so I was learning C++03). Those two authors come from a specific school of C++ thought which basically says that you should pretty rarely use inheritance at all. Templates cover a lot of the same functionality that you would use traits / interfaces for; just think of the constraints as being implicit from the function that you are writing ("I use the + operator here") instead of explicit ("my arguments implement Addable").
|
|
# ¿ Aug 31, 2018 18:19 |
Also now that I've thought a little more on Go's shallow-copy-on-assignment, I'm a little perturbed by it. It seems to me like that breaks encapsulation a bit too much. For example, if I'm using a Point3D type, I shouldn't worry if internally the x, y, and z coordinates are stored as three separate member floats or as a single vector of three floats. But with shallow copy semantics, all of the sudden those are very different semantically if I pass a Point3D to a function and then mutate one of the coordinates. Admittedly I've never used Go so it's possible I'm misreading the copy semantics or that there are idioms which mitigate this issue. But as I understand it it seems like a weird choice to me.
|
|
# ¿ Aug 31, 2018 18:25 |
CRIP EATIN BREAD posted:c++11 has traits as part of its stdlib Not really in the same way that e.g. rust has traits, which is what I was talking about here. C++ traits are more like type tags; in C++ terms I'm talking about concepts.
|
|
# ¿ Aug 31, 2018 18:27 |
DONT THREAD ON ME posted:yeah, it's a very different approach. my main worry is ambiguity, it seems like you could easily have two different types that each have a "foo" method with the same input/return types but wildly different semantics. it's like duck typing. This is exactly true, but in practice it doesn't really bite you too often.
|
|
# ¿ Aug 31, 2018 18:28 |
CRIP EATIN BREAD posted:idk, boost's entire geometry system has a way of doing things like: Jesus, it's their first week of C++! Don't show them boost, you'll scare them!
|
|
# ¿ Aug 31, 2018 18:52 |
stoked for pijul to hit 1.0 someday
|
|
# ¿ Sep 5, 2018 03:53 |
tef posted:git has parts of a sensible user interface, somewhere, but it's hidden behind a bunch of other flags drat, this is good poo poo. I only knew about like a third of these.
|
|
# ¿ Sep 5, 2018 08:19 |
prisoner of waffles posted:git has to be among the top 10 command line programs for sheer complexity of the possible valid command-line inputs. find has a ton of options which I've seen used in fairly creative ways. sed always seems to have a bunch of interesting and obscure uses, too. And of course awk can be used for all kinds of things but that one might be cheating because awk is basically a full programming language.
|
|
# ¿ Sep 5, 2018 18:18 |
bob dobbs is dead posted:isn't sed also turing-complete Neat! I actually think find is probably Turing complete too. The reason I specifically called out awk there because it was designed to be more of a full programming language than the other two. E.g. from the man page: quote:The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation.
|
|
# ¿ Sep 5, 2018 18:28 |
DONT THREAD ON ME posted:it would not be that difficult to design some sort of shell prelude that makes f#/haskell feel a lot like bash but with types. It already exists: https://hackage.haskell.org/package/turtle e: dammit gonadic io!
|
|
# ¿ Sep 5, 2018 19:03 |
mystes posted:I haven't tried Turtle but it seems to just be oriented around running unix commands. I guess maybe I should try it because at the least that would make it easier to explain why it's not what I'm looking for. It's more of a reimplementation of common unix commands' core functionalities, and instead of just doing text transformations it has Haskell's type system. So really I'd say it's less "Turtle is oriented around running unix commands" and more "Turtle often names its functions after similar Unix commands". I've never used Turtle interactively as my main shell or anything, but I've used it to write what would have been medium-length shell scripts and it's pretty nice for that.
|
|
# ¿ Sep 5, 2018 19:22 |
mystes posted:Do you know why the following doesn't work? The issue is that you don't want mapM here at all. stat in this case has type Turtle.FilePath -> Shell FileStatus, so you want to just do ls "." >>= stat. Think of Shell as being the List + IO (+ Managed). The list part is relevant here because whenever you use >>= the mapping over shell elements is already implied.
|
|
# ¿ Sep 6, 2018 00:00 |
gonadic io posted:wait there's a bunch of list functions implemented on a shell so that makes it easier I think you've got a type error there in the fmap FileSize, since the stuff before that is a Shell [FileStatus] not a Shell FileStatus. You gotta either (fmap . fmap) the fileSize or (better yet) combine the Shell [FileStatus] into a Shell Filestatus with fmap select & join. Something like: code:
VikingofRock fucked around with this message at 01:56 on Sep 6, 2018 |
|
# ¿ Sep 6, 2018 01:53 |
The fmaps get pretty annoying after a while. Maybe they'll add an operator a &| f = fmap f a with the same precedence as &
|
|
# ¿ Sep 6, 2018 02:31 |
Luigi Thirty posted:homemade lisp status:
|
|
# ¿ Sep 12, 2018 08:35 |
Symbolic Butt posted:maybe in 30 years someone will find a neat application of octonions in programming, it'll be rad clifford algebras all the way imo
|
|
# ¿ Sep 12, 2018 21:14 |
gru/minion
|
|
# ¿ Sep 13, 2018 18:31 |
before posting that you oughta warn us to brace ourselves!
|
|
# ¿ Sep 13, 2018 21:00 |
gonadic io posted:
I think that's a bit overkill here. I got rid of four levels of indentation by replacing your match statements with if lets. It even fits within 80 columns now! IMO this sort of strategy is the way to go when only one match arm can logically continue the function. As for the rest of the indentation, most of it comes from nested for loops. A lot of times those can be logically separated out into an iterator, which can then be chained together in all the usual ways. For example here you could imagine making an ConnectedTiles iterator that returns all tiles connected to a given start tile and then in all_tiles_connected() just return whether your total tile count is the same as connected_tiles(arbitrary_tile).count(), or for the inner loop you could make a Neighbors iterator which gives the neighbors of a given tile. VikingofRock fucked around with this message at 22:49 on Sep 13, 2018 |
|
# ¿ Sep 13, 2018 22:37 |
Lime posted:i think using let match would look a bit nicer than if let: I don't know how I forgot that. Yeah your way is much better.
|
|
# ¿ Sep 13, 2018 22:50 |
gonadic io posted:ty for the suggestions. the lack of early return from a mapping closure bothers me way more than i thought it would. maybe generators solves this? I recently ran into a way to get around this. The idea is you use filter_map() to end iteration early and then check a sentinel value. code:
You could pretty easily extend this to returning things besides Option or Result. Whether this is a clever trick or a dirty hack is left as an exercise to the reader.
|
|
# ¿ Sep 13, 2018 23:50 |
ctps: defending my dissertation today somehow all this terrible programming paid off!
|
|
# ¿ Sep 14, 2018 17:36 |
today I saw how to make (& wrap) a burrito with 44 different recipes on my reddit feed and at first glance assumed it was a rust monad tutorial
|
|
# ¿ Sep 19, 2018 03:32 |
Kilometres Davis posted:I've been using VS Code and just run cargo from the terminal. Often the syntax highlighting is a little slow but I spent years working on systems that were further apart than the earth's radius so I hardly notice it. I'd still it to be better ofc. I might give Intellij a try. clippy is very good and you should run it on all of your rust projects. not only will it help you catch a lot of subtle errors, but also it's great at pointing out "there's an easier way to do that", especially with iterators and option / result.
|
|
# ¿ Sep 23, 2018 16:56 |
Are there reverse zip bombs? Like where a reasonably-sized input has a gigantic zipped form. I know that by the pigeonhole principle there are inputs with zipped forms that are larger than the original input, but my guess would be that there is an upper limit on this potential growth.
|
|
# ¿ Sep 26, 2018 16:30 |
|
|
# ¿ Sep 16, 2024 11:02 |
cinci zoo sniper posted:okay, the last two lines are a warcrime. before loop: tmp = {} inside loop: tmp[i] = None after loop: tmp = list(tmp) e: assuming that this is in Python 3.7+, where dicts are guaranteed to preserve insertion order. Otherwise, make tmp an OrderedDict at first VikingofRock fucked around with this message at 02:49 on Sep 29, 2018 |
|
# ¿ Sep 29, 2018 02:47 |