[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 345
Thread images: 28

What are you working on, /g/?

Old thread: >>60142581
>>
>>60144368
Thank you for using an anime image.
>>
File: d lang.png (909KB, 1280x720px) Image search: [Google]
d lang.png
909KB, 1280x720px
What's your favourite dead language?
>>
HKTs are features meant for brainlet newbies
>>
nth for installing agda
>>
>>60144396
Latin
>>
File: 1468882928818.png (199KB, 439x392px) Image search: [Google]
1468882928818.png
199KB, 439x392px
Implementing C in CoC.
>>
>>60144396
Shitkell, it just got divided into two with the same name
>>
File: nVjQ1iE.png (1MB, 1357x1281px) Image search: [Google]
nVjQ1iE.png
1MB, 1357x1281px
Reminder that if you're too brainlet for Rust, you're a Koder.
>>
>>60144400
checked
>>
>>60144396
Hasklel
>>
>>60144407
but you already have two Cs and an o
>>
how the shit do you learn C++ up to an acceptable level if you don't have two lifetimes?

is there a compact book with the essential knowledge how to code in the real world?
>>
>>60144433
You don't. You learn whichever subset your employer uses.
>>
>rustics will never understand the power of dependent types
>>
>>60144446
Apperenlty Rust and C users know how to use macros. Stick to your brainlet abstractions
>>
>>60144433
>C++ is hard
>>
>>60144446
Who said this?
>>
Java is the best statically typed language in existence.
>>
>>60144433
You mean like the syntax? That doesn't take too long. If you mean libraries, you pretty much just reference those as needed...
>>
>>60144459
>use dependent types
>have type-safe macros
>>
>>60144471
What do you think about Pakistan?
>>
Write traverse_ in Rust.

traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()

-- Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see traverse.
>>
>>60144478
Inferior to Java, like everything else.
>>
>>60144481
Do your own homework
>>
>>60144497
It's a challenge to the Rust shills.
>>
>>60144505
See >>60144497
>>
>>60144519
I'm of the opinion that Rust can't do it.
>>
>>60144519
See >>60144541
>>
>>60144543
Wrong post?
>>
>>60144497
>>60144519
what university unironically uses rust for teaching?
But then again Rust users like trying to recruit more cultists more than programming in their shitlang
>>
>>60144543
What?
>>
>>60144552
whoops

well it was about as relevant as your redirect anyway
>>
>rust shills claim you can implement HKTs in rust
>ask them to show how to implement a function that uses them in rust
>"d-do your own homework!"
>>
>>60144595
Ahaha, nice try. Do your own homework
>>
>>60144605
We'll take that as an admission that Rust can't really do HKTs, then?
>>
Guys whats a HTK
>>
>>60144605
No university teaches Rust.
>>
>>60144616
it can't really do generics either
>>
>>60144617
Higher-typed kind
>>
>>60144616
Any language with macros can have HKTs, it even has a crate for it

>>60144621
None of them teaches Haskell either
>>
>>60144616
>We'll take that as an admission that Rust can't really do HKTs
Using this logic you can "prove" literally anything.
>>
>D
>made by Walter Bright and Alexandrescu
>decent product but not shilled
>Rust
>made by literal whos
>shilled by Mozilla and Rust Defence Squad
hmmmm, I wonder why D is dead and Rust is not lol
>>
Which programming language would Jesus use?
>>
>>60144617
It's an abstraction, no one really cares about it
>>
>>60144655
Malbolge
>>
>>60144655
lisp
>>
>>60144657
What's an "abstraction"?
>>
File: 1465101808774.png (198KB, 1920x1055px) Image search: [Google]
1465101808774.png
198KB, 1920x1055px
>>60144650
I like D though
>>
>>60144673
https://en.wikipedia.org/wiki/Abstraction_(software_engineering)
>>
>>60144655
Jesus wouldn't program, he'd do something productive with his time
>>
is there a statically typed lisp with libraries?
>>
>>60144655
HolyC
>>
>>60144650
I uniornically prefer my languages stay in dead obscurity.
The more popularity they get the worse they become.
>>60144676
why arent you paralleling a foreach instead?
>>
>>60144680
Jesus doesn't exist
Santa isn't real
Babies don't drop out of the sky
>>
File: Fedora.png (730KB, 1067x800px) Image search: [Google]
Fedora.png
730KB, 1067x800px
>>60144701
>>
>>60144638
>Any language with macros can have HKTs
Show me traverse_ in Rust, then. Implement HKTs using macros, then write traverse_.

>it even has a crate for it
If I make a package named "hkt" for Java, does that mean Java supports HKTs?

>>60144640
The burden of proof is on those who claim Rust can do HKTs.
>>
>>60144684
>is there a statically typed lisp
Yes, every single Lisp.
>>
>>60144700
>why arent you paralleling a foreach instead?
Because D, C and Rust handles parallelism in different ways and it wouldn't create a level playing field
>>
>>60144655
Hebrew.
If you believe Jesus is God, he actually DID program in Hebrew.
>>
>>60144481
template <typename Container, typename Action>
auto traverse(Container &container, Action &action)
-> std::vector<decltype(action(container::value_type{}))>
{
std::vector result{};
result.reserve(container.size());

for (auto &elem: container) {
result.push_back(action(elem));
}

return result;
}

template <typename Container, typename Action>
void traverse_(Container &container, Action &action)
{
static_cast<void>(traverse(container, action));
}
>>
>>60144713
>Show me traverse_ in Rust, then
You don't need HKTs to do that, and I am not interested in your arbitrary homework
>>
>>60144713
>The burden of proof is on those who claim Rust can do HKTs.
You can show that Rust having HKTs implies falsehood.
>>
>>60144723
>-> std::vector

wrong
>>
Daily programming challenge: sum all prime numbers below 2 million which are palindrome
>>
>>60144638
My university has a master's course that teaches haskell.
>>
>>60144713
>The burden of proof is on those who claim Rust can do HKTs.
https://gist.github.com/14427/af90a21b917d2892eace
>>
>>60144742
Yep, I forgot to update that, just copy the decltype part from the function signature.
>>
>>60144723
You just miserably reimplemented std::transform.
>>
>>60144722
Then why does the Pope speak latin? /thread
>>
>>60144719
Its not a fair benchmark then.
D is already getting stds which outpace even C.
>>
>>60144751
I don't see a formal proof of this program correctly implementing HKTs.
>>
>>60144732
>You don't need HKTs to do that
Yes you do. Look at the type signature.

traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
>>
>>60144751
We've seen that, now use it to implement traverse_.
>>
>>60144723
That returns void. It is not an implementation of traverse_.
>>
>>60144766
checks out
 #[test]
fn test() {
let v = Vec::return_(1);
let v = v.bind(|x| vec![x.to_string(); 3]);
println!("{:?}", v);

let o = Option::return_(1);
let o = o.bind(|&x| Some(x + 1));
println!("{:?}", o);

let o = Option::pure_(1);
let o = o.bind(|&x| Some(x + 1));
println!("{:?}", o);

let rc = Rc::return_(7);
let rc = rc.bind(|&x| Rc::new(x * 3));
println!("{:?}", rc);

let b = Box::return_(7);
let b = b.bind(|&x| Box::new(x * 4));
println!("{:?}", b);

let o = Some(Some(true));
let o = o.join();
println!("{:?}", o);

let v = vec![vec!(true), vec!(false)];
let v = v.join();
println!("{:?}", v);

let f1: &Fn(&i32) -> i32 = &|x| x*3;
let f = Some(f1);
let o = Some(3);
let o = o.seq(f);
println!("{:?}", o);

let f: Foo<_, Box<_>> = Foo::new(5);
let p: Box<_> = f.ptr;
println!("{:?}", p);

let f: Foo<_, Rc<_>> = Foo::new("5".to_string());
let p: Rc<_> = f.ptr;
println!("{:?}", p);

assert!(true);
}
>>
>>60144787
Hmm, no.
>>
where can I find a list of all the algorithms
>>
>>60144817
>a test is somehow a proof
I don't know how anyone can be this retarded.
>>
>>60144804
That's only because Haskell documentation sucks massive dicks so there's no mention of it other than the function signature which may not be enough for people not familiar with Haskell. I can do it again when Haskell's documentation becomes useful.
>>
>>60144817
where are the HKTs?
>>
Definition U : Type -> nat -> Type :=
fun T =>
fix f n :=
match n with
| O => T
| S n => T -> f n
end.

Definition sum :
forall T : Type, (T -> T -> T) -> T -> forall n : nat, U T n :=
fun T add zero n =>
let fix f accu n : U T n :=
match n with
| O => accu
| S n => fun x => f (add accu x) n
end in
f zero n.

Definition sum_nat : forall n : nat, U nat n := sum nat plus O.

Eval compute in sum_nat 3 10 3 4.
>>
>>60144826
See >>60144616
>>
>>60144832
Read the source
>>
File: akari ^^.png (310KB, 441x623px) Image search: [Google]
akari ^^.png
310KB, 441x623px
Friendly reminder that if you have an anime girl avatar on your github, you're being counted as a female in university studies regarding women coders.

>New research shows that software coding changes suggested by women had higher approval ratings than those from men - but only if their gender was not identifiable.
http://www.bbc.com/news/technology-35559439
>>
>>60144840
see >>60144640
>>
>>60144844
is .seq supposed to be polymorphic over a higher kinded type?
if so, can you post just that and the source, rather than the rest that has nothing to do with it?
>>
>>60144831
Don't blame your own failures on Haskell.
>>
>>60144847
>gender stats are nonsense
thanks for the breaking news akari
>>
>>60144840
No, if you tell me to print 1+1 and if I don't show it for you, it doesn't necessarily means Rust can't print 1+1
>>
>>60144847
mine is a cat :c
>>
>>60144860
Haskell's documentation being dogshit is not my failure but rather the failure of Haskell so I'm rightful to blame it.
>>
>>60144657
But what does a HKT abstract?
>>
>>60144855
See >>60144713
>The burden of proof is on those who claim Rust can do HKTs.

>>60144868
The documentation is very clear.
>>
>>60144871
A deficient type system.
>>
File: 1492880020264.jpg (60KB, 658x701px) Image search: [Google]
1492880020264.jpg
60KB, 658x701px
>>60144847
>Women are hijacking even the success of projects made by super turbo autists
>>
>>60144875
>>The burden of proof is on those who claim Rust can do HKTs.
see >>60144751
>>
File: images (3).jpg (3KB, 225x225px) Image search: [Google]
images (3).jpg
3KB, 225x225px
>>60144863
but it can't
>>
>>60144875
see >>60144736
Show me an implementation of a function with the following type.
RustHKTs -> False
>>
>>60144875
>Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results.

I guess you're right, and as thus, my implementation is correct as per Haskell's clear documentation.
>>
>>60144887
We've established that that isn't a proof.
>>
>>60144899
but it isn't, since it returns void
>>
>>60144901
>We've established that that isn't a proof.
How?
And who is this "we"?
>>
>>60144899
Your understanding of the documentation is deficient.
>>
File: download (2).jpg (6KB, 262x192px) Image search: [Google]
download (2).jpg
6KB, 262x192px
>>60144901
>>
>>60144915
>How?
That file doesn't contain a formal proof. It's pretty clear that it's not a proof.
>>
i wonder how large mozillas shill fund is.
>>
>>60144857
well?
>>
>>60144930
>That file doesn't contain a formal proof.
Proof of what?
>>
>>60144919
Your understanding of the deficient.
>>
>>60144944
Of that file being a correct implementation of HKTs.
>>
>>60144913
The documentation says nothing about the return type.
>>
So I guess we're in this weird situation of Rust having HKTs, but not being able to write functions that use them.

As usual, the writers of the claimed HKT implementation have completely missed the point of HKTs.
>>
>>60144953
the documentation states the exact type
>>
>>60144953
The documentation is irrelevant. The type signature states the return type.
>>60144955
>So I guess we're in this weird situation of Rust having HKTs
Huh? Did I miss something?
>>
>>60144955
>dude macros lmao
>>
>>60144952
What's wrong with it?
>>
>>60144961
>>60144966
Type signature is not documentation.
>>
>>60144973
comments aren't documentation either
>>
>>60144396
C
>>
File: gellar.jpg (327KB, 800x1215px) Image search: [Google]
gellar.jpg
327KB, 800x1215px
>>60144966
>>60144967
>mfw
>>
>>60144967
>too retarded for macro
duude abstractions lmao
>>
>>60144966
>Huh? Did I miss something?
I was humoring the Rust shills.
>>
Sub /g/, I'm trying to send signed integer arrays from C# to scala over TCP. In my csharp code I simply use BufferCopy to get my int array to byte format, however on the scala side I'm unsure how to deserialize. Bit shifting works just fine for positive numbers, but for negative numbers the values end up being wrong.

Anyone know how the byte layouts differ in these languages and what the correct protocol for serializing and deserializing between jvm and C# is+
>>
>>60144977
So we're back to square one where I said that Haskell documentation sucks.
>>
>>60144396
algol 58
>>
>>60144973
Type signature is the only documentation you can rely on.

>>60144967
It's hilarious that they can't see that even with macros they can't implement HKTs.
>>
>>60144973
Type signatures are the only valid form of documentation.
>>60144972
It doesn't contain a proof of correctness.
>>
>>60144985
if youre language encourages the use of marcos for extended functionality you need to uninstall your life.
>>
>>60145005
No, the type signature tells you what you need to know
>>
>>60145005
You're the only person here who thinks that Haskell documentation sucks.
>>
>>60145010
not him but hkts are literally pointless just use void*
>>
>>60145014
>if youre language encourages the use of marcos
Luckily, I don't use functional programming. It yields slower programs
>>
>>60145028
not type safe
>>
>>60144743
palindrome x =  str == (reverse str)
where str = show x

primes = sieve [2..]
where sieve (p : xs) = p : sieve [x | x <- xs, x `mod` p > 0]

main = print
$ sum
$ filter (not . palindrome)
$ takeWhile (< 20000000) primes
>>
>>60145013
>It doesn't contain a proof of correctness.
How?
>>
>>60145028
You're missing the bigger picture.
>>
>>60145038
>not type safe
>caring about type safety
gtfo
>>
>>60145034
>It yields slower programs
What real time marvels are you working on lad?
>>
>>60145034
>type checking slows down the runtime of your program
>>
>>60145041
Is English not your first language? That's not a valid response to what I said.
>>
>>60145013
>It doesn't contain a proof of correctness.
It's written in Rust and it's named HKT. Therefore it is a proof of correctness.
>>
>>60145040
my bad I thought you said "not" palindroms
>>
>>60145042
the bigger picture is the slower picture
>>
>>60145050
What are you on about? Functional programming produces slower programs, everyone knows that
>>
>>60145056
>That's not a valid response to what I said
How?
>>
>>60145050
Something in Python to reorganize his music collection, probably
>>
File: 1491988575018.png (595KB, 871x1103px) Image search: [Google]
1491988575018.png
595KB, 871x1103px
>>60144834
What's the difference between Prop and Type in Coq?
>>
>>60145071
While you are obviously false, because the implication is that functional is slower than non-functional (which isn't true), and I made a post about this last thread >>60143955

We are talking about HKTs.

Do generics or templates slow down your program?
>>
>>60145047
hello cnile
>>60145071
Im asking what kinds of things you are using where it actually matters.
>>
>>60145040
What language is that?
>>
The more the compiler knows about your code, the better it can optimize it.

The more constrained your functions are, the more the compiler is free to optimize them.
>>
>>60145064
Typical hasklet.
>>
What's your thought on Kotlin?
>>
>>60145092
>Im asking what kinds of things you are using where it actually matters.
Yes, the efficiency. Functional programming languages are inherently slow
>>
>>60145110
We're talking specifically about HKTs
>>
>>60145095
Python
>>
File: 1470575892470.png (43KB, 645x364px) Image search: [Google]
1470575892470.png
43KB, 645x364px
>>60145090
>While you are obviously false
So, which one is the least efficient language?
>>
>>60145083
~$ coqtop
Welcome to Coq 8.5pl3 (October 2016)

Coq < Check Prop.
Prop
: Type

Coq < Check Type.
Type
: Type


Prop is just a Type containing two constructors: True and False.
>>
>>60145110
Yes, but im asking what, besides hello world benchmarks, you have done to personally experience. Because it seems like youre just going off of /dpt/ shitposting.
>>
>>60145090
He's right though. Immutable data will be slower to work with.
>>
>>60145126
>Graph
Fortran produces the slowest programs
>>
>>60145117
>We're talking specifically about HKTs
Refer back to >>60145034
>Luckily, I don't use functional programming. It yields slower programs
>>
>>60145139
Haskell*
>>
>>60145108
Another gargantuan waste of time and effort that will produce a language of impoverished ambition and very little value.

How many more must we sacrifice on the altar to the false idols of "practicality" and "being pragmatic"?
>>
>>60145128
literally whats the point
>>
>>60145141
Do you use functions?
FP has functions
Guess you're slowing down your program if you use functions

Of course, you don't actually know what HKTs are.

>>60145148
Do you not know how a box plot works?
>>
>>60145128
>Type : Type
I'm assuming it's just hiding the Type : Type1 and so on?
>>
>>60145136
Lazy immutable data can be faster to work with.
>>
>>60145133
Yeah even outside the hello world and fizzbuzzes (where FP is used mostly), no one really uses FP
>>
>>60145152
Prop is Prop and Type is Type. I can't help you anon on that one.

>>60145160
Yes. But you can change a "variable" to display the different universes.
>>
>>60145000
Serialize -1 in C#, post the result here.
Serialize -1 in Scala, post the result here.
It's simpler to do it like so and determine the mismatch empirically, I'll help you.
>>
>>60145172
but whats the purpose of prop?
>>
>>60145156
>Do you use functions?
>FP has functions
>Guess you're slowing down your program if you use functions


I'm not the retard who uses HKTs, maps, recursions and filters to slow down program dramatically. No wonder no one in the industry actually uses FP

FP is SLOW
>>
>>60145190
We're talking specifically about HKTs
What is slow about HKTs?
Do you use generics and templates?
Are they slow?
>>
>>60145168
>and fizzbuzzes (where FP is used mostly),
lol

why even say something like this you know it's not true
>>
>>60145172
>>60145183
I think it erases all Props when extracting to a different language.
>>
>>60145177
>Serialize -1 in Scala, post the result here.
Wait you have no serialization layer, forget it.
I'd advise picking a binary format, say two's complement big-endian 8bytes, then make both sides conform to it by force, idk.
>>
>>60145190
>HKTs slow down program dramatically
What did she mean by this?
>>
>>60145183
Prop is for theorems. Type is for coding.
>>
>>60145199
>We're talking specifically about HKTs
No as I said, "Luckily, I don't use FP" as it yields useless inferior performing programs

>>60145199
>Are they slow
The more abstractions the slower the program
>>
>>60145223
c*ding <=> theorem proving.
>>
>>60145235
>The more abstractions the slower the program
Completely, comically wrong.
>>
>>60145235
Do you actually know what HKTs are?
Do you use generics and templates?
Are they slow?

You are really embarassing yourself.
>>
>>60145242
I know. But I can't help. Prop is just a type with two constructors.
>>
>>60145235
>The more abstractions the slower the program
How do HKTs specifically make the program slower? Explain it specifically for HKTs.
>>
>>60145252
He's probably a Go user.
>>
let succ cock = "Suck my {cock}"

succ Coq
>>
>>60145243
>>60145252
Abstractions prevents compilers from creating efficient programs. It's a well known fact
>>
>>60145267
Answer the questions.
>>
>>60145262
pretty sure its the same rust autist
>>
>>60145274
It's a well known fact that types make it harder for a compiler to produce efficient binaries.
>>
>>60145267
Yes, an abstraction like templates that literally turns into the same code you would have written without it prevents the compiler from creating an efficient program.
>>
>>60145252
>Do you actually know what HKTs are?
I don't use FP, nor I am concerned with them.
>Do you use generics and templates?
Yes I do use templates
>Are they slow?
Which one?
>>
File: 1475044979176.jpg (68KB, 567x567px) Image search: [Google]
1475044979176.jpg
68KB, 567x567px
>>60145292
>>
>>60145301
Either or.

If you use templates, you have nothing to lose from HKTs, beyond >>60145267 "any abstraction is slow" (really he means "anything that isn't explicitly dedicated in every respect is slow")
>>
>>60145292
The reverse is true. Types give the compiler information about your program. The more information the compiler has about your program, the better it can optimize it.
>>
>>60145274
Why should I care? They are slow and useless
>>
>>60145310
Templates literally expand to the same code you would have written without them.
>>
I don't know if this is shitposting or retardation desu
>>
>>60145310
ok


codelet
>>
>>60145323
With the cost of compile time, yes
>>
who here a coq-let?
>>
>>60145326
>t. "cost free abstraction" fag
>>
>>60145292
so let's make a programming language without types I guess. It's gonna have only void
>>
>>60145342
Who said that?
>>
>>60145341
A what?
>>
>>60145342
I guess you only etch programs into hard drives manually
>>
>>60145349
I said that
>>
>>60145334
Not necessarily. The compiler will spend less time reading code from disk, because there is less of it to read.
>>
>>60145345
>so let's make a programming language without types
Impossible.
>>
>>60145364
>loo
>>
>>60145364
And spend the rest of the time expanding them, what a brilliant idea
>>
File: goa.jpg (157KB, 800x600px) Image search: [Google]
goa.jpg
157KB, 800x600px
>>60144368

how to use .net RESTful API in Agile/Scrum with best practices?
>>
>>60145370
no anon you must let the human mind parse the stream of numbers
>>
>>60145387
Not programming.
>>>/g/wdg/
>>
I'm writing a turing complete programing language where every program's memory footprint must fit into a single byte.
Shits gonna be fast.
>>
>>60145387
>>60145398
>samefagging
>>
>>60145397
>numbers
What are those again? Sounds a lot like types.
>>
File: 1490517063841.jpg (55KB, 883x960px) Image search: [Google]
1490517063841.jpg
55KB, 883x960px
>>60145400
>turing complete

You have a 1 byte memory limit aimed for machines with infinite memory?
>>
>>60145387
https://www.youtube.com/watch?v=nvks70PD0Rs
>>
>>60145377
Have you measured it? Do I need to remind you that disk IO is slow?

So, we've established that templates have no effect on the performance of the compiled code (because they literally expand to the same code during compilation), and they may actually reduce compilation times (not that you're going to notice the difference anyway).
>>
>>60145306
see >>60145334
>>
File: 1457672386913.png (346KB, 600x664px) Image search: [Google]
1457672386913.png
346KB, 600x664px
>>60145400
>I'm writing a turing complete programing language
Instant garbage.
>>
>>60145423
>with the cost of compile time
yet they don't take any longer to check than templates
>>
If rust is so safe, why was >>60142597 allowed to compile?
>>
>>60145422
Templates do make object code bigger, because C++ generates code for every type you use, it may effect in execution too
>>
>>60145411
I see you've gotten confused, I was just interpreting the machine's electric pulses as a binary number that I then, mentally, converted to the more often used decimal number system

from here onwards we could set in place all types of conventions to interpret these as video or audio in our brain
>>
>>60145267
Pragmatically, yes, but in an ideal sense the more abstract your program is the more it can be optimized. The result is that FP performs much slower in most cases, but it's not an intrinsic property of functional programs, it's a consequence of optimizers being unable to use the increased freedom your typical functional program offers since it's currently very intractable.
>>
>>60145457
Runtime generics don't though
>>
>>60145457
You mean instead of... writing out the code yourself for each type that you use it with?
>>
>>60144444
the quints
>>
>>60145471
It's not always the case, templates may contain other useless data as well which you may not need
>>
>>60145490
>templates may contain other useless data as well which you may not need
Then the compiler will get rid of that data in the instantiated template.
>>
programing is immoral because it takes labour away from the oppressed proletariat class and gives it to the oppressor machine and capitalist class
>>
>>60145500
No, why do you think the attributes/properties will get deleted? It may or may not be used in the runtime
>>
>>60145527
that is until we can teach AI to shitpost.
>>
>>60145531
If something is unused, then the compiler will detect it as dead code and eliminate it.
>>
File: brainlet.png (4KB, 183x275px) Image search: [Google]
brainlet.png
4KB, 183x275px
>>60144368
>tfw too brainlet to understand SFINAE
how would i do this the right way?
#include <iostream>
#include <type_traits>

template <typename T>
struct motherfucker
{
template <typename = std::enable_if<std::is_trivially_destructible<T>::value == true>::type>
void print() { std::cout << "Yeah boi" << std::endl; }

template <typename = std::enable_if<std::is_trivially_destructible<T>::value == false>::type>
void print() { std::cout << "Nah man" << std::endl; }
};

int main() { motherfucker<int>().print(); }
>>
>>60145527
Please Read Marx or Lenin before arguing about communism.
>>
>>60145560
Just to udnerstand.
Why <typename T> and not <class T>?
>>
>>60145549
Are you clinically retarded? Only the user knows if it will trigger a certain attribute required in the runtime
>>
>>60145565
reading is a luxury not available to those in the oppressed proletariat class and is therefore immoral
>>
>>60145446
How dare you question the (((rust))) agenda
>>
>>60145594
OK. You're just trolling.
>>
>>60145591
Then templates aren't an appropriate abstraction for this use case are they, fuckface?

No wonder you think abstractions are bad if you don't even know how to use them correctly.

Seriously. Learn about templates because you clearly know fuck all about them.
>>
>>60145565
Yes, I have read their untranslated mentally ill ramblings, your point?
>>
>>60145645
>I got owned: the post
last (you)
>>
>>60145650
I hope being retarded works out for you, anon.
>>
Rust shills, Python and Ruby mouthbreathers, Go barely-sentient beings, most of /dpt/ knows nothing about programming.
>>
def dessine(event):
x, y = event.x, event.y
ew = event.widget
r = 20
if (x + y) % 2:
couleur = "red"
elif y % 2:
couleur = "blue"
elif x % 2:
couleur = "violet"
else:
couleur = "green"

ew.create_oval(x - r, y - r, x + r, y + r, fill=couleur, outline="")


at first sight, any idea why it doesn't work ? x + y being even, it draws green, when odd it draws red and I got no violet...
>>
>>60145584
I think in templates
typename
and class are actually synonymous. (I prefer the former, since types passed to templates don't necessarily have to be classes.)
>>
>>60144650
One word: FORCED GARBAGE COLLECTOR
>>
>>60145699
>t. assflustered shitkell programmer
>>
>>60145699
Every programming language sucks.
>>
If your language can't implement traverse_ then it's shit.
>>
>>60145711
They are working on removing that. If you don't depend on standard library functionality which requires the GC, you can completely disable it actually.
>>
>>60145699
>Go barely-sentient beings
I have yet to see anything that would confirm their existence. I sure hope something like that is just a joke.
>>
>>60145702
    if (x + y) % 2:

this is why dynamic typing is immoral x + y. converting forms ints to bools should be punishable by death. is even means (x+y) % 2 = 0 so the if statement is false
>>
>>60145742
They've been working on it for over a decade. It's never going to happen.
>>
>>60145743
https://gophercon.com/
>>
>>60145743
I know a friend who works for a startup producing credit card machines and the whole thing is written in go
>>
If your language has no inline assembly it's inherently garbage
>>
>>60145751
This is fake news. They only recently put a focus on removing GC dependency.
Also, stop acting like the GC is the sole reason that D is not as widely spread as other languages, because it is not.
>>
>>60145787
>writing non-portable code
>ever
>>
Wtf, why aren't yall in church
>>
>>60145792
>Also, stop acting like the GC is the sole reason that D is not as widely spread as other languages, because it is not.
Oh, I agree. It has no real features that other languages don't have. It's a completely unimaginative language from the 90s, and there is no reason to ever use it.
>>
File: 2017-04-30-200745_130x92_scrot.png (3KB, 130x92px) Image search: [Google]
2017-04-30-200745_130x92_scrot.png
3KB, 130x92px
>>60145748
>is even means (x+y) % 2 = 0
oh... I'm retarded, it's a typo in my teacher textbook that says "if n % 2 is False, then n is odd"

I knew it, got caught, sorry for retardedness
>>
>>60145796
>writing software for somebody else
>>
>>60145560
I'm a bit rusty on this, but try one of these:
template <typename T>
struct motherfucker
{
template <typename U = T, std::enable_if_t<std::is_trivially_destructible_v<U> == true>>
void print() { std::cout << "Yeah boi" << std::endl; }

template <typename U = T, std::enable_if_t<std::is_trivially_destructible_v<U> == false>>
void print() { std::cout << "Nah man" << std::endl; }
};

or
template <typename T>
struct motherfucker
{
void print() { return print(std::is_trivially_destructible<T>::type); }
private:
void print(std::true_type) { std::cout << "Yeah boi" << std::endl; }
void print(std::false_type) { std::cout << "Nah man" << std::endl; }
};
>>
>>60145796
Portability is for people who can't program
>>
>>60145823
>deliberately tying yourself to the whims of a particular processor architecture and its manufacturers
>>
>>60145800
our society has crumbled and lost God. hence endless language debates instead of mass conversion to Java
>>
>>60145823
>not using multiple architectures
>>
>>60145836
What a horrible language
>>
>>60145787
Most of programming languages can interface with C which has inline assembly support.
>>
>>60145823
>needing to rewrite all you code every time you buy a new cpu
>>
>>60144425
haskell is not dead , fuking pajeet
>>
File: haskell_programmer.jpg (10KB, 300x300px) Image search: [Google]
haskell_programmer.jpg
10KB, 300x300px
Literally never saw a production quality product using templates, multiple inheritance, raii, stl, boost, operator overload, lambdas or other shit.

It's always C, reaaally lightweight C++, finely tuned appropriate of inhouse stl and a bunch of silly languages like lua/python/js for small tasks
>>
>>60145527
>>>/pol/
>>
File: wtfthisshitagain.png (286KB, 994x633px) Image search: [Google]
wtfthisshitagain.png
286KB, 994x633px
>>60145836
oops I meant to instantiate the enable_if.
template <typename U = T, std::enable_if_t<std::is_trivially_destructible_v<U> == true> = { }>
>>
>>60145863
So shitlangs has to interface with C just to get inline ASM
>>
>>60145821
>if n % 2 is False, then n is odd
this is a correct statement, if you are willing to ignore the immoral conversion of an int to a boolean
>>
Working on a project that emulates certain types of caching systems. Currently on a part where the next line in memory is prefetched into the cache regardless of a cache hit or miss, and another part where the next line is only prefetched if a miss occurs. First one has just under the right amount of hits, the second is a little bit over the amount of hits. Can't figure out where my logic is wrong because both of these are only slight variations of a previous part I already completed. What's the best way to go through my code and figure out why my hits aren't adding up correctly when I'm dealing with 1 million+ lines of address-related input?
>>
>>60145883
Haspale is dead and burried. It divided into two languaes
>>
>>60145902
but it didn't
>>
>>60145902
You mean it reproduced?
>>
>>60145890
What super awesome language are you referring to that has inline ASM suport?
>>
>>60145787
I agree with this statement.
>>
>>60145821
Modulo isn't a logical operator
>>
>>60145915
C, C++, Rust, D
>>
>>60145912
Into two seperate trashcans
>>
>>60145872
Virtually all processors these days are x86-64.
>>
>>60145836
Thanks for breaking my compiler.
fatal error C1001: An internal error has occurred in the compiler.
1> (compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\template.cpp', line 13144)
1> To work around this problem, try simplifying or changing the program near the locations listed above.


>>60145859
I agree, although it also has its nice parts (which is the reason I use it)
>>
>>60145939
Didn't you learn the difference between death and birth at school, anon?
>>
>>60145893
>this is a correct statement
how ? if n % 2 is True then it means there's a remain on the division by 2 and therefore it's an odd number, isn't it ?
>>
>>60145584
There's no difference between typename and class in templates other than the fact that you need to use class if you use template-template (which is not the case here), and it's fixed in c++17 IIRC.
>>
>>60145947
This is completely and hilariously wrong.

What processor do you think your phone has?
>>
>>60145955
It's dead tho
>>
>>60145928
Those are all pleb tier 'inline assembly'.
Real inline assembly should just be regular language constructs that happens to emit specific op codes.
Forth and Lisp does it correctly.
>>
>>60145975
It looks alive and well to me, certainly more alive than D.
>>
>>60145974
People on /g/ typically don't write softwares for phones.
>>
File: wtfthisshitagain.png (225KB, 855x615px) Image search: [Google]
wtfthisshitagain.png
225KB, 855x615px
>>60145974
phones are a fucking meme
>>
>>60145992
Irrelevant.
>>
>>60145928
Inline ASM support is nice if you want to get most out of your CPU no matter what. It doesn't make sense to implement inline ASM support in a language like Java or Haskell.
>>
>>60145990
>D
>22

>Shitkell
>38
It's over lads, Shitkell BTFO
>>
>>60146021
>D
>49

>Haskell
>11
>>
>>60145889
This isn't working either
error C3111: An initializer list cannot be used as the default argument for a template parameter.

I'm sorry that I am too inept to figure this out myself and have to rely on your knowledge.
>>
File: wtfthisshitagain.png (229KB, 769x604px) Image search: [Google]
wtfthisshitagain.png
229KB, 769x604px
>>60145951
that's what you get for not using gcc
>>
>>60146021
>TIOBE
ok newfag
>>
>>60145896
Help me boys. Don't need anyone to write the code for me, just need advice on how to tackle figuring out why I'm not getting the right answers given over a million lines of input.
>>
>>60146021
>>60146036
Ahahahaha, how will shitlel ever recover
>>
>>60145959
that guy is just being autistic for no reason, just ignore him
>>
>>60146011
>Inline ASM support is nice if you want to get most out of your CPU no matter what
Except that most compilers are way, way smarter than the people who use them. That goes twice if the user is a /g/tard.
>>
>>60146044
http://pypl.github.io/PYPL.html
>D isn't even on the list
>>
>>60146033
try () instead of = { } maybe. that syntax should be valid though. are you still compiling in c++11 mode?
>>
>>60146053
shhh

they think they're good programmers by writing everything in assembly, don't upset them
>>
>>60146035
wow i didn't know richard stallman has enough money to afford ganoo shills
>>
>>60146058
Based Java
>>
>>60146006
Not irrelevant, because so much software makes assumptions about the systems in its very design, so porting it to a phone wouldn't work even if there wasn't any assembly code used. Phones don't even have standard streams.
>>
>>60146005
I've seen this specific captcha about 100 times now, what gives?
>>
>>60146053
That's true, but sometimes you have to resort to inline ASM. For instance, libyuv uses inline ASM to speed things up.
>>
>>60146086
You said "Virtually all processors these days are x86-64". You never mentioned anything about standard streams or anything else.
>>
>>60146011
>>60146053
>>60146070
>implying asm is only used for speed
try writing an OS in hasklel sometime.
>>
>>60146119
But haskell cannot be used for anything but fizzbuzz projects
>>
>>60146053
People have been saying that since 1956. It's still not true, what truth it has today is mainly due to people today choosing not to learn assembly. Even modern optimizing compilers frequently add prologue and epilogue and create stack frames even for functions that use exactly zero stack space. I've even seen cases where a calling convention passes arguments in registers, yet the compiler emits code that COPIES ARGUMENTS FROM REGISTERS INTO THE STACK AND THEN COPIES THEM BACK INTO REGISTERS, all before actually doing any computation.
>>
>adult male
>thinks compiler will take care of his problems
roflmaoing right now to bee honest
>>
File: wtfthisshitagain.png (231KB, 968x645px) Image search: [Google]
wtfthisshitagain.png
231KB, 968x645px
>>60146108
idk but from now on I'm screencapping it every time I see it
>>
>>60146114
I meant in the context of stuff people around here actually program for.
>>
File: 1470613970762.jpg (41KB, 960x960px) Image search: [Google]
1470613970762.jpg
41KB, 960x960px
>swift faster than trashkell
AHAHAHAHAHA Can't make this shit up
https://benchmarksgame.alioth.debian.org/u64q/nbody.html
>>
>>60146182
Swlel
>>
>>60146182
We should all use Fortran.
>>
>>60146148
>adult male
>thinks he outsmarts the compiler when he uses inline assembly xor to zero his variables
>>
Reminder to learn assembly. It's really useful, not even joking.
>>
>write a library for my favorite lang
>only people using that lang can use it
>have to upload to repository and get shitlords open source access to my code

>write rest api for my library
>anyone can use it
>complete control over releases, can be closed source if I choose

why arent we all webdev yet
>>
File: 1490538611370.png (143KB, 332x394px) Image search: [Google]
1490538611370.png
143KB, 332x394px
>>60146201
*SHITKELL
>>
>>60146182
>Fortran faster than Rust
>a language from 1957 is faster than a language from 2005
AHAHAHAHAHA Can't make this shit up
>>
File: wtfthisshitagain.png (235KB, 1055x611px) Image search: [Google]
wtfthisshitagain.png
235KB, 1055x611px
>>60146214
I agree with this statement.
>>
>>60146224
Shift
>>
>>60146220
because libraries and APIs usually do two different things
libraries provide functionality
APIs provide data in an agreed format
>>
NEW THREAD
>>60146297
>>60146297
>>60146297
>>60146297
>>
>>60146270
incorrect
>>
>>60146061
I appreciate that you try to help my, but this doesn't seem to be working either. Btw I have switched to clang (hoping it has better error messages) and compile with -std=c++1z.
<source>:11:91: error: expected expression
template <typename U = T, std::enable_if_t<is_trivially_destructible_v<U> == true> = ()>
^
<source>:14:92: error: expected expression
template <typename U = T, std::enable_if_t<is_trivially_destructible_v<U> == false> = ())>
^
<source>:18:34: error: no matching member function for call to 'print'
int main() { motherfucker<int>().print(); }
~~~~~~~~~~~~~~~~~~~~^~~~~
<source>:12:10: note: candidate template ignored: couldn't infer template argument ''
void print() { std::cout << "Yeah boi" << std::endl; }
^
<source>:15:10: note: candidate template ignored: couldn't infer template argument ''
void print() { std::cout << "Nah man" << std::endl; }
^
>>
>>60144396
D
>>
>>60145560
>template <typename T>
>struct motherfucker
lost
Thread posts: 345
Thread images: 28


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.