/dpt/ - Daily Programming Thread

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

Attached: hidamari_dpt_waifu2x_traps.png (1618x1308, 1.95M)

Other urls found in this thread:

pdos.csail.mit.edu/6.824/labs/lab-1.html
en.wikipedia.org/wiki/Argument_from_fallacy
twitter.com/SFWRedditVideos

Trying to debug this over-complicated C function .

static node* AllocateNode(u32 cb) {
assert(cb%8==0 && cb > 8);
if (cb

is java still worth or any sane person would go full kotlin or scala?

pdos.csail.mit.edu/6.824/labs/lab-1.html

Has anyone else gone through these lab exercises before? Writing my own MapR and Raft implementation sounds like fun but don't really know what I'm in for

If only Idris was ready.. It already runs perfectly on android

Full web frontent in idris with the same for the backend as session types are rather simple to implement on top of it.

Is this the best book for Learning C++?

Attached: 51WeVQlb7fL.jpg (404x500, 44K)

>a language is strongly typed if there is no implicit conversion
What about C# then, it lets you overload the implicit conversion, and I don't think it's less strongly typed than stuff lik python

thank you for posting a programming image

Attached: interrogative-anime-girl.jpg (500x500, 108K)

I think huffing gasoline is the best method to learn C++.
It's all about killing braincells, and doing that is more efficient than reading some book.

have you read your sicp today ?

Attached: oni sicp.jpg (1920x1080, 396K)

C# is strongly typed but is also dynamic. If you define an implicit conversion like int to bool you lose the strongly typed part but only because you wanted so in your project. C# is strongly typed by default.
By the way, I never tried it but wouldn't it enable devs to create a sum type?

I want to get into compilers. I'm thinking of which book to get. Is following the Tiger book from OCaml instead of SML fine, or will it shaft me by ending up using SML-specific features halfway through?

I don't mind learning SML in order to get work done while following the book, but ideally I'd like to avoid a language implemented in New Jersey.

Attached: tigerbook.jpg (154x203, 11K)

Oh and also, you can't overload an implicit convertion operator for a sealed value type like int, double, decimal..etc So I guess it is strongly typed in that sense.

C++ is the single most powerful programming language in existence.

Attached: 1509373184275.jpg (1150x994, 148K)

It is powerful alright but it is shit.

it's as powerful as other turing complete languages

constexp doesn't work when you need it

You must have a different metric of shit then. Whatever it is, you're retarded.
How good a programming language is directly correlates with how efficient and powerful it is. And it just so happens that C++ is the most efficient and powerful language on Earth. Hence C++ is the best programming language on Earth.
Cfags are their silly macros and void pointers can't even hope to compete.

Brainfuck is turing complete so your statement is obvious bullshit, try again oniichan.

Works fine. Post example.

Attached: 1509588624181.png (658x1000, 567K)

C++ is no more powerful than brainfuck

You don't seem to understand what "powerful" means in a CS context.
Also, you clearly have never used any other programming language if you seriously think C++ is anything but complete garbage.

Attached: 1452471092796.png (1280x720, 372K)

naruhodo

>By the way, I never tried it but wouldn't it enable devs to create a sum type?
sum types are unions in C, right? Isn't that just inheritance on an interface or so?

a sum type is a (safe) descriminated union
struct {
bool leftOrRight;
union {
Left_t left;
Right_t right;
}
};

Sum types tagged unions. A plain old union in C doesn't know what it's representing, and so they can be effectively used as a means of "type punning".

If C++ is no more powerful than brainfuck then brainfuck is more powerful than all other programming languages besides C++.

I've used more languages than you and their all complete shit. You just have shit taste in programming languages.
You probably also have no interest in efficiency, so your opinion is worthless.

Attached: 1519648136585.jpg (850x1094, 535K)

that's not true because there are many languages just as powerful as C++ and brainfuck

I want to make a really simple command line program which allows me to write in expenses to an excel spreadsheet.

Anyone got any ideas on how to start and the best tools to use? I'm proficient in Java but I wouldn't mind trying this in python.

BLUE BOARD
Please, I'm already too horny to focus after remembering last night's doujin I read, don't make it more painful for me please.

Have you come to the realisation that you've wasted your time learning a horrible language, and are desperately trying to justify it by pretending it's anything but horrible?

This for C
But in pure C# (no unions just structs and playing with bitfields) I am guessing it would be a class of all possible value types as fields and an implicit overload for each type.
Pretty horrible thing to implement if you ask me.

you can do something like

class Either {
c match(a -> c, b -> c)
}
class Left extends Either
class Right extends Either

then prevent people from extending Either somehow (e.g. by controlling export)

There's a nice lib for touching shitcel files in Python. I doubt Java has that and even if it has it's going to be 4x the quantity of code for no benefit at all so take the opportunity to dive into Python

No there isn't, because I just said in that C++ is the single most powerful programming language in existence. Can't you read?

C++ is the most useful programming language though, and is also industry standard. (the parts of the industry that aren't pure memes, that is).
Literally every other language is obsolete inefficient useless garbage with no place.

Attached: 1506390897456.jpg (600x849, 113K)

you lied

Thanks for the heads up. It's really just for my own usage as I'd like to be able to use it for my expense logs to hand off to my accountant at the end of the financial year.

Why would I lie?

Attached: 1509769620951.jpg (1280x720, 205K)

because you're bjarne stroustrop and you're here to ruin programming

Attached: 1475520686707.jpg (392x495, 120K)

This really depends upon your definition of powerful. Brainfuck is Turing Complete, so it can compute any problem computable by any other programming language. That said, its only means of I/O are getchar() and putchar(). A program that needs to communicate using multiple forms of input and multiple forms of output could not be written in Brainfuck alone. It would require a secondary program to parse the output of Brainfuck's stdout and split it between the multiple output ports.

That said, you could theoretically create a video game with no sound in Brainfuck, if you set its stdin to a gamepad device file, and set its stdout to a framebuffer. You would have to encode all images in the game into the program code itself, but it would be do-able.

>girl

Woah, Bjarne Stroustrup got a lot cuter.

it's a trap

Could someone give me a brief explanation of how dynamic typed languages can have a different typing system ?
Like what's the difference between python and Lisp for example ? Or maybe point me too a nice blog post or so.

It's basically as if they have type systems, but they aren't checked until runtime, so they throw an exception if you give the wrong argument.

"Strong" and "weak" types are relative and fairly vague terms. C# is pretty strongly typed in general but what you described allows you to weaken it somewhat.

Ruby-oniichan, watashi o chuuu shite kudasai!

Apparently /dpt/ is happy to help if you want to learn FP, but it goes silent as soon as you mention actual applications of those FP languages.

nothin personel kiddo

Attached: gd2urf.png (69x20, 448)

all the ocaml fags are sleeping. retard.

Static/dynamic typing has nothing to do with strong/weak typing.

>chuuu shite
何?

Attached: chuuu.png (1304x209, 21K)

The OCaml guys are a small minority and SML is even more remote. FP is a little bit wider than the bubble you're placing it in. Most of the FPfags here shill Haskell

Just give it some time and you'll find a functional programmer that actually uses your particular languages

Je crois que c'est limpide couz.
I think this is crystal clear senpai.

I just elongated the vowel sound.

Attached: 1523088316258.png (410x103, 9K)

I know, but I like screwing around with languages and ambiguity.

How much crossover is there from /dpt/ to /djt/? I'm still learning on and off but I don't browse /djt/ much anymore

Maybe I should get back to it

>daily japanist thread
>daily Java thread
?

The former. There isn't a daily Java thread that I know of

I used Kotlin and found it had the same problems as Java around array casting and such, now formulated as a leaky abstraction. Mostly pleasant otherwise. I've heard Scala has shitty stack traces, but that might be outdated

Might be worth it for hobby projects

Wouldn't know. I haven't been on /jp/ in ages. I remember back when /prog/ was a thing that there was a huge crossover between /jp/ and Jow Forums posters there though.

>/prog/

Attached: 1472860069099.png (600x979, 191K)

Eta, Idris (too new but idris-jvm works), Fredge (no eco system though), clojure.

Hope at least one of them changes it as kotlin is a dissapointment.

/dpt/ is a subset of /djt/

there is a /djt/ on Jow Forums now (and discord obvious)

I want weebs to migrate to their own boards. GR15 rule should be extended to weebs.

Anime website.
There are plenty of other imageboards without the weeb culture associated with 4chin (420 for example). Maybe that's more suitable for you.
Also you don't have to limit yourself to IBs if you don't like any, there are plenty of programming communities on the internet (or larger communities with a prog subset) in various forms. I invite you to take the time to look up the best place for you.

>Anime website.
A website with a "cartoon" section where you're welcome to fuck off does not equal "cartoon website"

SML doesn't really have any SML-specific features unless you count compiler-specific extensions. Just minor syntax differences and being more restrictive, and some very minor differences in advanced module features that only come up if you're doing research in ML module systems. The biggest difference for the tiger book would probably be a slightly different interface for the lexx/yacc libraries.

OCaml is basically a superset of SML with nicer syntax and a still-crap-but-less-crap library situation.

t. newfag

Nice to meet you, newfag. I'm dad.

I don't know what shit hole you came from, but please go back there.

Jow Forums is the "cartoon section" that I and a bunch of others fucked off to years ago. It's not my fault you followed.

I bet you are the same faggot who thinks /qa/ is a /jp/'s branch.

Are you stupid? What does that have to do with anything?

This website was made by a werb to talk about weeb stuff. It's now also owned by a nip. Instead of trying to change it as much as possible to your liking, just look for a more suited place. Again there are plenty of image boards without the anime.

Do you complain about seeing too much pasta around you when going to an Italian restaurant, too ? Yes you're not forced to eat pasta, yes they propose other dishes, but it is inherently part of their cuisine, and complaining about it is stupid, you should go to a pizzaria where they don't do any pasta instead.

>t. too retarded to understand he's retarded as he lacks the necessary mental capacity to comprehend his own retardedness.

Bros, first off, I'm not a programmer. I'm a scientist with a VERY basic grasp of python...and it's barely a grasp.

Long story short I've got a script with three functions that all run completely fine if I call them individually from the console. However if create a main function that calls them, it'll run the first two fine but not the third, yet the third one runs without any issues if I call it 'manually'.

Am I being an absolute fucking retard here? Is there something super obvious that I'm missing when calling main() ?

I've prepared my angus, but please bare in mind I don't program for a living or even for fun.

Go back to facebook, normiescum.

forgot to ad, the functions need to be run in a specific order as they involve manipulating data in a order that needs to be strictly followed.

Sure, and Youtube is a dating-website while 2ch is a dedicated weeb resource.

post code.

>implying watching cartoons isn't a normie things nowadays
Wake up, sheeple.

def new_prediction():
global userdate
global usertemp
global userrain
userdate = str(input("Enter the date which you wish to have forecast: (format YYYYDDMM) "))
usertemp = float(input("What is the forecast temperature maximum for the day you wish to forecast?: "))
userrain = float(input("What is the forecast rainfall (mm) for the day you wish to forecast?: "))
return timeconvert()

def timeconvert():
global day_of_the_year
date = pd.to_datetime(userdate, format='%Y%m%d')
new_year_day = pd.Timestamp(year=date.year, month=1, day=1)
day_of_the_year = (date - new_year_day).days

def prediction():
global userdata
userdata = [day_of_the_year, usertemp, userrain]
userdata = pd.DataFrame(np.array(userdata).reshape(1,3), columns = list("012"),)
global userdataprediction
userdataprediction = clf.predict(userdata)

Normies also breath.
Your point ?

Attached: 1493966085646.png (648x932, 325K)

see bros, I can't even fucking post code on Jow Forums properly. Just fucking kill me.
FYI, the indentation in my actual code is fine.

it's okay user, you need to surround it with [ code ]my code[/ code ] (I added spaces to break the syntax, should work I think, if not you won't see anything and this post will be stupid)

>resorting to false equivalence
My point is proven.

post main too.
you could use something like ghostbin.com if you prefer.

for a starter, instead of using globals for everything you could change :
def new_prediction():
# ...
return timeconvert(userdate, usertemp, userrain)

def timeconvert(userdate, usertemp, userrain):
# ...

it's called passing arguments to your function.

Why do some requrie inheritance to be a part of object orientation?
For me, there is nothing in the concept of an object that requires inheritance.

it's a popular way to do polymorphism

>en.wikipedia.org/wiki/Argument_from_fallacy

main was just:
def main():
return new_prediction()
return timeconvert()
return prediction()


It ran the first two fine then didnt seem to run prediction

It's just retards confusing descriptive statements for prescriptive ones because they are retards. (Notwithstanding the fact that I don't claim OOP is ever to be prescribed by any sane person anyway)

>return
This word, you keep using it. I don't think it means what you think it means.

remove returns.

return means that you leave the function with the value of the expression right of it.
(the value returned by new_prediction())

cheers bros

You are a mammal. A dog is a mammal. Both you and a dog inherit from a mammal class, thus you share the similarities all mammals share. However "mammal" isn't the full description for the either of you, so there are your own classes on top of the mammal class that expand on your description.

But if I divide my solution into objects, using classes or structs, but inheritance nowhere, that's not object orientation?

I've tried to actively avoid partitioning my solutions into classes and objects, and to be honest I find it almost impossibe to do that and not end up with a huge impenetrable buggy mess.

Nobody can agree what object oriented programming actually means.
But for the most part, they think it's not OOP unless it has inheritance. Rust doesn't have inheritance so few people call it an OOP language, even though it resembles OOP languages in other ways that are commonly asserted to be key principles of OOP (e.g. struct-level encapsulation).

Yay, thx for the insightful spitback. >>>/india/
Is a Platypus a mammal or not? Even in the real world these hierarchies are circumstantial rather than essential so what do you gain by doing this bullshit rather than just dynamic polymorphism? It's not like we're submerged in obvious and meaningful taxonomies in the computer programming world either are we?

You don't have to implement inheritance if there's nothing in your solution that requires inheritance. The same goes for interfaces.
Not to mention, if you're working on something that should be solved procedurally - there's no reason for you to stick to OOP.

>Nobody can agree what object oriented programming actually means.
wrong.

well then if that's what OOP is then fuck OOP (no scat)

I am an object. A dog is an object. My problem Is not concerned with the evoltionary link of mammals. Now what?