/dpt/ - Daily Programming Thread

∀ α β. (α × β) → (β × α) edition.

What are you working on, Jow Forums?

Previous thread:

Other urls found in this thread:

phauna.org/papers/anime/anime.pdf
kitlang.org/
ec-lang.org/
shop.oreilly.com/product/0636920083634.do
apress.com/book/9781484230176
twitter.com/AnonBabble

First for Haskell

>using a language without ordered types
baka OP!

Attached: 1452715120528.png (561x800, 651K)

redpill me on ordered types

>using pandas to crunch data
>have to stop every two seconds to print dataframe types to make sure theyre parsed right
>spend more time getting the fucking data to load right and rename key columns than I do actually meaningfully process the data
Fuck python so much.

no exchange
ordered variables are used in order of introduction

/dpt/-chan, daisuki~

Ask your much beloved programming literate anything

Please use an anime image next time.

Attached: shot0033.jpg (1920x1080, 310K)

Is it true that weeaboos are above average programming intelligence?

>Please use an anime image next time.
No. Now please let's focus on programming-related discussion.

print(type(a))


but

if type(a)==int:
print('yes')

if isinstance(a,int):
print('yes')

What is the difference?
Why does python has so many functions that do almost the same?

Well, at least you're not doing it in C, or C++ or assembly.

No, but it's true that people with above average programming intelligence have interests and a life style that leads them to become weeaboos.

phauna.org/papers/anime/anime.pdf

Attached: 648.jpg (1280x720, 64K)

test

Your test was successful. Have a good one.

Usually weebs are shitty programmers and unintelligent. They're just really introverted.

Yes, you are no longer banned for posting anime on Jow Forums

uBlock is causing problems

>unary
hehe

Yes
Preference for Anime is positively correlated with IQ

Attached: 1508867032437.jpg (795x946, 322K)

It's shit, especialy when you use libraries that sometimes need data frames and sometimes arrays, and need to reshape the data every step. I hate it so much. I want to try Julia to see if it's any better.

type(blah) returns a string with the top-level type of the exception. This CAN be useful, but if you want to check for whether a variable contains a *subclass* of a given type, you need to use isinstance().

I'm learning Lisp and starting to get the hang of it. Compared to other scripting language it seems incredibly verbose, after how many months does it get better?

I don't think this paper applies to you. You're posting pictures of anime girls biting their arms.

Anime is mainstream nowadays. Your slice of life cartoon doesn't have any "secret powers" you can relate too. It's dumb and you're lonely and you're watching what you imagine to be how girls interact between themselves.

Jow Forums wasn't elitist since 2010.

You can't code.
This.

>top-level type of the exception
Non-autistic, red-pilled
>a *subclass* of a given type
user defined, Object oriented Russian learning from 15 years old books on C++ that hail OOP as the best thing next to Perl.

Redpill me on languages with typing systems that can encode the Y combinator directly

programming is a subcategory of anime

read the docs

This one is me driving crazy. Please help!

function tag(stringBits) {
console.log(stringBits) // => ["test", "", ""]
}

tag`test${1}${2}`
// output: [ 'test', '', '' ]


Where is the second empty array?
function tag(stringBits) {
console.log(stringBits) // => ["test", "", ""]
}

tag`test${1}${2}.`
// output: [ 'test', '', '.' ]


In other words: I don't understand how empty array elements with tagged templates are created. The results pattern doesn't make sense to me.

they're all inconsistent

Where were you when the next better C was made
kitlang.org/
since the last most promising better C
ec-lang.org/

Weeb board, leddit fagtronics

What guarantees does SQLite offer me?
If I use last_insert_rowid like this:
BEGIN TRANSACTION;
INSERT INTO table VALUES(...);
INSERT INTO table2 VALUES(..., last_insert_rowid(), ...);
COMMIT;

Does that guarantee that the second insertion got the rowid of the previous insertion in a column (e.g. FOREIGN KEY), or could a second commit have come in between, despite being in a supposedly 'atomic' transaction?

Attached: 1530375064402.gif (220x101, 5K)

begone shill

dumb rustfag

Better C is C++

>implying

fuck off Stroustrup, nobody likes you.

Better C is Carp

New course requires me to use MS Visual Studio. It's the worst fucking IDE I've worked with.
So far I have spent more time fixing and looking up stupid shit just so I could continue writing my program.
The last fucking drop was when I created a pointer that I wanted to send to a function and change it there. Each time I run the program VS does an error pop up with loud ass alert sound telling me "OH NO YOU'RE USING A VARIABLE YOU HAVEN'T INITIALIZED YET", I've looked for 40 minutes on how to disable this shit but couldn't. So now every time I run my program to check for functionality I have to click away that message. No other IDE or just compiling does that, at most you get a warning during when compiling.

>New course requires me to use MS Visual Studio
Why?
>OH NO YOU'RE USING A VARIABLE YOU HAVEN'T INITIALIZED YET
Maybe you should initialize the variable before using it.

>Maybe you should initialize the variable before using it.

But I'm not even "using" it. Just calling an empty function with the variable as argument generates that error. And it's pointer, I'm just sending the address, what If I want to initialize it inside the function?

so i have 2 schemas
var touristSchema = mongoose.Schema({
name: {
type:String,
},
surname: {
type: String,
},
gender: {
type:String,
enum: ['Male','Female', 'other'],
},
country: {
type:String,
}
listOfFlights:[flightSchema],
})

AND
var flightSchema = mongoose.Schema({
arrivalDate: {
created: {type:Date, default:Date.now},
},
departureDate: {
created: {type:Date, default:Date.now},
},
placesToSitInPlane: {
type: Integer,
}
listOfTourists: [touristSchema],

})


I have problem with listOfTourist container, because it should take all tourists from listOfFlights from touristSchema that takes this particular flight (means they reserved place there). Another problem is with numberOfPlaces: Integer, it should increment every time i add tourist to the same flight object and keeps from adding new tourist if there are no sitting places for him left. How to represent all of this?

is this a relation N:M?

N tourists have M flights?

What's the most versatile OOP?

CLOS

i thought more about: touristSchema is representation of some tourist, one Tourist has M flights, then check in some flight, how many tourists it contains, if more than places throw some error. I think i fucked something with internal logic of that, because i just wrote json schemas for API, i did not started to write methods yet

After doing a serious benchmarking

a=a+1 is faster than a+=1
and
while is faster than for
and
while(True)+break is more efficient than while(condition).


in Python 3.6.
Discuss.

>ide literally tells user to stop being a retard
>user: BUT I WANNA BE A RETARD STUPID PROGRAM

UX question. I have a window that can load user saved forms. When a form is loaded the user can change it. A text warning appears saying the form has unsaved changes.
I want to give users two options: save changes and reset to last saved changes.
Is
>Restore form
good enough? I'm wondering if it's too ambiguous. Does it restore the form to its default state? does it clear all fields? Does it restore it to the last saved state?

>Restore to last saved state
Is not ambiguous but is too long.

Thoughts?

>a=a+1 is faster than a+=1
Depends on assembly language

>what If I want to initialize it inside the function?
Isn't that great, your IDE is telling you that it's a fucking awful idea

So, let's see:

A flight has many tourists so: Flight (1) ----- Tourists (N)

and then, in the tourists data structure, you save the flight he goes into.

>a=a+1 is faster
no shit the compiler has to figure out what a+=1 even means.

Will you be my anime gf pls

Why does switch need braces? After all, I can write the following macro:
#define C(x) case x: goto label ## x; break;

and then use it as such:
{
switch(n) {C(1) C(2) C(4) C(8)}
{
label1:
...
label2:
...
}
label4:
...
label8:
longjmp(buf);
return;
}

seek help

You were right. MVS deserves my apology

/sci/ guide to type theory

will try to watch the recommended vids

Need help trying to specialize variadic templates in C++. Anyone know how to get this to work?

template
void foo(int count, T t, Rest... args){
foo(count+1, args...);
}

template
void foo(int count){
std::cout

I wonder how much any of that really has to do with types as we know. I read a lot of Bertrand Russell. I feel like the topics he was addressing when talking about type theory were nothing like what we deal with as programmers.

never gonna make it, beta faggot

I'm trying to write a object relational mapper using reflection and attributes in C#.

The idea is that eventually it will handle auditing for any business object. The company I work for have a system they've written for auditing, but I think it's a pile of shit and I can write it better. Famous last words.

what are you actually trying to accomplish

Best book to learn C#?

shop.oreilly.com/product/0636920083634.do
apress.com/book/9781484230176

A function template taking one argument is never going to fully specialize a function template taking at least two arguments (int count, T t).

Anyway, why not just:

#include

void foo(int count){
std::cout

Microsoft Visual C# step by step

Usually, in programming, types can just be seen as sets. Once you get to dependent types, however, you can't really do this, and Russell comes in.

For that matter...

#include

template
void foo(Args&&...)
{
std::cout

Can someone help me out with this question, thanks. It's in java.

Learning about nodes, i need to write a method that will take a generic bag of nodes and find the largest "data" in them which would just be an integer.

public T getMax() {
T maxNumber = firstNode.data;

for(int i=0;i 0) {
maxNumber = firstNode.data;
}
firstNode = firstNode.next;

}
return maxNumber;
}


On another note, is data structures a legit difficult topic or am i retarded?

nodes in what kind of a data structure? A node can be part of almost anything

That's right, you fucking sexist misogynists! There's no need to use Duff's device in 2018!

Attached: 1528107107486.png (690x557, 49K)

No wonder "dynamic" shitlangs are so fucking popular these days.

Are pajeets actualy bots? Every single moment section looks like this.

Attached: Screenshot_20180922-211535.png (720x1280, 248K)

>shitting corner

In a bag?
numbersBag.add(1);
numbersBag.add(2);
numbersBag.add(10);
numbersBag.add(4);
//prints out that 10 is the largest.

a "bag" isn't a data structure. It looks like you're using a linked list?

Oh yea, that would be correct. Guess i need to reread the introduction of this book hah

>public T getMax() {
>T maxNumber = firstNode.data;
is that Java template syntax lol?

>a "bag" isn't a data structure
Wrong

C# in Depth 3rd Edition after learning basic C#.

post your code to prove your claim

HolyC

What language is most difficult?
Are there any languages that majority of programmers don't know and if you have it in your resume people will go "oh wow, that guy must bee good" because nu-programmers don't learn it?
Would C++ be something like that?

oh shit I was mistaken, bags are a thing

well I guess the distinction doesn't matter in this particular case.

either way a lot of data structures lend themselves very nicely to recursive function definitions so try that

Sql

C++ is pretty hard but not for any good reason.

C++ is the most difficult language
but it's not exactly prestigous

>What language is most difficult?
malbolge
>Are there any languages that majority of programmers don't know and if you have it in your resume people will go "oh wow, that guy must bee good" because nu-programmers don't learn it?
no such a thing.

C is kinda clumsy, but there really is no alternative so great that it will replace it. All attempts at making a better C, besides C++, have failed.

>Microbenchmarking Python
I sure hope you guys don't do this. The massive performance overhead of using python in the first place should also be a hint that performance is not really a concern.

why do we need to manually create header files
surely there is a tool that will just preprocess a source file and generate a header containing all the symbols with external linkage

There are compiler pragmas to disable all the stupid shit. It also doesn't like the str___ functions, and instead wants you to use the retarded annex K garbage.
Make a .h file which disables all warnings and #include that everywhere, then run it through gcc to check for warnings.

There is, but creating a header file forces you to rethink the design, so that's why it's recommended. Just like how you could make a .h file and include that, but it's better to reorder the functions.

Because C and C++ are shitty outdated languages stuck in the past while pretty much every other language has modules.

>a+=1 vs a=a+1
Because python is shit those 2 are not equivalent. One mutates a and the other returns a new a, in some types like lists they don't even do the same thing, if a=[] then a+= {} results in a being [] while a = a + {} gives a type error.

what are "modules"

c has modules all right
I unzip the module into my deps/ folder, then I compile again and it doesn't warn.
Works just fine, doesn't need admin like npm or pip does, and it doesn't conflict with apt-get either, like when you have pip trying to install package X and apt-get trying to install package X and it all just becomes a giant mess.
Gee, am I glad to use C.

A module combines the interface and implementation of some system into one file, letting you choose what is exported and what is imported. You also usually don't have to worry about declaration order or dependency cycles - it's all resolved by the compiler.

>modules are packages
No.