/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread: /dpt/ is the cleverest!

Other urls found in this thread:

arxiv.org/pdf/1309.3210.pdf
blog.landing.jobs/blog/2017/03/08/why-we-should-embrace-diversity-in-tech/
sleep.dashnine.org/
pastebin.com/WR5GT8Cw
twitter.com/NSFWRedditVideo

So. Any of you actually have experience getting an entry level job in programming?

What is your favourite programming paradigm?

First for linear time.

Neat codepen thing

If your favourite language isn't a language you developed, you're a fucking cuck.

OOP over functional programming

I'll post it again for posterity:

arxiv.org/pdf/1309.3210.pdf

This is literally the most up-to-date source of Big O formality for multiple variables and shit

What if I'm a member of the committee?

C--
C
Anaconda

Even worse. It's like the language is your wife's son.

I'm dead bored, give me something I can program in 3 hours.

Perfect

a portable int averaging library in C

Compute the average/arithmetic mean of two ints in C and account for all edge cases

Yes, show up, know your shit and depending on who's doing the interview be either full normie or mild autistic

What are the best books for learning Python?

what's Sup Forums opinion on this?

blog.landing.jobs/blog/2017/03/08/why-we-should-embrace-diversity-in-tech/

>need a book for learning babby's first programming language

I am working on a library of averaged numbers to use them in C.
Does someone have spare 67108864 TB?

How many languages should I know very well?

Implement all of Python's string functionality in a C library. You're not allowed to ask for the size of a string in any function, unless it's for something like removing the last x characters or something like that.

I live in Norway and have a job as a developer (meaning that 100% of my colleagues are white). I couldn't give less of a fuck what you do over there

Zed Shaw's Python the Hard Way is good, it's how I learnt it like 5 years ago.

3.

>unless it's for something like removing the last x characters or something like that.
Even then, you're not getting the size of the string, just the number of characters, words, etc.

A program in C that calculates the average

Which language would you suggest me for working with RESTful?

Silly modern meme

So basically the std::string class?

No. Fuck this guy. That book is a piece of shit.

>REST
sleep.dashnine.org/

C++ and FastCGI

That wouldn't work since C doesn't overload operators

Perl and web assembly

What language would you recommend as the first FP language?

>Le averaging int meme
/**
* Averages an array of integers.
*
* Averages an array of integers, without overflow or conversion to a larger type.
* It is equivalent to the sum of the array, divided by the array's length (rounded towards zero).
*
* @param n Number of array elements. Must be greater than zero.
* @param arr A pointer to an array of n integers. Must be non-null.
* @return The mean of the array's elements.
*/
int iavg(int n, const int arr[static const n])
{
int avg = 0;

/* A buffer of values that are lost to integer truncation.
* It should always be in the closed interval (-n, n).
*/
int error = 0;

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int loss = arr[i] % n;

// error + loss >= n
if (error > 0 && loss > 0 && error >= n - loss) {
// error = (error + loss) - n
error -= n - loss;
++avg;

// error + loss 0 && error < 0)
--avg;

return avg;
}

No, fuck you. It's free and it's pretty good.

why are you such a faggot?

You don't have to use operators. Functions are fine.

According to Stroustrup-sama, at least 5.

>C++ as your main
>Python to automate boring shit
>Java to make gui when needed
>C# to get money from microsoft stack customers
>Haskell to be pretentious shitposter on /dpt/

C preprocessor does

Python

CAN I SOMEHOW GET A BATCH FILE TO LET ME INPUT ARGV

AHHHHHHHHHHHHHHHHHHHHH

delet uoarself

Sure, but in strict C.

Now do it in C90

set arg1=%1?

It's good if you have the intelligence of a slightly below average dolphin.

>C as your waifu
>Ruby to program in while crossdressing
>Java to impress your pajeet friends
>Idris to magnify your e-peen
>bash for ricing
fixed

Exactly, so OP would have to be a retard not to learn it.

If you do this I hate you

Why?
C89/C90 has implementation defined modulo on negative numbers, while C99 doesn't.
I would have to use the div() function, but that brings the standard library into it.

doesn't work

How hard is it to write obfuscated code?

Spend a year working in India and you'll just pick it up.

post your shit

So, do you guys comment your code? I hope you practice good commenting.

What kind of retard doesn't?

I meant deliberately

Three.
One of C/C++ for when you need performance.

One of Java/C# for when you want to build something larger that just werks (large projects tend to turn to spaghetti in Python and the like).

One of Ruby/Python/Perl/etc. for duct taping other stuff together.

The only operator you really need is '+', and really catstring = concat(string1, string2, string3, ..., stringn);works just as well.

I don't have anything to post, I just want a batch file that will open the terminal and let me input argv
manually

I don't even know how do I do this, user a few threads ago said it's possible with macros and I want to learn how.

I don't.
My thesis supervisor didn't either and it took me a month or two to figure out what his codes were doing. My future students are going through the same shit lmao.

>for when you need performance.
Fortran

...

> The only operator you really need is '+'
>using the same operator as addition
Disgusting.

Compilers today are equipped with obfuscators anyway, why'd you want to learn that?

>it took me a month or two to figure out what his codes were doing.
disdain for plebs

nice meme

The only way I could imagine doing it is grabbing every instance where you use the '+' operator, testing the type of all the arguments, and then changing it as necessary.

Procedural, but ideally the language should also have first class functions and closures (from FP) and methods on structs (from OOP).

because i copied the code from a mate and i don't want the professor to find out.

its a program where you have to print some fizzes and buzzes lmao

I was saying that's really the only operator commonly used in other languages for strings, and that it's NOT necessary to even try to implement that functionality in C because using a function is just as easy.

it's hardly obfuscated at all, it's the most optimized (simplified) code that does what it's supposed to do just that it has magic numbers n shit

He used Fortran.

so then learn fortran. shouldn't take months

My own.
If that's not allowed then, C is my favourite language.

Don't live in NA or UK. Couldn't care less about the diversity meme.

That's what I did after learning what his code did and went on to actually do productive work.

But how do I even find a entry level job? Seems like the only job openings are senior or require +5 years of experience

>logical programming with native matrix operations
How's the idea, /dpt/?
Prolog severly sucked in datatypes.

You know, there's really nothing wrong with copying code, so long as you understand the gist of it, but whatever.

This turned out to be much bigger pain than what i thought it would be

help plox

Why is the Nethack source code so horrific?

You could try Haskell
It doesn't have matrices built in, but there are libraries, and you can overload operators

language?

learning c# on my own, but i'd appreciate any solution

it's on purpose.

things hard to write, must be hard to understand

Currently setting up to contribute to Firefox. Although I do have a genuine interest in it, I am motivated out of desperate need to pad my resume. Never worked on an open source project before.

here is a solution

pastebin.com/WR5GT8Cw

try to understand it first

sometimes in harder problems you have to use known algorithms to solve it,

What does Haskell have on logical programming?

>prior to first detection: check, for each entry (i,j), the entries (i+1,j), (i,j+1) and (i+1,j+1) for the same string
>if a repeating string is detected: check only in the same direction(s) as the previous repeating string(s)
>if one is detected then add to a counter k(i,j) which counts the length of the sequence with repeating elements
>figure out the rest yourself

like dis?

@echo off
cls
:main
echo Who's the best programmer in the world?
set /p var=
if "%var%"=="me" (
echo Of course it's you my man
)

if not "%var%"=="me" (
echo WRONG!!
echo.
echo Try again
goto main
)

pause

To some extent you can use certain forms of monads for this (again, library), but it's certainly not as well supported as it would be otherwise

example using the list monad

result = do
x

Common Lisp arrays.

You can do this in 4 functions.
a) that transforms the 2D array, so that all vertical rows become horizontal.
b) that makes diagonals align as rows.
c) that finds the longest match in the array by rows
The last one pipes these functions into each other and returns the longest match as follows:
->c
->a->c
->b->c
->a->b->c

thanks, will try

I see that you implemented DFS, i am yet to learn about it, still a beginner

it's cool that you do exercises, but reading classic shit also helps