[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: 319
Thread images: 14

File: 1482958568231.png (489KB, 934x1000px) Image search: [Google]
1482958568231.png
489KB, 934x1000px
What are you working on, /g/?

Old thread: >>58213663
>>
Why is it taking so long for glibc to implement threads.h?

musl has supported threads.h for a while now
>>
Need to setup a website with back end storage for a local business.

What's an easy web interface to design and build?
>>
Functional programming thread: >>58212017
>>
Functional programming thread:

>>58214672
>>
Wondering if it's a better idea to compile something that looks like it was never actually compiled (on Linux) or fork the project and rewrite the entire damn thing.

FYI anything associated to v8 is falling to shit.

>>58224222
Put an ad out for "C#, jQuery and entity framework." Literally stuff they teach anywhere.
>>
>>58224256
Nah I'm looking to try and build it myself.
>>
>>58224214

Either they've got something else they're working on implementing, they're being lazy shits, or there's difficulty implementing it on some non-posix systems. Either way, have a drag and drop implementation using pthreads:

https://github.com/jtsiomb/c11threads/blob/master/c11threads.h
>>
>>58224288
You need knowledge in those three things.

jQuery is what you'll use to call the back-end from the ui/front-end, specifically what's called Ajax calls.

C# is a good idea for a minimalist backend since there are plenty of backend libraries there and 90% of them are faster than ASP.

Entity framework is for SQL databases, not really my thing but there's plenty of database drivers in C# that load and store whatever data.

You can do that shit, get a service that can do at least 1000 serves a second, respond in under a millisecond and not cost you more than $5 a month. This is many multiples times faster PHP or ASP or the fast majority of interpreted languages.

Is /wdg/ up?

>try and build it myself
Sure thing, but if you have to ask...
>>
>>58224352
It's for a local network only. I'm talking about 1 hit every few hours at most!
>>
>>58224346
>have a drag and drop implementation using pthreads
I always try to use musl, but I was just wondering what was taking ganoo so long
>>
>>58224196
Im have a legit version of win7 OEM, but wanna install it on a ssd, so am currently cucke dby the OEM..
>>
Fuck, my RSS feed downloader doesn't work. I've had something similar before and it was because Cloudflare rejects requests without a User Agent. Ah well, at least I have something to do.
>>
>>58224214
It takes quite a while for new shit to make it into glibc, and they have a very slow review process.
There were some patches implementing it that appeared in August 2015 or so, if I'm not mistaken, but the author didn't really follow through for that long to get the glibc developers to get off their ass and review it properly.
>>
>>58224196
I'm trying to find some motivation to do programming for work, but I'm struggling... I'd rather be at home watching series or something.
>>
>>58224372
>back end storage for a local business
Then do whatever, go research databases. Not programming. Be gone vague troll of vague questions.

>>58224478
Productivity must be sought for productivity sake.
>>
>>58224517
>Productivity must be sought for productivity sake.
What does that even mean?
>>
>>58224478
Same shit m8, same shit, this end of the year thing is totally killing my motivation.
>>
>>58224517
My question was about front end web interface that would talk to a database. That's programming!
>>
>>58224560
Basically anything that doesn't disable jQuery in anyway, it's the only thing you absolutely need if you want to keep web api calls pretty.

From the back-end, literally go
"your favourite language here" "your preferred database here" driver
in a google search and you've got everything you need there. There's so much choice you're so dumb if you choose something bad.

>>58224533
Learn to enjoy your work.
>>
What does the :: mean in
    pub fn send(self) -> ::Result<Response> {
>>
>>58224632
The root namespace of the crate:
const MESSAGE : &'static str = "ABC";

mod a {
pub mod b {
pub mod c {
pub fn print_it() {
// error[E0425]: unresolved name `MESSAGE`:
// println!("{}", MESSAGE);
println!("{}", ::MESSAGE);
}
}
}
}

fn main() {
a::b::c::print_it();
}
>>
>>58224715
That's nifty, thanks.
>>
>>58224715
It really would be nice if we had a way to specify language syntax highlighting in code blocks.
That way, we wouldn't get basically the entire program in green in languages that use " or ' in a non-balanced way.
>>
>>58224451
Found the problem: 'https://www.nyaa.se/?page=download&tid=884762 stream did not contain valid UTF-8'.
I parsed binary data as UTF-8. I'm retarded.
>>
1. Is SICP worth going through? I've just started chapter 3. Some of it is cool, some of it badly explains concepts that are more easily explained elsewhere.

2. What CS university courses are especially helpful in real world programming? Basic algorithms courses?

3. Are things like Haskell / scheme just hipster meme languages? If not, why aren't they used more in the real world? Why aren't financial institutions or other places with money hiring smart haskell / scheme programmers if they can afford to get the best?

picrelated is my face when seeing all the contradictory advice and potential things to learn. Every topic is a million miles deep.
>>
>>58224938
>1
Dunno, never read it
>2
Look for stuff like linux/windows programing
>3
They are excelent tools for learning functional concepts, but are rarely used in real life
>>
>>58224938
>Is SICP worth going through?
Yes, but only if you get something out of it. Reading it for the sake of reading it, without understanding what you're actually reading, isn't useful. In that case, you should consider revisiting SICP at a later point in time when your understanding of the topic has increased.

>What CS university courses are especially helpful in real world programming? Basic algorithms courses?
Yes, and:
Any programming course or course that requires you to do problem solving / programming tasks.

Discrete mathematics and logic stuff

Anything with real world application, such as a course on Operating System, Computer Architecture, Data Communication, Networking etc.

>Are things like Haskell / scheme just hipster meme languages?
Haskell I don't know about, it has a pretty small user base though, if that's an indication of anything. But there are some cool applications written in Haskell AFAIK, so it is indeed a programming language designed for real world use.

As for Scheme, any Lisp dialect is handy to know, because it will teach you the fundamentals of a functional programming mindset. It's not much used in real world, but of course there are some exceptions to this rule.

I bet someone will pounce on me for this claim, but IIRC Lisp itself was designed as a proof of concept that it was possible to do lambda calculus on a computer.

>Why aren't financial institutions or other places with money hiring smart haskell / scheme programmers if they can afford to get the best?
"Financial institutions" is a pretty broad term, which ranges from anything doing menial Java back-end stuff and JavaScript/HTML front-end to maintaining legacy COBOL code to doing statistical analysis using R or some other language suitable for doing that to math-heads designing the latest HFT algorithm using C or C++ or even Fortran.
>>
>>58224800
Fixed it: http://pastebin.com/W395EBGT
>>
>>58224938
1. No
2. use unit testing, version control, learn OOP, databases, understand how a computer works at the lowest level, understand the platform you're developing on
3. the functional stuff added to C#, Java is great, but Haskell is a meme. It was designed for academics, not real programming
>>
>>58224938
>1. Is SICP worth going through?
No, it's an outdated text with some interesting things here and there, but overall it won't help you to become a better real-world programmer.
>Basic algorithms courses?
Yes, also Software Engineering, Operation Systems and Compilers.
> 3. Are things like Haskell / scheme just hipster meme languages?
Scheme - definitely yes, Haskell actually works well in some applications.
>If not, why aren't they used more in the real world?
Haskell (and related languages like F# and OCaml) is being used, by financial institutions among others, but the demand is relatively low.
>>
>>58225160
>Haskell is a meme
No it isn't
>>
>>58225169
Your mother is a meme, and not even the dank kind.
>>
>>58225169
>https://wiki.haskell.org/GHC/Memory_Management
>it's not uncommon to produce 1gb of data per second
>>
>>58225199
That's how fast it can allocate.
It doesn't actually keep all that at once.
>>
>>58225199
>Haskell computations produce a lot of memory garbage - much more than conventional imperative languages. It's because data are immutable so the only way to store every next operation's result is to create new values. In particular, every iteration of a recursive computation creates a new value.

Oh wow, I thought this was only a joke we had on /g/ to bait Haskellfags, but it's actually true? Jeez Louise
>>
>>58225214
>allocating 1 GB of data only to have the garbage collector reclaim it immediately

Why??? Isn't the compiler able to do some form of optimising to avoid this?
>>
>>58225244
Optimisers aren't magicians.
>>
>>58225253
Well, C and C++ compilers are able to implicitly do TCO... Why can't haskell compilers?
>>
>>58225264
>TCO
That is something different.
It's to do with the fact that everything in Haskell is immutable.
>>
>>58225244

Garbage collectors are generally a part of the runtime, not the compiler. Also, most people would rather 1 GB of memory not stay allocated any longer than it has to.
>>
>>58225273
>immutable
Well, so are const references. You don't need to pass everything by copy, not even meme language #1 aka Python does this.
>>
>>58225169
http://stackoverflow.com/questions/4858585/why-is-ghc-so-large-big
>2017 - 3 days
>not getting 4 copies of every library
>>
>>58225299
But muh purity
>>
>/g/ is bitching about how bloated Java is and how the JVM uses too much memory
>/g/ shills Haskell as the one language to rule them all despite it's perfectly acceptable for the Haskell runtime to allocate >1GB of data that's never used and hold it until it's GC'd

If this doesn't confirm that /g/ is full of retards, I don't know what is
>>
>>58225313
Isn't the whole point of letting the runtime deal with things that the runtime is tainted but not the code?

Isn't that for example the mental gymnastics Haskellfags do when they defend the io monad thing? That the user's code is still pure even if the monad returns code that taints the runtime since io is a side-effect?
>>
>>58225319
>it's perfectly acceptable for the Haskell runtime to allocate >1GB of data that's never used and hold it until it's GC'd
You can tell GHC what the maximum heap size should be

>>58225339
It's not mental gymnastics.
Main is an IO action.
It's like returning an AST rather than being able to literally perform actions.
The point is you can't (without non-standard unsafe extensions) write a function (forall a. IO a -> a)
>>
>C
>Python
>Java

Do you even need any other programming languages?
>>
>>58225346
>You can tell GHC what the maximum heap size should be
Doesn't this just cause Haskell programs to either crash (like in Java, when an OutOfMemoryException is thrown) or run slower (because it has to wait for the GC)?

>It's not mental gymnastics.
My point is this: What's stopping the runtime from passing a const reference and do COW like a sane system would do?
>>
>Rust
>C#
>Python
ftfy
>>
>>58225351
>xe still uses programming languages
>>
>>58225365
>My point is this: What's stopping the runtime from passing a const reference and do COW like a sane system would do?
I don't know what COW is, but Haskell is pure and that's a good thing.

>crash or run slower
Well yeah.
If it bothers you, you can do manual memory in Haskell, but unfortunately you can't turn GC off (though you can set the heap to 0)
>>
>>58224771

>https://github.com/isagalaev/highlight.js
Is what we need, and if I remember correctly, it's what Discord uses with its markup extensions.
>>
>>58225365
>>58225382
Oh and Haskell is getting a LinearTypes extension that should alleviate some allocations
>>
>>58225382
>I don't know what COW is,
Copy On Write. Meaning that only values that are written to are actually copied.

>but Haskell is pure and that's a good thing.
You just mentioned how impurity can be contained.....

>Well yeah.
Then that's not an optimisation or a fix...

>If it bothers you, you can do manual memory in Haskell,
Still not an optimisation or a fix
>>
>>58225382
Copy on Write.
>>
>>58225397
>>Well yeah.
>Then that's not an optimisation or a fix...
>>If it bothers you, you can do manual memory in Haskell,
>Still not an optimisation or a fix
What do you mean an "optimisation or fix"?
GHC can allocate a GB in a second, that's fast allocation.
What's the problem?
>>
COW = Copy on Write

You don't copy data unless it is manipulated.
>>
>>58225397
>>58225400
>>58225411
Haskell data is immutable, so there isn't any "write"
>>
>>58225407
>GHC can allocate a GB in a second, that's fast allocation.
>What's the problem?
First of all, allocating a GB in a second is absolutely not fast. Any userspace application mmap the size of the entire RAM in a matter of nanoseconds.

Second of all, we're talking about unnecessary allocations, not how fast Haskell is. Allocating memory unnecessarily is bad. Having to wait until it is reclaimed is bad. A second is "forever" on modern computers. Anything above a couple of nanoseconds is an eternity for an operation.

Imagine the scenario where you have a Haskell program running and it's using almost the entire heap. Then you call some function that returns some list it generates recursively and tries to allocate 1 GB, even though you only need to modify the final list.

It fails to allocate enough space for that list because it's already using the entire heap. This causes the Haskell runtime to crash and your program crashes. How can any sane person claim this isn't a problem?
>>
>>58225400
>>All
Stop using acronyms to pretend to be knowledgeable!
>>
>>58225440
https://wiki.haskell.org/GHC/Memory_Management
>>
>>58225437
Are you legally retarded or just pretending to be? Immutable does not mean you have to copy everything. Immutable simply means that you can't mutate it (aka modify it aka write to it), correct?
>>
>>58225407

>GHC can allocate a GB in a second, that's fast allocation.

Ruby can allocate a string of size 1,000,000,000, with every character in it being the letter 'a', in only 0.41 seconds. That is a memory allocation, and a memset of size a billion.

>>58225437

Then there is no need to copy.
>>
>>58225466
>Immutable does not mean you have to copy everything
I didn't say it does
>>
>>58225461
That is the link I'm fucking responding to, you dolt. Follow the chain of posts.

Just because the Haskell authors tries to justify their insane design decisions, doesn't mean that they are actually justified, which is why we are currently discussing this.
>>
>>58225481
>insane design decisions
Haskell has GC.
So do many other languages.
Haskell is pure.
This is not that common.

What are the insane design decisions?
>>
>>58225480
>I didn't say it does
I asked why Haskell has to copy everything instead of doing COW and you literally just replied "immutable".
>>
>>58225490
> What are the insane design decisions?
Not him, but lazyness was a mistake, and it has a direct impact on memory consumption.
>>
>>58225490
>Haskell has GC.
>So do many other languages.
>Haskell is pure.
These are all good things, I'm not bitching about this.

>What are the insane design decisions?
Allocating gigabytes of memory that's never actually used only to have it collected at a later point.
>>
>>58225493
Yes, it's immutable. So you can't write.

>>58225505
It doesn't allocate "gigabyte of memory that isn't used", and anyway this is an issue with GHC, not Haskell
>>
>>58225493
Haskell doesn't need COW because there is no write, but Haskell does share all the data it can between data structures(basically COW without write part), that's one of the perks of immutability.
>>
>>58225517
>Yes, it's immutable. So you can't write.
You are copying data so you don't modify the original data, this is the immutability.

SO WHY THE FUCK CAN'T YOU DO COPY ON WRITE INSTEAD???????

>It doesn't allocate "gigabyte of memory that isn't used",
It does, it fucking says so in the link you posted.

>Haskell computations produce a lot of memory garbage - much more than conventional imperative languages. It's because data are immutable so the only way to store every next operation's result is to create new values. In particular, every iteration of a recursive computation creates a new value. But GHC is able to efficiently manage garbage collection, so it's not uncommon to produce 1gb of data per second (most part of which will be garbage collected immediately).

>and anyway this is an issue with GHC, not Haskell
>le garbage collector is not part of haskell
>le runtime is tainted not haskell
>le io isn't impure because the runtime is tainted
MENTAL GYMNASTICS
>>
>>58225522
>copy on write, but always copy
You're literally just saying it copies everything every time.

This is not "COW without the write part".
>>
>>58225531
le mad xd
>>
>>58225531
>You are copying data so you don't modify the original data, this is the immutability.
>SO WHY THE FUCK CAN'T YOU DO COPY ON WRITE INSTEAD???????
It doesn't copy.
You can't write.

>>It doesn't allocate "gigabyte of memory that isn't used",
>It does, it fucking says so in the link you posted.
The data is used you utter fucking moron.
The GC doesn't just fucking say "why not allocate some data right now?"

>MENTAL GYMNASTICS
Wow, then I guess that one obscure C++ implementation that is really fucking shit is indicative of every fucking C++ implementaiton.
Jesus you fucking moron, grow a brain.
>>
>>58225546
I'm not the guy you're been arguing with, Haskell doesn't copy everything every time:
let a = [1, 2, 3, 4]
let b = 0 :: tail a
let c = b

Both a and b will share the [2, 3, 4] part, and both b and c will use the same memory. This is that COW does in other languages, but since there is no write in Haskell, there is no need for coping anything on write.
>>
>>58225560
>It doesn't copy.
That's literally what you do. You copy everything so the original remains """pure""" and not mutated.

>You can't write.
You write to your own fucking copy, or are you actually saying that you can't append a value to a list or assign a value to a variable? Because if you are saying the latter, then I don't think you know any Haskell.

>The data is used you utter fucking moron.
No, it's not used. It's duplicated for no reason other than having the original unmodified.

>The GC doesn't just fucking say "why not allocate some data right now?"
No, the GC collects data that isn't referenced anymore. So when you make a bunch of unused copies, the GC has the job of cleaning that up.

The job of the GC is literally to clean up memory that isn't used anymore FFS. What the fuck do you think that statement means?

>Jesus you fucking moron, grow a brain.
GHC is literally the reference Haskell implementation you dick. Not only that, it's the only Haskell implementation that's currently used because all others are defunct and were never official.
>>
Multiple users want to make simultaneous comments on something.

The shared excel spreadsheets doesn't seem to be cutting it. What's the next step up? I kind of feel databases is going to be overkill for this.
>>
>>58225618
>shared excel spreadsheets
Just use a fuckin' database at this point.
>>
>>58225602
>That's literally what you do. You copy everything so the original remains """pure""" and not mutated.
No. It keeps a reference.
Nothing is mutated so you can always keep a reference.
This is one of the advantages of purity, you always know that your old data will never be mutated.

>You write to your own fucking copy, or are you actually saying that you can't append a value to a list or assign a value to a variable? Because if you are saying the latter, then I don't think you know any Haskell.
No, you create new data.
You don't "assign to a variable", you declare a variable.
It has one value and only one value.
"append a value to a list" is returning a different list.
It isn't copying the list and then adding a value in front, it's saying that the new list IS the old list with the value at the front. It's pure, so you can just keep a reference to the old list. Hence
zeroes = 0 : zeroes

doesn't take up an infinite amount of space, it takes up very little space.

>clean up memory that isn't used anymore
This isn't what you originally said, which was that it allocates unused data.
This is what every GC does and every GC ends up with data that temporarily isn't freed.
You have no fucking argument, you're just trying to not be wrong at this point.

>GHC is the reference Haskell implementation
Wow, so I guess you're saying it's not a real Haskell implementation if it doesn't use GHC's implementation of the GC?
Weird demand for the language.
>>
Do Haskell programmers even care about language implementation? They often seem rather distanced from what the actual generated code looks like.
>>
gee, it's like I've stepped into the fpg containment thread
>>
>>58225618
SQLite
>>
>>58225640
They do when they try to push it into production and suddenly realize it's an order of magnitude slower than C++.
>>
>>58225640
People that want to attack Haskell do
They don't like Haskell because it isn't what they're used to
>>
Is ocaml the best lang ever made?
>>
>>58225700
G I L
>>
>>58225657

I'll second this for the general use case, except when there is a need for many, many simultaneous writers.

>>58225662

>People that want to attack Haskell do
Implementation performance is a pretty valid reason to attack a language. This still doesn't answer the question of why Haskell programmers don't seem to care.

>They don't like Haskell because it isn't what they're used to
Unfamiliarity is a pretty good reason to dislike a language as well. Could the ideas proposed in Haskell be more popular if they were designed in a syntactic form similar to other languages, such as C, Python, or even a Lisp? Probably. Haskell programmers would like to ask newcomers to not only learn a lot of type theory that they never learned in university, but also to learn a new syntax, and ignore performance problems.
>>
>>58225721
you can just spawn another process.
>>
>>58225721
Wait, ocaml has GIL? Why?
>>
>>58225744
Haskell isn't that slow, but obviously it has a GC so it's not going to compete with C or C++.
It's very declarative so it's also going to lose speed on that front too.
It has a GC so it's obviously not a systems programming language either.

Very fast Haskell doesn't look much like Haskell
>>
>>58225770
>Haskell isn't that slow, but obviously it has a GC so it's not going to compete with C or C++.

careful, you might trigger some Go users
>>
>>58225780
No matter what the devs say Go's aim won't be to compete with C for as long as you can't manage memory manually.
>>
>>58225770

>Very fast Haskell doesn't look much like Haskell
This is an important point. If one must sacrifice the benefits of writing Haskell in a way the language designers intended just to get some performance, why not simply use another language altogether?
>>
>>58225815
Because Haskell is a brilliant and amazing language, and some times you would rather have 30% written in not-really-haskell haskell than 100% written in not-haskell.
>>
>>58225836
Same shit with OCaml (my favourite language), writing low level stuff feels so dirty
>>
>>58225836

I'd rather have 100% fast than 30% fast, to be honest. And hell, it's not as if there aren't languages other than C and C++ that do a decent job at performance. Consider Rust, for instance. Or Ada if you have a death wish.
>>
>>58225867
So use soul-crushing languages when you really need performance, and languages you actually like when you don't.

I'm pretty sure someone has already realised this, somewhere...
>>
>>58225867
There are plenty of occasions where you don't need to go that fast.
>>
>>58225888
t. pajeet
>>
>>58225881
>So use soul-crushing languages when you really need performance, and languages you actually like when you don't.

what if I enjoy using C?
>>
>>58225867
Then you would use C and call it from your_favorite_language instead of retarded shit like Rust.
>>
>>58225888
GOTTA GO FAST

Because we all know Ruby outperforms FORTRAN.

>>58225896
Then you're a masochist and deserve whatever you get.
>>
>>58224196
Now that visual studios is free and c# is opensource, why would anyone use anything else?

It can be used for everything from hardware, desktop, webapps, and phone apps. And beats the hell out of all interpreted languages for speed.
>>
>>58225919
>why would anyone use anything else
Because it's not Haskell
>>
>>58225914
>Then you're a masochist and deserve whatever you get.
>REEEEE YOU'RE NOT SUPPOSED TO LIKE C
>I DON'T LIKE IT, THEREFORE NO ONE ELSE SHOULD
>>
>>58225919
Too slow and bloated.
>>
>>58225926
Masochism speaks.
>>
Been failing to 'get started' programming for a while now. I keep starting books and courses and not finishing them. Someone told me now that I have the knowledge to get started programming already, and that I probably just have weird expectations. What's something barely a step above a "hello world" that I can try to do?

I have started both C and Python in the last year, although honestly I can't remember much of either.
>>
>>58225924
I don't think you're actually a Haskellfag
I think you're just badmouthing Haskellfags
>>
>>58225919

I kinda want to see a speed comparison between C# C++ V8 and LuaJIT
>>
>>58225937
I'm an OCamlfag >>58225847.

I'm mad Haskell gets more memed than my language.
>>
>>58225970
it's because OCaml doesn't have enough meme material
i mean there's row polymorphism and modules but that's really it
>>
>>58225935
Go find a tutorial that has hello world then hit the next button. There's no magic trick or tip. Just go learn.
>>
>>58225956
LuaJIT is half to a third the speed of C. Don't know about V8.
>massive generalisation
>>
>>58226109
lua needs its tables to start at 0
>>
>>58226195
I've never found it to be that big of an issue.
>>
>>58226109

C# and Java somewhere around that perf too, right?
>>
>>58226195
they can start everywhere, it's only the stdlib that is retarded like this, also it's less of an issue than you'd think
>>
>just realized the reason Python gets bashed here is because it doesn't offer enough opportunities for mindless naval-gazing for the retarded ideologues on /g/ to gush over endlessly instead of actually getting something done.
>>
>>58226230
Java and Haskell are. Don't know about C#.
>>
>>58226259
Also because it's shit
>>
>>58226259
>can't spell 'navel'
>think xir's belly button is something to do with ships

Trolled hard.
>>
>>58226268
That's pretty incredible

>>58226259
>Forced indentation
>>
>>58226280
Yup. The high-level languages are really starting to catch up performance-wise.
>>
>>58226278
Maybe I meant staring at boats?
>>
>>58226259
The only reason people use python is because other people use python. Every time I use Yython, I've absolutely hated it. And Python fanboys are the worst. __init__, how beautiful and elegant. It's like reading pseudocode :^)

Fuck your significant white space and fuck you.
>>
>>58226259
Clearly you have never been to any forum where people talk about python because those faggots can endlessly argue about which of tens of the ways than you can one thing is the most "pythonic".
>>
>>58226291
Maybe you did.
>>
The only reason people use Haskell is because other people don't use Haskell. Every time I use Gaskell, I've absolutely hated it. And Haskell fanboys are the worst. Monad, how beautiful and elegant. It's like reading math :^)

Fuck your purity and fuck you.
>>
>>58226325
What's funny is that I actually hate haskell too for pretty much the reasons you listed. Thanks for doing my work for me.
>>
>HaskLEL is useless and, pure functional and stateless languages are a meme
>Lisp is only used for third class text editors
>SICP is not a good book and this is why it's given away for free
>Anime is shit
>Maki a slut
>C++ is much better than C
>Java is the language of the future
>JS is a good choice for server side
>The best software engineers are indians
>>
>>58226325
Monads are great but they aren't general enough
Indexed monads are pretty nice
Idris' Eff is really nice

But sometimes you want do for non-monads and even non-applicatives too
>>
>>58226366
>>Lisp is only used for third class text editors
Ouch dude, why'd you have to go there?
>>
I honestly can't imagine what it's like to write a complicated parser without parsec or without a parser generator
>>
>>58226366
>Anime is shit
REEEEEEEEEEEEEEEEEEEEEEEEEEE
>>
>>58226366
>>HaskLEL is useless and, pure functional and stateless languages are a meme
>>Lisp is only used for third class text editors
>>SICP is not a good book and this is why it's given away for free
>>Anime is shit
yes
>>Maki a slut
no idea
>>C++ is much better than C
depends
>>Java is the language of the future
>>JS is a good choice for server side
>>The best software engineers are indians
no
>>
data LazyT m a = Lazy { runLazyT :: () -> m a }
>>
how legit is ocaml?
We are learning it in class right now, but it seems like Haskell is way more popular.
>>
>>58226455
OCaml is really good, Haskell is also really good
I suppose Haskell is probably more popular
>>
>>58226434
1 GIGABYTE
>>
>>58226366
>The best software engineers are indians
stopped reading there
>>
>>58226512
>consuming the full bait before stopped reading
lol faggot
>>
>>58226533
He stopped a full post before you did.
>>
>>58226538
He stopped a full post before you did.
>>
Where can I get started with web crawlers?
>>
>>58226549
>>58226538
She*

>>58226569
You just want to crawl? Simply download a page, find urls in it then go back to step one.
Do you want to index the pages? Page Rank might be a good start.
>>
>>58226637
*Xe
>>
Hello /dpt/

I am forcing myself to get used to developing in the Linux environment by learning another language, C++, cause OOP is God's work.

I mostly program in the Windows ecosystem with C# so because of this it became too comfy to not to learn new things. I love how fast is develop with VisualStudio.

Now I am aware of Microsoft recent activity with Linux, it won't take a long time to get VS on Linux, but I want to use this little time to get senpai with the current dev environment in Linux.
I've heard that you do not even need an IDE in Linux cause all of the available tools are
integrating
with each other so the whole system is an IDE.

What are these tools? So what is available for profiling, debugging and etc.? Is Atom a good text-editor or should I use VS Code?
>>
File: 1482577907101.png (144KB, 500x500px) Image search: [Google]
1482577907101.png
144KB, 500x500px
>>58226662
God would never make OOP
>>
>>58226637
Are you admitting to samefagging or do you personally know the other anon and can magically identify them posting anonymously online?

Also nobody cares what chromosomes you have when you're born with too many.
>>
>>58226662
VS Code is mostly great, but it lacks debugging capabilities. I still use it on Linux more often than not
>>
>>58226703
>can magically identify them posting anonymously online
Yes.
> have when you're born
were born*
>>
(* Datatype constructors can carry values *)
(* and be recursive (and look like CFGs) *)
type var = string

type exp = Var of var
| Lam of var * exp
| App of exp * exp

let id : exp = Lam ("x", Var "x")
let w : exp =
App (Lam ("x", App (Var "x", Var "x")),
Lam ("x", App (Var "x", Var "x")))


what is this accomplishing
>>
>>58226662
If you really want an IDE, try out QtCreator.
>>
Does anyone have maybe a reference to how browsers position elements and render pages? I kinda want to make a little UI lib that would parse XML and draw that
>>
>>58226744
What is what accomplishing?

"var" is declaring a type synonym,

"exp" is declaring a new type, with 3 constructors
Var : var -> exp
Lam : var -> exp -> exp
App : exp -> exp -> exp

It's an AST for representing the untyped lambda calculus
>>
>>58226737
No, that is a indefinite "you". You're not helping your case.
>>
>>58226773
>No, that is a indefinite "you". You're not helping your case.
The US educational system, everyone.
>>
>>58226803
Wouldn't it be like 9.00 right now in the US?
>>
File: 798.png (306KB, 593x540px) Image search: [Google]
798.png
306KB, 593x540px
>>58226803
>unironically believing that language is prescriptive
>>
>>58226771
Computer science is a joke mathematical subject.
>>
>>58226859
type errorMsg = 
BadName of String
| ClosedPort of int * ip
| UnknownError
>>
Why do you guys prefer to program in Linux rather than in Windows?
>>
>>58226943
>
>>
>>58226924
Why do errors need a type?
>>
>>58225637
>you're not getting a copy you get a new variable Mental fucking gymnastics

>"append a value to a list" is returning a different list. It isn't copying the list and then adding a value in front, it's saying that the new list IS the old list with the value at the front.
You're literally saying that it's both a completely new list AND the old list with the modification at the same fucking time.

>This isn't what you originally said,
It is.

>which was that it allocates unused data.
It does, Haskell keeps track of modifications that are never used which means that it's kept in memory for no good reason. Why else would the example in the fucking link use A FUCKING GIGABYTE of memory?

>Wow, so I guess you're saying it's not a real Haskell implementation if it doesn't use GHC's implementation of the GC?
No, that's a fucking strawman. Go kill yourself, I'm so fucking done with your weasel words and bullshit.

You have no fucking idea how haskell is implemented and you're spouting contradictory bullshit just because you can't handle the fact that Haskell is using unnecessary amounts of memory in order to achieve "purity" instead of, you know, just passing a fucking const reference.
>>
>>58226953
Because errors are first class citizens too.
>>
>>58226971
But they're just synthetic sugar in the end of the day.
>>
>>58226953
What do you mean?

>>58226988
What?
What errors are you writing?
>>
This thread is pathetic. It is not about programming. It's just a bunch of computers illiterates and first semesters memeing about whatever they just learned.

A quick search shows that most arguments used here are not original and have been copied from some trendy tech blog or other shit site.

The only real programming questions I have seen so far are from beginners(it's fine to be a beginner btw).

This entire site is shit and I don't know why anyone would regularly come here.
>>
>>58226971
Should CPU architectures get a type too? Should platforms?
>>
>>58227020
You're here.
>>
>>58227036
That's pasta.
>>
>>58227020
You're here forever.
>>
>>58226957
Look, it's REALLY FUCKING SIMPLE
You do not copy in Haskell.
You do not write in Haskell.

You declare variables to be equivalent to other variables.
The implementation for this is generally just a pointer.

It's not LITERALLY (the old list) modified, and I never said it was.

>a gigabyte
Because of how many new terms are introduced during evaluation

>allocates unused
So now you're saying that you DID say something different.
Whatever, this still isn't true.

>a strawman
Explain yourself you fucking liar, is GHC's GC the only GC Haskell is allowed or not?
>>
>>58227054
That's pasta.
>>
I'm pretty sure '1GB per second' is the new 'sizeof(char)'.
>>
File: you wouldn't steal a car.png (119KB, 563x378px) Image search: [Google]
you wouldn't steal a car.png
119KB, 563x378px
>>58227077
You wouldn't allocate RAM
>>
I want to automate some of my daily routine. I've got a few years of coding experience but everything I've ever done was self-contained aka I have no idea how to write a program that interacts with other running programs.

Is there a good source for beginners to this specifically?
>>
is the turboautist on PTH too?
I can't find him with his autistic nickname
>>
>>58226943

Windows is fine m8. Dont listen to /g/
MSYS2 and VCPKG handle 98% of my problems.
>>
Hask *haskell = (Hask *) malloc(1024 * sizeof(char));
>>
>>58227090
Google IPC. The easiest way is just to read from stdin and write to stdout. Then you pipe stuff.
>>
>>58224288
Consider something like Rails.
I'm not saying Ruby on Rails in specific, but something like it. RoR might be fine, but if you know Python, there's bound to be a framework that's almost the same thing as it.
>>
>>58227085
Not for very long, anyway.
>>
>>58227136
That's 1KiB not 1 GB.
>>
>>58227250
It's 1GiB in millionths
>>
>>58224607

Fuck, he could literally write Java Servlets that did all this stuff in the space of an afternoon.
And those are the building blocks you're supposed to make your easy to use framework from!
>>
>>58225931
Faster than java
More feature rich
Only beat by strait c and c++ if those are done wit performance in mind, your average program would run nearly identically.
>>
>>58227061
>You declare variables to be equivalent to other variables.
Which is either achieved by referencing them or by copying them.

>The implementation for this is generally just a pointer.
Then "the old list + this new value" either has to be a tuple consisting of a pointer to the old list + the new value, or it has to be a new list with all the values from the old list + the new value (AKA A FUCKING COPY), yes??

So when you create a function that builds a list, and you're only interested in the most recent list, the runtime will either create a chain of tuples OR it will create a new list for each element, yes??

Which one is it, then?? You keep bouncing around like a fucking retard who doesn't have a clue how it's actually implemented.

>is GHC's GC the only GC Haskell is allowed or not?
I never said so you fucking cunt. But you dismissed GHC entirely because it's merely an implementation and not Haskell itself, even though it's the platform that's shipped with Haskell.

Mention another Haskell implementation that doesn't have this problem then you cunt.
>>
>>58227277
>More feature rich
He already said bloated
>>
>>58227292
She*
>>
>>58224938

Make sure you actually know SQL, so you don't end up with the NoSQL crowd's retard rejects who thinks that databases should just be key-value stores because that's all their peabrained intellects can handle.

Also, functional programming isn't cool anymore. It's a natural and necessary part of what programming consists of, along with OOP. If you don't believe me, see how C# is adding on more and more functional stuff, and Java is slowly morphing into a weird dialect of Common Lisp with C-like syntax.

Learning Haskell/Common Lisp/Scheme/OCaml/Erlang/etc. may not necessarily net you a job, but it will teach you very valuable skills that you will find useful every day you program.

Haskell is the greatest outburst of purity-autism since the third reich, but by god, it looks snazzy.
>>
>>58227290
It's a deep copy in the case of the list, because of the laziness. It can be verified by observing the memory usage of a Haskell program that creates a list of N elements and seeing that the same program doubles the memory usage for N+1 elements.
>>
>>58225160
Academical programming is real programming. Haskell is why Java has functional streams with type inference now.
(Although it doesn't have auto/var yet.)
>>
>>58227326
>Haskell is the greatest outburst of purity-autism since the third reich, but by god, it looks snazzy.
I thought that was Idris.

>>58225390
What's the status on that, anyway?
>>
>>58227290
>Which is either achieved by referencing them or by copying them.
Referencing is used, except for the nonstandard {-# UNPACK #-} pragma

>a copy
It will be a reference, and you might think of it as being copied, but I'm saying that it's a matter of declaring equivalence.

>only interested in the most recent list
You end up building a series of garbage, but at each point in the process that "garbage" is useful.
It's only when you're done with it (which is hard to figure out) that it becomes garbage.
It's not ALLOCATED useless, it's only useless because it hasn't been de-allocated.

As well as optimisations, there's also the deforestation optimisation, where intermediate data-structures can removed by streaming them, e.g. in (product [1..n])

>dismissed GHC entirely
Yes, because we're talking about its GC, which is utterly and thoroughly implementation related.
>shipped with Haskell
No, a variant of Haskell is shipped with GHC.
Not the other way around.
>>
>>58227277
>Faster than Java
Not if this is correct:

https://benchmarksgame.alioth.debian.org/u64q/csharp.html

It only wins in a couple (and just barely) where when it loses, it gets it's ass handed to it.

>the memory usage is worse than java across the board

Nice bloat you got there.
>>
>>58225319
/g/ lambasts every language except C#, which the winfags like and everyone else ignores.
>>
>>58227360
Back in my day, the only language that /dpt/ unanimously loved was C.

Of course, that was before me and Johnson forced Haskell and everyone started riding the lambda train.
>>
>>58227333
>>58227347
Which one of these are true?
>>
>>58227403
>Johnson
I forgot about that guy.
>>
File: still no hkts in net.png (463KB, 538x534px) Image search: [Google]
still no hkts in net.png
463KB, 538x534px
>>58227403
>tfw nearly made f# popular
>>
>>58227424
Calling it a deep copy is misleading IMHO.
You are literally stating that the two things are equivalent, but it will just be using a pointer.
Because it's immutable, you know the old data won't be modified.
>>
I just created my first Java hello world program following the tutorial at java.com. Should I continue continue following it or do you have some obligatory guides/tutorials?
Also, should I even consider learning Python at the same time?
>>
>>58227430
weren't higher kinded types left out of F# because the CLR didn't support them, and it would have turned F# into a shitfest like scala?
>>
>>58224352
>C# is a good idea for a minimalist backend since there are plenty of backend libraries there and 90% of them are faster than ASP

Such as? that sounds very interesting
>>
>>58227424
>>58227459
Oh I misread what he said.
His post is wrong, it doesn't copy the whole thing unless you're doing stuff you shouldn't be doing.

If you append to the END of a list, that forces you to copy the entire list because of how it's structured (the same way in a regular language you would have to travel the entire list to change the back).
>>
>>58227491
ServiceStack is one. I believe it powers stack overflow.
>>
>>58227491
>>58227514
If you like F# Suave.io is fun
>>
>>58225596
Actually, Common Lisp does pretty much the same thing. You are still allowed to fuck with the lists, since Lisp is for people who knows what the fuck they're doing, and sometimes destructively doing something is much faster and better. Consider reversing a large stack. You can do that by traversing it once, flipping the pointers so to speak, and you're done. Or you can build a whole new stack.

And at different times, both can be the right thing to do.

>>58225770
Both Java and C# are pretty fucking close to C and C++, and they have GCs.
And I know that GNU has a GC for C++, but I have never tried it.
>>
>>58227531
Is F# and SJW language?
https://suave.io/images/logo.gif
>>
>>58227459
>Calling it a deep copy is misleading IMHO.
It depends. Does the memory usage grow exponentially? If so, then it for sure is a deep copy.

I get that from the Haskell programmer's point of view, it isn't a copy, but I'm interested in the implementation.

>You are literally stating that the two things are equivalent,
No, I'm not. I'm stating that those will be very different in terms of memory usage and CPU cycles actually. But the end result is more or less the same, you get a list containing all the values.

>Because it's immutable, you know the old data won't be modified.
In both cases the old data isn't modified, but I'm interested in the actual implementation not the semantics particularly.
>>
>>58227430
To be fair to you, no-one used to mention F# at all, but I've noticed that it gets brought up semi-regularly these days. So you must have made some kind of impact.

Plus you didn't have Johnson on your team, posting his fucking GitHub Haskell NyanCat implementations and generally just sperging out everywhere. That helped massively.
>>
File: 218571925.png (5KB, 351x96px) Image search: [Google]
218571925.png
5KB, 351x96px
>>58227557
I used to really piss off Javafag, and that was all I needed to be happy
>>
>>58227492

Okay, never mind my post >>58227552 then
>>
>>58226296
You forgot the simple and utterly smart way they put code in other folders. Magic files that you write! How incredible!
>>
>>58227549
no
>>
>>58227569
Nicely done.

I find that it doesn't matter at all whether people are slating a language or praising it. As long as people talk about it enough it will gain popularity.

Everyone fucking hated Johnson, but he still helped push Haskell.

I'm considering trying to force a concatenative language next. I'm thinking Joy, but I might have to settle for Forth or Factor.
>>
>>58227340

> Someone looked at Haskell and found it to be too slutty and impure, so they made their own waifu-language.
I'm sure the sick fuck has a full body pillow with the interpreter printed out on it too.
>>
>>58227492
>(the same way in a regular language you would have to travel the entire list to change the back)
Not true, tail insertion can be done O(1) by simply having a tail pointer.
>>
>>58227403

I remember that huge Johnson.
That was so long ago that I still tripfagged back then. Was fun.
>>
>>58227464

just follow one set of tutorials at a time. You're already both learning concepts AND a language at the same time, so you have a lot to take on board at once.
>>
>>58227619
Or just keeping the length next to head pointer and then adding stride * length to it. You know, like a sane person.
>>
>>58227619
Yeah, but that's a different kind of list.
You could do something like that in Haskell, but the Haskell list is just the very simple

data List a = Null | Cons a [a]

You could have something like
>>
>>58227667
oh, you wrote list and not array. This is why I shouldn't post when I stay up for longer than 24 hours.
>>
>>58227667
>Or just keeping the length next to head pointer and then adding stride * length to it. You know, like a sane person.
That assumes that you have the list store in contiguous memory, something you cannot always guarantee. But yes, that would be ideal.

>>58227669
I'm not talking about "doing that in Haskell", I'm talking about how the runtime implements a list in Haskell, but thanks for the example though.
>>
>>58227619
>>58227669
Seq from the containers package uses finger trees

data FingerTree a
= EmptyT
| Single a
| Deep {-# UNPACK #-} !Int !(Digit a) (FingerTree (Node a)) !(Digit a)
#ifdef TESTING
deriving Show
#endif

(it actually uses polymorphic recursion, which is kind of cool)
>>
How far from truth is this:

Load:
- Html file parsed
- Data structure made in to objects
- Styling applied
Main cycle:
1 Layout shit
2 Inputs (mouse, kb) checked, scripts run
3 Rendering
>>
>>58227727
>ifdef
>pragmas
>deep copy parameter passing
>garbage collection
>lazy evaluations
>everything is a list

It's like Haskell took the worst ideas from all programming languages and just mixed them all together.
>>
>>58227651
I bet you're really Johnson, you gigantic faggot, you.

>>58227669
data List a = Null | Cons a (List a)
?

>>58227721
Pretty sure the implementation is just that: a singly-linked list. That's why String performance is so shocking.
>>
>>58227514
>>58227531

Will check them out, thanks
>>
File: inference.png (195KB, 1374x727px) Image search: [Google]
inference.png
195KB, 1374x727px
Has anyone looked at "Think Bayes"? Is it good for learning this stuff from a programmatic perspective?
>>
>>58227756
>ifdef
Non-standard extension GHC adds.
>pragmas
{-# UNPACK -#} is non-standard
>deep copy parameter passing
Don't know what you mean by this, everything is immutable so you don't ever need to copy anything.
You do the equivalent of a copy by transversing a list all the way to the back, altering, and then building it back up.
Everyone knows don't mess with the back of a singly linked list.

>garbage collection
Sad but necessary

>lazy evaluation
{-# LANGUAGE Strict #-}


>everything is a list
Wrong, it isn't.
>>
>>58227785
>Everyone knows don't mess with the back of a singly linked list.
Making such restrictions on data structures are pretty bad though.

>Wrong, it isn't.
Then remind me again why functions in Haskell only accept a single parameter.
>>
>>58227785
>non-standard
I see this repeated in this thread. Are there actually any other Haskell compilers than GHC?
>>
>>58227807
>Making such restrictions on data structures are pretty bad though.
What restrictions?
The finger tree showed is extremely efficient for virtually everything

>Then remind me again why functions in Haskell only accept a single parameter.
Because you can return a function, pass a tuple, etc?
>>
>>58227820
Like 2.
I don't think the CPP is ever likely to be standardised, thankfully.
UNPACK is generally an implementation detail.
>>
>>58227820
>>58227840
Oh, and virtually nobody uses those other ones.
Pretty much everyone is on GHC.
Though some people are against certain extensions.
>>
>>58227807
Restrictions such as "don't mess with the back of a singly linked list" are nothing to do with Haskell, bra.

Making String a synonym for [Char], on the other hand...
>>
>>58227861
>Restrictions such as "don't mess with the back of a singly linked list" are nothing to do with Haskell, bra.
List types in Python, Java and C++ have O(1) insertion time in front and back of list, as specified by their specifications. The implementation just keeps a tail pointer, which is what, four to eight bytes?
>>
>>58227874
Those aren't singly linked lists, bra.
>>
>>58227874
I'm telling you, lists in Haskell are almost literally defined as
data List a = Null | Cons a (List a)


Nothing is stopping you from doing

data MyList a = Null | Cons { val :: a, next :: List a, last :: Maybe (List a), back :: (List a) }
>>
>>58227881
single linked means that each element has only a single next pointer.

It has nothing to do with keeping one (1) additional pointer to the tail of the list.

Also, these specifications say nothing about having to be single or double linked.
>>
>>58227901
>I'm telling you, lists in Haskell are almost literally defined as
And I keep telling you that I'm talking about the implementation, not "how you do it in Haskell".
>>
>>58227902
data MyList a = Null | Cons a (List a) (List a)
>>
>>58227902
That's a different data structure, bra.
A better one, for sure, but definitely not the same one.
>>
>>58227920
>>58227901
>implementing strings as a list of chars
>>
>>58227918
>And I keep telling you that I'm talking about the implementation, not "how you do it in Haskell".
THAT IS THE IMPLEMENTATION
>>
>>58227924
>That's a different data structure, bra.
It isn't.
>>
>>58227932
>THAT IS THE IMPLEMENTATION
No, that is how you would do it in Haskell. I'm talking about how that is synthesised by the Haskell compiler.
>>
>>58227927
That really is so dumb I can't believe they did it.

Another complete facepalm move was not providing 'Natural'. It makes endless functions accidentally partial.

>>58227935
The data is structured differently: it's a different data structure.
https://en.wikipedia.org/wiki/Linked_list#Singly_linked_linear_lists_vs._other_lists
Notice how what you describe is considered under 'vs. other lists'.
>>
>>58227946
The fact that it doesn't have a pointer to the end is literally part of the declaration.

GHC would see

data MyList a = Null | Cons a (MyList a)

And turn this into a tag and a void pointer.

Null doesn't have any parameters, and is basically an empty struct, so nothing there. (Pointer might not even be used)

Cons would have two void pointers - one to an a, and one to a MyList a.
>>
>>58227954
>https://en.wikipedia.org/wiki/Linked_list#Singly_linked_linear_lists_vs._other_lists
This talks about singly linked and doubly linked lists and also tail sharing, not keeping a tail pointer. A tail pointer does not make it a doubly linked list, anon. Prev and next pointers make it a doubly linked list.

>Notice how what you describe is considered under 'vs. other lists'.
1) It actually isn't, see above.
2) "List" doesn't mean "singly linked linear list", it means a container type with operations that are consistent with what you would expect for a list.
>>
>>58228009
>>58227954
See here: https://en.wikipedia.org/wiki/Linked_list#List_handles

>In some situations, however, it may be convenient to refer to a list by a handle that consists of two links, pointing to its first and last nodes.

>in the context of such algorithms, the word "list" often means "list handle".
>>
>>58228009
>>58228031
>Everyone knows don't mess with the back of a singly linked list.

That's where this all started. We've been talking about singly linked lists this whole time.

Move those goalposts, though. That'll teach 'em :)
>>
>>58228040
Go kill yourself retard, you're not impressing anyone with your backpedalling.
>>
>>58228009
A tail pointer would not be consistent with the definition of a list provided.

data MyList a = Null | Cons a (MyList a)


A better compiler could see this and turn it into

struct MyList {
void* item;
MyList* next;
}


with Null being (nullptr, nullptr) and (Cons x Null) being (&x, nullptr)

But there is NO tail pointer in that definition.

You are right that GHC could (and probably should) provide a unique implementation (rather than giving it the same treatment as everything else) with extra data
>>
Friendly reminder that python 3 is not turing complete.
>>
>>58228057
Ahahaa.

>literally quotes original post
>backpedalling

Love it.
>>
>>58228064
turing completeness is a meme anyway
>>
File: pypy.gif (443KB, 400x480px) Image search: [Google]
pypy.gif
443KB, 400x480px
>>58228064
Python 3 is not Python complete

>>58228063
oh and this is ignoring laziness, which might add another box
>>
>>58228040
>We've been talking about singly linked lists this whole time.
I don't know what you think you've been talking about, but I'm pretty sure we've been talking about list containers for the entirety of this thread.

See >>58227290
>>58227619
>>58227721
>>58227874
>>
>>58228084
Every post I've made has been about singly linked lists, and used the phrase literally.

If that triggered you, I'm sorry.
>>
Trying to figure out a good way to handle DCS in a way that isn't as slow as it currently is.

I didn't consider the fact that DCS strings might be megabytes big, so my terminal is creating a buffer appending the incomplete data as it gets it, but that means the DCS parser has to go through every single character in the string a billion times until the buffer is finally complete, containing a string ending.

An option could be to just return the beginning of the DCS, OSC, APC and whatever, and leave the doing whatever until the end is reached to the user, but that's going to be error prone, and makes the API uglier.

It's a hard knock life.
>>
>>58228063
What's stopping the compiler from turning it into this

struct ListItem;
struct List {
struct ListItem* head;
struct ListItem* tail;
size_t size;
};

struct ListItem {
void* item;
struct ListItem* next;
};
>>
>>58228064
It says a lot about the credibility of Zed that I honestly couldn't tell whether or not he was serious when he made this claim.
>>
File: pretending.png (2KB, 244x226px) Image search: [Google]
pretending.png
2KB, 244x226px
>>58228095
>I won this internet argument because I was actually talking about something else the entire time! Hahah jokes on you
>>
I have 22 (You)s in this thread. Feels good.
>>
>>58228084
We've always been talking about Haskell lists, which are effectively defined as
data List a = Null | Cons a (List a)


>>58228110
I don't think lists get special treatment in GHC.
The compiler wouldn't know that this would be a valuable optimisation.
Plus, what if you did care about those extra 4 bytes?

There is a non-standard library called containers that provides a very efficient finite sequence type:
https://hackage.haskell.org/package/containers-0.5.9.1/docs/Data-Sequence.html
>>
>>58228131
have another, my dude
>>
>>58228146
ty
>>
File: 1480359906494.png (93KB, 800x600px) Image search: [Google]
1480359906494.png
93KB, 800x600px
>>58228129
>>
>>58228129
>he was actually talking about singly linked lists when he repeatedly used the phrase singly linked lists, shit!
>I know, I'll accuse him of trolling! XD

I'm so glad I pointed out that you didn't know what a singly linked list is. It turns out that you just can't read, which is much more entertaining.
>>
>>58228145
>We've always been talking about Haskell lists
No, we've been talking about the implementation of the list interface, why else would we be talking about copies vs keeping track of changes and garbage collection?

>>58228145
>I don't think lists get special treatment in GHC.
Maybe, but that's something they should consider.

>The compiler wouldn't know that this would be a valuable optimisation.
It would, but maybe not with regards to laziness.

>Plus, what if you did care about those extra 4 bytes?
Then you obviously wouldn't be using Haskell since, according to the documentation, it's not uncommon to produce 1gb of data per second which will be gc'd immediately.
>>
>>58228201
>not uncommon to produce 1gb of data per second
I have to see this shit HAHA
>>
>>58228167
Not him but a singly linked list handle may have a head and tail pointer?? There's too much memeing and trolling ITT, I can't keep track of who's trolling who anymore.
>>
>>58228156
Don't forget to null terminate your singly linked meme list. You don't want dangling meme pointers.
>>
>>58228201
>that's something they should consider
perhaps

>it's not uncommon to produce 1gb of data
this entirely depends on the code
>>
>>58228220
https://wiki.haskell.org/GHC/Memory_Management
>>
>>58228220
This is actually my favourite thing to come out of /dpt/ in a while.

I'm a Haskell user, and I love how literally the imperative mongs take it.
>>
Can someone link me to the (You) counter pls?
>>
>>58225881
But what if I like fast languages like C and C++ and find slow and shitty high level languages like Haskell soul crushing?
>>
>>58228242
>>58228220
>>58228201
Holy shit, you cannot make this shit up

>Haskell computations produce a lot of memory garbage - much more than conventional imperative languages. It's because data are immutable so the only way to store every next operation's result is to create new values. In particular, every iteration of a recursive computation creates a new value. But GHC is able to efficiently manage garbage collection, so it's not uncommon to produce 1gb of data per second (most part of which will be garbage collected immediately).


>hurr durr lets allocate A FUCKING GIGABYTE in order to append to a list
>herp derp but it doesn't matter because we just wait for the garbage collector to come and clean shit up for us
>>
>>58228274
Typical imperitard. Read the thread:
>>58225896
>>58225914
>>
>>58228274
Then you are possibly one of those programmers who prefers using a langugae because he personally finds it fun, than because it's best at solving the problem at hand.
>>
>>58225934
Just because you're retarded doesn't mean everyone else is too.
You just don't know how to fucking program properly.
>>
>>58228274
If you like fast languages you shouldn't be using C++
>>
>>58228299
Masochism speaks.
>>
>>58228293
> than because it's best at solving the problem at hand.

Is the problem at hand ruining the word that hardware designers do? Because that's what Haskell seems designed to do.
>>
>>58228293
But what if I find C or C++ to be the best language to solve that task at hand instead of Haskell? You know, like literally every piece of software I write.
>>
>>58228326
no, the problem at hand as in the project you are trying to get finished.
>>
File: 24818152.png (2KB, 420x420px) Image search: [Google]
24818152.png
2KB, 420x420px
I created a bunch of GitHub accounts trying to get a nice Identicon but the SJW banned me. :(
>>
>>58228145
>I don't think lists get special treatment in GHC.
Then how are they treated? Seeing how, according to yourself(?) (>>58227785), not everything is a considered a list (as claimed by >>58227756)

Methinks every single variable, value, parameter, whatever is stored as the following:

struct Value
{
void* data;
size_t data_size;
struct Value* old_value;
};


And then data can be anything, list, function, integer, whatever.
>>
>>58228336
That's fine
>>
>>58228342
>actually answering a joke rhetorical question

Were you born that autistic or did years of Haskell do that to you?
>>
>>58228364
I was responding to respond to the point you were trying to make.

I'm not even a Haskell programmer.
>>
>>58228351

I've been trying to explain this to you the entire time

data List a = Null | Cons a (List a)
>>
>>58228383
Get out you imperative pleb
>>
>>58228392
I think you'll find that the PC phrase is 'imperitard'.
>>
>>58228389
Fuck off troll.
>>
>>58228302
Guess how I know you've never used C++ or looked at the assembly output of a C++ program.

I had the same suspicions as you m8, but I wasn't retarded enough to ride on the meme bandwagon so I instead looked into it myself and determined that well written C++ can be just as fast as C if not faster than typical C code in some cases.

There's a reason why C++ is the industry standard for game engines.
Protip: it's because it allows powerful abstractions with C level efficiency.
>>
How do I restrict the length of a string in Java?

If I try to apply
mystring = mystring.substring(0, lengthrestriction)

I get an index out of bounds exception whenever mystring is shorter than the restriction allows.
>>
>>58228405
What the fuck?
That is literally a fucking list in Haskell
It's not fucking complicated
>>
anyone here used GEO DATASETS from ncbi??
>>
>>58228433
You've been trolled.
>>
>>58228433
We aren't talking about a list in Haskell, go kill yourself. We're talking about how immutability and laziness is implemented in Haskell.
>>
>>58228383
>I'm not even a Haskell programmer.

Must have been born with it, then.
>>
>>58228458
>born with autism
Everyone knows you get it from vaccines and/or that autism is just a pretend illness.
>>
new thread

>>58228476
>>
>>58228455
Fuck this shitty thread, I'm just going to install ghc and provide the -keep-hc-files and see for myself.
>>
>>58228471
It's both.

If it's pretend, you can definitely claim to have gotten it from vaccines.

>>58228479
Will it be better than this one?
>>
>>58228424
try{mystring = mystring.substring(0, lengthrestriction)}catch{}




should work
>>
File: browser #113.png (2MB, 1920x1040px) Image search: [Google]
browser #113.png
2MB, 1920x1040px
>>
new >>58228476


>>58228487
I can't promise that
>>
>>58228496
It's already turned to shit. Sorry, OP.
>>
>>58226943
having a Unix shell out of the box, pretty much. also, things like emacs or vim I guess. for me, it's more related to language choice. OCaml is a pain in the ass to work with on Windows and I can't think of a language that's significantly nicer on Windows than it is on Linux. so the best option is to just use Linux
Thread posts: 319
Thread images: 14


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