[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 24
File: it's a trap.png (873 KB, 1275x677) Image search: [Google]
it's a trap.png
873 KB, 1275x677
What are you working on, /g/?

Previous thread - >>55163989
>>
>>55169989
>traps
Stop posting this forced meme
>>
>>55169989
Is there an english translation for the PSP version of the 2nd game?
>>
File: monad diagram.png (26 KB, 334x358) Image search: [Google]
monad diagram.png
26 KB, 334x358
>monads are complicated
Retards will defend this
>>
>might be cool to do video game development as a random project
>but can't into art, storytelling, musical composition, or general game design
>can only really program
>>
>>55170018
>implying any of those are necessary
>>
File: hikaru.png (862 KB, 661x906) Image search: [Google]
hikaru.png
862 KB, 661x906
so can anybody help with this
>>55169727 (You)
>>55169720 (You)
and by "help", I mean, can you find out what goes wrong in getfiles (because the function doesn't output what it should (what is should output is all the files under the directory getfiles was called with))
>>
>>55170018
you could team up with one of those hopeless /agdg/ people
>>
>>55170022

But you can't just like... make game man.
>>
>>55170028
Ban evasion
>>
>>55170045
>no art, storytelling, musical composition, game design
>what is minecraft
>>
>>55170053
no, I just wanted another pic
and I'll have you reminded that you can't announce "reported"
>>
>>55170076
Go kill yourself faglord
>>
>>55169989
What is this stupid shitty op?
>>
>>55170062

Art -- granted, it's fairly blocky shit, but still art.
Musical Composition -- have you listened to any minecraft music?
Game Design -- it was a good enough idea to get him 2 billion dollars.
>>
>>55170094
fag
>>
>>55170170
Why don't you just stop worrying about "success" and just make something?
It's unlikely that your game is going to be the next minecraft or something that was by one developer that is actually good, like touhou.
>>
File: Please.jpg (31 KB, 539x437) Image search: [Google]
Please.jpg
31 KB, 539x437
>>55170028
What DOES it output which it shouldn't output? Poast the exact version of your shitty function that you're refering to, the input you're feeding it, the expected output, and the actual output, all clearly marked. Thank you for your cooperation.

t. Christine Weston Chandler
Don't be a faglord and STAY STRAIGHT
>>
>>55170170
>blocky >art
>music >not notch's
>design >poorly designed
>>
>>55170204
>Poast the exact version of your shitty function that you're refering to, the input you're feeding it, the expected output, and the actual output, all clearly marked. Thank you for your cooperation.
I shouldn't have to, you should be intelligent enough to figure this out and spoonfeed me
>>
>>55170215
>>55170204
>>55170028

Samefag, fuck off and stop trying to disrupt the thread.
>>
>>55170215
I wasn't going to click on your links, but ok whateva. Wait
>>
>>55170204
>>55170215
>>55170223
why r u trying to discredit my reputation
I really just want answers and help

pic related, im not samefagging
>>55170204
the ones I quoted have everything you need

the other guy is
>>
>>55170244
forgot pic
>>
>>55170244
>I really just want answers and help
Is that why you spent 30 posts in the last thread "debunking" people who asked for more info they couldn't decipher from your cryptic non-sequitur bullshit?

>the ones I quoted have everything you need
I rest my case
>>
>>55170225
>>55170244
You should map addparent before you filter for doesFileExist/doesDirectory exist. Subsidiary question: why is that?

t. Your master
Get out of programming, thank you so much.
>>
>>55170268
can you help me or not
this time, I have posted everything, the pic I quoted has output with functions with many different arguments, and it also defines the functions
>>
>>55170291
>can you help me or not
I can, but I wont.
>>
>>55170307
it doesn't matter faggot, because now it works
kll yourself, you can't understand or use critical thinking to decipher the question or problem, which btw was implicit
learn to implicit, cuck
>>55170278
thanks faggot
>>
>>55170307
I'm >>55170278 and if that's the case you should have kept your fucking mouth shut. Thank the Lord you're anonymous you sack of despicable shit, otherwise you'd have already reunited with Him.
>>
>>55170337
keep telling yourself that
ill sage because I don't wanna shitup the thread by replying to your obvious baits
>>
Back again. Still in the same place.
Need to use python (or perl!) to take an entire directory of .7z files and then iterate over them, POSSIBLY:
-unzip them one at a time (unzipping all of them would take space I do not have), move a single file (has "[!]" inside of the filename) that up one directory, and then delete the unzipped folder and archive
OR
-extract a single file (has the string "[!]" in the name) from the archive, then delete the archive
Really shitty incomplete code:
import os
workingdir="C:\\Users\\Peremptoria\\Desktop\\ROMS"
sevenzipdir="C:\\Program Files\\7-zip\\"
def unzip(path):

filenames=os.listdir(workingdir)
for filename in filenames:
unzip("{}\\{}".format(workingdir, filename)) #Both are string
>>
>>55170337
You helped him and he called you a faggot. See what you did? You fed the troll. Never feed the troll.
>>
>>55170363
>>55170337
samefag
and now I'll be a troll because you were mean for no reason
kill yourself
>>
>>55170351
>>55170291
>>55170334
>>55170244
>>55170076
>>55170028
Kill yourself
>>
>>55170374
I hope you saged
>>
>>55170372
Go die in a fire
>>
>>55170385
I noko-saged
>>
>>55170388
Nice photoshop skills you fuck
>>
>>55170388
autism
>>
>>55170388
>what is photoshop
>>
how do i multiply a matrix in assembly?
>>
>>55170409
Eat shit and die
>>
>>55170409
very carefully
>>
>>55170401
>>55170406
>Photoshop
>Not just changing the page's HTML and then screenshotting that
You two sure like to make things unnecessarily hard for yourselves.
>>
File: 1463174335918.jpg (98 KB, 865x924) Image search: [Google]
1463174335918.jpg
98 KB, 865x924
>>55170307
>>55170334
Neither of you is in the wrong because here is not Niggeroverflow: we cant have a guideline for how to ask dumb questions nor incentives for responding in a polite and to the point manner, nor an archive of already asked qs. Therefore, next time you see a rookie asking to be spoonfed, you should refrain from doing anything besides answering
>-> https://stackoverflow.com/ <-
and this general will fare way better. Do it for Hime. Thoughts?
>>
>>55170401
>>55170404
>>55170406
>photoshop
>clearly a mac screenshot
kek
>>
>>55170420
Please stop posting your fucking stupid forced meme.
>>
>>55170420
Fuck off you weaboo faggot
>>
>>55170420
>posts anime
discarded
>>55170423
>knowing enough about macs to know that
kys
>>
>>55170420
>asking to be spoonfed
I have no issue with that, what I have an issue with is him getting rude and starting to shitpost like crazy when people were asking for him to please provide some more info in addition to his original incoherent ramblings. He spammed the previous thread with at least 30 posts.
>>
>>55170435
But macs have photoshop. It's always been a mac first program since it came out on the mac initially.
>>
>>55170420
I'd fuck him
>>
>>55170442
>explain why error is not needed
>proceeds to ask for error 5 times
>starts calling me names and asking me to kill myself even though he hates rudeness
do you see the problem with yourself
>>55170452
*her
>>
>>55170452
>>55170420
Stupid samefag.
>>
>>55170467
>*her
Don't delude yourself, you degenerate.
>>
>>55170471
he thinks he's a girl so he's a girl, retard
>>
>>55170467
Fucking degenerate.
>>
>>55170467
>starts calling me names and asking me to kill myself even though he hates rudeness
After 30 posts of "fuck you you should be intelligent enough", yeah sure.
>>
>>55170487
I never said that, faggot, I started being rude the moment you started being rude
>>
>>55170487
Fuck off you retarded sack of shit
>>
>>55170499
You were rude from post one you flaming faggot. I'm not even the guy that originally answered you, I only answered after you for the N'th time reiterated your incoherent question.

You're just angry because you failed to type a question in english and this thread is proof of your butthurt.
>>
>>55170521
i dont believe you
nobody would be so bamboozled
you're clearly the only person who has problems understanding the question, which was implicit form a few statements
kys
>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>my sides >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>""""""""""""""""""""""""""""""this""""""""""""""""""""""""""""""""""""""""""""""thread""""""""""""""""""""""""'''''
>>
>>55170548
You got your answer, you're still shitposting.... It's clear to everyone that you are immensely butthurt.
>>
>>55170469
Wanna see my dick?
>>
File: 1465857215948.jpg (262 KB, 639x960) Image search: [Google]
1465857215948.jpg
262 KB, 639x960
>>55170420
>>55169989
kys you stupid pedophile
>>
>>55170575
I am?
What would I be mad about.
Clearly its you, because I used you and discarded you, like the beta you are, cuck.
>>
>>55170587
Sue me or I'll continue to oppress you
>>
>>55170589
>What would I be mad about.
Being a retard? Not knowing Haskell? Not knowing how to type proper English?
>>
>>55170603
If I ever find you, I'm going to stab you in the neck with a fork.
>>
Where are the janitors when you need them?
>>
>>55170614
not really, I fugred everything out
the only part I actually used anything anybody here gave me was the when to map addparent
the foldlm I came up with, and I already had a hunch I had to use something like foldM

and grmmor isn't a god incator of intelligance & knawlkege, fagit
>>
>>55170619
Aww he mad, is he?
>>
File: 20-15-50-maxresdefault.jpg (117 KB, 1280x720) Image search: [Google]
20-15-50-maxresdefault.jpg
117 KB, 1280x720
>>55170635
Good point. How long till this shit thread gets deleted and we have a proper dpt?
>>
>>55170635
don't worry, im saging, so my posts don't count toward thread count
im just having fun with this bitch boy who thinks he's "won"
>>
>>55170658
>so my posts don't count toward thread count
Yes they do, idiot. Saging just doesn't bump the thread.
>>
>>55170644
>and grmmor isn't a god incator of intelligance & knawlkege, fagit
Kys

>>55170658
Fuck off newfag.
>>
>>55170644
Yeah, you sure "fugred" everything out. Why don't you also fugr off now that you've fugred it out?

>the foldlm I came up with, and I already had a hunch I had to use something like foldM
You were pretty much told to use foldM.

But now that you have your answer, why are you still here? Are you really so frustrated that you have to tell everyone how frustrated you are?
>>
>>55170678
>>55170671
>>55170670
I was just pretending to be retarded, and I still won, because I rused you guys
>>
>>55170658
You're a fucking newfag, saging is basically "increase thread count but don't bump the thread". You're shitting up the thread for no good reason , you butthurt idiot.
>>
>>55169989
FUCK YOU FOR FUCKING UP A PERFECTLY FINE THREAD WITH YOUR SHITTY MEMES
>>
>>55170686
>MAXIMUM DAMAGE CONTROL
>>
File: pretending2.png (53 KB, 755x1255) Image search: [Google]
pretending2.png
53 KB, 755x1255
>>55170686
>I was just pretending to be retarded

You have to be 18 years of age to post here.
>>
Why do SJW get triggered by anime so much?
>>
File: damage-control.jpg (109 KB, 650x650) Image search: [Google]
damage-control.jpg
109 KB, 650x650
Damage control - the thread
>>
>>55170699
>>55170722
can you guys stop replying to me, this is the only thing that makes me want to shitpost more, thanks
>>
>>55170732
What does sjw have to do with anime you fucking retard
>>
I made a program that I know people will use, how do I make money now?
Do I put adds up? Charge for it?
Release it for free and bundle my own special botnet with it?
Which one of these will make the most money?
>>
>>55170739
Release it for free
Open source is the future
>>
>>55170739
Suck dick and fuck dudes.
>>
>>55170745
>he thinks people donate when they use free software
>>
File: sjwWiki.png (97 KB, 1366x585) Image search: [Google]
sjwWiki.png
97 KB, 1366x585
>>55170738
>>
>>55170760
He didn't, you're just a greedy jew that assumes you are entitled to money.
>>
>>55170739
make closed source
nothing good comes from open source
you really think peoplea are going to check the source to make it better or something?
nobody has the time for that
poste
fernand
>>
>>55170768
Are you actually promoting pedophilia and loli you disgusting faggot???
>>
>>55170760
community contributions to your shitty app > money
>>
>>55170768
>Anime Twist
my nigga
>>
>>55170784
Oh, did I just trigger you?
>>
File: triggered.webm (2 MB, 224x400) Image search: [Google]
triggered.webm
2 MB, 224x400
>>55170796
>>
>>55170804
>Loli defenders right now
KEK
>>
File: 1455369987908.jpg (72 KB, 1024x512) Image search: [Google]
1455369987908.jpg
72 KB, 1024x512
>>55170784
What if I say yes? XDD
>>
What is a simple graphical interface for gdb? -tui keeps messing up every time it scrolls down so I have to keep typing in refresh and wasting time.
>>
Isn't it me, or does IO in fact contaminate everything instead of being kept at bay, as most haskellers would probably say.
>>
>>55170796
>>55170842
>not being a pedophile makes you an sjw
Holy shit you weaboo faggots are fucked in the head

>>55170853
Drawings of children though.
>>
>>55170858
You shouldn't do IO in Haskell, it is impure and has side-effects.
>>
>>55170862
See your fellow SJW live in action >>55170784
>>
>>55170804
Why did policemen wait until he hits her to intervene?
>>
>>55170864
But one needs it. IO is imperative to do real work.
>>
>>55170864
Nope
The IO monad has no side effects
>>
>>55170875
Fuck off you degenerate
>>
>>55170881
This

IO is not impure. IO constructs a value that the runtime may "execute"
>>
>>55170862
>Drawings of children though.
So? They're fantasies, not people. If someone actually forced a real child into those poses and sketched that, that would be a different story, but that isn't the case %99.9 of the time.
There are depictions of things like murder in all sorts of art, yet nobody is labelled a "murderer" for that.
>>
>>55169997
i don't think so but there's a pc version
>>
>>55170878
They entered the train when it stopped at the station.

>>55170879
>real work
You shouldn't be using Haskell then, you imperative pleb.

>>55170881
Monads are just containers to do impure stuff.
>>
>>55170884
If I don't, what exactly are you going to do about it? Cry that you got "cyber-bullied"?
>>
>>55170891
Do you consider fapping to a photo of a child the same as fapping to loli?

Would you ever have sex with someone less than 14 years years old?
>>
here you retards
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html
>>
>>55170893
Monads are not impure and monads are not containers

Monads are just instances obeying the following diagram
>>55170001
>>
>>55170891
People don't get excited and want to murder people if they see drawings of murders.

People do actually get (sexually) excited by drawings and want to rape little boys and grills.
>>
File: 1449527932992.jpg (489 KB, 1280x912) Image search: [Google]
1449527932992.jpg
489 KB, 1280x912
Good thread.
Me with the glasses.

Also how should I go about rendering ~12M points in 3D space?
>>
>>55170917
TRIGGERED

SUCH OPPRESSION
>>
>>55170906
That looks an awful lot like a state machine. State machines alter state (and thus have side-effects).

Monads alter state. Monads have side-effects. Monads are impure.
>>
>>55170917
OpenGL

>12M
not that many
>>
>>55170923
Kill yourself stupid weaboo
>>
>>55170924
Monads do not alter state.
Monads do not have side effects.
Monads are not impure.

The picture does not look anything like a state machine. It is a diagram showing morphisms.
For instance:

1 ----(+1)----> 2

Not impure. Not a state machine.
>>
Stop replying to the trolls who have no knowledge of how Haskell works. They have no intention to learn what a monad is and are only doing this to annoy those of us who care enough to respond.

fuck them right off.
>>
>>55170768

Do we need to bring back pedobear to piss off SJWs?

>>55170881

Except for, you know, printing crap to the screen.
>>
Was just messing about with beginner SDL. First day at my new job (unrelated) starts in just over an hour.
>>
>>55170904
this is wrong though.
>>
>>55170953
>has an internal state (that is "contained")
>output differs
>not a state machine
>calling it "morphism" instead
You functional fags sure do some impressive mental gymnastics in order to avoid your own crippled limitations.
>>
>>55170960
It seems like it's that time again, fellow anon
>>
>>55170960
That's not the IO monad, that's the haskell runtime.

Think of it this way - C source code is not impure, but C programs are. Haskell "returns source code".
>>
>>55170858
Yes.
Haskell went full retard when it came to IO.
Getting your input from a file should require you to significantly alter the structure of everything you do.
Even just an input delimited by new line characters instead of fucking spaces or something requires you to taint your program with that piece of shit.
>>
>>55170925
It doesn't need to be interactive, though.
I'd love to avoid writing my own renderer.
>>
>>55170950
Cry a bit more, not enough tears
>>
>>55170976
They aren't states of the same object, they're different objects.
>>
>>55170973
State what is wrong
>>
>>55170979
This is one of the best features of Haskell that other languages need to learn. (An alternative is an effect system.)

The fact that IO 'taints' the type of the function means the compiler can determine almost anything that can be done at compile time, and evaluate it then.
>>
>>55170978
If your monad tells the runtime to do something, your monad is causing side effects. Stop being a pedantic shit and accept that all of programming is about causing side effects. A program that does not have side effects is equivalent to an empty program, or an infinite loop.
>>
>>55171015
Filtered :')
>>
>>55170998
functors are not a "wrapped" value.
applicatives do not allow you to apply a "wrapped" function to a "wrapped" value
etc...
>>
>>55171019
Subscribed and broke the filter :^)
>>
>>55170960
Haskell can't have side effects

IO Foo is a recipe for creating a Foo. Another common, more literal, way of saying this is that it is a "program that produces a Foo". It can be executed (many times) to create a Foo or die trying. The execution of the recipe/program is what we ultimately want (otherwise, why write one?), but the thing that is represented by an IO action in our code is the recipe itself.

That recipe is a pure value, in the same exact sense that a String is a pure value. Recipes can be combined and manipulated in interesting, sometimes astonishing, ways, but the many ways these recipes can be combined (except for the blatantly non-pure unsafePerformIO, unsafeCoerce, etc.) are all completely referentially transparent, deterministic, and all that nice stuff. The resulting recipe depends in absolutely no way whatsoever on the state of anything other than the recipes that it was built up from.
>>
>>55170978
>That's not the IO monad, that's the haskell runtime.
Jesus christ, you can't be serious.
Are you going to claim that program output is not a form of state?
>>
Yet another DPT completely ruined by pretentious Haskell fags.
>>
>>55171010
Yes, but there should be no difference between an input delimited by newlines and one delimited by any other character.
An input given to a function at command line shouldn't be treated differently that an input give by the contents of a file. That's just fucking retarded.
>>
>>55171042
main = forever killYourSelf
>>
>>55171055
what are you even saying?
>>
>>55171015
No, it's not. Your monad isn't telling the runtime what to do, your monad is a value that the runtime chooses to evaluate.
The runtime is impure.

>>55171041
A haskell program is a pure function
() -> IO ()
This IO () is a value that the program outputs.
The haskell runtime interprets the IO () as a program, and runs it.
>>
>>55171071
>the function is still pure because only the runtime is affected and has side-effects
MENTAL GYMNASTICS
>>
>>55171010
Other langauges can implement the IO monad, like F#
>>
>>55171086
f x = "print 3"
is f impure?
>>
>>55171069
he's saying that some things should not be treated as IO
e.g. exceptions to the rule, instead of trying to make everything (even if it should be IO), that way, it'd be less complicated
>>
>>55171071
>This IO () is a value that the program outputs.
>The haskell runtime interprets the IO () as a program, and runs it.
You could apply that stupid reasoning to ANY programming language and program. Saying something so general is completely pointless.
>>
>>55171100
>Saying something so general is completely pointless.
Isn't that the entire point of lambda calculus tho?
>>
>Haskell can't have side effects
I dunno man, this Haskell program looks like it would have a side effect:
main = putStrLn "Hello world!"


But you're the Haskell expert, not me. Are you telling me this program doesn't print Hello World? Or are you telling me this is not a Haskell program?

>That recipe is a pure value, in the same exact sense that a String is a pure value
Right, but there's a different between returning a value and telling the runtime "hey, go do I/O for me, will ya?"

>are all completely referentially transparent, deterministic, and all that nice stuff
Right, but they still have side effects.
>>
>>55171096
i still don't understand what he or you are trying ti say, what the fuck does IO have to do with how a file is delimited or how it is parsed. The IO 'grabs' the data and then the pure function handles the parsing etc... what has IO got to do with that?
>>
>>55171071

Hitler never killed 6 million Jews. What likely happened is that he signed some documents, and his officers interpreted those documents as orders to kill 6 million Jews. But let's not mistake this as him causing 6 million Jews to die.
>>
>>55171132
instead of treating it like IO a, treat it as just a, that way, no monad stuff enters the game (thus less complicated)
he esentially wants it more imperative like
>>
>>55171100
No, because IO a 's can be passed around within the language and manipulated, and most languages compile directly to the program.

Haskell itself does the majority of work from within the language.

>>55171124
It doesn't TELL the program to "go do an IO", it is simply a value that describes a set of instructions.
The runtime could ignore it if it wanted.

This is the unintuitive thing - when you request input, you are effectively describing a callback rather than literally hanging for input. If you thought of it as side-effecting this wouldn't make sense, you'd need to go "back in time".
>>
>>55171124
The point is - Haskell is always pure, IO doesn't change this.

So, our impure, non-independent codes have to get a common dependency - we have to pass a RealWorld. So whatever stateful computation we want to run, we have to pass this RealWorld thing to apply our changes to - and whatever other stateful computation wants to see or make changes has to know the RealWorld too.

Whether this is done explicitly or implicitly through the IO monad is irrelevant. You build up a Haskell programm as a giant computation that transforms data, and one part of this data is the RealWorld.

Once the initial main :: IO () gets called when your programm is run with the current real world as a parameter, this real world gets carried through all impure calculations involved, just as data would in a State. That's what monadic >>= takes care of.

And where the RealWorld doesn't get (as in pure computations or without any >>=-ing to main), there is no chance of doing anything with it. And where is does get, that happened by purely functional passing of an (implicit) parameter. That's why

let foo = putStrLn "AAARGH" in 42

does absolutely nothing - and why the IO monad - like anything else - is pure. What happens inside this code can of course be impure, but it's all caught inside, with no chance of interfering with non-connected computations.
>>
>>55171124
Strictly speaking from the programs point of view there is no side effect, that is to say it is entirely the runtimes choice to handle putStrLn however it wishes so long as it satisfies the type signature.
>>
>>55171148
That'd be assuming the Holocaust happened in the first place
>>
>>55171152
oh, so he doesn't actually understand it and is just talking shit like people who don't watch football saying it would be better if they made the goals bigger and got rid of the keepers,

He's a moron, got it.
>>
>>55171158
>The point is - Haskell is always pure
DELUSIONAL

>>55171148
Keke
>>
>>55171042
More like ruined by pedos and trapfags
>>
>>55171171
>Haskellfag logic
You're saying that Hitler is pure then?

>>55171158
So the IO monad actually is a container then?
>>
>>55171206
It's not a container for fucks sakes
>>
>>55171158
Realworld is not strictly true though is it?
>>
>>55171206
no, its a promise
thinking of just "a container" is harmful
those containers have context
IO has the context of a container that needs to do something to get its value
>>
>>55171227
You literally explained how it "contains" side-effects and other impurities from Haskell code by returning it as instructions that the runtime executes.
>>
>>55171154
>The runtime could ignore it if it wanted.

So Haskell has undefined behavior?
>>
does anyone here barely annotate private code?
>>
>>55171256
*barely annotate functions with their type in private code
>>
>>55171235
>those containers have context
>IO has the context of a container that needs to do something to get its value
So you're saying it has state?

I'm confused, why can't functional programmers just use normal terms like everyone else does? The IO monad is a stateful container. We get it.
>>
When I want to go through char** environ is the last member always that string (null)? i simply want to print out all the environment variables via the environ pointer, but I have no way of knowing when to stop since it isn't null terminated or anything.
>>
where is this mythic "open source community"? how can I join? is it a real community in the traditional sense or is it just a mailing list?
>>
>>55171301
Use getenv instead

char** environ is implementation defined
>>
>>55171279
im not an expert, so don't take my word for it
and I don't it think it has state
>>
>>55171303
It's just a mailing list. Sometimes they meet, check out your local UNIX user group
>>
>>55171279

They want to play in imagination land, where side effects don't exist. The reality is this:

If a programming language cannot receive input and cannot produce output in some manner, it is not turing complete, and all of its programs can be boiled down to one of the following:

1. An empty program.
2. An infinite loop
>>
>>55171341
A Haskell program is a pure program that returns an impure program.
>>
>>55171346
wait wat

are you serious right now?

is this actually the argument of Haskell programmers or an epic meme?
>>
>>55171346

A Haskell program is the impure program returned by the pure program.
>>
g'night /haskell/
main = sleep :: IO ()
>>
>>55171368
Filtered :')
>>
>>55171373
type mismatch
expecting type: IO ()
actual type: Int -> IO ()
>>
>>55171359
>>55171368

Haskell:
pure string func(int x) { return "writeln(" ~ x ~ ");"; }

Runtime:
mixin(func(3));
>>
>>55171388
type Hour = Word8
sleep :: Hour -> IO ()
sleep = ....
main = sleep 7.8

actually whats the smallest range within Num
>>
>>55171419
Bool
>>
>>55171419
*smallest range type within Num
>>
File: akuanime.png (222 KB, 634x597) Image search: [Google]
akuanime.png
222 KB, 634x597
>>55170420
fuck off animehomo
>>
>>55171419
>>55171425
Actually () might be a Num, let me check
>>
>>55171425
after Bool though?
>>
>>55171411

Well by that logic, Java is pure. It's the runtime that's doing all the fucking work.
>>
>>55171445
What do you mean "after"?
>>
>>55171454
As in opposite of before
>>
>>55171453
Java is impure bytecode.
Main in Java doesn't "return" the program, it executes other parts of itself.

>>55171425
>>55171443
>>55171445
Bool's enum but I don't know if it's a Num actually
>>
>>55171464
So a compiler is pure?
>>
>>55171474
It depends, a lot of compilers link other files and such. If you think of the source code as the input to the compiler, and the compiler has all the other libraries built in, then yes.
>>
>>55171464

No no, but I'm not talking about the bytecode. The bytecode isn't Java. Java is a language that generates bytecode, and the impure bytecode is the program. Java is pure.
>>
>>55171504
No, because Java doesn't return the program.

Think of it this way - main in Java returns an int. Not a program. An int.
>>
>>55171313
I would do that If I wanted to find a value of a specific EV. I simply want to list them all out. Kinda what you get when you enter env in bash.
>>
>>55171504
Ignore him, he's clearly mistaken about what Haskell is and what Haskell isn't. What question specifically would you like answered and I'll do my best to try and answer you as clearly as possible.
>>
>>55171042
>ruined by Haskell fags
Discussing a programming paradigm isn't ruining dpt. What's problematic is when people stop arguing. Or people who know nothing about software development pretend they do.
>>
>>55171528

>main in Java returns an int.
Main in Java doesn't return anything, Anon.

>>55171581

The fuck is a monad?
>>
>>55171620
>main in Java doesn't return anything
Well, there's your proof.

>what's a monad
See >>55170001
>>
>>55171620
the advantage of those mental gymnastics is that all side effects are explicitly annoted in a strict way so the compiler (and arguably the runtime) have greater possibilities (which you could also consider an advantage for code readability)
in reality the current haskell compilers don't really use the full potential of those possibilities, though
>>
>>55171620
You won't like the answer, but it is anything that implements the following interface
return :: a -> m a 
(>>=) :: m a -> (a -> m b) -> m b

That's it, that's all it is. People like to say it's like a container or a context or a burrito or something like that, but really it's just a datatype that you have defined those functions for.

That may seem like a cop out, but it really is the only answer. It provides a generic interface for abstracting over a variety of seemingly unrelated concepts, from IO to State to Streaming Computation, to Databases to Error Handling.
>>
>>55171629

Tell me the following:

After the termination of main, if a program is returned, does the Haskell standard require that something be done with that program?

If yes, then if that program can contain an instruction that is to be interpreted as I/O, if that instruction must be interpreted, Haskell has side effects. Otherwise, Haskell has undefined behavior.

If it is not required, then Haskell either has undefined behavior, or Haskell programs are equivalent to either nothing or an infinite loop.

If we do not consider the Haskell runtime to be a part of the Haskell language spec, neither can we consider the Java runtime a part of the Java language spec, and therefore all Java programs are pure because no Java program does anything.

If we do consider the Haskell runtime to be part of the Haskell language spec, we must consider what the spec requires as described above.
>>
>>55171698

Now if only Haskell syntax were readable.
>>
>>55171629
Can you please point out where you've read that Haskell Main returns a program? My understanding is that Core doesn't compile down and return a program desu...
>>
>>55171738
That's the function signature
"return" is a function that takes an 'a' and gives an 'm<a>'

"(>>=)" is a function that takes an m<a> and a function (a to m<b>) and returns an m<b>

**a -> b -> c is the same as a -> (b -> c) in Haskell but this isn't important to you. effectively it's like a(b)(c) being the same as a(b,c) (or in haskell a b c or (a b) c)

(>>=) is an infix operator, you can wrap infix operators in parentheses to use them like regular functions
a >>= b
(>>=) a b


>>55171750
I mean conceptually.
The actual implementation of haskell compilers obviously don't waste their time doing that, they just straight up converts IO operations to imperative code.
>>
>>55171576
There are functions to list them all.
>>
>>55171738
C++ Equivalent I suppose is something like
template <typename A, typename M>
M ret (A a) { return M(a); } // Not strictly equivalent

template <typename A, typename B, typename Ma, typename Mb>
Mb bind (Ma a, std::function<Mb(A)> f) { return f(a); }
>>
>>55171615
Haskell isn't a paradigm, it is a programming language. Lisp solved all these issues 40 years ago, then Haskell came along and pretended stuff that impure stuff is pure.
>>
>>55171769
Conceptually where? Who has said this? Can you link me a paper please?
>>
>>55171799
All functions in Haskell are pure
>>
>>55171802
This is not true though... see https://hackage.haskell.org/package/base-4.9.0.0/docs/src/GHC.IO.Handle.Text.html#hPutcBuffered

IORef's are decidedly impure, by both definition and design.
>>
>>55171769
>>55171787
Alright, I'll see if I can try and wrap my head around these in the morning. It's like... 5 AM and I should get some sleep.

>>55171795
>Lisp solved all these issues 40 years ago
And also, Lisp programmers are generally chill people who don't seem to mind much that most languages stole from them something or another. Goddamn, why can't Lisp general come back?
>>
>>55171825
Stuff like unsafePerformIO excluded.

The point I'm making is that the IO monad is pure and it's for practical purposes that Haskell's implementation might not be, but conceptually you can think that it's intended to be pure.
>>
>>55171847
>why can't Lisp general come back?
Wasn't this ruined by Haskellfags and that one autistic and racist bloke that programmed everything in Racket?
>>
>>55165843
http://c-faq.com/aryptr/aryptr2.html
>>
>>55171857
unsafePerformIO is not what I was talking about, follow the definition of putStr and you'll walk down the chain until you get to hPutcBuffered and then out of nowhere IORefs start popping up.

Ehh, how long have you been programming Haskell? I like your enthusiasm but you seem to have drunk too much of the cool-aide...
>>
File: greggs.jpg (67 KB, 453x539) Image search: [Google]
greggs.jpg
67 KB, 453x539
>>55171861
*autistic and racist bloke originally from /prog/
>>
>>55171847
all a monad does is allow you to convert a bunch of shit implicitly.
>>
>>55171870
Ok, Haskell itself is not pure but it's almost pure, and you can reason about impurity and such in a pure language. If you consider lambda calculus:

(\x.print x) 3
reduces to
print 3

But this doesn't reduce to anything.
What's "print"? What's "3"?

It doesn't matter, because this is the result that is passed back to the runtime and the runtime sees "print 3" and then decides to display the number 3
>>
>>55171898
I get exactly what you're saying, but you're sort of missing the point. Have you ever used the ST Monad before?
>>
>>55171920
No, I haven't actually made anything significant with Haskell
>>
>>55170018
Fucking lazy piece of shit. Stop making excuses.
You want to make a 2D game? Get a spritesheet from an older 2D game similar in gameplay to what you are trying to make.
You prefer 3D games? There are a shitload of free 3D models online.

Free sound effects and music exist.

Either read up on game design, or start with trial and error.

Try to fucking learn with what you do, don't try to make something that you will put on steam greenlight for fuck's sake.
>>
>>55171932
Okay so I suppose the best description I ever read about one part of the type-system was that it didn't seek to eradicate side effects, rather the intention is to quarantine them. The ST Monad is actually a really good example of this and you should seriously consider reading some examples of people using it, especially in regards to quick sort or a prime sieve.

Whilst you conceptually are sort of on the right track regarding how IO works, there is a key point you're missing, which is that in any language with a runtime system it is the runtime system engaging in the actual IO. The IO itself will always be impure, neither the language spec nor the type system will ever stop IO from being impure. There's a reason that only 1 (family) of functions have the type
IO a -> a
and they're all called unsafeXXX.

Haskell itself allows you to write code which transforms 'RealWorld' although strictly speaking that transformer stack doesn't actually exist.

I'd almost venture to say that conceptualising Haskell code in the way you've done is potentially harmful, as you're in some respects minimising the importance of the type system in providing you the 'purity' that you desire.

Read up on the ST Monad, you'll find it pretty interesting I hope.
>>
in C you can compile your programs using
gcc program.c


or

cc program.c


is there the same option for C++?
like
you can do
g++ program.cpp


is there some abreviation to g++ like gcc to cc?
>>
File: A1f7vY8.jpg (3 KB, 500x374) Image search: [Google]
A1f7vY8.jpg
3 KB, 500x374
>>55171871
>>
>>55172015
No.
cc is a standard POSIX program, for the system's C compiler. Obviously on GNU systems, it's symlinked to gcc.
There is no standard command for a C++ compiler.
>>
>>55172039
thanks for the reply anon
>>
>>55172015
microwave_time.jpg
>>
>>55172058
what ?
>>
>>55172006
This isn't absolutely necessary though.
Obviously it's the run time that does ACTUAL io.
You can have a language where a pure program outputs an impure program, and an impure runtime executes the impure program.
Within the pure language, IO bindings are irreducible (in the same sense as the example earlier with lambda calculus)

The obvious example would be the fact that, if you were to be far more literal, all programs are simply a single number / a sequence of bytes.

This literal interpretation would say that the runtime isn't itself impure, it's simply a sequence of bytes. It's the impure hardware that interprets this as an impure program. The hardware is the only ""truly"" impure part.
>>
>>55172139
Nowhere in the compilation phase nor in the conceptual model described by the creators of the language or GHC do people describe haskell as a language that makes a pure program which generates an impure program.

If you could please provide me with a paper or a comment or anything by anyone who's got anything to do with the language, the spec or GHC that describes how you conceptualise the language I would really appreciate it.
>>
>>55172139
Obviously this is hard to conceptualise when it comes to input, but it still works. Callbacks are one way to think of this.
>>
>>55172220
I'm not talking about Haskell at this point
>>
>>55172235
Okay well yeah, then sure. This is pretty much 90% of EDSL's. You write a pure program in your DSL, from that you generate a pure representation which runs through an impure runtime (your interpreter) to generate a desired output.
>>
>>55172256
Yeah, that's what I mean.
Was there a motivation for not doing it this way in Haskell?
>>
>>55172277
Probably performance concerns to be honest. Also the language is a 26 year old purely research language. I doubt the original back end really had the capacity to actually do all the things you're asking of it.
>>
File: whatevs.jpg (170 KB, 871x1471) Image search: [Google]
whatevs.jpg
170 KB, 871x1471
printed out some register values
>>
>>55172350
Haskell has got a lot of mileage out of it, think it's time it got replaced (no offence to Haskell)
>>
>>55172388
This. Just use rust, the language of the future.
>>
>>55172397
enjoy your SJCuck infested language m80.
>>
>>55172397
Rust is utterly shit
>>
>>55172416
Rust is bar none the best language ever designed. It works fantastically in practice too. It's the closest we have to a perfect language right now.

>>55172406
Everything is cuck-licensed which means you can clone everything to avoid the sjw bullshit.
Not that it really matters because the sjw bullshit is limited to mosjwilla communities anyway.
>>
>>55172406
>Muh SJWs

Everytime
>>
File: 542140.jpg (14 KB, 400x400) Image search: [Google]
542140.jpg
14 KB, 400x400
>>55172397
>rust

https://github.com/rust-lang/rust-www/issues/268
>>
>>55172444
Rust doesn't have even the most basic support for functional programming, it doesn't even have controlled effects

How would it replace Haskell?
>>
Why is stack exchange so shit? Literally every answer to a C++ question is "use Boost".
Look shitters. I know Boost exists, the whole reason I'm asking is because I don't want to use that piece of shit.
>>
>>55172476
ask your question here dummy
Thread replies: 255
Thread images: 24

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.