/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1523642301499.jpg (1280x720, 263K)

Other urls found in this thread:

github.com/JuliaCollections/DataStructures.jl/blob/master/src/heaps/arrays_as_heaps.jl).
youtube.com/watch?v=bLHL75H_VEM
hakaran.com/
twitter.com/NSFWRedditImage

First for decorators
class Button:
def __init__(self):
self.click_handler = None

def on_click(self, func):
self.click_handler = func

def update(self):
click_event_happened = True

if click_event_happened and self.click_handler != None:
self.click_handler()


btn = Button()

@btn.on_click
def handler():
print("Button has been clicked")

btn.update()

>First
you mean zeroth?

OP is zeroth

No, 0P is the 0th poster

Fuckin yikes

is click_event_happened persistent across calls to update?
also you've gained literally nothing over just using func

Just going to be the first in this thread to mention that not all instructions are created equally some take longer than others to execute.

#instructiondescrimination

>What are you working on, Jow Forums?
A shorter fizzbuzz
(,&((;,>)Fizz`Buzz)@":{~+.&3-~0:

Attached: 1553459454479.jpg (1000x1000, 230K)

This code is disgusting. Never post this again.

Attached: DxXFVP5V4AACC0L.jpg (135x143, 6K)

Reminder that linked lists are essentially anal beads.

>get cs degree
>get a job programming backend using archaic language abap
>2 years experience, but feel like I'm losing out on other languages

They may switch me to a new team soon so I may be working with javascript or c# / java. They said not to worry too much about trying to study for it outside of work so I'm about to start my own personal project outside of work.

I am trying to learn basics of machine learning. I'm starting with bumpy. I already have experience with it before. Does anybody have knowledge of machine learning?

Is it a worthy pursuit?

what are binary trees then

Numpy*

the shocker

>1-based indexing is better than 0-based indexing
Implement an array-backed heap using 1-based indexing and tell that to me again, I fucking dare you.

Attached: 1553701422221.jpg (800x800, 80K)

why would you make an array backed heap instead of a pointer backed heap

Attached: DPH6JCB.png (698x276, 50K)

yikes

Huh? That's just a bunch of grapes...

Do not yikes at me ever again.

a girl thats a friend of mine does this to me all the time, normally Im having a panic atack or something and Im just trying to talk to someone to calm down, Im going to start saying it to her when she freaks out, it's so condescending

>a girl thats a friend
yikes

Attached: D1Ngd1DXgAE8Sw5.png (500x417, 265K)

>normally Im having a panic atack
yeah i'd yikes you too you fucking faggot

Grim

What? Here you go (github.com/JuliaCollections/DataStructures.jl/blob/master/src/heaps/arrays_as_heaps.jl). Just because you are retarded doesn't mean everyone else is.

zoinks

dude, I don't think you understand what a panic attack is, I'm sitting at my desk nothing is wrong, then all of the sudden it feels like the world is going to end. All it takes is for me to talk to someone to get out of my head. i expect my friend to do this for me because I would/have done it for her. but half the time she either roasts me or hits me with yikes

it's probably the fucking focalin, it's not even helping with motivation, it just lets me focus on things I want to focus on, so here I am focusing on magic the gathering and shitposting on Jow Forums isntead of starting my god damn personal project

>is click_event_happened persistent across calls to update?
It's just for demonstration purposes
>also you've gained literally nothing over just using func
You could use something similar for multiple event handlers
btn = Button()

@btn.on_click
def first_event_handler():
pass

@btn.on_click
def second_event_handler():
pass

Okay, it turns out in this case that the algebra works out. Huh.

most girls dont want to be your mommy
if you're having panic attacks for no reason maybe you should stop taking drugs

I need them to help me focus

fuck them I don't need any of them

test

need the people I mean*

bigoted cis-shitlord trees

do any of you even have a job?

not yet. i'm working on it.

Attached: 6-4aQ-Qp_400x400.jpg (400x400, 28K)

i'm a home security guard

sadly, yes

i'm sorry for your loss

I'm working on not getting a job.

me too, thanks

Just this week I refused two job offers
keeping my sweet employment virginity for a haskell job

Attached: 1553433700321.png (718x718, 601K)

you keep saying this but i've never seen any proof you've been offered any jobs

enjoy fucking starving

I hate setting up shit

Attached: so boring.png (1048x573, 130K)

oh boy don't you love having a billion package managers and sub package managers for shitty languages on your system

>tfw keep getting job offers but can't accept because I'm cucked by a contract
>tfw keep getting offers for relocation to a better country but too scared to accept
this is why I've moved all development to VMs, regardless of how fucking slow they are

Lads, I just thought, what if you could use rust for programming games? like in unity or unreal engine/cryengine

Now that would be epic, although for now I will learn some basic c++, I suppose. They have forced my hand.

why would anyone want to use rust

Conda is one package manager for Python and it doesn't shit on system wide pip packages. I don't see problem with it.

>anaconda and pip
wtf why would you need two package managers?

Are there any cons to including named parameters in a language?

I don't see the point tbqhfam. Depending on how dynamic you want them to be, add terse syntax for either struct/record or map literals.

not any objective ones, you might consider them bloat or uneccessary

use row types

Not really aside from "unnecessary bloat" but I find them helpful when reading code.

can someone explain what happening here with rvalues and lvalues, and casting in C?

Attached: Screenshot from 2019-04-06 12-51-57.png (540x519, 58K)

You're dereferencing a null pointer, bro.

JavaScript rocks!

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

I'm writing a wayland compositor in scheme. I finally got basic dynamic tiling implemented, although there are still some bugs, particularly around windows that have a minimum width/height. I have a feeling that the code will become 10x more complicated in order to deal with that shit.

Attached: tiling.webm (1024x768, 236K)

>I'm writing a wayland compositor
havent seen you in a while

I don't get it

F# question

let flipCoin =
if rng.Next(2) = 1 then "HEADS" else "TAILS"


This evaluates once on program startup and then never again, so all calls to flipCoin will return the same value.
How do I re-evaluate flipCoin during run-time?

make it a function
I haven't done F# in a while but i think you can just do flipCoin() =
then when you want to evaluate it, call flipCoin()

i am sick of hackernews obsolete interface, is there a better alternative? what are you using to browse hackernews?

I got a bit distracted by my other hobbies for a while. But I'm back to programming now, probably.

youtube.com/watch?v=bLHL75H_VEM

Attached: b85.jpg (468x426, 23K)

Why were high level languages invented in the first place? Sure, writing everything in assembly is no fun, but wasn't C enough?

Attached: orc_logic.png (500x500, 106K)

it's not bait. until now i was using hakaran.com/ but the guy completely changed the interface a few days ago. it now does suck.

C isn't as productive as higher level languages.

...

>t. can't into pointers

JavaScript rocks!

Attached: javascript rocks.png (1000x494, 134K)

t. brainlet who doesn't understand how to use the best tool for the job

>c
>array index start at zero

Attached: photo.jpg (900x900, 77K)

I new all about pointers and shit in college but now after two years of not looking at them I'm going to have to review that shit, fuck I have no idea about them anymore.

hopefully it's like riding a bike

based haskell programmer
also very cute, as proven by the image of himself he posted

fucking knew* god damnit

A high level language is a language with 1-indexed arrays. Hence "high level".

The same reason multiple tools exist. You can insert a screw with a hammer but it’s obviously easier with a screwdriver

Well I'll be damned. Thanks.

>standard functions are inconsistent about adding trailing nulls to strings

Attached: 1547048173831.jpg (1024x1024, 66K)

This but unironically. The hate on js is entirely a meme. When asked why they hate it, they will find weird syntax features no one actually uses.

most of you fucking plebs prolly don't even know what is

less-than sign, asterisk, greater-than sign
next question please

does this waifu exist?
apply

Attached: 1553181693710.gif (370x340, 620K)

no.
im an autist with no social skills and dont think im good enough even though i probably am.

>not having a mommy tulpa gf
Now I just need a physical gf I can assert dominance over. Not sure how to get one.

gf shop

Is learning java a waste of time?

It turns out that the algebra ALWAYS works out because closed intervals of integers are EQUIVALENT to closed one side open other side, since [a,b] = [a,b+1). They are literally the same. Stop reading what some faggot dijkstra cult programmer babbles on about after not even reading the stupid essay in the first place and try to think for yourself.

I'm not even going to get into how 1-based indexing is superior and how closed interval ranges are superior but atleast think for yourself before repeating cultish noob programmer memes derived from bikeshedding conversations on the internet.

it's easy to learn and a job is guaranteed

Does gf shop have blue eyed brown haired Nazi waifu?

Attached: 2E9EB119-610F-4B57-B849-962D32CEA2DC.jpg (657x1024, 68K)

na i think they're out of those

I found one in college but I got autistically nervous at the thought of a relationship and stopped talking to her. Why am I such a faggot? Sorry for blogposting.

don't ask me user i have similar problems

Plz help