/dpt/ - Do Prefer Totality

What are you working on, Jow Forums?

Old thread:

Attached: Sulphur-Crested Cockatoo HD Wallpapers 18.jpg (1600x960, 164K)

Other urls found in this thread:

hackage.haskell.org/package/profunctors-5.3/docs/Data-Profunctor.html
pastebin.com/gwDci0xy
paulbourke.net/dataformats/obj/.
youtube.com/watch?v=zBkNBP00wJE
youtube.com/watch?v=UYcRvU9UO40
twitter.com/SFWRedditVideos

Tell me things about programming complexity /dpt/.
Opinions, techniques, advice, whatever.

Should you be considering big o during the design phase? Do you prioritize the CPU or human maintainers? Is there anything you can do to improve yourself in this area (data structures and algorithms books, project design lessons, etc.)?

I'm going to bed but will read this tomorrow.

Attached: 039e016b522795ad2a0632842db195de1948dedb5edc42f5b973766f73ba9fdf.jpg (180x217, 7K)

What's a good lang for embedded besides C?

C is pretty much the onlu universal embedded lang. You could try assembly, but it's pointless having C.

everyone except me is retarded and i can prove it programmatically

I bet it's Forth.

Literally nothing. (I was going to say "the target machine's assembly", but I doubt you'd be interested in that if you're looking for alternatives to C.)

Is this the true power of C++?
template
requires std::is_arithmetic_v T sqrt(const T &Number) noexcept[[
expects:Number >= 0]][[ensures Ret:Ret >= 0 && Ret < Number]] override final
noexcept {}

Attached: 1528304992788.png (1920x952, 46K)

omfg i was like an hour debugging whhy i couldnt change an unordered_map inside a function. Turns out i had a const hidden in my function.

Jesus christ why cant they say like hey you cant edit this shit nigga ur in a const function.

Complexity is important to consider but make sure you benchmark and consider your requirements too. An O(n) algorithm with a huge constant factor could be a worse choice than an O(n^2) algorithm with a small constant factor if your input data is always small. Caching and read patterns matter too. Linear search might be faster if you can pull all the data into a single cache line than binary search if the nodes are fragmented all over the heap.

Post the function, niggy

>whiteboard interview
So, uh, I want to make sure that you understand recursion. Can you compute the Ackermann function applied to 4 and 2 on the whiteboard for me?

ill paraprahse, i glossed over it because the code is a bit more complex:

MyClass
{
private: std::unordered_map myDict;
//constructor blablabal
}

//other file, i missed the const to the right
myclass::doSomething(std::string&name, int i) const
{
myDict[name] = i;
// this gave weird errors, it wasnt clear i wasnt allowed to do that.

}

you want complexity faggot?

read others code.

If you master this ability you will be better than 99% of the people here. The longer you stick with textbooks the longer you will be a faggot. Its like being a construction worker and preparing by going to university.

suck my dick nigxer

During design phase, you should think if you are processor, memory, disk, or network bound. You should consider rough timing requirements: real time, human interactive, foreground task, background task, or long running. Consider available resources like hardware and developer time. Optimize design accordingly.

I generally think there are three main phases of a good implementation. You shouldn't need to start from scratch, but main parts should be rewritten each phase. First phase optimizes for simplicity. Make the intent of the program obvious. Second phase optimizes correctness. Sacrifice some simplicity to cover more possibilities. Third phase is performance. Sacrifice some simplicity or correctness for speed boost.

>Should you be considering big o during the design phase?
in most cases, no
>Do you prioritize the CPU or human maintainers?
Depends on the scenario. I have good documentation habits so I can get away with brutally optimizing shit without making my code completely unreadable.
>Is there anything you can do to improve yourself in this area
Heavily dependent on the context. With my line of work, Big O isn't a real concern most of the time, because almost everything we do is state machines, interrupts, and maybe some string parsing (which is often also implemented with a state machine). The optimizations come in with inline assembly and careful manipulation of the compiler.

more C
it's literally the only relevant language in embedded except for asm. t. embedded dev
I'm hoping rust makes inroads in embedded though, with the multi-core MCUs gradually trickling their way down into practical applications, a lang that's well-equipped for concurrency would be awesome.

ack(oh, no) = 16? who the fuck knows

wait doesn't ack(4, _) take ages to calculate

yes, the question is really testing whether the interviewee understands that within a few steps of trying to compute it by hand

what do i win

Attached: 1466583701447.png (600x720, 536K)

the next question. derive profunctor-based optics from first principles

fuck you. derive sugma

uh p a (f b) and shit?

what is "sugma"?

hackage.haskell.org/package/profunctors-5.3/docs/Data-Profunctor.html

sugma deez nuts lmfao you fell for it

sugma dick

Can one use sigma-types in Java or C#?

you mean polymorphic types?

or do you mean dependent pairs

Dependent pairs.

Why don't you like good ol' C? :(

Attached: stages_of_C_denial.jpg (1605x655, 313K)

gay

About what I expected, but thanks anyway.

I don't mind C, but I want to introduce my team to another language to keep my career prospects open.

What do you mean?

Why not C++ or Ada?

why is blender breaking when I try to open this obj file?
pastebin.com/gwDci0xy

I am following the obj format standard paulbourke.net/dataformats/obj/. WYYYY NOT WURK

Assuming the individual digits of the printout are in an ordered array of ints, what is the best way to get the colors out of the numbers

I'll post my solution in a second, if it works

Attached: number output.png (1079x1715, 118K)

probly the commas

a terminal lain viewer

Attached: found a lain.png (680x564, 26K)

I mean I'm worried that specializing too much in C will cast me as a maintenance programmer in future jobs. I want to show ability to stay flexible.

All the selling points of C++ aren't really applicable. Ada is something I hadn't considered. Have you ever used it? It has a reputation as boring and bloated, but that might be safe.

I want something that has a strong static type system with lots of compiler guarantees since I'm looking at a long edit-compile-debug cycle. A high performance math library is a big plus.

>I want something that has a strong static type system with lots of compiler guarantees
The language was literally designed to for program correctness in performance critical applications.

ok.

for (Loop = 0; Loop < 121; Loop++){
if ((LoopCounter%5) == 0 && ArrayCreationLoopCounter != 0){

int goestocolor = (D.int[Loop-1]+D.int[Loop-2]+D.int[Loop-3]+D.int[Loop-4]+D.int[Loop-5]); // D is the array of 120 ints

Hash = String.format(Hash+FinalColorMethod(goestocolor)); // Returns a hex character as a string based on the value given
stringcounter = stringcounter+1;
}

if (stringcounter == 6 && ArrayCreationLoopCounter != 0) {
Colors = String.format(Colors + Hash);
stringcounter = 0;
Hash = "#";
}
}

Attached: color output.png (804x1109, 78K)

What is the most productive programming language? Doesn't have to consider performance, mainly expressiveness and how good the standard library and other popular languages are.

Python

Why not Ruby?

anything dynamically typed

What about Go?

it's corporate trash, why did you bring it up?

Because it has a batteries included standard library.
What about Rust?

Rust is the opposite of productive because it's a low level language that prioritizes safety

I just started my second year of my bachelor's. What are some (preferably interesting) things I can work on outside of class to show off to future employers and develop as a developer? One of my lecturers was talking to me about Q# as something interesting. He said I'd never get a job using it but it would show that I'm flexible.

That was my impression, but has anyone here ever used it?

I don't know much about it and want some guidance getting started.

Other pros, cons? I hear it's quite verbose. If it has these qualities, why is it not more popular?

racket

Why are lambdas so overhyped? There are cases here and there were it makes things just slightly neater, but nothing so major

Attached: 1534307487031.jpg (644x650, 57K)

If I were her, I'd just finish the job and off myself for real.

Does your Uni have any clubs or design teams that need code? Does it have an ACM chapter? Check those out.

For interesting stuff, take hard classes and apply what you learn. Outside that, pick an open source project and hack. Contributions to a well known project will always be valuable.

They are not; higher order functions are.

What the fuck's a higher order function (assuming it's sepples and not some functional whack)?

Attached: 1534310502098.jpg (480x480, 50K)

If you're willing to fight with Rust, that can also work.

a function that takes atleast one function as an argument
theres some in the std::

My job prohibits using FP except when strictly necessary. For loops are usually much easier to understand for anyone who isn't a MIT graduate.

get a load of these lambdlet and FP noobs

Attached: obese.png (660x663, 374K)

imagine being literally required to write code with necessary side effects and garbage non-expressive code

please tell me you're not working with java, you can't expect people to be using for loops instead of streams because it's "MIT graduate" level

My campus is quite small. Sort of a satellite campus. Which means if opportunities do come up it'll be easier for me to get them but opportunities may not come up.

C#

why didn't CNN report about this earth shattering incident?

youtube.com/watch?v=zBkNBP00wJE
youtube.com/watch?v=UYcRvU9UO40

>All the selling points of C++ aren't really applicable.
gotta say i disagree. compile-time execution of arbitrary deterministic C++ code (including higher-order functions/lambdas), static branching, variadic templates / pack expansion, fold expressions, perfect forwarding, std::apply (static expansion of array/tuple elements over function arguments / loop unrolling), variable templates, type traits / metafunctions, std::void_t / std::is_detected (allows for concepts-style static type constraints), user-definable literal operators (allows for compile-time strings/operations/formatting/parsing, regex pattern parsing/DFA generation, vector swizzle operators, etc). and there's more to come in C++20; pack expansions in lambda captures (capture variadic args by move), constexpr/literal class types allowed as non-type template arguments (including compile-time strings), and (i shit you not...) allowing virtual function calls in constexpr contexts (as long as they're deterministic), lol

For loops as opposed to what?

the first one's my go to to impress people and cniles with c++ desu

Exactly my point. None of that shit helps my use case, even if I could learn to use it, find a non garbage implementation, amd explain it to coworkers.

five loops
xd

oof

why do you post this every thread

it's not funny

it was never funny

and we're not dumb enough to take you seriously

This is the first time I'm posting it

kayyyyyyyy bud

back off???

get out of my Jow Forums

no u

>for loops are much easier to understand for idiot drones who took 4 fucking years to get IP drilled into their brains and can no longer learn anything new

What's the alternative to for loops? I'm fairly new to programming.

>unironically using streams
enjoy your 10x slower performance LOOOOOOOOOL

"we made a wrapper around forEach that does nothing but help make wannabe academics masturbate and use up 90% of our fucking cpu cycles"

LAMBDALETS
ARE
REAL

map, folds, filter

depends on why you are using it. the classic example is you have a list of one thing but you need a list of another thing.

for loop:

List unparsed = /*something you already had*/;
List parsed = new ArrayList(unparsed.size());

for (var x of unparsed) {
parsed.add(Number.parseNumber(x);
}


with map:

List unparsed = /*something you already had*/;
List parsed = unparsed.stream().map(Number::parseNumber).collect(toList());

holy shit the idiocy of CS retards
No wonder why anyone outside academia wants you faggots

and that second one is supposed to be fucking BETTER? LOOK AT IT

FUCKING LOOK AT IT

WHAT DOES IT EVEN MEAN? WHY DO I HAVE TO CALL A FUNCTION AND PASS THE RESULT OF THAT FUNCTION AS AN ARGUMENT TO WHATEVER THE FUCK "COLLECT" IS
REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE JAVA DEVS GET OUT REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

LAMBDALETS
GET
OOOUUUTTTTTTTTT

I see. I should read more about map. I saw my first usage the other day, learning how to deal with JSON shit, but the tutor didn't go in depth about it.

for

>t. brainlet

works on my machine

yeah, or read about java streams. they're a pretty powerful way to do most anything we used to do with for loops with a nicer, more declarative syntax.

haha noob there is no such thing as Number.parseNumber() !!!!!!!!!!!!

>None of that shit helps my use case, even if I could learn to use it
if you learned a bit more about it, i think you'd probably find that some of it would. you're always free pick and choose, for what it's worth. even just the common C/C++ subset + constexpr + lambdas would be very useful and broadly applicable, for example

... yeah, I know that. but thanks.

>trying to shoehorn FP cancer into c++
neck you'reself and stay away from my pure waifu

>pure
ironic

you're using the wrong language if you wanted cutting edge performance

>read about java streams
I think you just done fucked me up. There goes my evening.