[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: 316
Thread images: 30

File: wg21-timeline-2017-03.png (303KB, 1937x1427px) Image search: [Google]
wg21-timeline-2017-03.png
303KB, 1937x1427px
Rolling release edition.

What are you working on, /g/?

Old thread: >>60788834
>>
File: haskell coin count.png (13KB, 325x222px) Image search: [Google]
haskell coin count.png
13KB, 325x222px
Has Haskell gone too far?
>>
>>60793593
That would imply it has gone anywhere
>>
>>60793593
Why do you keep reposting this shit? Are you so desperate you have no other ways of self-actualisation besides letting everybody know you can write typical Haskell code all by yourself until someone pays attention?
>>
>>60793630
this is the second time

perhaps i should have said

>>io
>>no dependent types
>"""some quote of a meaningful post'''

and then you wouldn't have complained about repetition
>>
>>60793593
>trashkell
who fucking cares? Go fork trashkell that has no I/O
>>
From what a project owner wrote to the leadership team:

>I have come to the conclusion, that SCRUM offers the developers a framework to plausibilize stupid excuses

After I said:

>The acceptance criteria of your ticket did not specify on which operating system the executable must run. It works on my openBSD machine, therefore it's done.

What do you think?
>>
>>60793579
C++98 is the comfiest c++ and you know it
>>
>>60793800
Too bad we have to wait at least 70 more years to get to C+++98
>>
>>60793593
Thanks for writing this, I was about to try rewriting my old go.
>>
>>60793663
You're both assholes.
>>
>>60793820
By then, every single program would consist of one line due to how much the C++ standard has enveloped everything.
Except for systemd of course. That would be in C and in the process of taking over the linux kernel
>>
>>60794015
> every single program would consist of one line
auto auto(auto) { auto auto; }
>>
https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b
What do you think about orthodox sepples?
I think that if the guy is not going to use modern sepples he should just stop being a faggot and use C like any sane person.
>>
>>60794033
auto auto::<auto> auto(std::auto) { auto::auto; }
>>
>>60794052
g++ -auto auto -auto auto auto.cpp
>>
>>60794043
C does have some pains that come with it. I think it's a fine approach to use C+.
If it could be properly defined and taught to new programmers.
>>
>>60794043
>The committee has been busy fixing the language for years
>Let's just ignore all it and use C++ as C-with-classes a-la 1983
>Oh, and let's reimplement all the STL because reasons
I actually agree on exceptions and RTTI tho. Sometimes I wish they'd cut all the C cancer out of C++, but then I remember Rust exists and calm down.
>>
Started learning golang as a jsfag, it's fucking great
>>
File: EVc3Nm0.png (427KB, 770x478px) Image search: [Google]
EVc3Nm0.png
427KB, 770x478px
>>60794137
Go is a language for mentally chall-
>jsfag
Oh, nevermind, go ahead.
>>
>>60793663
scrum is retarded, you're retarded, the PO is retarded
>>
>>60794135
Even the author of STL doesn't like templates.
They should just ban templates as a library feature and have it be internal use only.

You shouldn't inflict that shit on other programmers.

C doesn't make C++ worse. It's the guiding principles of C that makes it worth anything. I agree that C++ could be a better language if they stopped with the backwards compatibility. Like D. It has its flaws but it's early days.
>>
>>60794174
>C doesn't make C++ worse.
its literally the main reason why C++ is the way it is you delusional cnile.
>>
>>60794174
Templates are the best thing to ever happen to C++, and if you don't recognize it you don't have any serious experience with C++, and C is the source of most bad decisions in C++.
>>
File: 1496815852634.jpg (484KB, 1800x1196px) Image search: [Google]
1496815852634.jpg
484KB, 1800x1196px
How can people justify using rolling release languages that literally add and delete syntax from the language between minor version updates like rust?
>>
>>60794285
Hate maintaining old php because of this...
>>
>>60794174
>They should just ban templates as a library feature
Enlighten us. How else would C++ implement compile time code to fit every single data type?
>>
>>60794174
>>60794220
If you don't like templates, don't use them.
Stuff like the STL and Eigen are good examples of how templates have spared them a lot of programming.
But it doesn't mean you have to make every class you make template based just because you can.
>>
>>60794285
Because most people who are using volatile languages are either aware and don't mind, or just find it part of the fun to use and watch a language they like grow and change.
>>
>>60794312
I think he means he wants to limit templates to the STL like java has limited operator overload to their own string type.
>>
File: 1492827377241.png (173KB, 308x326px) Image search: [Google]
1492827377241.png
173KB, 308x326px
What's the fastest way to learn Java coming from C/C++?
>>
>>60794338
not at all
>>
>>60794338
learn the syntax, read the api of functions.
>>
File: 1301237254532.gif (7KB, 150x141px) Image search: [Google]
1301237254532.gif
7KB, 150x141px
Today at work, I discovered that one of the programs we use frequently is actually written in CoffeeScript, that then gets compiled to Javascript through a convoluted chain of npm commands/scripts/tools/whatever-you-want-to-call-them, that is then executed by nw.js that's 2-3 years old because updating it "breaks the program". The UI is made of HTML template files and styled with CSS.

The person who wrote this monstrosity originally no longer works at there. A shame, because I'd love to ask him certain important questions regarding his choices of programming languages and technologies. Because I'm the person who, for some reason, was chosen to fix some bugs in it.

I know nothing about Coffeescript, npm or nw.js. I know a few little things about Javascript, but that won't help me. I don't even know where to start. I'm screwed.
>>
>>60794194
>>60794220
No. Look at the proposals. People like the blame C but theres so many shitty features that were accepted. Look into structured bindings and how they've collided with std::tie.
They have an old feature preventing progress. And it's completely unrelated to C. This stuff is all over. C is not a complicated big language. You can easily design around it if you weren't a group of people who only cared for themselves and/or you didn't rush things.
>>60794312
It's not trivial to explain the problems with this in a short post anon. Templates are a mess and they don't infer types well enough to be actually useful. If people think avoiding the copy pasting you'd do without templates is an argument to have a shitty metaprogramming language in C++ then your standards for language design is just very low.
>>60794316
See above. Also note how I explicitly said the issue with templates is libraries that use them. If you want to fuck yourself with templates that's fine. It's how it affects me I care about.
>>
>>60794442
>You can easily design around it
Its that kind of rationalization that killed C++ before it began.
>>
>>60794362
I hate how webdevs are creeping into programming. This is technically programming but still >>/g/wdg/
>>
>>60794362
Break it down into parts, take notes and unravel the parts that doesn't make sense.
It takes time but it is possible.

It always a lot of work but if nobody can work with it, someone has to spend time on this to sort things out.
>>
>>60794455
I agree that it'd be better now if they had just made a new language but you would probably be programming in C now if that were the case.
>>
>>60794476
>but you would probably be programming in C now if that were the case.
Not really, people didnt need sepples to figure out C needed put down.
>>
>>60794442
>It's not trivial to explain the problems with this in a short post anon
Cop out answer, anon.
Templates are the simplest answer to it and you know it. Or if you want to fuck around with preprocessing, you're fine to as well.

//func.hpp

TYPE func(TYPE a)
{
return a;
}

//main.cpp
#define TYPE int
#include <func.hpp>
#undef TYPE

This is actually the code that was recommended to write in C. How is this better?
>>
>>60794476
It would probably be Ada, Modula-17 or Turbo Pascal 20 tho.
>>
>>60794524
in C you would just
#define func(x) x 

though
>>
>>60793649
>io
Trash. Ignored.
>>
>>60794524
I've actually seen such code in glibc IIRC, this is horrible.
>>
>>60794575
I said >>io not >io
you stupid pleb
>>
>>60794524
>templates is the easy answer
Templates isn't an easy answer to anything.
Polymorphic type dedication would be the easy answer.
>but that's templates!
No its not.
>how is this better
It's not as problematic as C++ templates from a feature-of-a-language perspective. It's certainly not how I'd do it anyway. Just use a parameterized macro. It's very similar to what I think is your idea of a template. But this is just a strawman. I never argued that C was the solution.
>>
>>60794552
and in sane languages from the current century, we no longer need to do satans bidding with macro nonsense.
>>
>>60794611
How is this instance of macros worse than the equivalent trivial template?
>>
>>60794285
Why are you on nightly? AFAIK, stable does not do that.
>>
>>60794552
For any nontrivial function, you're increasing the size of the binary with each call of the function
Not exactly ideal.

>>60794589
>Polymorphic type dedication would be the easy answer
>slow down every single aspect of every single C++ program because I'm too dumb to understand templates
You're better off using Python fucking scrub

>Just use a parameterized macro
See above
>>
>>60794611
yeah, you just compile some other language to js.
There's nothing wrong with macros, dumb web shitter.
>>
>>60794611
Which is exactly why templates shouldn't be used
>>
>>60794652
>slow down
The compiler perhaps. But it sounds like you think it'd slow down runtime.
Which only a retard would think.
>>
>>60794641
Because macros are a dirty hack and an insult compared to actual templates.
>>60794654
>my language doesnt have them so no one should use them
"no"
>>
>>60794362
Coffeescript is unreadable. I'd suggest to scrap and reverse engineer the entire thing.
>>
>>60793593
    • Ambiguous type variable ‘m0’ arising from a use of ‘evalStateT’
prevents the constraint ‘(Monad m0)’ from being solved.
Relevant bindings include
count' :: Integer -> m0 [([Char], Integer)]
>>
>>60794588
I read from right to left.
>>
@60794653
>anyone who doesnt use macros is a web baby
(You)
>>
>>60794678
>Because macros are a dirty hack and an insult compared to actual templates.
Templates are a fucking hack and an insult to actual macros.
Or let me guess, you think C style macros are the only macros?


>>my language doesn't have them
I'd use a real fucking programming language

>>60794698
should be evalState, whoops
>>
>>60794674
Name me 1 (O N E) language with static polymorphic type deduction that's as fast as C/C++
>>
>>60794652
>you're increasing the size of the binary with each call
Actually you don't. If this were an issue (aka you tell the compiler to minimize binary size) the compiler will outline (opposite of inline) it for you. Most of the time when the compiler outlines its to conserve instruction cache. But for the large majority of template-y/type macro things you'd never run into that since if you have a function you pound hard like that (see math-vector operations) you usually want them inline.

Why do brainlets think they can talk about programming?
>>
>>60794732
>(You)
>doesn't give (you)
Kek
>>
>>60794735
What do you mean "static polymorphic type deduction"?

If you just mean type deduction, that's at compile time anyway

If you just mean polymorphism, then plenty of C programs use void* all the time
>>
>>60794735
Rust
>>
>>60794735
ats, though
>>
>>60794735
Rust.
>>
>>60794753

>void* is polymorphism
Now I've heard it all.
>>
>>60794780
Who are you quoting?
>>
>>60794734
Ah, I see Ive riled up a Lisp-fag.
>>
>>60794799
>t. newfag
>>
>>60794807
(((Lisp)) is ((a) ((good))) language)
>>
>>60794807
I don't use Lisp, I am simply pointing out that templates are literally a limited form of macro.

>>60794814
id :: forall a. a
id x = x

in C this would compile to

void* id(void* px) { return px; }

if you had C with polymorphism (not templates), the only difference would be safe typing
>>
>>60794735
None available atm. Why would that be a requirement? Doesn't matter whatsoever
JAI has it as a presented feature.
Here's the most relevant bit of the talk. I doubt you'd actually appreciate this though. Since Jblow doesn't deem it worth rat-holing on why templates are problematic since everyone already knows that. Its not even the best part of the design of this language. He does some things in part 2 that C++ programmers would do with templates and it'd be absolutely insane to try. You probably wouldn't even bother.
https://youtu.be/BwqeFrlSpuI#t=43:58
>>
File: fin.png (5KB, 239x211px) Image search: [Google]
fin.png
5KB, 239x211px
>>60794814
>>
>>60794863
>I don't use Lisp, I am simply pointing out that templates are literally a limited form of macro.
You're right that templates are limited macros, but they're limited to make sense in C++.
>>
>>60794871
>none available atm
OK. I don't know a lot about irrelevant languages. But I guess there were some as evidenced by this thread.
>>
>>60794873

Few things make sense in C++
>>
>>60794873
Nothing makes sense in C++, including templates.

>header/source
Doesn't work with templates at all. Only one obscure compiler had export so they removed it.

>inb4 "this is ok because I know WHY this happens"
literally the javascript response
>>
>>60794873
>templates are limited macros
Templates are Turing complete.
That's what makes them horrible. If they were just like these trivial 'replace this type' case then they'd be pretty OK. I wouldn't have an issue with them.
>>
>>60794910
js people don't know why things happen, it's magic to the most basic stuff like left_pad function.
>>
>>60794929

You can use them in that way, and they work perfectly fine when used that way.
>>
Any good books on programming for me to grab?

I'm somewhat new to the realm. I've learned a few languages and written a couple basic programs for use on RPi/Duino projects, but aside from that I'm completely lost.

Help a newfag out?
>>
>>60794735
Rust
>>
>>60794945
Nice meme
>>
Reminder the previous Dlang-chan was cuter than her current iteration.
>>
>>60794950
Head to >>>/v/
>>
>>60794958
But I'm not a gaymer
>>
>>60794958
>>>>/v/
>>>/v/
>>
>>60794754
>>60794772
http://benchmarksgame.alioth.debian.org/u64q/rust.html
>consistently higher CPU time and ram
When will SJWs leave?

>>60794753
Point is that compilers can't optimize for stuff like that.
It's like doing a>>1 instead of a/2. They both nearly do the same thing, but a/2's assembly instructions are longer.

>>60794871
>None available atm. Why would that be a requirement?
>hey guys. Trust me. This is a totally faster way of doing this
>don't mind that no languages have ever pulled this off and always made it slower
>srs guys
>guys this is totally faster
This is how you sound like
>>
>>60794939
They *work* fine. They're not convenient to write or modify in any way. They're a terrible feature if we intend to have a metaprogramming language (which is what templates are now). They're not a limited metaprogramming language as people claim. They're a very bad metaprogramming language which people love to use because they're starved c/c++ programmers who are desperately clammering for features.
>>
>>60794863
>I am simply pointing out that templates are literally a limited form of macro.
show me a macro i cant implement with templates.
>>
>>60794971
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=gpp
>>
>>60794971
>Consistently faster than C++
kek
>>
Honestly the ONLY issue with templates for non-retarded people is how analysis-unfriendly they are for e.g. completion tools and other things. Otherwise it's lit af tbqh fampais.
>>
>>60794971
>Point is that compilers can't optimize for stuff like that.
What?


>>60794987

conditional inclusion of an .h
>>
>>60794971
It has been proven to be as fast though. It compiles down to the same damn code anon. It's static.

Again. If you can't watch that and immediately appreciate the fact that it's as fast as templates you're stupid. Not stupid in the sense of being a clever person who's out of his depth but actually stupid. Any moron can see this given enough knowledge of programming.
>>
C++ is shitter than Rust
>>
>>60794973

I agree with that. TMP was an accident.
>>
>>60795010
Found the rustfag
>>
>>60795010
It's not a high bar anon. Find greater feats.
>>
>>60795010

lol
>>
>>60795026
>how to fish a butt flustered sepples cuck
>>
>>60795040
xD
>>
>>60795006
>conditional inclusion of an .h
okay, now give me a real problem, because i actually use a language with a proper module system.
>>
>>60795061
>goalpost moving 101
>>
>>60795028
I do not disagree
>>
>>60795061
C++ doesn't have a module system
conditional inclusion is a real problem
>>
>>60795079
>>60795071
>C++ is the only language with templates
???
>>
>>60795079
C++ has two module systems. kek
And 3 standard libraries
>>
>>60795079

Modules are the only feature missing from C++.
Give it modules, relegate the entire C processor to an optional legacy feature and you're sorted.
>>
>>60794993
>C++ still wins 6-4
>Rust still has massive binary files
Thanks for proving my point

>>60795007
(you)
There are just some compile time optimizations that can't happen if you assume every type, anon. You NEED code to safely execute commands of types you don't know. Otherwise there's always some edge case that will fuck the user over
>>
>muh com.company.enterprise.business.module.app
Spotted the Pajeets.
>>
>>60794971
>asks for Rust vs C++ comparison
>posts Rust vs C
Wew, lad.
>>
>want to some inline assembly in C#
>create apropritate C++ .dll
>load up .dll in C# code
>types in C++ and C# are incompatibile to the point where you have to use third-party software to translate C++ function signature to C# method signature
>arrays returned from the .dll throw argument out of range exception when I try to acces them in any way
>it turns out that it's an issue back from .net 2.0 and I have to call .dll functions on separeate thread or some shit
What is even the point of .Net? It's the most inconvinient piece of shit I ever used and I'm JavaScript specialist
>>
>>60795093
C++ doesn't have any
>>
>>60795114
delete this!
>>
>>60795106
>Rust still has massive binary files
That's what happens if you link statically
>>
>>60795129
Wait, C# really has no inline ASM?
>>
>>60795153

It's a fucking bytecode language, of course it doesn't have inline asm
>>
>>60795165
So why do people use it again outside of memity?
>>
>>60794993
Holy fuck C++ actually got BTFO

How did a 2 year old compiler beat a 45 y/o?
>>
>>60795165
bytecode languages were mistake
>>
>>60795181
Because it's mostly llvm vs. gcc
>>
>>60795180
muh MVC
>>
>>60795180

They think adding some syntax sugar to Java stops it being a pajeet POOlang
>>
File: rust_vs_cpp.png (61KB, 637x351px) Image search: [Google]
rust_vs_cpp.png
61KB, 637x351px
>>60795106
>cppltard is this mad Rust is faster than c++
But hey, at least sepples isn't being run by cultural marxists who conspire to genocide whites by brainwashing white women to not to have sex with you, amiright?
>>
>>60795195
>>60795181
C++ has a lot of defensive copying.
>>
I'm basically supposed to write into a file a bunch of commands like "CURSOR_UP, CURSOR_UP, ACTION_KEY...." There is only 15ish distinct commands like this. What's the best way of keeping them in my program? #define them, put them in variables and then just write those?
>>
>>60795230

enums
>>
>>60795230
Use an enum type.
>>
>>60795213
>cpp has a lower average and a much smaller box

What is this graph supposed to prove?

Also, why compare GCC to llvm?
>>
>>60795213
>c++ consistently gets more optimized results
Srsly. Have you ever read box and whisker graphs before? Stop posting info that btfos you
>>
>>60795265
How did you pass middle school maths?
>>
>>60795235
Ok, but when it actually comes to the ostream.write(X), what good is if that X is an enum? They are basically numbers.
>>
>language X is faster than language Y
>not understanding a language's formal definition has nothing to do with its implementation
All of you go back to >>>/vg/agdg/, this is a programming thread.
>>
>>60795279

quit projecting and admit you're too retarded to read a graph
>>
File: 1496276147267.gif (2MB, 205x221px) Image search: [Google]
1496276147267.gif
2MB, 205x221px
>>60795265
>smaller box
>>
>>60795283
>Every language is the same speed in theory!

I take it you don't work on anything important
>>
>>60795283
>not understanding practical reality
>>
>>60794734
>should be evalState, whoops
I still, literally can not understand how it works.
>>
>>60795265
>>60795266
>sepples internet defense force
http://benchmarksgame.alioth.debian.org/u64q/which-programs-are-fastest.html
>The boxes are broken into separate groups, at the minima of the kernel density estimate for the geometric mean scores.
>>
>>60795283
Sorry anon, I understand you language is slower than python
>>
>>60795282
enum + array of strings
>>
>>60794950
>meme
>>>/v/
>>
>>60795282

Aren't you supposed to overload << to put custom types on the output stream? I don't do sepples.
>>
>>60795317
>you
your*
>>
>>60795106
>types you don't know
This isn't what we're talking about moron. Every type is known at compile time. It's a consistent decision throughout JAI.
>>
>>60795309
which part fampai
>>
>>60795283
>he doesn't understand UB, i.e. deliberate omissions in the formal definition, is the main reason C is so fast
>>
how can I use UB to make C faster?
>>
>>60795375
The UB cases could be defined in C and it still would be as fast as now.
On more uncommon platforms it would be bit slower because C's definition would differ from how the machine actually works.

UB is about easier compiler implementation for different platforms.
>>
File: CKy9yVNVAAEdTVv.jpg:large.jpg (62KB, 1024x1024px) Image search: [Google]
CKy9yVNVAAEdTVv.jpg:large.jpg
62KB, 1024x1024px
>>60795336
>Gaming programming language
>>
>>60795283
No. There's semantic definition that makes the same machine less suited for code. Sure you could probably create a machine that only executes JS well (like having it parse in the CPU and every other program has to translate their machine code to JS). But for modern machines the more machine specific you are for the task the better.
>>60795399
I've told you this so many times anon. I gave you actual examples. I won't bother anymore. You're a lost cause.
>>
>>60795399
>>60795409
https://www.youtube.com/watch?v=yG1OZ69H_-o
It's a great talk btw.
>>
>>60795315
>he still doesn't understand box and whisker graphs
The box represents the lower quartile to the upper quartile. The whiskers represents the lower extreme and upper extreme.

The upper quartile for c++ is lower than on Rust. That means that more C++ programs are more optimized on C++ than on Rust.
>>
>>60795422
Jai as it is right now is shit. But a language built for games would actually be good because speed is a constant concern on all fronts.
>>
>>60795422
Simulation programming language is more accurate right now but yes his aim is games.
Lots of researchers have a lot of interest as well because they're also in a field that requires performance and expressive power.

But I'm not asking you to switch or anything. You can just keep frog posting and writing your crappy python.
>>
>>60795422
dumb frogposter
>>
>>60795456
Well first you have to read http://ece.uprm.edu/~nayda/Courses/Icom5047F06/Papers/paper4.pdf and then you can write to the admins of the benchmark game to explain why they're being wrong by summarizing results the way they do now. Or you can just stop being butthurt about minuscule differences and just admit C++ isn't the next faster thing out there anymore.
>>
>>60795458
>JAI is shit right now
Are you Jblow? Because he and Jonathan are the only two who have access right now. At least publicly.
>>
>>60795520
>At least publicly.
Ive kept up with it and watched all the archives.
He has a few interesting features, but none that cant easily be implemented otherwise. The syntax even though its going to be changed is still probably going to be shit due to his tastes.

Unless he makes some amazing breakthroughs in runtime, Jai will be DOA.
>>
>>60795213
How the fuck could you make something in FORTRAN? I mean, you can interface it with C, but the most exciting thing you can do with FORTRAN alone is Conway's Game of Life.

I would also expect it to be quick on mathematical calculations.
>>
>>60795338
almost all of it
>>
>>60795559
>the most exciting thing you can do with FORTRAN alone is Conway's Game of Life.
You heard it here first! Fortran is pretty cool language!
>>
>>60795508
Are you retarded or do you train to be this dumb?

Where does it say that it doesn't follow the box and whiskers style?
>>
>>60795609
you understand the coins bit right?
just defining a list [(String, Int)] (well integral a => a)

for count i'm creating a state monad action, given coins as a parameter (i could have bound it to the coins i defined, but i left it open)
you can then do what you want with that action, e.g. count' runs it (using the coins provided) given an int (the initial number of coins) ignoring any remainder


mapM (mapM $ state . flip quotRem)
this makes more sense if i split it up

count = mapM choose
(e.g. mapM choose coins)
runs the "choose" action on each (String, Int) pair

choose (s, i) = (,) s <$> state (`quotRem` i)
this is what the inner mapM evaluates to (i've also swapped the flip quotRem to an operator section) when the input is a pair

state takes an (s -> (a, s)) function and turns it into a state action
in this case i'm using quotRem which produces the quotient AND the remainder - and it conveniently lines up so that the remainder ends up as the new state
(i use an operator section because i'm dividing by i, not dividing i). the monadic state action returns the quotient, and i pair it up with the string (the name of the coin0 using (,) s <$> which is fmap ((,) s)
>>
>>60795456
>The upper quartile for c++ is lower than on Rust.
>That means that more C++ programs are more optimized on C++ than on Rust.
JESUS CHRIST How did you fucking pass basic maths?
>>
>>60795677
that helps a but but one problem I have understanding it is if I do
choose ("test", 11)
I get an ambiguous type error.
>>
>>60795853
which GHC version are you using?
try enabling NoMonomorphismRestriction or -XNoMonomorphismRestriction
>>
in purescript, why does the following not compile?
module Main where

import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)

main :: Eff (console :: CONSOLE) Unit
main = do
v <- {a: "foo"}
log v.a
>>
>>60795853
>>60795908
you might need FlexibleContexts also

it would have the type

(Integral b, MonadState b m) => (a, b) -> m (a, b)

sometimes without certain extensions you can end up with functions that when partially applied don't typecheck
>>
Which OS does Java run fastest on?
>>
>>60795951

Android
>>
>>60795943
I don't know purescript much if at all but
<- {a:"foo"}
presumably that's a pure value and you can't bind it in do notation, use let instead
>>
>>60795959
No it doesnt because the Google's quick hack of dalvik is piece of shit.
>>
>>60795908
GHCi, version 8.0.2
even with NoMonomorphismRestriction I get the ambiguous type error
>>
>>60795987
what is the specific error?
>>
>>60795951
GNU plus Linux.
>>
>>60795949
even with FlexibleContexts, its ambiguous. Oh, I think the problem that I'm calling show on the result. choose ("test" 11) typechecks fine
>>
>>60795964
it fails at v.a
  Could not match type

{ a :: String
| t0
}

with type

( a :: String
)


while checking that type ( a :: String
)
is at least as general as type { a :: String
| t0
}
while checking that expression v
has type { a :: String
| t0
}
while checking type of property accessor v.a

im confused why {a :: String} which is Record (a :: String) becomes (a :: String)
>>
>>60796022
It produces a monadstate action so it doesn't have a show

the monad state action would do this:

s <- get
let (q,r) = quotRem s 11 -- (x / 11, x % 11)
put r
return ("test", q)
>>
>>60796022
>>60796054
you can do e.g.
runState (choose ("test", 11)) 100
>>
>>60793579
I/O isn't really needed. If you're a good programmer that is.
>>
>>60795456
>
{
|
}

Are these integrals?
>>
I'm working on a network tunneling thingy to make secure tunnels over various kinds of protocols (ICMP, DNS, UDP, TCP, HTTP) to get free internet from misconfigured hotspots (like in airports).

Already made a crate to deal with TUN interfaces with support for mio/tokio.

Currently working on a packet parser/builder because all the alternatives for Rust are shit, and I need to deal with raw sockets for the ICMP portion.
>>
File: 1485735320014.gif (458KB, 256x256px) Image search: [Google]
1485735320014.gif
458KB, 256x256px
Has anyone here used Kotlin?
What did you think about it?
It seems neat but I don't know if learning it would be worthwhile
>>
>>60796298
learn chapel you FOOL
>>
File: 1417115197707.gif (395KB, 500x500px) Image search: [Google]
1417115197707.gif
395KB, 500x500px
>>60796337
I was mainly looking for something that makes Java programming more tolerable
>>
>>60796298
My company's pushing Kotlin for all Android developers. I haven't heard any major complaints yet. Personally, it's better than Java but Clojure is more interesting.
>>
>>60796298
>another meme language inheriting the perl/ruby/swift idea of "'more ways to do the same thing!' makes programming more fun!"
>>
File: 1426966209134.gif (293KB, 150x150px) Image search: [Google]
1426966209134.gif
293KB, 150x150px
>>60796394
Honestly, it was the fact that it's now officially supported for Android development that got me interested in it in the first place. Thanks, I'll check it out.
>>
>>60796440
>officially supported
I've also heard that at Google I/O 2017. It doesn't mean anything though. It's just Google trying to be cool.
If you need some inspiration, check out this project: https://github.com/inorichi/tachiyomi.
>>
i'm trying to convert the numpy array from tensorflow's mnist dataset you import in python to an image, but it's just coming up all black. i pickled the numpy array to get it back to my local machine. i do
f = open("image.pickle", 'rb')
img = pickle.load(f)
im = Image.frombytes("1", (28,28), img)


using numpy, pickle, and PIL.Image imports. this is an example of a row in the numpy array from the pickle

[ 0.          0.          0.          0.          0.          0.          0.
0. 0. 0. 0.47450984 0.99607849 0.81176478
0.07058824 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0.
0. ]


i'd appreciate any help
>>
>>60796511
Not closing the opened file.
Disgusting.
>>
>>60796511
>>60796525
>not using 'with'
I literally just threw up in my mouth
>>
>>60796658

with is an ugly hack for shitlangs without RAII
>>
>>60796663
No, it's excatly the same thing.
>>
>>60796733
>>60796663
>>60796658
>>60796525
you're not talking about anything relevant to the problem
>>
>>60796765
Welcome to 4chan.org/g/dpt
>>
>fart on a toilet
>accidentally take a shit
Oh look it's functional programming
>>
>>60796663
>can't close the fd if others still have a reference to it
RAII sounds like a great idea. NOT.
>>
>>60796881

that's gc without with/try-finally, not raii
>>
>>60794015
>C++ standard has enveloped everything.
dont you mean boost.
though i guess with std[2-99999] being added, it might end up with everything in a century or two.
>>
>>60796881
Found the retard.
>>
>>60795129
> translate C++ function signature to C# method signature
use
extern "C"
to avoid name mangling.
>>
>>60796765
>>60796511
if anyone wonders how i did this, I switched to using matplotlib.pyplot instead of PIL.Image
>>
ded
>>
File: 1495567706679.jpg (42KB, 456x740px) Image search: [Google]
1495567706679.jpg
42KB, 456x740px
As an Aspie sufferer, what's the best language for me?
>>
>>60797429
Haskell
>>
>>60797429
Learn OCaml since
>Fact: OCaml programmers are the most powerful race in the world.
>>
if I want to learn android development, should I use java or kotlin?
>>
>>60797459
C++
>>
>>60797445
I said "Aspie sufferer", not "Down syndrome sufferer".
>>60797453
Is it better than Huskall? If so, why?
>>
>>60797459
Rust compiles to Android now.
>>
>>60797468
It's different. It's an actual programming language.
>>
>>60797429
Lisp
>>
>>60797481
What is an "actual programming language" though?
>>60797483
Why?
>>
>>60797497
Something that isn't just designed to please /g/ memesters but to write actual software.
>>
>>60797513
I'm pretty sure Huskall was designed before /g/ even existed.
And what is this "actual software" you speak of?
>>
>>60797497
https://www.quora.com/I-have-Aspergers-and-have-loved-LISP-for-its-regularity-of-syntax-semantics-Is-LISP-the-perfect-language-for-autistic-engineers
>>
>>60797526
>being this bad at logic
/g/ autists existed before /g/ too.
>>
is Ocaml worth getting into? I already know C# and Haskell
>>
>>60797551
If you already know these languages there will be other languages that will expand your horizons more (look at C or Python).
The main advantage of OCaml for the average developer is that it is the language that both correctly implements OOP and shows you do not need it.
>>
>>60797544
This is quite literally impossible. Now I see that you're just retarded. I guess OCaml is Huskall-like garbage after all.
>>
>>60797551
I see no reason to use OCaml t b h, Haskell is better as a FP masturbation language, and there are much better general-purpose languages out there.
>>
>>60797599
>quite literally
Oh, I see.
>>
>>60797613
Well, you aren't the sharpest tool out there, so maybe you don't get it.
>>
File: g.png (12KB, 543x485px) Image search: [Google]
g.png
12KB, 543x485px
>>60797620
>>
File: 1495050123417.png (181KB, 385x385px) Image search: [Google]
1495050123417.png
181KB, 385x385px
>>60797669
I saw this and laughed for almost an entire minute. Pretty hot, no?
>>
People roasted my function last night so now I'm here to set you nerds straight

def fibonacci(n):
l = n
ln = [0, 1]
while l:
ln.append(sum(ln[-2:]))
l -= 1
return ln[:n]


>This dumb, why do you need to store all the fibonacci numbers in a list when you aren't even using them all?

The only time they """ALL""" aren't used is if arg n < 2

>kill yourself for using short variable names

Short variable names produce visually appealing code you unaesthetic virgin

>no that's fucking disgusting. try while l > 0 for starters

Someone doesn't that 0 will break a while loop

>It should be recursive

Recursion is for code stylists not programmers
>>
>>60797846
>that spacing
>that function
>>>/reddit/
>>
>>60797846
He enjoys talking to a brick wall
>>
>>60797846
>Python
Stopped reading there.
>>
>>60797846
Is this an attempt at defending something you don't believe? It's almost convincing.
>>
>>60797846
for _ in range(n):

Here's some idiomatic loops for ya
>>
SICP hardcover or paperback?
I feel like hardcover would make me feel like a wizard, but paperback is easier to manage.
>>
>>60797866
This. Ceilings > toilet seats >> walls.
>>
>>60797846
>recursion
People who would defend recursion as a solution for an infinite series are morons.
Don't bother refuting them.
>>
>>60797846
ln[:n]
What's the point in slicing it? Doesn't it mean you've done the last addition for nothing?
>>
>>60797886
Hardcover trumps paperback every time.
>>
>>60797846
Your a fucking idiot.

def fib(n):
a,b = 0,1
for _ in range(n):
yield a
a,b = b,a+n

>2017
>not designing functions lazily
pick one
>>
>>60797879
>_
>>
File: 1495722905464.gif (599KB, 500x500px) Image search: [Google]
1495722905464.gif
599KB, 500x500px
>>60797846
I have no gripe with Python, but that's disgusting
>>
>>60797846
>fibonacci
>keep a list
This isn't erathostenes tho
>>
>>60797895
K&R is better as paperback
>>
>>60797897
a,b = b,a+b

git add *
git commit -m "fuck"
git push -u master origin
>>
>>60797846
There are O(log(n)) ways to compute the n'th Fibonnaci number you know?

...

</eulerproject>
>>
>>60797897
best version desu
>>
>>60797913
it's
origin master
nizzle
>>
>>60797889
This. Looping is just retarded.
>>
File: 1484862720362.jpg (30KB, 425x382px) Image search: [Google]
1484862720362.jpg
30KB, 425x382px
>>60797900
>I have no gripe with Python
That's disgusting.
>>
>>60797968
Scat is a respectable fetish.
>>
>>60797956
What. That's the opposite of what I said.
>>
File: 1490833016594.gif (121KB, 256x256px) Image search: [Google]
1490833016594.gif
121KB, 256x256px
>>60797968
Other people can use whatever they want, doesn't mean I have to.
>>
>>60797992
How is that even remotely relevant?
>>
>>60797984
Oh, so you're a recursionfag? Don't reply to my posts.
>>
>>60797915
>he doesn't calculate the numbers beforehand and makes an array with the results for O(1) computations

...

</pwndproject>
>>
>>60798040
But no. You said that looping was retarded. I think looping is important a lot of the time.
>>
>>60798072
>You said that looping was retarded.
Looping is retarded.
>I think looping is important a lot of the time
That's because you are retarded.
>>
>>60798049
def fib(n):
if n>=100: raise NotImplementedError
return [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025, 20365011074, 32951280099, 53316291173, 86267571272, 139583862445, 225851433717, 365435296162, 591286729879, 956722026041, 1548008755920, 2504730781961, 4052739537881, 6557470319842, 10610209857723, 17167680177565, 27777890035288, 44945570212853, 72723460248141, 117669030460994, 190392490709135, 308061521170129, 498454011879264, 806515533049393, 1304969544928657, 2111485077978050, 3416454622906707, 5527939700884757, 8944394323791464, 14472334024676221, 23416728348467685, 37889062373143906, 61305790721611591, 99194853094755497, 160500643816367088, 259695496911122585, 420196140727489673, 679891637638612258, 1100087778366101931, 1779979416004714189, 2880067194370816120, 4660046610375530309, 7540113804746346429, 12200160415121876738, 19740274219868223167, 31940434634990099905, 51680708854858323072, 83621143489848422977, 135301852344706746049, 218922995834555169026][:n]
>>
>>60798133
>has to write the list out
>can't calculate it at compile time
>>
File: dlang_chan.jpg (70KB, 349x368px) Image search: [Google]
dlang_chan.jpg
70KB, 349x368px
Threadly reminder that dlang-chan has RAII; she's quite fast in execution and compilation; and she's super duper cute! Say something nice about her, /dpt/!
Also, Andrei's a pretty cool guy.

>Tour
http://tour.dlang.org/
>Books
https://wiki.dlang.org/Books
>GC
https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
https://wiki.dlang.org/Libraries_and_Frameworks#Alternative_standard_libraries_.2F_runtimes
>>
>>60798133
Tbh this is probably what I'd do in python because it's normally so slow.
>>
>>60798152
>compile time
>python
You're a special kind of stupid
>>
>>60795422
dumb frogposter
>>
>>60798159
Look
Either you post a piece of code you wrote in D yesterday or today or I will call you a phoney in front of /dpt/
>>
>>60798170
I'd still be right you nerd
>>
>Rustacean
>Pythonista
What else?
>>
>>60798193
Deep C Diver
>>
>>60798177
We don't write "codes" around here, pal.
>>
>>60798177
Why post my pathetic shit when I can post code from better skilled people?
>>
File: 1494875494377.png (161KB, 472x599px) Image search: [Google]
1494875494377.png
161KB, 472x599px
>>60798133
>can't even do the whole list
>>
>>60798213
wtf, don't be so hard on yourself
we care about you, not some "better skilled people"
>>
>>60798241
>implying I won't be bullied like a certain invisible yuru
Nice try, anon.
>>
This may be a common question, but what's the best way for an absolute beginner to get into programming?

Books? Software?

Is there a decent guide out there?
>>
>>60798346
code.org, do the angry bird tutorial.
>>
Can clock_gettime() return just the tv_sec or am I going to have to make a struct for it and pass it along whenever I call it.
>>
>>60798346
Learn to google, fagboy
>>
>>60798367
b-but this is just a shitty flash puzzle game for kindergartners
>>
>>60798346
were you any good at math, logic in highschool?
also, state your goal, why do you want to get into programming
>>
>>60798371
Nope, but you could just wrap it in a function that then returns the seconds.
>>
>>60798609
I was decent at math, but never finished calculus.

I'm interested in programming as a potential career skill. IDK how practical that is.
>>
File: IMG_0155.jpg (22KB, 480x360px) Image search: [Google]
IMG_0155.jpg
22KB, 480x360px
>>60793579
I want to learn Java but I am dead creativity wise.

Give me an idea of something to develop. Something with no GUI and that just requires whatever the JDK provides (no extra libraries).
>>
>>60798726
raytracer
>>
>>60798726
Fizzbuzz
>>
>>60793579
Programming challenge: form a circular list in your language of choice.
All items in the list must refer to the same object located in memory.
Here's an example in Lisp:
#1=(9 . #1#)

This is expanded into a circular list consisting of
(9 9 9 ... )
>>
Are you proud of your work Anon?
>>
I started learning scripting languages and i just found out Powershell has native webscraping libraries

I have also found out InvokeWebrequest has -UseBasicParsing parameter which basically loads only basic portion of the site (what is "basic"?), is that only part of the HTML or what?

Can anyone explain what's the difference between regular InvokeWebrequest and BasicParsing?
>>
File: Eta syntax highlights.png (8KB, 194x1044px) Image search: [Google]
Eta syntax highlights.png
8KB, 194x1044px
Which palette for syntax highlights do you guys prefer
This? 1/2
>>
File: synthcity syntax highlights.png (11KB, 601x336px) Image search: [Google]
synthcity syntax highlights.png
11KB, 601x336px
>>60799058
Or this? 2/2
>>
>>60799058
>>60799069
both are shit but I pref the 1st
>>
>>60799058
Use a color wheel
>>
>>60799058
With vim I used Earendel.
>>
>>60797017
>C++ standard has enveloped everything.
>dont you mean boost.
Is there a difference?
>>
Is it possible to print debug info in GLSL shaders?
I feel like I'm trying to build a ship in a bottle every time I attempt shader code.
>>
>>60795079
C++20 will.
>>
>>60799505
https://www.opengl.org/sdk/tools/gDEBugger/
http://www.nvidia.com/object/nsight.html
https://renderdoc.org/builds

I prefer render doc where it works.
>>
>don't use ides their bloated lmao you said
>use vim you said

>try to get omnicomplete for C#
>need omnisharp
>omnisharp needs python
>omnisharp needs syntastic
>syntastic needs the Mono C# compiler (119 MB)
>omnisharp needs omnisharp-server
>omnisharp-server needs msbuild
>msbuild needs to be built from source
>msbuild need Visual Studio 2017

Great editor you got there folks, really not memey at all.
>>
File: IMG_3944.gif (847KB, 500x370px) Image search: [Google]
IMG_3944.gif
847KB, 500x370px
So where did we land with the whole Exceptions Vs Structuring Code to Prevent Exception-Cases debate?
>>
>>60799619
>vim
This was your first mistake.
>>
>>60799622
>Exceptions Vs
rhs is always better.
>>
File: Assist_Trophy_Andross.jpg (58KB, 1000x760px) Image search: [Google]
Assist_Trophy_Andross.jpg
58KB, 1000x760px
Learning OpenGL. How do I compute flat shading, given than I can't hard code my normal vectors into my VBO (since I'm using an EBO to save vertices)? I've only followed learnopengl.com up to basic lighting but the fucker hardcodes his normal vectors, and I can't.

Pic related.
>>
>>60799622
Static analysis is best, exceptions if you're lazy.
>>
anyone have that list of programing practice projects. I want to hone my C++ skills over the summer for the next level class i take in fall.
>>
File: v2g.jpg (304KB, 1280x953px) Image search: [Google]
v2g.jpg
304KB, 1280x953px
>>60799786
can't find v4.0

also
http://www.dreamincode.net/forums/topic/78802-martyr2s-mega-project-ideas-list/
>>
>>60799850
thx
>>
NEW THREAD!!

>>60799997
>>60799997
>>
>>60800003
dumbass
>>
>>60799999
>>60800000
>>
>>60800003
Are you being retarded on purpose?
ISHYDDT
>>
File: interrupt_routine.jpg (285KB, 544x645px) Image search: [Google]
interrupt_routine.jpg
285KB, 544x645px
>>60793593
Ok, listen little faggot. Have you ever written a compiler? Have you ever written an interrupt routine, you little faggot? You ever written an interrupt routine? you little faggot. No, you haven't because you're a faggot. Okay. Why don't you go write an interrupt routine faggot. Haskell? You're fucking in the ocean with some nigger in the deep ocean. Got no clue what's underneath you, you little faggot. Why don't you go write an interrupt routine?

This is an interrupt routine. I wrote my own compiler. It has an interrupt keyword. Does Haskell have an interrupt routine? Can you write an interrupt routine in haskell with an interrupt keyword? Huh? Can you write an interrupt routine in haskell? Do you know what an interrupt is, you little faggot? Everything you know about haskell is something I know about interrupt routines. How about them? How about them apples? Huh? Everything you know about haskell or lisp, I know about interrupt routines. Fuck yourself nigger
>>
File: 1452176223023.png (58KB, 283x255px) Image search: [Google]
1452176223023.png
58KB, 283x255px
Working on my imageboard, 4kev.org
>>
What are some good programming blogs written by really smart people?
>>
>>60800618
http://altdevblog.com/
Search for topics you like. There's some real gems there.
>>
>>60798951
struct list {
int value;
struct list* next;
};

int main()
{
struct list xs;
xs.value = 9;
xs.next = &xs;
}
Thread posts: 316
Thread images: 30


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