/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1542756450052.jpg (600x812, 349K)

Other urls found in this thread:

youtu.be/2agJoqviGY4
myredditnudes.com/
twitter.com/NSFWRedditGif

for me, it's zig

Attached: zig.png (4824x1527, 118K)

Fuccin ccontentful:
I don't even know what this shit is for. So my site loads faster?

for me, it's emacs

Attached: emacs.png (225x225, 5K)

If you dont code in Lisp you are a subhuman plain and simple.

Nice, what's.your favourite bit?

red pill me on this

Lisp is the most powerful programming language.

Hobby project lang that aims to be betterC

c# babby here
is doing this stupid and gay
someEvent?.Invoke()

should I just stick with regular ifs to check if an event is null?

>aims to be betterC
Nice. Go throw it on the pile with the other ones.

well first of all, magit is excellent. it's legitimately the only git interface i'd ever recommend over the command line tools.
i use org-mode all the time to organize my notes and make sure i stay on schedule
it's extremely extensible and customizable. the core lisp interpreter and platform-dependent stuff is written in C, but literally the ENTIRE editor is written in emacs lisp, and every single internal variable and function is exposed to you to mess around with. There's nothing like it.

Also, the documentation system is far ahead of any IDE that exists today, even though emacs was made 30 years ago. Not sure what a particular key does? Press "C-h k" followed by the key, and you get a nice buffer with the command's documentation. Not sure what key a command is bound to? Press "C-h f" followed by the command name, and it will give you the documentation and keybindings.
And on that note, emacs does the sensible thing and stores your undo history as a tree that you can navigate visually, so your history never gets lost. Any editor that unironically stores your history in a stack-type data structure isn't worth using in 2018.

Anyone know of any good NAT traversal libraries for Android?

Attached: 1542111463660.jpg (1533x1015, 198K)

Oh, I use use emacs too and already use all that stuff. I was more looking for specific stuff that people may not know. Hidden gems, if you will.

I'll throw out restclient.el, which lets you make http requests easily from inside emacs.

>triggered by no trigger discipline

I'm interested in getting into functional programming. What's the best functional language? What are some good books about it/functional programming in general?

Lips

ah ok, i use restclient as well.

i really like the xwidgets feature on emacs. it lets you put gtk3 widgets inside a buffer, which has the side effect of allowing you to put an entire webkit graphical browser, complete with javascript and cookies inside emacs. not a lot of people seem to know about it, probably because the emacs version in debian and ubuntu repos doesn't have xwidgets enabled at compile time.

but if you have it enabled, you can run (xwidgets-webkit-browse-url) and view actual web pages in a buffer. scrolling is a little buggy but it works for the most part

Attached: Allman-style.gif (647x363, 88K)

Haskell

Attached: 1537985908896.png (1075x1518, 1.76M)

Functional programming is impossible to debug. Elixir and Go are trendy now.

Just take the good - pure functions and being able to pass functions around as params, and forget functional programming as a whole.

The guy making it is smart, focused, insightful regarding problems with the C standard library, and embarrassingly wrong about problems with the rest of the C ecosystem. He understands how tasks like checking error codes can be improved using a richer, more powerful type system, but does not grasp the basic problem that writing repetitive code is fundamentally an error-prone activity. He has realized that C syntax is arbitrary and can be improved, but hasn't figured out that the biggest improvement to be made is to present the programmer with saner defaults. I think his main contribution to the systems language space is to turn up the heat on Rust as it tries to move into more niches currently defended by C.
Zig is a neat project but in the long run I think it will end up like Clay. (Yeah, remember Clay?)

SML
start with "the little MLer" and go through the CMU course sequence
Alternatively, haskell, with "learn haskell from first principles"
Alternatively alternatively, elm and then one of the above.

Why Lisp is so powerful?

Dumb frogposter

nvm I figured it out (ice4j)
everything you know about Lisp I know about interrupt routines

>Functional programming is impossible to debug
is this bait

I knew about it but I don't use it because a browser without an adblocker is useless to me.
I guess I could use it for local webdev though, now that you mention it.
I do already use eww.

I'm trying to make a math library in C, prototyping in python. I've basically finished matrices and vectors and I'm going to try working on derivatives and equations.

you forgot abstraction and higher kinded types. or polymorphism at all in God's case LOL

disfunctional programmers are dumb

You tell me:
postBait(bait)
.hookAnon(bait)
.isAnonReallyTrolling()
.thisMethodWillFail()
.someDay()
.ifNotToday()
.AndYouWontHaveAnyClueWhere()
.BecauseUnlessYouCustomCode()
.anExceptionMsg()
.You()
.WillHaveTo()
.BreakitUpIntoParts()
.

Back to Contentful: youtu.be/2agJoqviGY4

>want tutorial on Contentful
>i.e. making Angular a static file
>get a bunch of bs on how to use it as CMS
>goddamnit

U wut m8.

I seriously don't know what you are talking about, maybe is right.

How does FP help with polymorhpism in ways that OOP doesn't?

>higher kinded types

u wut. Be specific.

that is specific you mong, I recommend Learn You a Haskell if you want to deuneducate yourself

FP helps with pymorohism when the dysfunctional language we are talking about doesn't even have generics

this really is bait

But muh C# and Java have some generics.

And JavaScript is magic and love - everything breeds with everything.

yeah, Im just amazed that anyone would use Go as a shining example of anything. except maybe the depths of human stupidity.

Redpill me on polymorphic code

what sort of polymorphism

Isn't Haskell like over a decade old? Why haven't they implemented generics yet?

I am still trying to figure out why they reversed the logical order

Attached: braces.webm (640x800, 1.49M)

Because it's a bad concept.

its literally bad for your career. if you copy and paste your code in a million places youll have millions more lines of code than the nerd loser using Scala or whatever to write the same program in 1% of the code.

Tbh I don't know Go, but I do hate Elixir.

The only thing you need to know is that it's one of the three principles of OOP when you get asked that at an interview question. Or when you need dependency injection via an interface.

Maybe I don't do serious work, but I have seen maybe 10 attempts to use polymorphism and inheritance irl and about 7 of them was someone being bored.

And not that anyone cares, but I think I will just figure out the CMS part of fuccin contentful.

Going to make a pretend car sales site so my pretend non-power user can add listings.

generic functions

because generics are a cope for dysfunctional dweebs

>if you copy and paste your code in a million places youll have millions more lines of code

But muh services/utility classes / helpers / whatever fags are calling them these days.

Wish I was not such a big fucking retard, I can't make friends to work with nor keep myself interested long enough in my own projects before I jump to something else.

Maybe I should go back to uni and focus in finding good colleagues.

How do you guys keep the engine gong?

Jesus Christ you horrify me

I am not even sure if you actually know something that I don't and I am that clueless or you are trying to be 2deep3monads4me.

>why they reversed the logical order
You mean, writing foo int instead of int foo?

I'm working on this monstrosity:

>WPF

r u a dino

Thank you for posting your frogs in another thread.

No just a CS major whose teacher probably only knows C#

I mean I probably know lots of things you don't but I'm just horrified by the idea of someone not using polymorphism.

>How do you guys keep the engine gong?
heavy dose of cute anime

I write my Java like that too and I don't see why it would be hard to debug. Maybe you're just ignorant?

Is there a cleaner or simpler way to compare every element in a 3d matrix to every other element? This is the first time i've done this desu
i,j,s,g are indexes

Attached: Screenshot from 2018-11-21 12-38-18.png (451x387, 26K)

god my eyes
what are you trying to accomplish exactly? there's no matrix here

> I'm just horrified by the idea of someone not using polymorphism.

Last time I had a legit use for inheritance (in the most basic sense too) was when I was learning to code by building a game. Characters inherited from human and had additional attributes based on their class.

There was also one instance where google maps pin inherited from an abstract Pin class and had distinct properties based on whether they were a restaurant, hotel, landmark, whatever.

What do you use polymorphism for?

Working on some icons for my software in Illustrator. I know this can be done in less than an hour even as a beginner, but I took the time to learn the software a bit more in depth. Will continue tomorrow with the design and read even more tutorials.

Attached: suits.png (476x457, 22K)

Attached: 1538380445232.jpg (249x249, 16K)

>>i,j,s,g are indexes
b is a matric
b[i][j] is an element
b[s][g] is every other element that it's compared to

Yes it's complicated to read that's why i'm asking if there's a simpler way.

For a 3x3 matrix:
i:j = 0:0
s:g =
0:1 0:2
1:0 1:1 1:2
2:0 2:1 2:2

and so on.

I'd tone down the borders a bit, like make them muted versions of the interior

Fuck off. Your reddit-kind aren't welcome here.

Attached: 1374580566292.jpg (344x209, 9K)

not repeating my code ten thousand times. consider what you just wrote. you're describing super basic examples where it's obvious we need these tools - why would we rewrite the dealDamage method in each kind of Human? furthermore, what about some other function outside that heirarchy that draws the character on the screen? need we write a draw(x: Archer) and a draw(x: Mage) and so on? why not just a draw(x: Human)?

What do you work on where such abstractions are unnecessary?

Thanks I might do that. The colors are nor final yet, I just took some predefined ones from Ilustrator, but I am pretty happy with the shapes at least, I think they will fit well into my GUI.

1. Java is shit. It didn't even have a LINQ equivalent until Java 8 for fuck's sake. Also this thousand-ways-to-get-a-stream shit gets old real fast:

IntStream.of(myInts);
Arrays.stream(arr)
collection.stream();
+5 more


Seriously. I can just call `stream()` on everything? I have to memorize all this bullshit. Fuck Java. Fucking "ArrayList". Seriously, it makes everything tedious as fuck.
2. How do you know which method in the chain failed if you get an error? Serious question.

not him, but a lot of my projects are better served by composition than inheritance. not that they're mutually exclusive, but composition for me makes inheritance redundant many times

so it's a 2d matrix then? I don't understand your example, you would do well to learn how to discuss the input and output of your program abstractly rather than in the context of your chosen solution. so the input is a two dimensional matrix. what's the output?

>What do you work on where such abstractions are unnecessary?

Any LOB application ever.

>says the unironic weeb plebbitor

Attached: 1541513152132.png (571x529, 131K)

Learn js, and their variants. Web is where it's at now.

you should only check for null if you know theres a possibility that it can be null, otherwise if it is null then theres an error you want to know about

Square matrix.
Output is every unique combination of two indices.

>Java had no LINQ
yeah, javas shit. takss em forever to get with the times
>I can just call stream on anything?
yeah, it's great. what's the problem?
>Have to do other shit to get a stream of arrays etc
yeah, I agree,it's shit.
>Fucking arraylist
Sure sign of a brainlet. I've heard this a lot and every time it's a nothing urgent. So please tell, what are you talking about?

>How do you know which method in the chain failed if you get an error?
stack trace literally tells you... how do you not know this? jesus, every fp detractor is an amateur hour moron huh?

Agree

Yeah, sure, and other domains too. But they are rare overlall.

>muh safe navigation

user is right.

>yeah, it's great. what's the problem?

Too lazy to read what I typed, but my point is that I have to call "stream()" on something before I can map/filter/reduce it. This is redundant. There is a post on stackoverflow by someone on the Java team making some weak-ass excuse about lazy loading, but they are just being lazy.

>Sure sign of a brainlet. I've heard this a lot and every time it's a nothing urgent. So please tell, what are you talking about?

Java is very particular about collections / arrays - just like stream, they are initialized differently and have different methods without any rhyme or reason. To me, it appears to be complexity for the sole sake of complexity.

>stack trace literally tells you... how do you not know this? jesus, every fp detractor is an amateur hour moron huh?

>stacktrace literally tells you

Doesn't tell you what went into each method. Don't know where it all went wrong.

> every fp detractor is an amateur hour moron huh?

Muh feelz. Hold up, I will try to whip up an example.

1

For me, it's 0

If it's not jagged, flatten it.

int width = 3, height = 3;
int size = width*height;

int foo[size]{0,8,9,
3,9,2,
3,1,6};


for(int i=0; i

Thanks!

So my example was:

int[] changedInts = intsAsStream
.filter(n -> n % 2 == 0)
.map(n -> AddTwo(n))
.map(n -> SubtractFour(n))
.map(n -> DivideTwentyByNum(n))
.peek(n -> System.out.println(n))
.toArray();


which gave me

Exception in thread "main" java.lang.ArithmeticException: / by zero
at main.DivideTwentyByNum(main.java:29)
at main.lambda$3(main.java:41)
at java.util.stream.IntPipeline$3$1.accept(Unknown Source)
at java.util.stream.IntPipeline$3$1.accept(Unknown Source)
at java.util.stream.IntPipeline$3$1.accept(Unknown Source)
at java.util.stream.IntPipeline$9$1.accept(Unknown Source)
at java.util.Spliterators$IntArraySpliterator.forEachRemaining(Unknown Source)
at java.util.Spliterator$OfInt.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.AbstractPipeline.evaluateToArrayNode(Unknown Source)
at java.util.stream.IntPipeline.toArray(Unknown Source)
at main.main(main.java:43)


Which supports your point. Guess I am just used to shit error messages in other language. In my defense, if it wasn't a "divide by zero" exception, it might be a pain to debug, because I don't see the value being passed in anywhere in the error msg.

If everything was broken out into intermediate variables, I could see what the issue is. Likewise, if I looped, I could see the value which threw.

dumb zeroposter

Attached: 187b9a2fcc821c711aff1b9d8f4a33067cbc7b6b80d4b7bca267b52822fc0c2e_1.jpg (1080x1273, 232K)

>ifunny.co

Attached: snapepe.png (571x529, 131K)

needs more ifunny logos

dumb frogposter

Lads, I need your ideas for things to do. I like cute 2D girls and video games and the C programming language. Please respond.

Attached: 1396571416586.jpg (278x278, 34K)

you've been rused, my green friend

a

make a tohou clone

dumb dumb frogposter poster

urMom.bang(hard = true)

haha xd

Write a voice filter that will make you sound like a cute anime girl.

>People always complaining they have no ideas for what to do
I don't get this. I have way too many ideas for what I want to do. It would take me years to get around to doing all of them, because they're too large in scale, and I have shit I should finish before I start something new.

Attached: 1452463042847.png (336x377, 128K)

>Wanna learn to program
>open up dwm source code
>massive wall of jumbled characters and symbols
>Read first few lines
>200 includes and definitions
>what the fuck is this bullshit?
>rest is almost completely illegible

Close it and feel even more discouraged.

Attached: wat-aoulo-ths-tm-amber-thanmy-younger-brother-on-chance-22077703.png (500x862, 237K)

I can implement a mean linked list and binary heap and I need a project idea to work on.

disgusting

bang(&ur_mom, SLOW|DEEP|HARD);

includes and definitions
I don't know why a lot of suckless shit does that. It's unnecessary to do that in C.