/dpt/ - Daily Programming Thread

What are you worjing on, Sup Forums?

Old thread:

Other urls found in this thread:

youtube.com/watch?v=qcA-g4VVwk4&feature=youtu.be&t=7m56s
sstewartgallus.com/git?p=uevents.git;a=blob;f=benchmarks/lock-futex.h;h=60eaee656f9090eb1088b45db4d435fd9d164622;hb=HEAD
github.com/xoreaxeaxeax/movfuscator/
github.com/xoreaxeaxeax/movfuscator/blob/master/slides/domas_2015_the_movfuscator.pdf
cl.cam.ac.uk/~sd601/papers/mov.pdf
openbookproject.net/thinkcs/python/english3e/
twitter.com/NSFWRedditGif

Messenger chatbots HN says it would be future and i bought hard that meme with 5 bots.
4 in fb sdk in node js, one in meme api ai

First for D.

Insanity: doing the same thing over and over again and expecting different results.
x = rand();
y = rand();
z = rand();
printf("%d", x == y && y == z);

That's not what insanity is and everyone who says that is cringe inducing.

this won't even compile, retard

> How to spot a literal autist

>that plebbit space
I don't want reddit stink nearby. Fuck off.

Reminder that suckless hates Java, C#, and C++. Stop using them.

> Confirming your genuine aspergers

You know what will be cringe worthy? You begging on your knees not to kill you after I unzip my Japanese Katana.. nothing personale, kiddo

No.

who

Is Agda okay?

Friendly reminder

youtube.com/watch?v=qcA-g4VVwk4&feature=youtu.be&t=7m56s

Every language is a Lisp in disguise. Inc

Plan 9 has the best compilers because it was made by the father of C.

This is the name of my new software company.

>drop haskell because it's so hard
>look for alternatives
>none match haskell
Sigh... I guess I'll read LYAH again and do some H99.

Read the wikibook instead of LYAH
ask questions here

buttboi

What are you looking for?

sml or lisp you fool

A language that forces you to write functionally.

There's almost no compiler that respects inline and when they do they do so against their better judgement in some situations.

Pointless keyword since when the compiler is wrong about inlining and you use it it doesn't actually do it for you.

But, something I haven't thought about before:
Since there's situations where you shouldn't inline for performance reasons are there situations where the compiler inserts function calls for efficiency? In straight imperative code that is. I haven't heard about that happening so I assume not but really why would this not happen?

I saw some guy with stickers on the laptop.
Ultimate cringe.

>people who consider code/syntax errors 'bugs' and make it evident in stupid jokes concerning solving bugs and introducing more bugs by solving bugs

OCaml is easier than Haskell and you can write functionally 90% of the time (it's also worse than Haskell but that's not the point)

OCaml isn't pure

Is that what they meant?

No, it doesn't unnecessarily create new functions and calls to them. The biggest concern about badly inlining code has to do with program size

I'm two months into learning to program. I feel like I'm in a rut where I'm not retaining new information and struggling to apply the information I know.

What do I do? Do I trudge onward? Do I go back and try to review old material? I have like 100 pages of notes and trying to go back through them is overwhelming.

If you need the compiler to baby you and stop you from fucking up at every turn maybe you should give Rust a shot

I did take a look at OCaml, but I've heard bad stories about the language.

Benchmarking my locks against futex locks

Does anyone know if it is possible to do faster futex based locks than sstewartgallus.com/git?p=uevents.git;a=blob;f=benchmarks/lock-futex.h;h=60eaee656f9090eb1088b45db4d435fd9d164622;hb=HEAD

Purity is a good thing.

>you can write functionally 90% of the time
You can do that 100% of the time actually (also the first implementation of the CoC was made in OCaml) but I agree if you find Haskell too hard you won't benefit much from switching language.
Maybe read about lambda calculi first.

you've never introduced a bug by solving another?

Each of my features is a bug in disguise.

>CS theory has no practical applications and you're gunna be jobless

I thought big data distributed auto-sharted databases, uniqueness types (I.E. Rust) and formal verification were the in thing nowadays?

Why don't you look into the language itself instead of believing everything you hear on Sup Forums

Sure, but it makes things difficult as a consequence and I'm just trying to help user out.

It's p. easy to transition from OCaml to Haskell, it might be better so that you can first get used to programming functionally in OCaml, and then when you move to Haskell you don't have to concentrate on stuff like what is a lambda/what is a cons/what is a tail call, while you are focusing on harder stuff like lazy eval and higher kinded typeclasses

>program size
No not outside of embedded. It's primarily about cpu instruction cache (which can easily get very expensive to fetch to if your inner loop doesn't fit for instance). If it was just about Executable size then nobody would frown on force inline. And there's tons of frowning on force inline.

But I haven't heard about compiler breaking up code into function calls. I'm thinking maybe people would get very uncertain about their code if they knew that the compiler will take such liberties with it. I'd certainly be uncomfortable with the idea of having the extra cost of function calls I don't know about. It'd force me to have an extra level of confidence in the compiler, and I don't.

>Sure, but it makes things difficult
He's trying to learn

If someone trying to learn maths says it's hard, you don't give them a physics book

Whoops, poor analogy.
Replace physics with english.

It's an extremely rare circumstance and when you do you don't know for a long time. It's not feasible as the core element in light programming banter.

It'd be more appropriate to have jokes where you complain about whoever committed this shit code and it turns out to be you.

I think it's more like theoretical computer science, like complexity theory.

What is the best way to make the jump from making a bunch of basic shit to making stuff that's more complicated. I've made dozens of small shit like rock paper scissors games or functions that do shit to numbers, but how do I proceed from here? Everything seems either too trivial or too complicated to grasp.

Project Euler maybe

github.com/xoreaxeaxeax/movfuscator/
>cheating in computers by using more than one instruction
Pathetic.

>Why don't you look into the language itself instead of believing everything you hear on Sup Forums
I didn't hear it on Sup Forums. OCaml isn't being shilled here.

I find that suggesting an intractable rewrite project is also fairly comical.

Say you're working with 500 KLoC of C++ or something, so you ask when the Ruby rewrite starts.

Well you find something that seems complicated and look at it until you realise it's not really complicated. A way to do that is to break up the problems into smaller steps.

ML are by far the most practical FP languages imo. Try having a look by installing utop from opam (the package manager). There also is F# which is Microsoft's attempt at an ML-family language.

F# is trash

Lol. Didn't get what it was at first.

>making your username impossible to type
i hope this guy enjoys never getting a call back

^C ^V?

I'll give OCaml a spin then.
I don't like F#, because MS.

how the fuck is he adding numbers or even using basic control logic by moving registers around?

It's literally just
XOR EAX EAX
EAX

It's a common x86 instruction plus an extra EAX for good measure.

github.com/xoreaxeaxeax/movfuscator/blob/master/slides/domas_2015_the_movfuscator.pdf

cl.cam.ac.uk/~sd601/papers/mov.pdf

Pretty neat

Hey Sup Forums
I'm trying to write a NEAT implementation from scratch. Up to now I've read the main paper from Kenneth O. Stanley but I'm left with some questions.

1)The paper doesn't mention it but, by the logic with which crossovers happens, it makes sense for neurons to have an innovation number.
So do neurons have an innovation number? And if they do is the innovation number shared with the connections or specific of the neurons?

2)When the net structure changes how do connection "feed" the network, or, to better explain myself, by what order is the infromation fed forward? (pic related)

I could be a faggot but it a looks like he is using a lot of look up tables.

Sup, /dpt/.
Done anything cool in java lately?

smoked some drugs with the natives

>java

guys...can you please motivate me to continue learning programming?

I'm trying to learn Haskell as a first language in hopes of one day in about a year to become independent and travel around Europe or just find a nice place somewhere in the EU to get away from the gray hometown I currently live in. After Haskell I'm planning on learning PHP since it's really sought after...

Anything will do..

this is a bait post

it isn't tho

>I'm trying to learn Haskell as a first language
>to meet those goals you said
HA HA HA HA HA HA HA

HA HA HA HA HA HA HA

Javascript, Java, C#, C++.

Pick one or many if your motivation is to be employed and acquire currency.

this is bait, post

I would imagine that haskell is really discouraging first language, so really for you sake maybe try something easier.
But it really doesn't matter because the flow is:
1. find project you want to do
2. implement it
3. goto 1

No matter what lang if you don't like what you are working on it will feel like shit.

Wear long socks

unsigned multiply(unsigned a, unsigned b){
if (!a)
return 0;
static unsigned i = a;
i = i + a;
b--;
if (b>0)
multiply(a, b);
return i;
}

So this is supposed to be a lesson in recursion without the ability to use anything other than relational, increment and decrement operators but i'm trying to get the logic down first using +.

multiply(3,7) returns 21 and multiply (7,3) returns 42 when they should both return 21. I can't figure out why it's breaking when i reverse the numbers

if you have a compiled binary with libraries not available on your computer, can you still run them?

Working on a snapchat bot for purposes. anyone know how to engineer a viral phenomenon?

Anyone want to buy an instagram crawler that harvests strings that it reads for snapchat names? You gotta hand pull all the names out tho.

>goto
Use for/while loops fucking nigger

THIS!

if you linked statically otherwise no.

multiply(a,b) on its own does nothing.
Every time the function is called, the VALUES of a and b get COPIED as the arguments, so that when you modify a and b in the nested call, it DOES NOT MODIFY a AND b from where you called it.

unsigned multiply(unsigned a, unsigned b) {
if (a) {
a--;
return b + multiply(a, b);
}
else {
return 0;
}
}

>Javascript, Java, C#, C++

I guess I'll go with Java then onto PHP. Thanks for stopping me

where can I find projects to do? You won't find a person with less imagination than me, trust me.

Step1: var muhProject = FindProjectYouWantToDo(); goto Step2;
Step2: ImplementProjectYouWantToDo(muhProject); goto Step3;
Step3: goto Step1;

Just trudge on. You'll feel like you aren't learning anything and that you can't really remember what you have learnt.

But if you pay attention you can see that you're doing more complicated things, with fewer mistakes and faster.

I can't imagine that I would.

Your code doesn't even compile
multiply.c:6:25: error: initializer element is not a compile-time constant
static unsigned i = a;
^
1 error generated.

ick

Have you tried starting a project of some kind? There's only so much you can learn from exercises, and so many things you might not realize you need to learn without doing something for real.

>purity is only about safety
If the programmer can reason better, so can the compiler. Hence way more opportunities for optimization.

int mult(int a, int b, int c) {
if (!a || !b) return c;
c += a;
mult(a, b--, c);
}

>+=

No. I tried to do exercises from another place but a lot of them were exercises that required knowledge of stuff I haven't learned yet.

I thought the solution for that would be the static i variable. I don't see why it works for one case but not the other.

It compiles fine for me.

I had to use the prototype given to me.

Which language?

Recursive in a non tail call language. Disgusting.

>a lot of them were exercises that required knowledge of stuff I haven't learned yet
Then learn those things.

Python. I'm learning from this book
openbookproject.net/thinkcs/python/english3e/
I'm on chapter 13

recursion is pretty cumbersome in all but a few situations, and those were mostly invented to make recusion look good.

If you need your compiler to optimize your shitty recursive wank into a an iterative loop, maybe you shouldn't use recursion.

(You)

Well, I'd recommend starting a small-ish project you think you could do with what you know. Mess around, get comfortable with what you know before going forward.