[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: 315
Thread images: 32

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>58637935

What are you working on /g/?
>>
First for Rust
>>
File: How to use WD-40 to remove Rust.jpg (69KB, 640x426px) Image search: [Google]
How to use WD-40 to remove Rust.jpg
69KB, 640x426px
>>
Webkit browser in Linux framebuffer / direct rendering
no more Xorg or wayland will be needed in order to shitpost
>>
>>58642700
But how will I shitpost without ricing?
>>
Haskell
>>
>>58642711
you will rice your console browser
>>
How do you like my FizzBuzz? It's actually pretty easy when you get the hang of it.

http://pastebin.com/cEjZG6Vk
>>
what language is Puzzle and Dragons made in?
>>
File: pajeet.png (26KB, 308x302px) Image search: [Google]
pajeet.png
26KB, 308x302px
rate my power function
>>
>>58642794
your opening braces are on the wrong line
>>
>>58642783
If you scroll, it's like watching an old CRT with tracking issues.
>>
>>58642801
I apologize, I'm still learning
>>
>>58642794
>>58642810
how come the quality of /g/ goes down by orders of magnitude whenever Ruby's not around?
>>
>>58642829
Ruby shitposts without trip on to make it look like the quality goes up when he posts.
>>
>>58642829
because you're obsessed with him
>>
>>58642829
it doesn't
>>
Python is shit, why do people use it?
>>
File: ada33f8e61.png (11KB, 600x400px) Image search: [Google]
ada33f8e61.png
11KB, 600x400px
>>58642671
Just implemented the timer.
>>
>>58642682
>That's not surprising but it also makes you wonder how they made it work.

Well a () is an empty struct. And likewise ! is an empty enum. You can implement it yourself:

enum Never {}

fn infinite_loop() -> Never {
loop {
// un-commenting the following line will cause a type error
// break;
}
}
>>
>>58642971
>Well a () is an empty struct. And likewise ! is an empty enum.
Yeah, I get that, but it's interesting that they can figure this out from a loop and not recursion.
>>
>>58642971
! seems pretty interesting, even Haskell doesn't do this
>>
File: 1437663010095.jpg (93KB, 679x453px) Image search: [Google]
1437663010095.jpg
93KB, 679x453px
testing my unsafe bytebuffer in java

writing 2048 bytes, shorts, ints, longs, float, double, chars into the buffer and reading them back out without re-allocating.

that's 59kb of data and it takes 5ms. looks to me really slow.

next I will test bulk copies.
>>
>>58642996
java first runs in interpreted mode and eventually compiles. also there is a margin of error. do that a million times over and time that to get a better idea of performance.
>>
>>58642994
Haskell doesn't really have a need for it.

It's useful in Rust because having an empty type can lead to certain optimizations (e.g. Result<T, !> is just a T).
>>
>>58642992
>not recursion.

What do you mean? This compiles:

fn infinite_loop() -> ! {
infinite_loop()
}
>>
File: Evapo-Rust (1).jpg (38KB, 450x400px) Image search: [Google]
Evapo-Rust (1).jpg
38KB, 450x400px
Please stop discussing meme languages :)
>>
>>58642889
its easy to throw a script together
its basically for people who can't program/can't be bothered to use bash
>>
>>58643029
Yes, I know. And it's obvious why that type checks. It's not so obvious why loop {} : ! but loop { break; } : (), at least not to a computer as far as I can imagine.
>>
>>58643034
Nobody's even mentioned C, Java, Ruby or Python yet
>>
>>58643045
>C
>Meme language
(You)
Also, Java has been mentioned.
>>
>promoted and move departments
>exec wants me to spearhead our move C#/.NET
>literally everyone under me is proficient in Java only
>half of them are curries with an effective learning disability and tenuous grasp on the English language
>my career hangs in the fucking balance

How do I tell him to fuck off politely? This is actually going to ruin our small company. I should start applying for other jobs.
>>
>>58643053
C is a meme language full of terrible decisions and a lack of any and all real features
>>
>>58643009
holy shit should have thought of that. it drops from 5ms to 0.02 - 0.03ms. I guess that's an improvement
>>
>>58642794
0^0 = 1
>>
>>58642994
>>58643015
https://hackage.haskell.org/package/void-0.7.1/docs/Data-Void.html

https://hackage.haskell.org/package/void-0.7.1/docs/src/Data-Void.html#Void
>>
>>58643064
>full of terrible decisions
Please elaborate.
>lack of any and all real features
C is minimal on purpose. Bloat does not lead to a good language.
>>
>>58642794
rate mine

double power(double a, double b){
return exp(b*ln(a));
}
>>
>>58643059
>I should start applying for other jobs.
You should have done that earlier. How did you not notice this level of dysfunction in the company?
>>
>>58643079
>Edward Kmett
Big surprise.

In Haskell void is just
forall a. a
anyway.
>>
>>58643059
Just tell him everything will be fine and then hop on the first job offer you get to escape. I have been there and done that with ugly executive level decision making. You can't change his mind. He probably already got his kick-back from Microsoft and plans to fire the lot of you and outsource to a contractor in Deli.
>>
>>58643044
>at least not to a computer as far as I can imagine.

All it needs to do is find out all the possible return paths are. break, return or the last line are the only times things return values, so it's not like it can miss cases, it just needs to propagate the type. And if any of them have a type that doesn't match, it knows its a type error.
>>
>>58643088
>C is minimal on purpose
I don't even believe this.
I actually believe that C just wanted to stay as it was, and that's why they never added to it.
>>
>>58642677
Here's the thing. Good quality code upfront is always cheaper than mediocre code that needs to be re-engineered. Rust forces a relatively high minimum code quality.
>>
>>58643088
>>58643115
And that it was basically a "C is fine as it is!" kind of madness that led them to think changing it would mean it wasn't perfect
>>
>>58643115
It was minimal because they couldn't add any more keywords to the symbol table due to space restrictions. Nobody else implementing C wanted to drift too far from "standard C", and later C got standardised on that small set of aspects.
Also makes it easier to implement on a new system.
>>
>>58643095
The suit in question hasn't been this abruptly stupid before. This is a new thing. I was concerned about the amount of H1B coming in the door but I figure that's industry standard at this point.

>>58643103
I'm too honest to bullshit like that, and I doubt he is being bribed, but yeah I could see this transition killing our house dev. team. Maybe it is a pretext to outsource.
>>
>>58643115
>and that's why they never added to it
But they have added to it.
Do you think there was ANSI C, and then nothing else after that?
They're working on a new standard at the moment (C2X).

>>58643124
I never said C was perfect.
However, C does what it was designed for very, very well.
>>
>>58642671
Thank you for being a sane and adequate person
>>
>>58638285
True, but that is a niche application.
>>
>>58643137
>they couldn't add any more keywords to the symbol table due to space restrictions
That's wrong and stupid.
They just don't like adding keywords because it can break old code.
That's why all of the new keywords added an in the "standard's namespace", like _Bool, _Noreturn, etc.
They provide convenience macros so that you can use more sensible names, and not break programs that don't use them.
>>
>>58643147
>they have added to it
Very little.

I'm saying I think that the reason C hasn't had any major additions isn't because it's minimalist but it's minimalist because it hasn't had any major editions. Minimalism is kind of like an excuse.
You could even add things like discriminated variants, pattern matching, proper imports, etc which would include certain parts of C code dramatically and which could have pretty trivial semantics
>>
what format does a openGl texture have?

I have some image files in a custom binary file and I would like to write a custom encoder so I can directly bind them. at the moment I have to convert them by cpu to pngs and that's slow as fuck.
but that's kinda out of my comfort zone.
>>
>>58643159
That's the C origin story though, why are you so aggressive? I'm feeling threatened.
>>
>>58643142
>Maybe it is a pretext to outsource.
Oh it is. I've seen it happen a hundred times here in NYC. Small company gets a little fat in the development department, wants to go in another direction, can't be arsed to go and do serious training or hiring, floods the existing people with work they can't do and then hopes that most quit before laying off the rest.

It's an ugly side of our business but honestly given the employment laws in the first world there is no way a company can be agile and profitable vs. big boys paying no taxes like Google unless they adopt this kind of villainous behavior.
>>
>>58643170
i think s3tc
>>
>>58643179
make google pay taxes again
>>
>>58643169
Those features would actually require massive overhauls to how parts of the language would work.
>>
i wanna make videogaymes. i come to /g/ and pretend i dont want to make videogaymes. Even though I do
>>
>>58643066
is that not correct?
I thought anything to the power of 0 is one
>>
>>58643254
But 0 to the power of anything is 0.
Really, it's undefined.
>>
>>58643215
nope

>discriminated variants and pattern matching
discriminated variants are 90% syntax
C programmers already use loads of them

pattern matching is 90% syntax
C programmers do it awkwardly all the time

switch(v.index) {
case LAM: ... v.var ... v.type ... v.expr ...; break;
}

switch(v) {
case LAM [ v = var, t = type, e = expr ]: ... v ... t ... e ...; break;
}

you could even re-use enum, since enums are a special case of discriminated variant

>imports
depending on the system you use this might be non-trivial, but the main detail is being able to control what is imported and exported
>>
>>58643254
That is correct I don't know why he's saying it isn't
>>
>>58643254
0^0 is undefined.
0 is a very special number.
>>
>>58642794
(define (pow b0 x0)
(let iter ([a 1] [b b0] [x x0])
(if (zero? x)
a
(iter (if (odd? x) (* a x) a)
(* b b)
(quotient x 2)))))


int power (int b, int x) {
int a = 1;
while (x) {
if (x & 1)
a *= b;
x >>= 1;
b *= b;
}
return a;
}
>>
>>58643307
The issue with tagged unions is how do you control how the tag and data are stored? It wouldn't make sense for C to have a feature that isn't flexible in terms of representation.
>>
>>58643194
shhh they'll hear you
>>
>>58643336
Well, a non-primitive feature anyways.
>>
>>58643336
>>58643354

It's stored like a struct with a descriminator + a variant
>>
>>58643336
>that isn't flexible in terms of representation.
structs have all sorts of padding rules that you don't control.
An enum would just be defined to be like a struct with an int tag at the top and a union for all the variants. This could be very well defined.

I however understand why an import system wouldn't work, basically the only reason people still hang on to C is because of the nice ABI and import system would cause mangling and god knows how they'll fuck that up in the standard.
>>
>>58643307
Pattern matching would require quite a change to the semantics of switches.
It makes absolutely no sense for a pattern match to fall-through, but normal switches allow it.
So you're either going to have a weird "forced" break, a duplicate facility of switch with a new keyword, or weird, hard to specify behaviour of allowing fallthrough.

>>58643354
>>58643366
C clearly doesn't like to have those sorts of features, considering none exist.
>>
>>58643382
Additionally changing switch to actual pattern matching will immediately drop the support from the embedded community.
>>
>>58643366
>>58643373
Well-defined doesn't mean good. It might be better to have the tag after for alignment purposes. You also might want to have N tags in one array and N data in another.

>>58643382 also makes a good point about switch vs. match.
>>
>>58643382
>Pattern matching would require quite a change to the semantics of switches.
>It makes absolutely no sense for a pattern match to fall-through, but normal switches allow it.
>So you're either going to have a weird "forced" break, a duplicate facility of switch with a new keyword, or weird, hard to specify behaviour of allowing fallthrough.

>not breaking for a variant is UB
it's that simple

>>58643382
>C clearly doesn't like to have those sorts of features, considering none exist.
Except, you know, enums.
Oh, and designated initializers.

But nobody actually likes or uses those C features anyway!
>>
how would you go about setting up a 9 x 9 display using graphics
>>
>>58643409
>Except, you know, enums.
Enums are defined to be an integer type. It's pretty simple.
>designated initializers
That has nothing to do with this.
That's just a convenient way of initialising structs and arrays.

C doesn't have any language feature that will declare some sort of struct or union type without you explicitly doing so.
>>
Languages shouldn't support pattern matching, at least if they want to be reasonably efficient and allow the programmer to have control over data arrangement. What they should have is generics with type classes (or templates) and a generalized kind of lambda where you have a single environment shared between multiple subroutines. With a Scott encoding of sum types (potentially as a trait so you can implement the same data type in different ways), this recovers pattern matching in a rather elegant and way while being a useful and generic feature.
>>
>>58643310
that means google's calculator done goofed
>>
>>58643398
In the vast majority of cases that is the desirable representation

otherwise you could always have something like

switch(tag, pointer)
case Ctor[ a1 = arg, a2 = otherarg ]


>>58643428
>Enums are defined to be an integer type. It's pretty simple.
discriminated unions could be defined to be an enum + a union
it's pretty simple

>>designated initializers
>That has nothing to do with this.
>That's just a convenient way of initialising structs and arrays.
It makes use of patterns, or copatterns.

>>58643428
>C doesn't have any language feature that will declare some sort of struct or union type without you explicitly doing so.
C has a feature which declares an int alias without explicitly telling it to do so, called enum.
And why not add it?
>>
>>58643440
How is pattern matching inefficient? Also you could make a theoretical language syntax where patterns are indepedent of data arrangement. Not saying C should add all this (C probably shouldn't add anything; we need an overhaul if we want to move on).
>>
>>58643440
>allow the programmer to have control over data arrangement
99% of programmers in industry don't care about this
>>
>>58643461
Why don't you make a proposal to the C standards committee then?
Talking about it here isn't going to change anything.
>>
>>58643440
Cinbreds everybody. So retarded they think their extensive fizzbuzz expertise (they took only 27 years to learn to fizzbuzz!) means C is the best language, and they just can't wait to educate you about it!
>>
>>58643478
Pattern matching itself isn't inefficient, but if you have it as a language feature then you generally also have to constrain the representation of the sum types themselves. This method simply extends lambdas so they can be used to recover something that looks a hell of a lot like pattern matching while retaining as much performance potential as possible and without being specific to that use case.

>>58643485
We are talking in terms of C here, anon.
>>
>>58643519
>Why don't you make a proposal to the C standards committee then?
I don't like C
>>
>>58643521
>We are talking in terms of C here, anon.
Sorry! I thought you was just publishing a free of context manifesto.
>>
>>58643521
Nobody wants to actually program in the lambda calculus, anon.
Also turning unions into lambdas is more overhead than any C programmer would like to stomach.
>>
>>58643520
What? Did you read or even comprehend that anon's post at all?
Your response makes absolutely no sense.

>>58643524
Why do you care so much then?
>>
How different is Opengl 3.1 vs Opengl 3.3.
>>
>>58643541
>Why do you care so much then?
I'm just saying I don't believe that C is actually minimalist, I think they just say it because they don't want to add features.

That might change soon though, especially if they add closures or runtime generics. (The latter can just be void*)
>>
File: racket-logo.png (39KB, 512x512px) Image search: [Google]
racket-logo.png
39KB, 512x512px
Racket version 6.8 has just been released so I'm going through and checking out the changes. Seems to be mostly optimizations rather than changes to the libraries.
>>
What's the best language for big guys?
>>
>>58643577
Java
>>
>>58643571
>I
who?
>>
>>58643585
anon, of course
>>
>>58643571
>it's not on AUR
feelsbad
>>
>>58643596
>using a pleb tier distro
yeah, it sure does.
>>
>>58643620
What's a good distro for a programming enthusiast?
>>
>>58643629
gentoo and slack are top tier. i personally prefer gentoo
>>
>>58643571
>typed racket typechecking performance improvements
I hope this is really the case because compiling typed racket code is slow as hell
>>
>>58643535
Well, in terms of a language that is as concerned with performance as C is. At least I am.

>>58643537
>Nobody wants to actually program in the lambda calculus, anon.
Not talking about lambda calculus.

>Also turning unions into lambdas is more overhead than any C programmer would like to stomach.
I am not talking about encoding the data as lambdas. I am talking about using a "generalized lambda" for pattern matching. Typically it will all be inlined so there isn't really any performance difference between having this "generalized lambda" where multiple subroutines share the same environment and multiple lambdas, but when it comes to a substructural type system then you want to express whether a branch arm is used at most once or at most any number of times and thus whether it is allowed to consume or only borrow affine resources from the context.

You can get most of the way with Rust, but it lacks this "generalized lambda" that would essentially be the ability to anonymously implement traits.
>>
>>58643693
>the ability to anonymously implement traits
While capturing variables, I should add.
>>
What are some programming concepts that took you way too long to understand?
Personally
>Haskell type signatures and their significance
>Closures
>>
>>58643596
>>58643660
I made a dumb overlay[1] for Portage so that I could install the newest versions of Racket without having to wait for the scheme herd to get off their asses and add Racket to the main Portage list.

[1] https://github.com/lehitoskin/racket-overlay
>>
https://www.youtube.com/watch?v=9QE-z0aQheU
Shit, have to wait until tonight until I can watch it.
>>
>>58643776
>three and a half hours of someone else doing work
hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
>>
>>58643788
Because there is no way anyone can learn anything from watching others work and explaining their work.
>>
>>58643564
The difference is 0.2
>>
>>58643828
I'm here on level 2 or 3
He's up on level 6 or 7
I'm not going to get to his level by just watching him
I'm going to get to his level by learning from teachers
OK???
>>
File: IMG_5947-fourchan-g-58621095.jpg (74KB, 1280x720px) Image search: [Google]
IMG_5947-fourchan-g-58621095.jpg
74KB, 1280x720px
Is C++ still the way to go for cross platform desktop programs ?
>>
>>58643867
Java
>>
File: akari.png (266KB, 765x1045px) Image search: [Google]
akari.png
266KB, 765x1045px
>>58643867
try haskell
>>
>>58643862
So the reason you posted is that you wanted to tell everyone how new you are? Okay then.
>>
>>58643896
Are you saying I'm not new?
>>
Learning emacs while taking a Scientific Python class. For my HW, I need to copy+paste the code from my python scripts onto a text file, and I was curious how you would do that with emacs, because I don't think I can copy+paste text between different emacs sessions
>>
>>58643867
Definitely not.
You shouldn't use C++ for any purpose.
>>
File: 1479592760135.png (114KB, 511x511px) Image search: [Google]
1479592760135.png
114KB, 511x511px
Anybody who unironically uses C++ should kill themselves.
>>
File: 1473168190943.jpg (67KB, 521x697px) Image search: [Google]
1473168190943.jpg
67KB, 521x697px
>>58642996
now redid the test with bulk memory copy instead of putting individual primitives and I got a speed increase of 400% to below 4000ns. that's pretty cool.
>>
>>58643867
tcl/tk
>>
>>58643867
Yes
>>
>>58644005
What would advice me to use senpai?
>>
>>58643896
>>58643941
Pfft, plebs. I'm the newest one here.
>>
>>58644018
rude desu

some of us dont have a choice
>>
>>58643867

C++ is still the way to go for most game development, cross platform or otherwise. C# with Unity is, however, becoming a more popular option, particularly with Indie developers.
>>
>>58644107
You always have the choice of killing yourself.
>>
File: 1484950301696.jpg (146KB, 432x529px) Image search: [Google]
1484950301696.jpg
146KB, 432x529px
>>58644124
>>
>>58644122
the patrician choice is still ue4. unity is a the lame duck version
>>
>>58644122

i dont care if its even in Unity, when people say C# for game programming i want to scream

c++ or nothing.
>>
>>58644172
>i want to scream
Post boi pucci
>>
>>58644172

this. I feel M$ shills c# for muh game programming to lure noobs into their shitty layered and confusing technologies

tho CORE is cross platform which is bretty kool
>>
File: 1479596863096.png (20KB, 640x480px) Image search: [Google]
1479596863096.png
20KB, 640x480px
> he can't pick row-major or column-major matrices
>>
Please spoonfeed me on Ruby - what is it useful for, what is it useless for, etc.
>>
>>58644300
for being a hipster while sipping starbucks
>>
God bless /dpt/. I wish /dpt/ had a separate board.
>>
>>58644300
Ruby is a programming language for girls
>>
>>58644320
We had a text board for that. Unfortunately there were too many EXPERT PROGRAMMERS around and Mootikins axed the server.
>>
>>58644346
I am a girl(male).
>>
>>58644300
Concise, highly expressive code. It takes a lot of inspiration from Smalltalk and CLOS in the "everything is an object" sense. Unfortunately, this comes at the cost of execution efficiency.
>>
Trying to learn python. What the fuck is a list comprehension? And what is the question even asking?
>>
File: Ruby.jpg (43KB, 449x600px) Image search: [Google]
Ruby.jpg
43KB, 449x600px
>>58644411
>>
>>58644404
Have you met Ruby?
She's a girl (female)
>>
>>58644370

ya technology should be 2 boards honestly

tech general and programming/developing
>>
>>58644429
It can be called engineering and we'll let you shit it up
>>
Whats a fun OOPL to code in? It has to be OO for my class. No python ruby smalltalk java or c# because they are taken.
>>
>>58644470
scratch
>>
Someone redpill me on lambda calculus

Should I put even an ounce of effort into learning it instead of just doing more binary tree algorithms?
>>
>>58644470
>fun
>OOP
>>
>>58644470
C++ then
you're already doing OOP so go for maximum suffering
>>
>>58644483
learn Haskell or OCaml and you'll learn lambda calculus
>>
>>58644495
>autism
>>
>>58644527
this
OOP is autism
>>
>>58644472
>>58644495

>>58644505
I'll ask my professor but I think she doesn't want us to use it.
>>
>>58642693
get out
>>
>>58644241
You can't imagine how jealous I am
>>
>>58644580
forgot the first part of my post "thanks for the memes"
>>
Why doesn't /g/ ever talk about mobile development?
>>
File: 1479605643910.gif (3MB, 445x247px) Image search: [Google]
1479605643910.gif
3MB, 445x247px
>>58644643
HAHAHAHHAHAHA
>>
>>58644643
Because we're hipsters.
>>
>>58643142
If it is a pretext to outsource, ask him to be honest with you. Because in that case, you can plan ahead, you can all fuck over the H1B (isn't that the name of the avian flu?) curries, and you can change jobs and part on friendly terms with the suit.

Better for all the humans involved.
>>
>>58643147
It was designed to be a layer of abstraction over the PDP-11's assembly.

How is that relevant in 2017?
>>
>>58643440
I don't want to care about the data arrangement.

Why should I have to care about that shit? I don't care how the language stores values, whether it caches them or whatnot either.

It's not a relevant choice.
>>
>>58643629
Depends. How much do you want to fiddle?

> Lots
Slackware, Gentoo, Funtoo

> Some
Debian, Fedora

> None
Mint, Ubuntu

All are valid choices.
>>
>>58644194
>this. I feel M$ shills c# for muh game programming to lure noobs into their shitty layered and confusing technologies
You realize that Uniity is built on Mono, right? Why would Microsoft want people to use Mono?
>>
>>58644693
Because embedded systems without operating systems exist.
>>
>>58644419
Generate a list of numbers from some num i to j and then do that again but with some num where i < j
>>
>>58644693
Epic meme, bro.
>>
>>58644470

>Because they are taken
Everyone has to use a different language? Because Ruby and Smalltalk are probably the most object oriented of object oriented languages...

Fuck it, take F# and program it in an object oriented manner. It shouldn't be too difficult, since it's a .NET language just like C#. Alternatively, CoffeeScript is also fun. It's basically JavaScript with the syntax of a Pythonish/Rubyish fusion.

>>58644643

Mobile applications require sticking to one of a small handful of major APIs that aren't exactly fun to program in. Unless you have an idea for a specific mobile application, there's not much reason for a hobbyist to program for mobile platforms.

The desktop is truly the greatest platform for developing any software, because there are no rules, really.
>>
>>58643867
Depends on program.

Java is pretty good (use a modern toolset and a modern definition of the language. StackOverflow-tier shitposts about how Java doesn't have native look-and-feel should get autobanned. It's had it since what, version 6?), and you will have a rather comfy experience.

Just don't go full hindu and use ONLY say Eclipse and think that this is how you're supposed to do thing. Java is a collection of tools that you chain together. You can compare this to C# where you seem to have fewer tools but they all work under Kind Overlord MSVS.

Python is supposed to be great, but I've never had much reason to use it that much, so I can't give any opinion.

Of course, if you're good with C++, there's no reason to not use C++.

>>58643988
You could save to file, but killing text also lets you paste it (like you know, via C-v on notepad), and thus you can paste it that way.
>>
File: 1473052483575.jpg (224KB, 1920x1080px) Image search: [Google]
1473052483575.jpg
224KB, 1920x1080px
Is it possible to enter unreal mode from a vm86 task?
>>
>>58643254
Maths people are weird. They have negative 0 and positive 0 too.
>>
>>58644470
Common Lisp. Use CLOS. After that, feel sad that you don't get to use CLOS again.
>>
>>58644419
list comprehensions are a convenient way to initialize a list, like if you need a list of square numbers you just do
l = [x*x for x in range(whatever)]

>>58644776
I think they have to generate lists of pairs
>>
>>58644736
Those don't run PDP-11s.

That C is the best fit for them is a good reason for C, but C was not designed for that purpose.
>>
>>58644423
Different continents, dude.
>>
>>58643254
1 = x^1/x^1 = x^(1-1) = x^0
x can be any number but 0 because 0/0 is undefined
>>
>>58644848
What exactly in C is "tied to" PDP-11s?
>>
Has anyone gotten their SGX licence?
I'm still waiting for Intel to approve NEET Omnicorp as a trusted developer.

I wish AMD SME wasn't so God damned useless. Tech for pedo's who worry about cold boot. Nothing else.
>>
>>58644852
https://youtu.be/BRRolKTlF6Q
Maybe this is appropriate for you to understand the problem.
>>
Anyone who can't answer this correctly should never come back to /dpt/:
int a = 20, b = 10;
a = b;


What are the values of a and b after running the following code
>>
>>58644857
That's an irrelevant question. It was originally designed for the PDP-11.

Hence, whatever reason you may have for using C, the original purpose for which it was designed is an unlikely one. (If you do have a PDP-11, that's actually kind of cool.)

C therefore has to have some properties outside of "abstraction for pdp-11 assemblies" to be good.
>>
>>58644889
Hmmmmm, 6?
>>
>>58644889
clearly 30
>>
>>58644889
They switch.
a = 10;
b = 20;
>>
>>58644889
Hmmmmm, false?

>>58644894
>It was originally designed for the PDP-11.
Your point being?
Why is that relevant at all?
>>
>>58644889
Do we overload the assignment operator for ints or not?
I can't answer this without making wild assumptions.
Leave your homework out of /dpt/.
>>
Just finished setting up a crontab for a python program I wrote!

It's more of a "getting the hang of python" than anything, but I figured I could make some interesting analyses from the conclusions...

On a related note, does anyone know any good websites for code review? I'm looking to see how I can optimize my program;

https://github.com/CubicProgramming/python_project/blob/master/access_politics.py
>>
File: 7180340460178.gif (3MB, 286x258px) Image search: [Google]
7180340460178.gif
3MB, 286x258px
>>58644889
>>
>>58644889
The answer is that it depends upon the language in which you've written said code.

I feel that it SHOULD be a = 10, b = 10, but it might crash (lol all vars are consts!), fail to unify (this is really just prolog with C-syntax) or something else entirely.

So it depends entirely on language definitions.
>>
>>58644914
kill yourself dude not joking
>>
>>58644908
If you looked at the original question, it said that C is good because of its original purpose.

I asked why being a good abstraction for the PDP-11 assembly language had any bearing on programming in 2017.
>>
File: 433346.jpg (15KB, 293x327px) Image search: [Google]
433346.jpg
15KB, 293x327px
>>58644919
>>
>>58644925
The original K&R C was designed for the PDP-11 so they could more easily implement and port Unix.
ISO C was not designed for that purpose.
Please talk about the correct definition of C: ISO C.
>>
>>58644910
>litteral reddit

Fuck off and kill yourself.
>>
>>58644925
You assume the original purpose wrong from the beginning.
C was created to port UNIX to any other platform besides PDP-11.
>>
File: 1477922731908.jpg (21KB, 599x334px) Image search: [Google]
1477922731908.jpg
21KB, 599x334px
>>58644934
>>
>C is designed to use processors well
Not true, not true; wrong. Processors are designed to execute C compilations well.
>>
>>58645075
What are you on about. C isn't 'designed to use processors well'. A lot of the time when you just write C code it's overspecified and doesn't optimise well.
C lets you write code that utilises the processor well and so far we don't have many other options for those who want to get the most out of it.
Processor instruction sets aren't designed around programming languages at all. And you really could fit more snugly with the processor if you made something that tries to close the gap between assembly and C neatly. And no I don't mean you have to specify register use etc. It's just a shame that we still don't have a language that lets ASM be obsolete.
>>
>>58645100
>It's just a shame that we still don't have a language that lets ASM be obsolete.
I have no idea what such a language would look like.
>>
I want to create a cross platform desktop program. What language and technology/framework should I use? Basically something that would work on Windows/Linux/Mac with minimum hassle.
>>
>>58645126
Lazarus. Never found a language that was less trouble in the long run.
>>
>>58645126
I went down that road a few years ago and I settled on qtgui with python (pyqt bindings).

But I hear the C++ bindings for qt are a mess so it's not as nice when you're gonna need to perform.

The look was pretty so-so though. But it wasn't a major concern for me at the time.
>>
>>58645119
It looks a lot like ASM
>>
File: fightme.png (10KB, 433x131px) Image search: [Google]
fightme.png
10KB, 433x131px
Just reformatted
>>
>>58645119
>>58645170
It probably would be fairly close to asm.
First step would be a platform aware C. Where you for instance have syntax for telling the compiler to prefer one set of instructions over another.
>>
>>58645179
>2017
Already?
Has it gotten even worse than 2015?
>>
>>58645197
I've literally never used 2017, I just figured I'd try it out. I'm shit at programming and probably couldn't give you reasonable information on whether it's actually improved or not.

Well...

The installation process was significantly better. They made it very easy to select what you wanted to do at install and clearly listing what each selection would provide and I think it will lead to less bloat. I don't have any sort of C++ shit installed now because I don't use C++ where as before there would be basic c++ stuff like console applications and c++ winforms support with the standard install. You could also go deeper and basically select which individual tools or libraries you wanted to include in your install so that's an improvement.
>>
>>58645187
>First step would be a platform aware C
But it won't be a high-level language then.
And there's a thing like macroassembler.
>>
>>58643215
for the most part, 99% of the work in new language features are basically just compilerside, and bring very little language change.
It's like java generics - they only exist in the compiler.
>>
>>58644419
the list comprehends an expression to build itself.
>>
Anyone here a fan of Qt?
>>
>>58645100

>we still don't have a language that lets ASM be obsolete
The reason for dipping down into assembly is typically because you need an instruction that your language's compiler will not emit. Languages like C, Rust, etc... are designed to be architecture neutral. They can't make assumptions about the presence of underlying instructions, especially ones used for system-level tasks. You will never see instructions like enable/disable interrupts, set page table register, etc... in a high level language. You also won't typically see them invoking a lot of very case-specific instructions used for high performance tasks. Libgmp has a few sections of code that are written in assembly, for almost every instruction set of note, to use certain instructions useful for arbitrary precision arithmetic that quite frankly, are unlikely to ever be implemented by compiler optimizers.
>>
>>58643310
Indeterminate, not undefined.
>>
>>58644824
We have several groups and each has to use a different language. We were asked what languages we knew so prof could recommend new ones for us. I forgot to put ada on my list so she stuck me in an ada group and I'm trying to get out of programming in ada because I hate doing it. So I have to find a different language that isn't taken. Also I don't think shes going to accept F#
>>
>>58645256
No.
>>
>>58645256
me, i'm trying to download the open-source installer but i can't...
>>
>>58645311
> Doesn't like Ada
Embarrassing
>>
>>58645345
Ada is shit though.
>>
>>58645350
Prove it
>>
>>58645345
I understand what its useful for but I don't want a simple project for my class to take 3 weeks
>>
>>58645359
I said it's shit.
Therefore, it's shit.
>>
>>58645332
What do you mean you can't?

OS? Version?
>>
>>58645371
A simple project doesn't take three weeks unless you have no idea what you're doing
>>
>>58645389
Mint 18.1.


I solved it by disabling ublock origin.


You need to do a little quiz before you can download it now,go check it.


Anyways i got it from https://download.qt.io/archive/
>>
>>58645415
Why did you put so many empty lines into your post, you attention whore?
>>
>>58645432
because i can
>>
>>58645447
You should leave.
>>
>>58645453
you should stop getting triggered
>>
If Rust is such a good language then why are they keep putting out new versions of it?
>>
>>58645406
What if hes pacing to a quarter? literally no reason to rush.
>>
#!/usr/bin/perl

use v5.14;
use strict;

my $ayy;
$ayy = "LMAO";
say $ayy;
for (split (//, substr($ayy, 1))) {
say $_;
}

Is there any regex to remove the first character from the string?
>>
>>58645406
did you read the part where it's written in ada
>>
>>58645537
^.(.*)$
should capture everything but the first character in the first capture group, right
>>
>>58645537
just use a non-capturing group on the first character?
but why would you want this, just substr it?
>>
>>58645537
That's not something you should be using regexes for.
Also, why the hell are you using perl?
>>
What is a good way to check if a number is prime?

namespace _06.PrimeChecker
{
using System;

public class PrimeChecker
{
public static void Main(string[] args)
{
long number = long.Parse(Console.ReadLine());
string result = CheckForPrime(number) ? "true" : "false";

Console.WriteLine(result);
}

public static bool CheckForPrime(long number)
{
if (number == 1)
{
return false;
}
else if (number == 2)
{
return true;
}

long boundary = (long)Math.Floor(Math.Sqrt(number));

for (int i = 2; i <= boundary; ++i)
{
if (number % i == 0)
{
return false;
}
}

return true;
}
}
}
>>
>>58645723
for starters you can skip even numbers
>>
>>58645723
bool
is_prime(int n)
{
if (n < 2) return false;
for (int i = 2; i * i <= n; ++i)
if (n % i == 0)
return false;
return true;
}
>>
>>58645736

I suppose that's better?

 
namespace _06.PrimeChecker
{
using System;

public class PrimeChecker
{
public static void Main(string[] args)
{
long number = long.Parse(Console.ReadLine());
string result = CheckForPrime(number) ? "true" : "false";

Console.WriteLine(result);
}

public static bool CheckForPrime(long number)
{
if (number == 1)
{
return false;
}
else if (number == 2)
{
return true;
}
else if (number % 2 == 0)
{
return false;
}

long boundary = (long)Math.Floor(Math.Sqrt(number));

for (int i = 2; i <= boundary; ++i)
{
if (number % i == 0)
{
return false;
}
}

return true;
}
}
}
>>
School project, I reproduce printf in C.
>>
>>58645723
What is 6*1 - 1?

What is 6*1 + 1?
>>
>OOP? lmao fucking pajeets
said the c programmer as he was writing up another struct
>>
>>58645963
>b-but structs are C so it doesn't count!
>>
>>58645963
You should first learn what OOP is. In case you're trying to troll someone: Acting like a retard is not trolling.
>>
>have 10 mbyte of data
>""compress"" it with lz4
>gained <100kb for a massive performance hit
why bother?
>>
>>58644423
Ruby's not a female dude. and even if she was, she'd be mine.
>>
>>58645903
5
7

Why?
>>
Why does

let foo = filter (==1) in map foo [1,5,2,5,3,1]


do nothing, but

let foo x = x+1 in map foo [1..10]


does? I think I'm misunderstanding what map does.
>>
>>58646029
enlighten me
>>
>>58645757
Look up Sieve of Eratosthenes
>>
>>58646103
All primes will be of the form 6n±1, so you should at MOST be checking those numbers.

Else, do this >>58646161
>>
>>58646183
>All primes will be of the form 6n±1

2, 3
>>
>>58645233
That might change in Java 10 though.
>>
>>58646203
Oh no, two test cases. I guess throw that optimization out since it's only good for numbers you can't count on your fingers.
>>
File: 1465205146416.png (253KB, 1920x1080px) Image search: [Google]
1465205146416.png
253KB, 1920x1080px
Good evening, dpt :)
>>
>>58646215
>gets called out on false statement
>makes a giant strawman to save ego

You're gonna go far, kid.
>>
>>58646257
How can you see anything?
>>
>>58646277
I don't know why you're so retarded. If you're unwilling to use an optimization because you have to check two numbers you're clearly going to crash and burn before too long.
>>
>>58646290
>If you're unwilling to use an optimization

I never said that. I'm not even the original guy. But what you said was a provably false statement.

Dumb mother fucker.
>>
>>58646301
Name a prime besides 2 and 3 that aren't of that form.

Go ahead, smart ass :^)
>>
>>58646310
I already proved you wrong.
>>
>>58646315
>can't name one
>still shit talks

Ok, kiddo.
>>
File: 1485337578698.jpg (67KB, 640x640px) Image search: [Google]
1485337578698.jpg
67KB, 640x640px
How do you boys like my coding?
>>
File: 1458784844736.png (250KB, 1920x1080px) Image search: [Google]
1458784844736.png
250KB, 1920x1080px
I don't understand this problem.
>Your application should read a four-digit
integer entered by the user and encrypt it as follows: Replace each digit with the result of adding 7
to the digit and getting the remainder after dividing the new value by 10. Then swap the first digit
with the third, and swap the second digit with the fourth. Then print the encrypted integer. Write
a separate application that inputs an encrypted four-digit integer and decrypts it

Now what if the user inputs 1208? The last digit, 8 will produce a number bigger than 9 if's added with 7, where does the overflow go?

>>58646284
What's the matter?
>>
File: 1484907778643.jpg (3MB, 4160x3120px) Image search: [Google]
1484907778643.jpg
3MB, 4160x3120px
>>58646329
>kiddo
>>
Is it possible to dynamically create an array of objects with new in C++ that call a constructor with the corresponding argv? I can only figure out how to do it with the default constructor.
>>
>>58643325
(defun pow (a b)
(loop repeat b
as k = a then (* k a)
finally (return k)))
>>
>>58643743
what are closures?
in the context of lisp of course
>>
>>58646363
Considering (9+7)/10 <= 9, you can just add to each digit normally and then go through the rest of the operations.
>>
File: meme8633031079.jpg (95KB, 527x502px) Image search: [Google]
meme8633031079.jpg
95KB, 527x502px
working on copied website

is it possible to create a local html link to parent folder?
>so i can move my files and it will ever be linked
>>
File: 1480733429196.gif (1MB, 193x135px) Image search: [Google]
1480733429196.gif
1MB, 193x135px
>>58646404
Problem is, in C, (4+7)/10=(5+7)10.

When I am going to write the decryptor, it can't tell whether it was originally 4 or 5
>>
>>58646114
>mapping a function that needs lists to numbers
map (filter(==1)) [[1],[5],[2],[5],[3],[1]]
would work
>>
>>58646437
Your problem dealt with the remainder. So (4+7)%10 == 1, (5+7)%10 == 2, etc. What's the issue?
>>
i can't get display all to work. help
it only display the first result i enter

public class OppoBranchesApp
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
Queue branchQ = new Queue();
Queue northQ = new Queue();
Queue southQ = new Queue();
Queue centerQ = new Queue();

for(int i=0; i<3; i++)
{
System.out.println("ENTER MANAGER NAME: ");
String name = input.nextLine();
System.out.println("ENTER DEPARTMENT NO.: ");
int dept = input.nextInt();
System.out.println("ENTER LOCATION: ");
String loc = input.nextLine();
loc = input.nextLine();
System.out.println("ENTER NO. OF WORKER: ");
int num = input.nextInt();

OppoBranches oppo = new OppoBranches (name,dept,loc,num);
System.out.println(oppo.toString());
name = input.nextLine();
}

>Display all
while(!branchQ.isEmpty())
{
OppoBranches oppo = (OppoBranches) branchQ.dequeue();
System.out.println(oppo.toString());
}

}
}
>>
>>58645757
how do i post code like that?
>>
>>58646506
You use xml style tags like <cod e> </cod e> (no spaces)
>>
File: read_the_sticky.png (182KB, 914x396px) Image search: [Google]
read_the_sticky.png
182KB, 914x396px
>>58646506
If only there were something that "stuck" to the top of the board that told you basic information such as this.
>>
Perl guy again.
#!/usr/bin/perl                                    
use v5.14;
use strict;
my $ayy;
$ayy = "LMAO";
say $ayy;
for (split (//, $ayy=~s/^.(.*)$/$1/)) {
say $_;
}


It gives me output:
LMAO
1

What am I doing wrong?
>>
>>58646537
Catalog was a mistake.
>>
>>58646543
>What am I doing wrong?
You are writing in perl.

I'm not even joking, take a look at this.
https://swtch.com/~rsc/regexp/regexp1.html
>>
>>58646537
>>58646533
>>58646551
thanks
>>
>The C standard allows you to declare the control variable in the initialization section of the for header (as in int counter = 1 ).
Can anyone show an example?
>>
>>58646492
www73 . zippyshare . com/v/LUHov0Qa/file . html

the file
>>
>>58646575
ah nevermind
>>
>>58646577


import java.util.Scanner;
/**
*
* @author rosalyneress
*/
public class OppoBranchesApp
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
Queue branchQ = new Queue();
Queue northQ = new Queue();
Queue southQ = new Queue();
Queue centerQ = new Queue();

for(int i=0; i<3; i++)
{
System.out.println("ENTER MANAGER NAME: ");
String name = input.nextLine();
System.out.println("ENTER DEPARTMENT NO.: ");
int dept = input.nextInt();
System.out.println("ENTER LOCATION: ");
String loc = input.nextLine();
loc = input.nextLine();
System.out.println("ENTER NO. OF WORKER: ");
int num = input.nextInt();

OppoBranches oppo = new OppoBranches (name,dept,loc,num);
System.out.println(oppo.toString());
name = input.nextLine();
}

//Display all
while(!branchQ.isEmpty())
{
OppoBranches oppo = (OppoBranches) branchQ.dequeue();
System.out.println(oppo.toString());
}

}
}

>>
>>58646492
>dequeue
>http://tutorials.jenkov.com/java-collections/queue.html#remove
while... {
Object firstElement = queueA.remove();
}
>>
>>58646203
Special case them.
>>
i really like Go, it's easy to read/write (kinda like pseudocode), nice stdlib, pretty fast for its use cases
>>
>>58646543
using 60 spaces before `my`
>>
>>58646596
but I already have linkedlist and queue class
>>
>>58646594
Please use the standard Java curlybrace style.
>>
>>58646620
Oh `my`.
>>
>>58646626
please be patient with me. I started writing codes with c++. I dont know why I learn c++.
>>
>>58646679
>>58646492
>That broken English
Go home Pajeet
>>
>>58646703
englis is hard
>>
>>58646557
Nice paper
But it doesn't help me to perform substr($ayy, 1) with a regular expression.
>>
>>58645657
I know, it's not even efficient. But I want to learn regular expressions.
>Also, why the hell are you using perl?
I want to set up Wakaba and Kareha.
>>
>>58646745
why don't you just use the substring operation? Rewriting standard libraries does not seem like a smart or practical use of time.

Especially given how awful perls regex performance is.
>>
>>58646817
I've used substring operation.
Now I want to try another way.
>>
>>58646594
>Rosalyn
are u a gril
>>
>>58646856
there is no girl on the intenet
>>
>>58646856
https://www.google.com/?gfe_rd=cr&ei=2J6IWLryBOXG8AfB6oD4Dw#q=%22rosalyneress%22

jesus
>>
>>58644727
>You realize that Uniity is built on Mono, right? Why would Microsoft want people to use Mono?
You do realize that Microsoft assigned paid employees to contribute to Mono, right?

Not that that's a bad thing. I think it's good that their putting so many resources into OSS projects. It's good for them because when more developers are using C#, they'll reach into things that integrate nicely with C# like Xamarin and Azure-based services. While Xamarin is free, and they throw free Azure around like Oprah, when these developers get into a decision-making role, they might influence their company to use Azure services, which at that scale is plenty of revenue.
>>
>>58644889
Both 10, in a sane language.

Why would this be a hard question to answer?
>>
>>58646925
>I think it's good that their putting so many resources into OSS projects
lel
It's nothing but a cover of their EEE strategy.
There's no full .NET environment on other platforms but MS platforms.
>>
File: 12323123123.jpg (59KB, 490x506px) Image search: [Google]
12323123123.jpg
59KB, 490x506px
any idea where I screw up here? I'm trying to find the shortest non-repeating set of numbers from the ones in "numbers", to this one the correct part is 3,2,2,1 but it always returns the value 3 despite it being 4 or more
>>
File: tmp_21323-f391789671536.png (418KB, 1280x720px) Image search: [Google]
tmp_21323-f391789671536.png
418KB, 1280x720px
>>58647004
>dio
>>
File: Us1eRga.gif (3MB, 406x300px) Image search: [Google]
Us1eRga.gif
3MB, 406x300px
>>58647004
>>58647026

Yeah, you fucked up by badly naming your variables
>>
>>58646961
>muh EEE bogeyman

Stop making judgements based on memes and feelings, and use your head. That was literally over 20 years ago.

They've done nothing but make the ecosystem more open over the past few years. Xamarin was closed-source and cost $1,000 per dev, per year, and MS bought it and made it free and open source. Open-source focused companies are joining the .NET Foundation (Canonical, RHEL), and Microsoft is now part of the Linux Foundation. Some of top contributors to Mono are employed directly by Microsoft.

If I had to guess, I'd be willing to bet that somewhere between the release of .NET Standard 2.0, and the eventual realization of Mono having virtually all of the API width of the actual .NET Framework, that they're going to merge Mono into the actual .NET line. Realistically speaking, Mono is only currently missing APIs for the webdev side of things.

Let's be honest, though: it wouldn't matter if Microsoft handed 75% of their company to whatever cause you deem morally acceptable. You'd still post things like this, and claim "it's all a part of their big plan, maaaaaaan!".

Their devdiv is fantastic. Windows is still shit, though.
>>
>>58647075
Where are 3 billion devices running .NET?
>>
Is GOTO a meme?
>>
>>58647143
In your mom's anus.
>>
>>58647254
You are going to have to elaborate to elicit an actual response.
>>
New thread:

>>58647282
>>58647282
>>58647282
>>
>>58647254
"GOTO is harmful" is actually a meme.
>>
>>58645473
>Rust being stable since last year
>1.14
I think you're mixing up Rust with Swift 3 here??
Thread posts: 315
Thread images: 32


[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.