|
Notorious b.s.d. posted:and smarter pointers not if it's c++03 or earlier
|
# ? Apr 14, 2016 18:48 |
|
|
# ? May 25, 2024 13:07 |
|
fart simpson posted:how do you know this? like i find refactoring and modifying stuff in elm (a pure functional language) is way way way easier than doing the same in javascript, because elm code easily ends up being modular and composable and the compiler is v helpful i had to use LISP for some academic poo poo like 6 years ago. i remember nothing about it except infinite function nesting. but now, upon typing that, i realize i may be ascribing to functional programming what might just be the fact it was academic code. but surely my professor would never write code that is a muddled mess only he understands!
|
# ? Apr 14, 2016 18:52 |
|
Notorious QIG posted:nah now it's code:
|
# ? Apr 14, 2016 18:55 |
|
Illusive gently caress Man posted:its just so dumb that every time i want to say code:
|
# ? Apr 14, 2016 18:56 |
|
i asked 10x to talk with me about what was needed for <feature> PR, so that we don't repeat what happened earlier this week. most of the stuff needed for this feature was from the PR that got blasted because there were too many conflicts with his local branch, so i wanted to talk about it to make sure we were on the same page. he responds with "There needs to be a PR for the <feature> so it can be merged……". boss chimes in to the email chain with "seems like an MVC design pattern?". i feel like walking out and i probs would if i were confident in my ability to find another job within a reasonable time frame.
|
# ? Apr 14, 2016 18:57 |
|
Of course, it should be "a mvc"
|
# ? Apr 14, 2016 18:59 |
|
Captain Foo posted:probably some code, tbqh probably i need a wifi shield so i can connect to the ksp server directly instead of using my computer as a passthrough
|
# ? Apr 14, 2016 19:02 |
|
Illusive gently caress Man posted:its just so dumb that every time i want to say can you get away with : code:
|
# ? Apr 14, 2016 19:03 |
|
Notorious QIG posted:not if it's c++03 or earlier can you at least use a boost
|
# ? Apr 14, 2016 19:04 |
|
HoboMan posted:i had to use LISP for some academic poo poo like 6 years ago. i remember nothing about it except infinite function nesting. I'm glad you reconsidered. All of the best parts of the c# language (ie NOT the .net infrastructure) are considered to be "functional" features. var, foreach, linq, expression bodies, cascading nulls, AndThen (is that what it's called when u chain futures together?)
|
# ? Apr 14, 2016 19:05 |
|
this is how i sometimes feel at redhat
|
# ? Apr 14, 2016 19:06 |
|
gonadic io posted:I'm glad you reconsidered. All of the best parts of the c# language (ie NOT the .net infrastructure) are considered to be "functional" features. var, foreach, linq, expression bodies, cascading nulls, AndThen (is that what it's called when u chain futures together?) AndThen? Do you mean async/await?
|
# ? Apr 14, 2016 19:13 |
|
Illusive gently caress Man posted:its just so dumb that every time i want to say return DoThis().then([&] { return DoThat(); }); or if you want to pretend you're writing haskell, return DoThis() >> [&] { return DoThat(); };
|
# ? Apr 14, 2016 19:18 |
|
DoThis()?.DoThat()
|
# ? Apr 14, 2016 19:23 |
|
HoboMan posted:i had to use LISP for some academic poo poo like 6 years ago. i remember nothing about it except infinite function nesting. also lisp as it's written outside of functional programming classes isn't particularly functional, and out of the box it doesn't support some things people used to modern fp languages will expect. it's a multiparadigm language that was just the biggest language that supported fp 30 years ago
|
# ? Apr 14, 2016 19:23 |
|
fritz posted:can you at least use a boost in theory yes, at this job no
|
# ? Apr 14, 2016 19:28 |
|
weird posted:
yes this technically works but it assumes that the contents of the loop are one and only one function call of course you could (a) write an external function that handles the inside of loop () or (b) write a lambda, but lambdas only exist in c++11 and up. and besides goddamn is that some ugly code either way if you aren't just trying to fart() each butt oh also without lambdas you can't capture variables from outside the loop so have fun trying to get that to work with c++03 with any function that depends in some way on external state!
|
# ? Apr 14, 2016 19:32 |
|
i pretty frequently have to iterate over stl::map objects, which is really "fun" in c++03. say i want to add one to each member of an int map keyed by stringsC++ code:
|
# ? Apr 14, 2016 19:34 |
|
also be sure to note that it is not a pointer, it just overrides operator* and operator-> to make it look like one! this has the fun side effect that &(*it) != it
|
# ? Apr 14, 2016 19:37 |
|
std::transform should do that?
|
# ? Apr 14, 2016 19:40 |
|
more like dICK posted:std::transform should do that? same problem as before re: external functions or lambdas. im intentionally making simple examples here of loop structures, ofc there are easier ways to add 1 (also std::transform and std::for_each are in libraries separate from, say, <map> so you have the added joy of more #includes, hooray)
|
# ? Apr 14, 2016 19:49 |
|
typedef the pain away
|
# ? Apr 14, 2016 19:50 |
|
c++11 owns
|
# ? Apr 14, 2016 19:52 |
|
I think that "operation I regularly apply to a map entry" is he perfect thing to encapsulate in a function but I'm in this thread so whatevs
|
# ? Apr 14, 2016 19:53 |
|
c++ is bad
|
# ? Apr 14, 2016 19:53 |
|
more like dICK posted:I think that "operation I regularly apply to a map entry" is he perfect thing to encapsulate in a function but I'm in this thread so whatevs depends on how often you actually apply that operation i guess. plus im generally of the opinion that fewer functions = better (within reason, of course)
|
# ? Apr 14, 2016 19:55 |
|
i have an incredibly noob haskell question okay so i have a type like: data Butt = Fart String | Poop Int | Diarrhea Bool and now i have a list like butts = [Butt] and i wanna filter the list down to just Fart Strings somehow. so right now im doin like: isFart :: Butt -> Bool isFart (Fart _) = true isFart _ = false ...filter (isFart) butts this seems insanely bad. like if butts was actually butts = [Bool] i could filter (=True) butts to get True butts but because its a Fart String i don't seem to be able to do that?
|
# ? Apr 14, 2016 20:00 |
|
Bloody posted:i have an incredibly noob haskell question what you are doing really is the best way. *: you can do this using lens, or like isFart x = case x of {(Fart _) -> True; _ -> False} but those are both fundamentally the same thing.
|
# ? Apr 14, 2016 20:02 |
|
hmm ok. glad im not missing some hilariously trivial bit of functionality somewhere at least im writing functions to filter my parsed statements into declarations (so i can check for duplicate identifier usage and poo poo) and usages (so i can check for unused/unreferenced identifiers)
|
# ? Apr 14, 2016 20:03 |
|
if you then immediately get the string out, then consider doing fartString :: Butt -> Maybe String instead
|
# ? Apr 14, 2016 20:03 |
|
while ur here do you happen to know how to interact or at least capture state from megaparsec it's clearly a thing that can be done but is either lightly documented or i don't understand how to read the docs for it. i wanna be able to tag all this stuff im parsing out with where it came from so later when im doing stuff with it i can say "hey this thing is never used, it was declared on line 16"
|
# ? Apr 14, 2016 20:05 |
|
Bloody posted:either lightly documented or i don't understand how to read the docs for it welcome to haskell enjoy your stay
|
# ? Apr 14, 2016 20:06 |
|
this is my favorite documentation ever: https://hackage.haskell.org/package/base-4.8.2.0/docs/Control-Arrow.html#t:Kleisli its beautiful fart simpson fucked around with this message at 20:11 on Apr 14, 2016 |
# ? Apr 14, 2016 20:08 |
Notorious QIG posted:i pretty frequently have to iterate over stl::map objects, which is really "fun" in c++03. say i want to add one to each member of an int map keyed by strings Why wouldn't you just do ++(it->second)?
|
|
# ? Apr 14, 2016 20:08 |
|
VikingofRock posted:Why wouldn't you just do ++(it->second)? again because it's a simple example to demonstrate the general gist of what im talking about christ almighty do i have to write unit tests for example code too
|
# ? Apr 14, 2016 20:21 |
|
Bloody posted:while ur here do you happen to know how to interact or at least capture state from megaparsec it's clearly a thing that can be done but is either lightly documented or i don't understand how to read the docs for it. i wanna be able to tag all this stuff im parsing out with where it came from so later when im doing stuff with it i can say "hey this thing is never used, it was declared on line 16" It's been too long since I've done haskell in anger so try the haskell irc I think the way I did it uni was to do an initial lexing lass turning each char (or token) into data CharSrc = CharSrc Char Int Int For the line and column numbers and then writing your parsers to usually ignore the positions with a bunch of utility functions
|
# ? Apr 14, 2016 21:00 |
|
But that was with regular parsec not mega so maybe it's built in now? It's a pretty common use case...
|
# ? Apr 14, 2016 21:01 |
|
well great, went to check in the last few hours of work, visual studio crashes. everything i just did is gone.
|
# ? Apr 14, 2016 21:12 |
|
try saving your changes every once in a while. that happens automatically when you build. vs also has auto recover
|
# ? Apr 14, 2016 21:14 |
|
|
# ? May 25, 2024 13:07 |
|
gonadic io posted:But that was with regular parsec not mega so maybe it's built in now? It's a pretty common use case... yeah megaparsec seems to allow it but pretty much just documents it with inscrutable type signatures heh
|
# ? Apr 14, 2016 21:15 |