/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

youtube.com/watch?v=uiJycy6dFSQ
surjithctly.github.io/documentation-html-template/
en.cppreference.com/w/
github.com/majestrate/XD
twitter.com/SFWRedditVideos

Idris > Haskell > *

kek
Just fuck my shit up, senpai

Learning Scala because $$$

But is it worth your sanity?

youtube.com/watch?v=uiJycy6dFSQ

What shitlang is this?

This would be true if Idris was ready for production.

>But is it worth your sanity?
I've already lost my sanity by being an Android developer.

Reminder that nobody who posts in /dpt/:

>uses Python
>is male
>thinks OOP is a good thing
>likes Electron apps

Top tier reading comprehension, m9

My condolences fampai

you know it's shit when they have to call functions procedures for no reason other than to be different

Procedure used to be the common term as opposed to a function which is a mathematical entity that has no side effects. It is planned to have func as syntactic sugar for proc {.noSideEffect.} and func is already a keyword. Naming it def would not make sense because Nim also provides an iterator and a method keyword, whereas def stands for define.

How do people get Microsoft mvps? Is it worth it?
What about Oracles certs

nobody cares, just kill yourself already

...

When interviewing people I have never cared how many Microsoft/Oracle certs they have

Do you carre about WPM?

Only to the extent that your typing speed doesn't stop you from getting things done.

It's OK user. I get my daily laughter during merge requests.

>Kind of want to program
>Nothing I want to program

fuck

Are you me.

Is there any documentation editor that would produce something as simple as this? could be also a markdown editor that has an automatic table of contents.

surjithctly.github.io/documentation-html-template/

Yeah, I interviewed a bunch myself, never asked
Was just wandering if that's a big deal, we are a small company

Do bugfixes for open source shit on git?

Realisticly speaking, how long would it take to code a DOS level kernel in C, having plently of prior experience with programming but none with kernels directly?

Take a look at the FreeDOS project, even a simple real mode OS is a lot of work if you want actual functionality

the phrase "dos level kernel" shows you don't even have a primary understanding of operating systems

>Takes string
>Reverses it
>Checks if palindrome

What do you think?

#include
#include
#include

std::vector stringToVec(std::string inputString) {
std::vector letters;
for (int a = 0; a < inputString.size(); a++) {
letters.push_back(inputString.at(a));
}
return letters;
}

std::string vecToString(std::vector inputVec) {
std::string reversedString("");
for (int a = 0; a < inputVec.size(); a++) {
reversedString.push_back(inputVec.at(a));
}
return reversedString;
}

std::string cleanString(std::string inputString) {
std::locale loc;
for (std::string::size_type i = 0; i < inputString.length(); i++) {
inputString[i] = std::tolower(inputString[i], loc);
}
for (std::string::size_type i = 0; i < inputString.length(); i++) {
if (inputString[i] == ' ') {
inputString.erase(i, 1);
}
}
return inputString;
}

std::string checkPalindrome(std::string reversedString, std::string originalString) {
if (cleanString(originalString) == cleanString(reversedString)) {
return "Yes";
}
return "No";
}

std::vector reverseVec(std::vector inputVec) {
std::vector reversedReturn;
for (int a = inputVec.size() - 1; a >= 0; a--) {
reversedReturn.push_back(inputVec.at(a));
}
return reversedReturn;
}

int main() {
std::cout

Too many unnecessary copies, read about references.

This is either bait or homework shit, get the fuck out.

In Haskell, this is just

palindrome s = s == reverse s

Also, this is the first time in years I see someone using 'locale'.

Here is the equivalent Haskell:
(ignoring main)

palindrome = (==) reverse

>unnecessary copies
What are those

>homework shit
Its not this is legit my solution to what I said

idk dude im just looking at random shit on this site en.cppreference.com/w/

> C++14
> g++
>Loonix
>code with

shit doesn't compile
> undefined reference to `pthread_create'
> collect2: error: ld returned 1 exit status

first of all, why? is supposed to be part of the standard

add -pthread to the compiler flags

const bool is_palindrome(const std::string &s)
{
return s == std::string{s.rbegin(), s.rend()};
}

Use std::string_view to accept string parameters.

github.com/majestrate/XD

needs a logo maybe Sup Forums can help

>2017
>still no haskell microkernel

You do realize that this won't work for something like:
"A new order began a more Roman age bred Rowena"

This girl wrote his own game engine and you can't even write a proper palindrome tester.

why the fuck are we still supposed to do this when the include speaks for itself?
> -pthread
> Adds support for multithreading with the pthreads library. This
> option sets flags for both the preprocessor and linker.

>Garbage collected kernel
This is as bad as when Microsoft attempted to write a managed kernel to replace NT.

Except it works so I don't understand why you say it is not proper.

#include doesn't link against any libraries. It just copy and pastes header files into your source file.

>2017
>not contributing to Rust microkernel

ok?
const bool is_palindrome(std::string s)
{
std::transform(s.begin(), s.end(), s.begin(), ::tolower);
return s == std::string{s.rbegin(), s.rend()};
}

palindrome `on` map toLower

import Data.Char (toLower)

palindrome s = s == reverse $ map toLower s

>2017
>contributing to a dead project in a dead language

>his

Redox is trash. Haiku is way better, and it's written in a much better language too.

I get it but gcc is supposed to know what to do

is C++11, not some new experimental contraption from C++17

you need to lower both strings

Except you fail to take into account the spaces.
Second time you fags have failed

That's not even a palindrome.

...

Yes it is

>I get it but gcc is supposed to know what to do
What the fuck do you mean? I just fucking told you, #include just copies and pastes shit into your source files. Retard.

No it isn't. What, you think spaces don't exist or something?

partition `on` (map toLower . filter (not . isSpace))

>keep radically changing the specs (inb4 >you didnt even test my autistic 905049560386 line C++ program)

>only slightly increases the length of the Haskell one-liner

Who cares, we're not here to solve your homework, merely showing that it doesn't require a 100 lines of code solution.

What am I looking at?

a haiku

>#include just copies and pastes shit into your source files.
why the fuck do you have to add special compiler flags for standard code to compile?

you can pretend that it makes sense if it makes you feel better but it's bullshit

He only added one line in the C++ example, wtf are you talking about.

a Chinese poem about Sup Forums attitude to the Rust language

we're talking about

It's not bullshit, it makes complete fucking sense.
uses pthreads and therefore relies on the pthread library. You think is fucking magic or something? You need to link against the fucking pthread library you moron.

Writing a game engine takes a day if its simple you pompous fuck

>Sup Forums
I should say dudebro attitude in general

kek
So this is the power of c++

No, that guy is just really fucking shit.
It would be so much worse in C.

C++ is worse than Java

you always have to link against something you fucking moron

do you know what libstdc++.so is? DO YOU MANUALLY LINK TO IT AND ALL THE OTHER SHIT??

just shut the fuck up.

>that guy is just really fucking shit
I really don't understand why you say this. What is inherently wrong about the code.

This cat kind of looks like Assad

>DO YOU MANUALLY LINK TO IT AND ALL THE OTHER SHIT??
actually yes, you do

C++ is orders of magnitude better than Java.
Java literally has no place in software development, C++ does a better job at literally everything that Java and even C does.

as you can see, Haskell code can easily adapt to changing requirements and is almost modular in a way

Performance and readability

with includes ... you fucking moron.

It is Assad you fucking nit show some respect

Java has modules, C++ doesn't. All it does is that it opens the flood gate for fucktards like you into systems programming

I don't think the standard specifies this so this is valid behavior

Oh, wow! I'm so sorry.

libstdc++.so is automatically linked against unconditionally.
You're saying that GCC should automatically link against libpthread.so when is included.
So I ask you, why the fuck should GCC introduce this shitty hack? What if I'm freestanding and I create a header file called thread and include it? It'd link against an unwanted library.

>What if I'm freestanding and I create a header file called thread and include it?
like gcc doesn't know which thread you're including

at least stfu after you got owned.

Requiring external libraries to build stuff in the std namespace is just laughably bad.

Why should pthread be a part / dependency of libstdc++?
Why should pthread be linked into binaries that don't even want to use threads?

>>Takes string
>>Reverses it
>>Checks if palindrome
import std.stdio, std.algorithm, std.string;

void main(string[] args)
{
string input;
while ((input = readln.strip) !is null)
input.is_palindrome.writeln;
}

bool is_palindrome(in string s)
{
auto rs = s.dup;
rs.reverse();
return s == rs;
}

Man, I wish D was more popular.

Imagine using a language that doesn't support parallelism using threads

>Java has modules, C++ doesn't
Yet it still manages to be better. When C++ gets modules and concepts in the next revision, Java and C# will be severely blown out of the water for good.

Why? It's not very good.

auto is_palindrome = function (string s) => s.dup.reverse == s;

It also fails for "σοφός", say, but good luck fixing that.

It's already a huge improvement over C++, and Andrei is the man.

>like gcc doesn't know which thread you're including
How is it going to tell?