[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: 333
Thread images: 39

File: hime c.png (1MB, 1280x720px) Image search: [Google]
hime c.png
1MB, 1280x720px
old thread: >>60373589

What are you working on, /g/?
>>
>inb4 politics
>>
>>60380440
Hitler did one thing wrong!
>>
kill all animes
>>
File: CDE.png (198KB, 1024x768px) Image search: [Google]
CDE.png
198KB, 1024x768px
Post your programming environment!
>>
can somebody create a non-anime thread
by non-anime i mean without fucking anime
>>
>>60380494
VSCode 2bqh
>>
File: 1457227178224.jpg (777KB, 1920x1080px) Image search: [Google]
1457227178224.jpg
777KB, 1920x1080px
I was wondering how would you go about subtracting generic types. For example, the function (let's call it "without") should be able to pass the following tests:
assert([12, 23, 23, 11, 5, 23].without(23) == [12, 11, 5]);
assert("ccxi".without('x') == "cci");
assert("abcderfiibcne".without("bc") == "aderfiine");
assert(["siwwo", "lkaiwmn", "diw"].without("iw") == ["swo", "lkamn" "d"]);
assert(['c', 'd', 'd'].without('d') == ['c']);
assert([234, 301, 322].without(12) == []);
>>
>>60380507
look at the banner you stupid reddit transplant
>>
>>60380516
In JavaScript this is easy
> Array.prototype.without = function(arg) {
... return this.filter(item => item !== arg);
... }
[Function]
> [1,2,3].without(2)
[ 1, 3 ]
>>
>>60380510
How can you stand to use that shit, it's literally a web browser for editing text.
>>
>>60380516
Typeclasses.
>>
>>60380516
>subtracting generic types
How can you "subtract" a "generic(?)" type?
>>
>>60380516
You seem to want to write two different functions

1) List<x> -> x -> x
2) List<x> -> List<x> -> List<x>

in the first, you are simply removing elements that match the value you give
in the second, you are deleting any subsequences that match the list you give
>>
>>60380570
>it's literally a web browser for editing text.
But i can make it as minimal as Vim if i want. But the bonus is, everything just works without fucking around with my RC. And anything i need i can get right. Not to mention quick suggestions and multiple debuggers at hand.

Its really nice.
>>
>>60380516
*Bjarne intesifies*
>>
>>60380516
(defun without (element list)
(cond
((not list) nil)
((equal element (car list))
(without element (cdr list)))
(t (cons element (without element (cdr list))))))
>>
>>60380516
(cont from >>60380678 ) wait crap this is wrong
fixed version:
(defun without (element list)
(cond
((not list) nil)
((equal element (car list))
(without element (cdr list)))
(t (cons (car list) (without element (cdr list))))))
>>
>>60380616
>you just don't understand, I NEED 2GB OF MEMORY TO OPEN A TEXT FILE!!!
>>
>>60380516
>>60380569
and for strings
> String.prototype.without = function(c) {
... return this.replace(new RegExp(c, 'g'), '');
... }
[Function]
> "abcderfiibcne".without("bc")
'aderfiine'


Instead of combining with the array function, to solve this test:
assert(["siwwo", "lkaiwmn", "diw"].without("iw") == ["swo", "lkamn" "d"]);

I would suggest doing:
let strings = ["siwwo", "lkaiwmn", "diw"];
strings.forEach((str, i) => strings[i] = str.without("iw"));

instead

And this test:
assert([234, 301, 322].without(12) == []);

just seems wrong

>inb4 4chan eats one of my code tags or thinks this post is spam
>>
>>60380678
>>60380708
Let's see your assert tests
>>
>>60380710
Idiot, he told you to write 1 (ONE) function
>>
>>60380709
With 3 tabs open im currently sitting at 17.0MB which is unironically lighter than vim.
>>
>>60380738
you know chromium opens like 200 threads, right?
>>
>>60380616
>>it's literally a web browser for editing text.
Aren't we all doing the same thing right now?
>>
File: Untitled.png (489KB, 1920x1080px) Image search: [Google]
Untitled.png
489KB, 1920x1080px
>>60380717
didn't write them but here's one
(assert (equal (without 2 `(1 2 3)) `(1 3)))

proof:
>>
>>60380749
7 background processes equaling ~200MB
Granted i could kill the heavy ones but it really doesnt make a difference. It even has a VIM extension i could get if i wanted. All the bonus features it comes with more than make up for it.
No reason to use Vim anymore, imo.
>>
gedit
>>
D.
>>
>>60380813
REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
>>
Programming a Texas Instruments CC2541. It's a strange Bluetooth Low Energy chip with an 8051 on it. It was somewhat of a hassle to get the tooling set up to work with the chip.

They are pretty cheap and seem ok so far. Having to deal with these arcane proprietary C compilers is less fun.
>>
I'm writing a posix shell script and I need my script to wait until a process has been disowned and fully opened before it continues.

How do I accomplish this?
if ! pgrep $PROG > /dev/null
then
$PROG &
while ! pidof -s $PROG > /dev/null
do
sleep 1
done
fi

This doesn't actually wait.
>>
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!

>>60379737
I'm sorry; I didn't notice it.
C++ suffers from its long history and identity searching. What I mean by that is it's more of a federation of languages than just a single one. (Credit goes to Effective C++; which is a really good read.) This can be good and bad depending on how you look at it, but in my opinion the language and the community suffers for it. D was made with the purpose of re-doing C++ but with modern paradigms and designs in mind. And for the most part it accomplishes that. Sadly, the GC stood in its way for complete domination.
I don't know much about Rust other than some tidbits here and there. Thus, I want comment on that.
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
>>60380884
I can't believe I forgot the picture! This language is kawaii as fug.
>>
>>60380884
>>60380895
F
>>
File: 16684208.jpg (44KB, 480x539px) Image search: [Google]
16684208.jpg
44KB, 480x539px
>>60380895
Please choose a different character
>>
>>60380874
>while ! pidof -s $PROG > /dev/null
Don't you need [ ] for that shit to work properly?
>>
>>60380884
>>60380895
Does she have templates that can inherit from their parameters without spitting "typename" everywhere?
>>
>>60380981
>inherit
>>>/g/wdg/
>>
>>60380986
>>inherit
>>>>/g/wdg/
>>>/trash/
>>
Isn't it pretty much impossible to program without an Object Oriented style in mind?
>>
>>60381004
please tell me you are joking
>>
>>60381010
I'm genuinely curious.
>>
>>60381004
You could say the same thing about a functional style. What makes a language functional or object-oriented isn't about which style it can be semantically reduced to -- for, in all cases, the answer to that is both of them -- but which style it presents as syntactically.
>>
File: yukari_hoho.png (15KB, 153x177px) Image search: [Google]
yukari_hoho.png
15KB, 153x177px
>>60381004
rofl
>>
>>60381024
what do you think object oriented even means?
do you think anything with structs is OO?
>>
>>60381035
>FP and POO are somehow mutually exclusive.
Bad post.
>>
>>60381048
You just interpreted my post to mean exactly the opposite of what it means.
>>
>>60381044
>what do you think object oriented even means?
It means what "object oriented" means in English.
>anything with structs is OO
No.
>>60381039
Explain please?
>>
>>60380940
>defacing akari-chan with an emoji
Get the fuck out.

>>60380981
Metaprogramming using dlang-chan is superior compared to C++.

>>60381004
I don't even program in OO most of the time (even when using dlang-chan). Step it up, senpai.
>>
>>60380798
>No reason to use Vim anymore, imo.
I've invested WAY too much time into my RC and learning all the keyboard commands. NO.
>>
>>60381060
You bringing up FP when someone mentioned POO already makes it blatantly obvious.
>>
>>60381065
So why is it hard to program without using OO?
>>
>>60381074
>vimlets literally stockholmed
>>
>>60381080
I'm just asking if it's possible or not.
>>
>>60380986
why is inheritance so bad?
hard mode: you can't google it real quick
just wondering if the OOP haters can articulate themselves or if they have merely joined in on the circlejerk
>>
>>60381076
That's simply incorrect. My post was intended to mean that FP and POO are one and the same and differ only in presentation, and that's that.
>>
>>60380884

>eventually
Well until that eventually happens, I'm going to be flirting with Rust-chan, who never had a GC to begin with.
>>
Javascript is a functional programming language
>>
>>60381103
>OOP haters
Where did I claim to hate OOP? I'm simply stating the truth that it's fucking garbage and belongs on >>>/g/wdg/
>>
>>60381092
Of course it's possible
>>
>>60381117
OOP is better than functional programming.
>>
Turing Machines
or
Lambda Calculus

Choose wisely
>>
>>60381105
>FP and POO are one and the same
Which is comically wrong. You are claiming that the set of all FP and POO languages is the same set, yet I can show you at least one language which is in one, but not in the other.
>>60381132
This is as retarded as saying "Procedural programming is better than imperative programming". It doesn't make sense on any level since FP is a subset of POO.
>>
>>60381144
lc
>>
>>60381117
why though? why is OOP garbage? I want to hear YOUR personal opinions about it.
>>
>>60381144
>Lambda Calculus
Which lambda calculus?
>>
>>60381106
I hope it's in the near future at least. I mostly use C, so the moment they take the GC out of the stdlib, I'm going to jizz my pants.
Also didn't you say Rust's type system is most likely broken?
>>
File: ran's_DMRG.png (1MB, 900x1440px) Image search: [Google]
ran's_DMRG.png
1MB, 900x1440px
>>60381144
I pick quantum Turing machine
>>
>>60381162
any of your choosing
>>
>>60381155
It's impossible to create non-broken software with it. Which is why I love it.
>>
>>60381147
>You are claiming that the set of all FP and POO languages is the same set,
No, I'm actually not. I'm claiming that FP and POO are ultimately the same style of programming, independently of the languages that use them as labels.
>>
>>60380965
I don't know, but i figured out the problem.
I just needed to figure out when a program actually appears on the screen before trying to continue.

Now, how do I write a while loop that does nothing while a specific boolean is false?
Right now I have this
while ! wmctrl -lp | cut -d ' ' -f4 | grep "$(pidof $PROG)" > /dev/null
do
true
done
>>
how do I into python /g/?
>>
>>60381166
>Any questions?
Why does she have tails?
>>
>>60381175
Does it have to be Turing-complete? You implied this, but that wouldn't be "any of my choosing".
>>
>>60381199
I implied no such thing
>>
>>60381182
"style of programming" doesn't mean anything concrete. I don't really care what you think as long as you don't make retarded statements about the sets "POO" and "FP".
>labels
They aren't labels, they are sets.
>>
File: 1492618231265.png (248KB, 1000x1200px) Image search: [Google]
1492618231265.png
248KB, 1000x1200px
>>60381198
She's a nine-tail fox but also a superquantumcomputer that can solve the halting problem
>>
>>60381216
>the sets
>They aren't labels, they are sets
Lol what horseshit
>>
>>60381228
>She's a nine-tail fox
But she looks human except for the tails.
>>
>>60381213
You implied this by saying "Turing machines or Lambda calculus (not calculi)". The most well known lambda calculus is Turing-complete.
>>60381228
>superquantumcomputer that can solve the halting problem
You wouldn't need one for that. You just need a non-shit language.
>>
>>60381190
You have no choice but to poll, unless you you can receive a message from your WM.

If you want to avoid turning your processor into a space heater you can replace true with a sleep. GNU sleep allows floats, so you can sleep 0.1 or something.
>>
>>60381240
You were tricked into thinking that she looks human*
>>
>>60381236
It makes a lot more sense than ill-defined buzzwords like "style of programming" and "labels".
>>
>>60381258
Damnit
>>
>>60381248
>You wouldn't need one for that. You just need a non-shit language.
No language that currently exists can solve the halting problem. Including assembly for any processor architecture.
>>
Object oriented java in VS (that I paid for)
>>
>>60381284
My language can trivially solve its own halting problem.
>>
>>60381103

Behavior can be modeled with composition.
Data cannot.

That is, assuming you are referring to the OOP we come to know and hate in C++, C# et. al.

There's also this thing called the expression problem (all about thing.member). This isn't an issue when using free functions and opaque identifiers. Harder to debug, yes - but, you should be writing correct code to begin with.
>>
>>60381290
>My language can trivially solve its own halting problem.
Not if your language is Turing complete. And if it isn't, it's a shit language anyway, so it doesn't help your argument.
>>
>>60381304
>Not if your language is Turing complete.
Of course it isn't. Why the hell would it be?
>And if it isn't, it's a shit language anyway
You have to be a drooling pseudo-intellectual retard to believe this.
>>
>>60381284
>currently
>>
>>60381165

If what I heard from that professor's presentation was true, then yes, there is at least one fundamental flaw in the Rust type system. Although honestly, I don't really care if Rust's type system can't guarantee the safety of my programs. The language features are still nice, particularly for bare metal programs.
>>
File: yukari_wish.png (64KB, 350x235px) Image search: [Google]
yukari_wish.png
64KB, 350x235px
>>60381248
>>60381290
>>60381327
>mfw you share a thread, and indeed a whole PLANET AND ITS RESOURCES with people as fucking stupid as this
>>
>>60381391
Did this post have a point? I'm not expecting a reply though, you're clearly delusional.
>>
>>60381401
The point was to call you stupid, which is redundant now since you're even stupid enough to not realize it.
>>
>>60381412
In what way am I "stupid"? I don't think your post had a point really.
>>
>>60381419
>I don't think
Obviously
>>
>>60381427
So I was right. Your post didn't really have a point and now you're just trying to save face since you realized you said something meaningless.
>>
>>60381391

It's not worth it. This Anon clearly does not make real world software, or even software that accomplishes a realistic purpose. You can't sell him on useful programming languages. If you try, he'll ask you to define what useful or practical means. He's not interested in developing actual software, just using it to solve proofs -- a glorified calculator.
>>
>>60381462
>real world
What is the real world? Is there a fake world?
>>
@60381462
How can you "Solve" a proof?
>>
>>60381452
>So I was right
No. No, you weren't, and it has nothing to do with what you were hypothetically right *about*. You simply weren't right because that would be physically impossible for you.
>>
>>60381467

https://en.wiktionary.org/wiki/real_world

>The realm of human experience comprising physical objects, and excluding theoretical constructs, hypotheses, artificial environments, and "virtual" worlds such as the Internet, computer simulations, or the imagination.

It's a metaphor, Anon.
>>
>>60381467
Yeah, the one you think you live in, you fucking child.
>>
>>60381481

Produce proof/solve equation.
>>
>>60381490
>it has nothing to do with what you were hypothetically right *about*
I see. Thanks for confirming it yet again. At least you realize that you made a silly mistake. Too bad you're insecure enough to not acknowledge it.
>that would be physically impossible for you
Why would that be the case?
>>
>>60381498
A metafor what?
>>
>>60381502
So is this world actually fake? Are you fake too?
>>
>>60381513
>At least you realize that you made a silly mistake.
You must be mistaking me for someone else.
>Why would that be the case?
For the same reason that explaining to you the answer to that very question would be a waste of time.
>>
>>60381526
>You must be mistaking me for someone else.
You know that only makes it better, right?
>a waste of time
Trying this hard to not acknowledge your mistakes is even more of a waste of time.
>>
>>60381545
>You know that only makes it better, right?
>Trying this hard to not acknowledge your mistakes is even more of a waste of time.
>>
File: smug_ran.jpg (632KB, 709x1063px) Image search: [Google]
smug_ran.jpg
632KB, 709x1063px
>>60381545
>talks retarded shit
>gets told to fuck off by multiple people, including a cancerous tripfag
>"HURR ALL OF YOU ARE THE WRONG ONE!!111"
P A T H E T I C
>>
>>60381563
What are you trying to say? I'm afraid I don't fully understand.

>>60381564
Sounds like you have AIDS. Sorry to tell you that.
>cancerous tripfag
Why are you degrading someone of your ilk? You might as well put on a trip too.
>>
>>60381564
In argumentation theory, an argumentum ad populum (Latin for "appeal to the people") is a fallacious argument that concludes that a proposition is true because many or most people believe it.
>>
>>60381564
Why does she have tails?
>>
>>60381645
The argument is only fallacious deductively. Inductively, as well as abductively, it's actually a good argument.
>>
>>60381688
helps her balance
>>
>>60381697
Cheer up. I'm sure tomorrow will be a better day.
>>
>>60381700
frrrrrrrrt
plop
plbbt, phbbbbt, prrrrp
splat
>>
Trying to do a type of join in Spark and just coming up fucking blank.

I have two RDD's, some which have the same ID but different data. What I want to do is join them and put them in a tuple of (RDD1, Option[RDD2]) and perform my own merge logic on the join, as RDD1 is the primary table I still need to maintain that all of the original values are retained and RDD2 only has to be in the tuple if there is a match.
>>
>>60381720
please explain
>>
>>60381514

Things which are not hypothetical, but instead, what one is likely to encounter. Have you ever heard of the allegory of the cave? If you are confined to one spot and only able to see a shadow of what everyone else is doing, you might have a narrow view of what people are like. If I were to then teleport you into the middle of downtown Seattle, the world that you would see which is radically different from what you are used to, that is the real world.

In the real world, nearly every programmer uses turing complete languages. Type theory isn't a common subject, even among academia. Programming languages exist to produce software -- tools that run on a computer to achieve a purpose. Proof assistants are software just the same as Mozilla Firefox or XTerm are software, but they aren't really practical outside of the field of pure math. Incidentally, the field of Computer Science is actually quite different from the field of pure math, despite the fact that it incorporates a lot of mathematics into its subjects. The most popular fields within computer science, based on what I have seen from people getting new PhDs, would be machine learning, cybersecurity, and some soft science mixes (like human computer interaction, or computer science pedagogy). The only people I've met outside of the Internet who know anything about type theory have tended to be fans of either Prolog or Haskell, both turing complete languages.

What I've been saying is that you're an anomaly, and no one understands what the fuck you're talking about, because you live inside some sort of bubble that is vastly different to the experience of nearly every other computer scientist.

>>60381645

You should not assume that every argument is about proving some topic right or wrong, and that these fallacies can be universally applied.
>>
>>60381757
>In the real world, nearly every programmer uses turing complete languages.

In the real world, nearly every programmer uses a keyboard with a scroll lock key.

God knows what would happen to programming if that key were to disappear
>>
>>60381743
what an absurd question
>>
>>60381781
The scroll lock key is more important to programming than Turing completeness.
>>
Does anyone actually program in here?
>>
@60381757
>x who know anything about type theory have tended to be fans of either Prolog or Haskell
Impossible.
>>
File: g2tSfA.gif (172KB, 650x650px) Image search: [Google]
g2tSfA.gif
172KB, 650x650px
>>60381790
>>60381800
Poland (that is to say, nowhere)
>>
>>60381797
i can't prove this post wrong
>>
>>60381800
Nope. I just write looping programs in my Turing complete langs.
>>
>>60381800
I've been programming a lot lately, but I rarely talk about it in these threads.
It just feels like blogposting.
>>
>>60381818
The scroll lock key is Turing complete
>>
>>60381800
Frequent posters don't program. This includes a couple of C tards, a couple of shitkell autists, a few sepples fag, a D fag and that one autistic gate keeper that hasn't written a single line of code in his life.
>>
>>60381740
nvm fixed ;) joinWith does this exactly
>>
>>60381849
>shitkell
keep posting this till it matters :^)
>>
>>60381849
Excuse you, I write plenty of code
For proof see >>60381816
>>
>>60381849
>gatekeeper
You're one of the most cancerous posters though.
>>
>>60381890
This. The gate keeper needs to get range banned
>>
>>60381800

Well I recently got done with a programming assignment involving making a neural network in Tensorflow.
>>
File: 1469182791976.gif (2MB, 640x360px) Image search: [Google]
1469182791976.gif
2MB, 640x360px
>>60380424
Removing all recursion and looping from Rust.
>>
>>60381901
Who is the gate keeper
>>
File: akari bakyuuun~!.jpg (50KB, 640x360px) Image search: [Google]
akari bakyuuun~!.jpg
50KB, 640x360px
>>60381909
the akari poster!
>>
>neural network
>>>/v/
>>
>>60381001
The "who are you quoting" autist.

It's this one:
>>60380986
>>60381117
>>
>>60381901
No. The stupid redditor who brings up "le gatekeeper boogeyman" is the cancer, and should be banned.
>>
>>60381906
next remove the rest of the language then submit it as a pull request
>>
>>60381929
We know it's you, gate keeper
>>
File: ghostbusters.gif (2MB, 500x209px) Image search: [Google]
ghostbusters.gif
2MB, 500x209px
>>60381909
>>
>>60381906

Well then you'd have a garbage lang. Although I suppose if you used the FFI, you could call a bunch of C functions that could do the iteration for you.

>>60381915

And how do they "gate keep"?
>>
>>60381929
How is your 4chan defense mission going today?
>>
How to solve a problem for enterprise software:
>Write the standard sensible Java solution
>Split it into 100 different files with a directory structure that has 5 levels
>Give the classes cryptic names like "AbstractProblemSolutionFactory"
>Make sure it only works on one version of Eclipse from 2008
>Despite this, include a gradle build file to make it seem like it's more portable
>Make sure half the code is generated from xml files parsed with XSLT
>Use Spring to find the xml files
>Unit test things that don't need tests because you have to meet the test count target
>Don't test the things that do need tests because writing those tests would be too hard
>>
60381757
>type theory
>fans of Prolog
Now I know you're just lying.
>>
for (int i = 0; 1; i++) exit(i);
>>
>>60381941
keep this thread out of things like
Java
C#
OOP
Web development
Video game development
AI
etc
>>
>>60381941
>then you'd have a garbage lang
Sure, but it will still be better than anything with looping or recursion.
>the FFI
That will have to go too.
>>
>>60381941
I merely require that people possess a rudimentary knowledge of computer science before posting in /dpt/. Nothing more than that.
>>
>>60381963
is this your first day here?
>>
>>60381757
>In the real world, nearly every programmer uses turing complete languages.
Not true, HTML is very common.
>>
>>60381983
Is this your first month here?
>>
>>60381989
Writing HTML isn't programming.
>>
>>60382003
HTML is declarative programming.
>>
>>60381963

>Java
Nah. Plenty of people come here with their intro to programming homework, which means Java most likely.

>C#
It's an alright language.

>OOP
Given that the most popular languages tend to be object oriented, it's unavoidable.

>Web development
Fair, we have /wdg/ for that, but this thread IS for programming in general.

>Video game development
Fair, we have /agdg/ for that, but this thread IS for programming in general.

>AI
It's a legitimate topic to discuss. Needs a lot of math to properly understand, however.

>>60381989

HTML is a markup language, not a programming language. It is typically not used without both CSS and JavaScript. HTML+CSS has been proven to be turing complete, and JavaScript is turing complete on its own.

Also, a lot of the HTML you see is not hand written, but generated from some backend script.
>>
File: explosive_brap.png (326KB, 678x506px) Image search: [Google]
explosive_brap.png
326KB, 678x506px
>>60381725
Girls don't fart
>>
Guys, I just found this beautiful nugget in some software that I have to maintain for work.

...
} catch (Exception e) {
System.exit(0);
}


I have genuinely lost a week of my time to whichever fuckwit thought this was a good idea.
>>
>>60382086
Exceptions were a mistake.
Java was a mistake.
>>
>>60382059
Web development is not programming.
>>
>>60382100

If there is at least one turing complete programming language involved, it is programming, even if it's some garbage like PHP.
>>
>>60382086
If only you'd used a language with monads
>>
The distinction between programming language and markup language is retarded.
It's almost as if the "algorithms + data" model is wrong, and there is only data.
>>
>>60382061
THICC BRAPPCUTIES SHARTIN IN YO FACE WHILE U TRANSCODING ANIME ON YO 1800X WIT A HARD ASS DIAMOND WHILE THE JUCCI FRUIT BRAP GIRL BRINGS YOU TO BROWN TOWN
>>
Why would anyone use tuples instead of heterogeneous lists?
>>
Is this beautiful or not? Why?
-- Load/save plain PPMs without error checking; img[img.w][img.h].r=img.maxVal
-- sets the red channel of pixel at the top-right corner to the reddest value

local p3 = {}

function p3.load(path)
local file = io.open(path)
local data = file:read('a')
file:close()
data = data:gsub('#[^\n]*', ' ') -- remove comments
local w, h, maxVal = data:match('P3%s*(%d+)%s*(%d+)%s*(%d+)')
w, h, maxVal = tonumber(w), tonumber(h), tonumber(maxVal)
data = data:sub(#data:match('P3%s*%d+%s*%d+%s*%d+') + 1) -- remove header
local img = { w = w, h = h, maxVal = maxVal }
for x = 1, w do
img[x] = {}
for y = 1, h do
img[x][y] = {}
end
end
local channels = { 'r', 'g', 'b' }
local startIndex, endIndex = 1, 1
for y = h, 1, -1 do
for x = 1, w do
for _, ch in ipairs(channels) do
startIndex, endIndex = data:find('%d+', startIndex)
img[x][y][ch] = tonumber(data:sub(startIndex, endIndex))
startIndex = endIndex + 1
end
end
end
return img
end

function p3.save(img, path)
local file = io.open(path, 'w')
file:write('P3\n', img.w, ' ', img.h, '\n', img.maxVal, '\n')
for y = img.h, 1, -1 do
for x = 1, img.w do
file:write(img[x][y].r, ' ', img[x][y].g, ' ', img[x][y].b, '\n')
end
end
file:close()
end

return p3
>>
>>60382100
let me guess - 18, 19 years old? maybe started programming in lisp or C about six months ago after browsing /dpt/ a little? might be a freshman CS student?
>>
>>60382176
Guess again.
>>
>>60382176
>18, 19 years old
Not more than 15. I can literally count the pimples in his face
>>
>>60382154
Tuples are heterogeneous lists
>>
>>60382174
looks beautiful, but a language such as C or C++ would be easier to understand what is going on here. way more intuitive.
>>
>>60382128
There is a clear distinction between declarative and procedural programming languages.

It's easier to simply label all declarative languages as not real programming.
>>
>>60382193
In most languages heterogeneous lists are much easier to abstract over.
>>
>>60382196
I agree, C and C++ are much better for reading formats. I just wanted to learn Lua.
>>
>>60382205
>thinking that procedural is the same as imperative
This might be the most retarded post in this thread.
>>
>>60381849
Don't forget yourself
>>
>>60382110
How do you feel about golang, Ruby-chan?
>>
>>60382206
tuples are heterogeneous lists in languages without abstraction over the relevant parts
>>
>>60382206
>""abstract over""
>>>/g/wdg/
>>
>>60382232
>""abstraction over""
see >>60382239
>>
>>60381849
I've written massive computational/numerical routines that take days to run at a time. I shitpost on 4chan between collecting data and debugging while the code runs.
>>
File: 1494679726004.jpg (18KB, 477x420px) Image search: [Google]
1494679726004.jpg
18KB, 477x420px
>>60382228
https://github.com/ksimka/go-is-not-good
>>
>>60382250
Are you a fox demon?
>>
>>60382205
What about languages like XMLfuck where a turing-complete set of instructions are encoded using a markup language?
>>
>>60382239
fucking hilarious that you don't know shit. considering even in the lowest of low-level programming languages a simple function counts as "abstraction". anything above is machine code is abstraction. you really should take the time to understand legitimate criticisms against object-oriented programming or try programming something instead of circlejerking and gatekeeping
>>
>>60382228
Go is garbage.
>>
>>60382256
No how could I be a fox demon? Those things are fictional.
>>
>>60382266
I've seen them
>>
>>60382259
>even in the lowest of low-level programming languages a simple function counts as "abstraction"
>anything above is machine code is abstraction
So? How is this relevant to my post?
>object-oriented programming
I don't use it.
>>
>>60382255
Thanks.
>>
>there are people who program using languages without dependent types
I mean, why would you subject yourself to that?
>>
>>60382255
>no OOP is somehow a bad thing
Opinion discarded.
>>
>>60382283
All dependently typed languages are poop.
>>
>>60381963
Get brain cancer
>>
File: 1486328274222.png (460KB, 800x600px) Image search: [Google]
1486328274222.png
460KB, 800x600px
>there are people who program using languages without higher inductive types
I mean, why would you subject yourself to that?
>>
>>60382292
>poop
Practical object-oriented programming?
>>
>>60382266
2D is real. You just have to neck yourself first.
>>
>>60382271
you implied that abstraction as a technique is exclusive to web programming by redirecting to /wdg/. stop being autistic.
>>
>>60382301
The same reason people go camping, I assume.
>>
>The current design of GOPATH makes creating independent projects very difficult. Instead, a single uber-directory with every Go project underneath it is encouraged (see: The Go Programming Language). This risks major coupling of projects and will lead to maintenance difficulty in the future.
I still don't understand how this is bad.
>>
>>60382307
I didn't. My previous reply clearly shows it.
>>
File: 1494276716858.jpg (44KB, 1200x675px) Image search: [Google]
1494276716858.jpg
44KB, 1200x675px

type
BinaryTreeObj[T] = object

le, ri: BinaryTree[T]
data: T
BinaryTree*[T] = ref BinaryTreeObj[T]

proc newNode*[T](data: T): BinaryTree[T] =
new(result)
result.data = data

proc add*[T](root: var BinaryTree[T], n: BinaryTree[T]) =
if root == nil:
root = n
else:
var it = root
while it != nil:
var c = cmp(it.data, n.data)
if c < 0:
if it.le == nil:
it.le = n
return
it = it.le
else:
if it.ri == nil:
it.ri = n
return
it = it.ri

proc add*[T](root: var BinaryTree[T], data: T) =
add(root, newNode(data))

iterator preorder*[T](root: BinaryTree[T]): T =
var stack: seq[BinaryTree[T]] = @[root]
while stack.len > 0:
var n = stack.pop()
while n != nil:
yield n.data
add(stack, n.ri)
n = n.le
var
root: BinaryTree[string]
add(root, newNode("hello"))
add(root, "world")
for str in preorder(root):
stdout.writeLine(str)
>>
>>60382308
That reason being?
>>
>>60382355
Fuck if I know, camping is a terrible experience, would not recommend.
>>
File: idr.png (7KB, 530x244px) Image search: [Google]
idr.png
7KB, 530x244px
>>60382283
If I could write a game or an operating system in something like idris I'd be interested. But going through the type-driven development book it just feels like a toy at this point. Do you have any idea how I could apply it to more serious applications?
>>
>>60382376
heavy use of dependent types almost certainly incurs a significant performance penalty
idris was meant to be fast but is allegedly slower then haskell (not that haskell is slow, but it isn't fast either)
>>
>>60380424
trying to debug my spaghetti code without breaking 10 more things while fixing one thing
>>
>>60382376
Although it is a pretty language and I would enjoy writing more of it. I especially liked how it did my implementation of map of vectors for me after I specified the type.
>>
>>60382396
>I especially liked how it did my implementation of map of vectors for me after I specified the type.
in Haskell this is just

derive Fuctor
>>
Recursion is a useless cancer
>>
File: spj.jpg (31KB, 224x223px) Image search: [Google]
spj.jpg
31KB, 224x223px
NEW-ISH
https://www.youtube.com/watch?v=re96UgMk6GQ
>>
File: book.jpg (27KB, 328x499px) Image search: [Google]
book.jpg
27KB, 328x499px
>>60382388
I meant more in the sense of the time and space complexity of the data structures than anything else. Would this book help in that regard?
>>
>>60382346
>le, ri
why, FUCKING WHY
why not left, right? are those extra two characters really that prohibitive? why didn't you name your object "BinTr"? fucking pajeet C++ competitive programming tier naming style there anon.
>>
Do you think there should be professional licensing for software engineers like there is for traditional engineers or doctors /dpt/?
Imagine a world where fuckwits who write code like
>>60382086
could be disbarred from practicing software engineering.
>>
>>60382388
>heavy use of dependent types almost certainly incurs a significant performance penalty
Only if by "performance penalty" you mean compilation time.
>>
>>60382445
No, I mean it leads to physically slower programs.
>>
>>60382407
Cool. How does it manage that if you don't specify the type?
>>
File: 1462891948342.jpg (50KB, 353x251px) Image search: [Google]
1462891948342.jpg
50KB, 353x251px
>>60382442
>professional licensing
>>
>>60382418
>haskell
It's broken and will most likely never get fixed. Why even post it?
>>
File: 1494685007840.jpg (21KB, 500x500px) Image search: [Google]
1494685007840.jpg
21KB, 500x500px
>>60382430
You were able to interpret the variables, didn't you?
>>
>>60382455
Manage what?

>>60382460
keep making these posts
it will change nothing
>>
File: 1494260773491.jpg (48KB, 410x416px) Image search: [Google]
1494260773491.jpg
48KB, 410x416px
>>60382442
>professional licensing
>>
>>60382453
That's extremely unlikely. The way how most FP languages deal with memory would lead to physically slower programs, but not something static.
>>
>>60382453
I remember reading that Idris aggressively attempts to remove the stuff that would slow down runtime. Has there been much in the way of benchmarks for this?
>>
>>60382465
>it will change nothing
Indeed. I don't think it's possible to make haskell more broken.
>>
>>60382474
It's supposed to be fast (i'm not saying "supposedly fast") but I've yet to see any benchmarks

>>60382473
nothing is free
>>
>>60382493
It's safe to say that less runtime checks won't somehow make a program slower.
>>
>>60382507
No you fool
>>
>>60382513
t. relativist nihilist who has yet to grow up
>>
I'm still looking for stupid shit to buy from ali

so far I got me a TENS unit, titanium keychains, what eles?
>>
>>60382526
erased doesn't mean non-existant
>>
>>60382538
you're not the sharpest tool in the shed, are you?
>>
If you can't handle me at my exceptionest, you don't deserve me when I'm exceptionless
>>
>>60382550
http://docs.idris-lang.org/en/latest/reference/erasure.html
>>
as a Java dev, what's harder to learn:
Common Lisp, Haskell, or Idris?
>>
>>60382566
Common Lisp because it's dumb

In terms of Haskell v Idris, most of the complexity in learning Idris for you would be most of Haskell anyway, the extra bits Idris adds aren't all that confusing
>>
>>60382555
Leave him be, he probably thinks his Python scripts don't do any runtime checks because he doesn't put any types in them.
>>
>>60382566
my peenus weenus of course haha
>>
>>60382581
:-DDDDD
>>
>>60382581
Thank you, sir, may I have another?
>>
how can I have sex by programming in c++?
>>
>>60382604
Autoerotic asphyxiation is probably the best you could do with shit like C++.
>>
File: t3_58n7ds.png (215KB, 1218x703px) Image search: [Google]
t3_58n7ds.png
215KB, 1218x703px
>>60382604
Like this
>>
File: 1493879020711.png (660KB, 785x980px) Image search: [Google]
1493879020711.png
660KB, 785x980px
What programming language should I use to program an actual anime girl into existence?
>>
>>60382576
>he finds Common Lisp too difficult
>>
>>60382604
Wear programming socks and post lewd images of your legs with your favourite IDE or text editor open showing C++ code on the background.
>>
>>60382634
Haskell because it is the ultimate NEET language
>>
>>60382643
It's not NEET enough.
>>
>>60381065

OOP basicaly means everything is an object. (Everything orientates around objects)

Basically means just creating tons of objects and having them pass messages to each other, and doing stuff based with or without those messages. OO programming is VERY hierarchical so you have objects extending from other objects and so on.

Most languages are mixed paradigms so I doubt theres a PURE OO language. Java for example is an OO language but also a declarative and function language (as of late) as well.

Declarative languages (like C) are just a list of instructions with control flow.

Functional languages revolve around, you guessed it, function. Specfically high-order functions. Great for mathematics. Although I don't know much about funcitonal languages.

Generally, whatever paradigm is used the most is called the languages paradigm. Like F# is functional but has a little OO in it. Java is OO but has a bit of Functional in it.
>>
>>60382634
trashkell
>>
>>60382634
>>60382647
bcpl
>>
>>60382634
Fortran
>>
>>60382647
>impossible to get employed using it
>practically requires you to have already finished education
>completely antithetical to most training (e.g. software methodologies, design patterns, etc)
>>
>>60382670
>practically requires you to have already finished education
Are there people who are actually retarded enough to think this?
>>
>>60382659
>Declarative languages (like C)
>>
@60382659
I have never seen this many buzzwords in a single post.
>>
>>60382676
I wasn't talking to you
>>
>>60382690
I wasn't talking to you either.
>>
>>60382688
I never gave you permission to reply to me autist.
>>
>>60382704
>>60382711
You're such a cancerous fucking individual.
You'll never improve.
You're worthless.
>>
>>60382711
Seriously, did your parents drop you on your head hard when you were a baby?
>>
>>60382714
Do you ever wish you could have a relationship with a real woman?
>>
>>60382722
not him, but I do
>>
File: t3_5ne0h0.png (410KB, 1024x768px) Image search: [Google]
t3_5ne0h0.png
410KB, 1024x768px
There's a startup hiring graduates in my town, but I've heard so many bad things about startups. Should I go for it /dpt/?
>>
>>60382722
I'm straight.
>>
File: fuckyou.png (40KB, 1029x517px) Image search: [Google]
fuckyou.png
40KB, 1029x517px
Solve this, you stupid, neet retards.

>tfw I don't even know an algorithm how to detect recurring cycles
kike
>>
>>60382722
No. I have anime.
>>
>>60382734
Startups are fantastic to work at for the first 8 months, and then you should run the fuck away.
>>
>>60381462
stfu trip faggot
>>
>>60382742
ok master

the largest prime under 1000 which has 10 as a primitive root
>>
>>60382742
how can that be used to solve real life problems?
>>
>>60381462
>>60381467
you can tell when they're asspained because they'll ask you who you are quoting or pick some other inane bullshit to get autistic over
>>
>>60382773
depends on your real life problem obviously.
It does not solve your virginity problem though
>>
>>60382742
appears to be 983
>>
>>60382801
that's a big problem
>>
>>60382773
>>60382801
what is a "real life"?
>>
>>60382742

>baiting /g/ into doing your homework.
>>
>>60382864
>implying project euler is my homework
there are literally solutions for most problems on the internet. Would be retarded to get this as homework
>>
>>60382472
>"gay" shirt
>>
I/O is a crutch for mediocre programmers.
>>
>>60382979
Are the IO-less lang guy?
>>
>>60382979

Can't write a CRUD application without I/O.
>>
>visible tension between my scott and d-senpai over memory safety killing C
dont like it lads, i want scott to escape C++ hell too.
>>
>>60382819
does that shit even repeat?
>>
>>60382659

>I doubt there's a PURE OO language
Ruby and Smalltalk. Everything is an object, no exceptions. All function calls are really just message passing. All operators are also message passing. Entire runtime is manipulable.
>>
>>60383063
>i want scott to escape C++ hell too
cppchan is love
>>
>>60383090
She is, but not her language.
>>
File: 1481669880462.png (254KB, 580x504px) Image search: [Google]
1481669880462.png
254KB, 580x504px
Is C dependently typed?
>>
>>60383090
C-san is love AND life.
>>
>>60383122
Yes.
>>
>>60383122

C has fixed width integers, fixed with floating points, arrays, structs (product types), unions (sum types), pointers, and nothing much else. There is no dependent typing, nor is there even a such thing as a generic (just macros).

You get a handful of basic programming primitives and have to make everything else yourself.
>>
>>60382722
>3DPD
You're killing me, anon!
>>
File: 1482267532973.jpg (106KB, 1280x720px) Image search: [Google]
1482267532973.jpg
106KB, 1280x720px
Should I ever comment my codes?
>>
Rust BTFO
>>
>>60383439
https://thesquareplanet.com/blog/the-story-of-a-rust-bug/
Forgot the link.
>>
>>60383439
Lust is cute!
>>
>>60380424
>inb4 people working on shit that does not matter and nobody cares about
just a daily autistic thing on /g/
>>
File: 26a.jpg (81KB, 771x681px) Image search: [Google]
26a.jpg
81KB, 771x681px
>>60383439
>May 5th at 5:35pm, the Rust build system accepted and merged my PR! A few hours later, at midnight UTC, a new nightly release of Rust was published, which included my fix. After a quick rustup update and a recompile, buzz now works correctly without any changes to the code! Yay progress!
Also
>Not just using NetworkManager
Are you one of those anti Redhat Luddites?
>>
File: test (6).jpg (212KB, 645x960px) Image search: [Google]
test (6).jpg
212KB, 645x960px
>>60383423
No. Commenting is for pajeets.
>>
>>60383452
>a bug gets fixed and published shortly in the nightly
is this some reverse-false-flagging or something?
>>
>>60383488
>>60383546
Enjoy your buggy shitlang faggot
>>
@60383563
i dont even use rust, nerd. Just saying this is more a rust fluff piece than it being "BTFO".
>>
How good are Rust's OpenGL bindings?
>>
>>60383571
Nice damage control, nigger
>>
@60383592
>'rust' is not recognized as an internal or external command,operable program or batch file.

>wangblows
>>
A shitty web/text-based clicker/idle game. I really hate JS, and front-end in general.
>>
60393626
"wankbloz"
>>>/v/
>>
>>60383488
>Not just using NetworkManager
more like
>not just making /etc/resolv.conf immutable pointing to 127.0.0.1
>and running dnscrypt
>>
>>60383641
Not Programming.
>>>/g/wdg/
>>
What is the most aryan Haskell formatting style?
>>
>>60383713
Shitkell has no formatting style
>>
>>60383060
didnt you just learn about break, like, yesterday?
>>
>>60382176
This nigga is trying to do that ridiculous Good Will Hunting trash.
>>
>>60383725
Why not?
>>
New Thread:
>>60383788
>>60383788
>>60383788
>>
    char *one = "hello";
char *two = "dog";
*a++ = *b;


I want to change the 'h' in one to the 'd' in two. Then I want one to point to the next letter, 'e'.

This gives me a seg fault. What am I misunderstanding?
>>
alright plugging in my keyboard right now

edit: lol fuck thatll teach me. i bought a shitty 20 dollar gaming keyboard, logitech ( smaller keys ) and when i was trying to touch type a for loop i typed out "die".

talk about pajeets and fucking over feminized men in the industry. no wonder women took over so easily.
>>
>>60383793
String literals are not modifiable.
Change
char *one = "hello";
char *two = "dog";

to
char one[] = "hello";
char two[] = "dog";
>>
File: 1493103504515.jpg (70KB, 600x600px) Image search: [Google]
1493103504515.jpg
70KB, 600x600px
so how good are you guys in mathematics? is everyone here with/going for a stem degree and has several courses on it or are there people who self taught some programming stuff and left out most of the math?
>>
>>60383831
>or are there people who self taught some programming stuff and left out most of the math?
I don't see why you can't learn both just by yourself.
>>
>>60380494
what is that OS, Mr. Giuseppe?
>>
>>60383831
literally draw the line or equal sign using brackets. and draw the brackets using equal signs...


gaaaah

if yure not trolli g the thread have some food or a drink
>>
>>60383793

when you do
char *c = "string";

you are actually doing
static const char GLOBAL_VARIABLE[] = "string";
char *c = GLOBAL_VARIABLE;

being it get placed within .text section of the executable with the machine code which is set as read only
instead of the stack or the heap (malloc'd or local variables)
when you try to write on the readonly area, the kernel interprets that as a coding error and for sake of security it kills your process using the signal seg fault

there's that much implicitly going on, that you are misunderstanding
>>
>>60383860
i was just curious which scenario is more frequent in /dpt/. I just left out learning both by yourself because i forgot.
>>
>>60384544
Judging by the high amount of retards here, the most common scenario would be uni-taught.
Thread posts: 333
Thread images: 39


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