/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

haskell.org/
en.wikipedia.org/wiki/Approximations_of_π
python.org/downloads/
twitter.com/NSFWRedditImage

Refuck 1.0.

>OOP
just say "no"

Currently planning to extend emacs to support live shared library reloading.
Unless somebody knows tool that can already do that?

Lolis

#include /* cracks knuckels */

int /* sisp energy drink */
main() /* puts on the hoodie */
{ /* eurobaet intensifies */
printf("Let's CODE\n");
}

What do you think of my code?

First for(isprime(p) == 1).

Aaaaaand, Compile error. GJ

Die please.

you're hired

Can a dumbass learn programming?

>indians use X so I must stop using X too so that nobody calls me a pajeet
Indians use water too, user. Are you going to stop drinking water?

no

>age < 50
>"You are young"
milfhunter

Can indians teach you how to write code?

>}else{

What are you smoking

POO

Indians don't use clean water

Yes

Fixed my laptop and made a quick implementation of binary search
#include
int binarySearch(int* array, int target, int min, int max) {
if (min > max)
return -1;

int midpoint = min + ((max - min) / 2);

if (array[midpoint] > target) {
return binarySearch(array, target, min, midpoint - 1);
} else if (array[midpoint] < target) {
return binarySearch(array, target, midpoint + 1, max);
} else
return midpoint;
}

int main() {
int array[] = {3, 6, 8, 12, 14, 17, 20, 21, 26, 32, 36, 37, 42, 44, 48};

const int numTestValues = 9;
int testValues[numTestValues] = {0, 3, 12, 13, 22, 26, 43, 44, 49};
int expectedValues[numTestValues] = {-1, 0, 3, -1, -1, 8, -1, 13, -1};

for (int count = 0; count < numTestValues; ++count) {
int index = binarySearch(array, testValues[count], 0, 14);
if (index == expectedValues[count])
std::cout

pi = atan(1.0) * 4.0

Simple reminder that if you're a beginner, Java is the best language to learn. Plenty of flexibility, easiest introduction to OOP you will find and heaps of documentation.

>Indians use water
stop lying

man perlootut

clearly this is best style
if (cond) {
;
}
else {
;
}

pi = 22 / 7 -- good enough

fuck off back to wdg

Why does /dpt/ love Udemy so much?

Did you just try to be smart?

>Modern compilers help idiots, who don't return values for a non void main. Still, you suck.

>he cant remember .1415

>integer division
good job

Can I fuck off too? I just came from edc

Which programming language should a brainlet like me (try to) learn? Python? I want to make some cool simple linux apps.

Haskell

Why use C-style array and not std::array?

python is low effort with immmediate reward

Prelude> 22 / 7
3.142857142857143


get with the times granddad

Cool, simple and linux is an anagram of perl, you do the math.

>he doesn't know it's .1416 because of rounding

pi = (double)22.0 / (double)7.0

fix'd

Prelude> pi
3.141592653589793

but then I can't seem ``clever'' for knowing 3 digits worth of approximation...

pi = 3 // close enough

>Haskell
Are you memeing me or what? I looked at the homepage for haskell and their example is confusing as fuck

primes = filterPrime [2..]
where filterPrime (p:xs) =
p : filterPrime [x | x

And now to try to get my GCC project to work on windows... Wish me good luck.

python is a good language if you aren't a master programmer, and everything else you could probably learn is absolute shit

Where do I start with programming? Are sites like codeschool good?

That's obviously complicated for someone who doesn't know Haskell, try the wikibook or the"try it" bit on haskell.org/


Python will rot your brain

double zeta(double s)
{
int nmax = 10000;
double dt = 0.001;
double sum = 0.0;
for(int n=0;n

>What does this mean?

Spend 30 minutes learning it and you'll know? What is the point of learning a language you already know?

Will learning python make it easier to learn other languages later or is it non-transferable?

Haskell is a pure functional programming language. It's esoteric because mathsy academic types like it that way.
Python is good enough for a beginner, you'll find that you can do a lot just by googling shit and gluing bits of what you know together. It's reasonably capable for making stuff.

Just link en.wikipedia.org/wiki/Approximations_of_π and be done with it

Post cute anime girls at least

It's somewhat non-transferable. If you're learning for the sake of learning, learn C++.

it may with enough effort

I'm a brainlet who can't into math, Python looks pretty comfy desu

python.org/downloads/

Python is no lingua franca but it'll help.

Haskell is good for a beginner, you just don't start off by showing them tsuff like that.
Python is NOT good for a beginner because it ruins them as a programmer forever.

>esoteric

question mark

no

What is the hardest language?

>python.org/downloads/
Wow, I'm learning so much looking at this download page, pretty sure my distro has python already anyway, I was asking which is the best learning resource.

C++

Show me a man who knows all the rules for initialization and I'll show you a liar.

Working on an ASM interpreter for PIC16F877A "emulation". Just got finished implementing the logic for symbols. Next up: macros.

any OOP trash

>22/7 is accurate to 3 digits
>2 2 7 is three numbers
???

So with MinGW gcc on windows, do I use .a or .lib libraries? I.e. linux or windows ones?

bash

malbolge

Ook

>Python is NOT good for a beginner because it ruins them as a programmer forever.
What makes you say that?

I don't know, sadly

Walk into google, ask to speak to the manager, give him a firm handshake and tell him you wanna work there.
}else{ kill yourself

I tried learning C++ when I was younger but I think I'm too brainlet

haahahaha guys
OOP backwards
is
POO
comdeuy geauld

Reminder that actual mathematicians hate trashkell and trashkell programmers.

Mindlessly parroting Sup Forums memes 24/7 does things to people's brains

brainlets will use it to show that they are aware that the fraction exists. when in reality all they're doing is adding extra operations for worse results.

1) The language is incredibly poorly designed.
2) A lot of awful practices fall under the term 'pythonic'.
3) The language does not have a type system, or any kind of static verification.

What is wrong with } else {?
this is the book I'm daring and they show it as examples

>muh static typing

You forgot that meaning of ``pythonic'' changes every week

w.r.t. 3 IIRC there was some PEP few years ago which let you put annotations on functions which would them be checked ahead of time but I don't know what happened to that; definitely step forward if you _have to_ use Python though.

>actual mathematicians hate trashkell and trashkell programmers.
hey, I consider myself an actual mathematician and I like haskell

nothing wrong with } else {, these autismos just cringing at your lack of spacing. }else{

Interesting. Welp, I'll give Haskell a go and if I'm too brainlet I'll ruin myself with python, I'm not planning to work as a programmer or anything just wanna learn a language to do small projects in when I think of stuff/add things to other peoples projects.

it's just personal preference
whitespace doesn't matter in C

python's dynamic typing doesn't bother me so much because it tends to raise errors on type mismatches rather than just rolling with it like PHP or Javascript.

Use the wikibook, it's quite slow.

You could also start with C.
That might be more beginner friendly.

>I consider myself an actual mathematician

Assembly

it's ugly.
[spoiler]I actually really like the way it looks I'm just memeing to fit in with the cool programmers[/spoiler]

Get the fuck out, you hardly even program and constantly fucking avatarfag and shit on everything

MATLAB is not a real fucking programming language you brainlet

C is more transferable than python? I mention python because I notice a lot of small linux apps are done in python.

If you like python just use it, don't listen to Sup Forums memers trying to persuade you

The eye scans for a lone closing }.

I personally advocate the open { newline approach, which makes scanning for code blocks even easier. But I'm a heretic that uses C#.

// Some shit
int i = 15, j = 20;
if (j < i && sky.IsRed())
{
// Do stuff
array[j] = i + j;
}
else
{
// OP is gay
WriteLine("Very gay");
}
// More crap obscuring your vision
j = -10;


This is just visually superior, admit it. Look how shit it looks below.

// Some shit
int i = 15, j = 20;
if (j < i && sky.IsRed()) {
// Do stuff
array[j] = i + j;
} else {
// OP is gay
WriteLine("Very gay");
}
// More crap obscuring your vision
j = -10;

Yes.