/dpt/ - Daily Programming Thread

Get to work edition.

Previous thread: What are you working on Jow Forums?

Attached: teach_me_cpp_senpai.jpg (1440x810, 155K)

Other urls found in this thread:

stackbuilders.com/
cryptact.com/?lang=en
bofaml.com/content/boaml/en_us/home.html
credit-suisse.com/us/en.html
db.com/company/index.htm
github.com/nrao/antioch
sc.com/en/
gensym.com/
devdocs.io/javascript/functions/arrow_functions#Basic_Syntax
reasonml.github.io/en/try?rrjsx=true&reason=DYUwLgBAhgJjEF4IA9ED4IE90ogaiwG4AoYgKQGcA6YAewHMAKWGRgJgBoIBmASl6A
twitter.com/NSFWRedditImage

formal logic was a mistake

First for people with fewer than 15 accepted pull requests in the Linux kernel should not be allowed to speak about systems programming, or argue about systems programming languages.

Attached: 45320993582.jpg (662x602, 212K)

Reminder that C++ is the most powerful programming language, and C++ becomes easier and simpler with each standard revision.

This is good.

This is bad.

Reminder that C++ is the least powerful programming language, and is still barely usable.

Nevermind I figured it out

Why?

based

>people trying to do """"""""""""""""F"""""""""""""""""""'P in C++

Attached: King.Of.The.Hill.S04E05 - Aisle 8A.C.avi_snapshot_07.36_[2018.05.18_20.40.18].png (640x480, 508K)

gj user!

are you doing nofp

i'm doing no sepples, forever.

based and redpilled

no fp november?

C++ is quite comfy with STL and while using lots of functionalprogramming-inspired ideas. Of course, it's not comparable to our lord and savior Lisp, however if I was forced to write in C++ restricted to STL I wouldn't want to kill myself.

What language would you use for finance software (not trading)? I guess that java is the standard there...

C++ STL is horrifically designed, but my personal private library is clearly the best for all tasks.

haskell is taking over finance.
Any language with strong compile time and immutable capabilities though.

Why not Ocaml? Jane Street uses Ocaml extensively.

Don't most banks use C++?

>haskell is taking over finance
source: my ass

agda

most banks are shit and would be bankrupt if it weren't for daddy gobernment

Ocaml is fine, I personally don't like it. But yeah, Jane Street are obviously in love with it.
or COBOL depending where you go, but I'm talking about non banking software. As you'll be in an uphill battle trying to convince any bank they need to have their shit rewritten.
stackbuilders.com/
cryptact.com/?lang=en

dude just print money and charge interest on it

I'M MAKING A COOL VIDEOGAME IN C++
IT WILL BE SO EPIC I WILL BE A MILLIONAIRE INDY DEV SUPERSTAR AND GET LOTS OF CAT GIRL ADMIRERS

join your buddies

>stackbuilders.com/
>cryptact.com/?lang=en

what did you mean by this

We'd live in a taxfree world if it weren't for C++

NEET who wants to get gud

What do?

We'd live in a tax free world if it weren't for Juice

Trying to debug a memory leak in a 30 year old product. Fuck.

read SICP

Read SICP, read dragon book, read little/seasoned/reasoned schemer.

>30 year old product
nice

what is it about?

stay NEET

JavaScript rocks!

Attached: js_rocks.png (1433x779, 473K)

companies using haskell.
for banks we have:
ABN AMRO Amsterdam, The Netherlands
bofaml.com/content/boaml/en_us/home.html
credit-suisse.com/us/en.html
db.com/company/index.htm
github.com/nrao/antioch
sc.com/en/

gensym.com/
Expert systems.

learn Math

I prefer the other one

I did and barely understood it, but I seriously forced myself all the way through and understand general concepts like strict vs lazy evaluation, how registers work, and the trade-offs between compilers and interpreters. What next?

Dragon book is on my list already. Will look into the Schemer books.

But it's suffering and I'm going to turn 30 soon.

add 3 to x
const add = x => x+3


how to add 2 numbers using arrows?
const add = x,y => x+y

doesn't work

Because you can still do this:

float *array = array_alloc(sizeof(float), 10);
array[5] = 7.79;


Instead of having to do gross shit like
(float*)array.data[5] = 7.79;

put them in parens

devdocs.io/javascript/functions/arrow_functions#Basic_Syntax

if you've seriously finished SICP, then you're done
you have nothing else to learn
you beat programming
gg wp

const add x => y => x + y

Show us your PR history jackass, also
>implying the linux kernel is the only relevant systems software project in the world
I like that pic though

Got a friend who works for a bank/investment firm and I can confirm they still run COBOL.

Is SICP worth it for someone who isn't new? I wouldn't call myself a master of computer science at large, but I have at least dabbled in a ton of different things and I have a few realms where I am quite good and/or experienced.

I think you're either misinterpreting me or think I'm being sarcastic. I didn't say that I mastered every principle in that text. I just read and tried to understand what I could and have a very vague, abstract understanding of how these systems interact with each other.

That doesn't translate to writing C code at all. I also wouldn't be able to pass a test on the book either. Looking for other things to supplement my current understanding so I can go back to SICP later someday.

doesnt work

test your things before posting

are you thinking of currying a function?

get your curry ass outta here, rajeesh

yh there's a typo, I figured you're smart enough to figure that one out

>are you thinking of currying a function?
I'm thinking of making a function that adds two numbers using arrows

>Is SICP worth it for someone who isn't new?
Absolutely. I was also used to programming when I've read (and did the exercises, srlsy do the exercises) the SICP. It is totally worth it. Many things that I've gotten on an intuitive level were validated and rationalized, other things that I've learned axiomatically now make sense logically.

Okay, then you just do this.
void *array_alloc(size_t n, size_t sz)
{
struct buf *buf = malloc(n * sz + sizeof *buf);
buf->sz = n * sz;
return &buf->data;
}

size_t array_size(void *array)
{
struct buf *buf = ((char*) array) - offsetof(struct buf, data);
return buf->sz;
}

const add = (x,y) => x+y

I can deal the game but I can't play it.

Attached: 2018-11-12-141555_1600x900_scrot.png (1600x900, 837K)

Literally answered here

>doesn't check if malloc fails

dropped

Why would you ever do that

in haskell this is just add = (+)

check this
const add = x => y => x + y;
add(12)(12); //24

>she uses a language that lets her multiply integers as if there's no consequence

>()()
disgusting

4 u

That's more complicated for no reason.

yes, JS is disgusting

wtf but the other guy said js rocks
did he lie?

Attached: 1490171246325.jpg (243x250, 7K)

>she uses a language that doesn't let her multiply integers with no consequences

weebs out

anime weebsite
>her USELESS language can't enforce invariants about storage and representation

>she uses a language that lets her multiply intergers

>Is SICP worth it for someone who isn't new?
Yes, it's challenging and reinforces programming concepts you're probably not using enough.

reasonml.github.io/en/try?rrjsx=true&reason=DYUwLgBAhgJjEF4IA9ED4IE90ogaiwG4AoYgKQGcA6YAewHMAKWGRgJgBoIBmASl6A
works fine :)

damn David

Will definitely check it out, thanks user

Attached: 1519173791437.jpg (347x344, 19K)

>her language can average 2 ints

Attached: 1483541640953.png (518x539, 310K)

If you have zero creativity give up now. I'm trying to learn C and everyone keeps saying:
>just write some small simple programs to get some practice
I can't think of anything to write. I start thinking that once I learn some new syntax or more libraries something will come to me but it never does. I'm in an endless cycle of just going through lessons reading others code until I "get it". But nothing to create ever forms in my brain.

Attached: [HorribleSubs] Zombieland Saga - 06 [1080p].mkv_snapshot_09.49_[2018.11.08_17.01.21].jpg (876x1080, 169K)

>adjoint folds and unfolds

Attached: 1534802088460.jpg (334x506, 22K)

>I can't think of anything to write
anime is making your brain foggy

I've never done anything original in basic C either.

The only language where I've actually implemented things I wanted to make myself was Python.

I've gotten a few patches into git but fuck that Cnile shit in general. The git codebase is the most ridiculous clusterfuck I've ever had dealt with. What the Cfags don't tell you is that these big C projects are shitty unorganized crapfests with 40k of makefiles and perl scripts holding them barely together. git's subcommands are all just C files droppped in git's root directory with the rest of the code, except for the bunch of them are just shell or perl scripts. Some of them are prefixed with git-, some aren't; it's just whatever the first guy who checked it in decided. It took them literally 5 years to stop dropping 150 git-{every3-5lettercombination} programs in your /usr/bin when you installed it. As someone who's been using git for almost a decade, it's scary how much of our coding infrastructure has come to rely on it.

dumb frogposter

>As someone who's been using git for almost a decade
>programming almost 10 years
are you a millionaire by now?

Start with C to learn good practice, and to gain an appreciation for how much work other languages will do for you. Then, go to something higher-level like Java or Python. No FP yet, learn OOP and generics. Then, pick up a functional language and learn why that exists and what makes it so valuable. Then, come back to C with a well-rounded skillset suitable for a language that truly demands it.

Every step of the way, make stuff that sounds fun. It doesn't matter if it's useful or sophisticated. Just learn concepts and make stuff you like.

why the heck is this not working?
string plaintext;
string encrypted;
string decrypt;
int numreadin;
cout

This is very good advice.

You sound like a shitty person but thanks for the image.

What should I call this function?

Attached: Screenshot from 2018-11-12 22-50-42.png (383x38, 5K)

Thanks, I'll take keep it in mind. I started with python but left it early because It felt like I knew what it was doing but not how it was being done and it personally felt like I was missing out something vital. All the resources never seemed to go deeper than surface level of what was going on.

intersection?

which part is not working?
does it give the wrong output, does it crash, does it not compile?

Sadly no, and that's not all work experience. I make a bit more than $140k/year nowadays after options/bonus so I'm not complaining.

>const
>const
>const

I recommend reading up / watching videos on computer architecture and operating systems if you are interested in what is going on. It helped me to appreciate C quite a bit as well.

Ultimately I still use Python way more, because the stuff I like doing a lot is not very low level after all and way too complex to build bare bones.

I can also recommend going for open source contributions, even if they'll be really small at the start.

python and every other scripting language is layered in the following fashion, more or less.
program source code is read by the interpreter which builds an AST, maybe some jit tech is involved for speed up reasons, then the AST is walked and each node is executed. That's the jest of it, there is no voodoo magic going on there. The hardest thing I found was optimization, that is one bitch I'd avoid dealing with if I can it involves intimate knowledge of the target architecture which honestly after initially wrapping my head around it is no longer of any interest to me.
Understanding Lisp is a good way to get into language design without going through the dragon book first.

intersection(A, B)

I do not understand unit tests. Say I need to write a xml to json file converter. Where would I even start writing tests? Would I just start by seeing I can read in a file at all and build from there, or start by writing a test that takes in a file and verifies the output against what the output of the entire program should look like? All the examples online show shitty situations where they are testing a program that adds two numbers. I have no idea how the fuck to approach this.

it compiles just fine, I don't know why it doesn't show any text when it does the cout

Unit tests are meant to ensure that a part of a program modifies state in a way that is intended. You'd typically do this by ensuring that the known input to a function produces an expected output. They're meant to verify that a piece of code is written the way it is supposed to behave.

The book The UNIX Programming Environment has a chapter about making a calculator using *nix classic tools, aka yacc/lex &co. It is an excellent introduction to language design for the noob, assuming only C knowledge and the ability to install the tools needed. check it out user, you won't be disappointed.