Programming thread

You can get by with Notepad and the JS tutorials on developer.mozilla.org. You don't even need to install anything to start programming. Note that Notepad doesn't have syntax highlighting (which is an extremely helpful thing to have when programming) so you could use Notepad++ instead. It has just barely the amount of features you need to comfortably write basic HTML and JS. If you happen to use Linux, it's also easy to get started with C and C++. Every programmer should know a bit about C, since it's very prevalent. You might even prefer it over JS for various reasons when you start to figure things out, but starting directly with those languages is quite difficult. It expects you to handle some things that most other languages do for you, and beginners have enough on their plate already without having to worry about all that. I recommend doing a little bit in JS until you have the vaguest inkling of what's going on. Make Pong or some other really simple game in an HTML <canvas> element or something, then you can branch into what you want to do.
 
Last edited:
If you happen to use Linux, it's also easy to get started with C and C++.
And if you use Windows it's easy to get started with Linux without dual booting. Just enable Windows Subsystem For Linux and install a distribution from the store. Don't do this if you use VMs on your system and aren't using Hyper-V. But otherwise it's a great introduction, all the command line tools and compilers are available. Even GUI apps I guess now if your Windows is up to date.
 
And if you use Windows it's easy to get started with Linux without dual booting. Just enable Windows Subsystem For Linux and install a distribution from the store. Don't do this if you use VMs on your system and aren't using Hyper-V. But otherwise it's a great introduction, all the command line tools and compilers are available. Even GUI apps I guess now if your Windows is up to date.
Or Cygwin/MSYS2. MSYS2 in particular is great if he wants to be able to natively run his shit on other people's computers.
 
Sperging about which language is best for beginners is retarded. Literally give them any ALGOL-styled language with the typical constructs you see in day-to-day programming. The hardest part for newbies is the process of figuring out how variables and control flow work, and it's basically the same regardless if you're writing in C or Lua or Python or JS or whatever the fuck else. Once they figure out the basics, they'll be experienced enough to switch to whatever language does the job without too much pain.
 
Sperging about which language is best for beginners is retarded. Literally give them any ALGOL-styled language with the typical constructs you see in day-to-day programming.
I'm not sure I agree. I've made fairly extensive use of R and, all told, I like using it. It's often used as a first programming language for those with a background in e.g. psychology or ecology or some other scientific field. There's still enough shitty about R as a language that I think it will corrupt such novices. Python has warts like explicit self but it's still not as much of an abomination as JS.
 
  • Thunk-Provoking
Reactions: y a t s
I'm not sure I agree. I've made fairly extensive use of R and, all told, I like using it. It's often used as a first programming language for those with a background in e.g. psychology or ecology or some other scientific field. There's still enough shitty about R as a language that I think it will corrupt such novices. Python has warts like explicit self but it's still not as much of an abomination as JS.
There are plenty of people who get their first taste of programming in unholy shit like Scratch. I don't think shitty languages will create a bad programmer, they just need to learn how to change their workflow and forget to do their language's shitty workarounds when they move to a different language.

It's still a good idea not to retardedly persist with a shitty globals-everywhere lunatic language as a beginner because you're trying to learn how to do things right. A language that does things too wrong doesn't really facilitate that.
 
I'm not sure I agree. I've made fairly extensive use of R and, all told, I like using it. It's often used as a first programming language for those with a background in e.g. psychology or ecology or some other scientific field. There's still enough shitty about R as a language that I think it will corrupt such novices. Python has warts like explicit self but it's still not as much of an abomination as JS.
I wish R had an audience outside of academia, because there's a lot to like about it as a Python alternative. While the obsession with pipes wouldn't translate well to most languages unless you're a psychopath trying to wean a new programmer onto Bash, you've got generally decent syntax and in many was a more pleasant take on the mixture of C-like trappings on a basis of Scheme than JS. Its C API is reasonably pleasant, too.
 
It's still a good idea not to retardedly persist with a shitty globals-everywhere lunatic language as a beginner because you're trying to learn how to do things right. A language that does things too wrong doesn't really facilitate that.
Well, like I was saying, R is exactly such a language. The global namespace is heavily polluted just from the base installation with variables like mtcars and iris and when you use library(), you're eventually bound to mask other variables (which you will be advised of). If x is some variable you need from libraries foo and bar, you can fully qualify like so: foo::x. It's still a mess. One of R's other mixed blessings that immediately comes to mind is the heavy focus on data frames (or, better, tibbles) instead of other, more elementary data structures. I'm pretty sure base R doesn't have a fully functional dictionary type like Python does, which is why r2r exists.
I wish R had an audience outside of academia, because there's a lot to like about it as a Python alternative.
There are quite a few private and governmental organizations that use R and a huge open source community around it. I wouldn't say R is a Python alternative as such. R is specifically targeted at statistics and data science where Python is a more general-purpose programming language. They now overlap in what was once strictly R's domain. I would say R continues to do quite a few things better which is why Python hasn't made R redundant.
While the obsession with pipes wouldn't translate well to most languages unless you're a psychopath trying to wean a new programmer onto Bash, you've got generally decent syntax and in many was a more pleasant take on the mixture of C-like trappings on a basis of Scheme than JS. Its C API is reasonably pleasant, too.
Python has a third-party pipe module:
OCaml also makes extensive use of its pipeline operator. It can make things substantially more readable. But I'm not sure what you mean by "C-like trappings on a basis of Scheme". Are you referring to R's FP leanings?
 
Last edited:
  • Like
Reactions: y a t s
Well, like I was saying, R is exactly such a language. The global namespace is heavily polluted just from the base installation with variables like mtcars and iris and when you use library(), you're eventually bound to mask other variables (which you will be advised of). If x is some variable you need from libraries foo and bar, you can fully qualify like so: foo::x. It's still a mess. One of R's other mixed blessings that immediately comes to mind is the heavy focus on data frames (or, better, tibbles) instead of other, more elementary data structures. I'm pretty sure base R doesn't have a fully functional dictionary type like Python does, which is why r2r exists.
I don't really know though, would starting to program with awful global namespace garbage teach new programmers to do that or would they eventually learn how much global bullshit sucks after getting ruined by it over and over again?
 
  • Like
Reactions: Jarry Seinfelt
But I'm not sure what you mean by "C-like trappings on a basis of Scheme". Are you referring to R's FP leanings?
The FP leanings are there and admirable, but it's more about the language's underlying structure. It's changed significantly since, but R was initially written as a Lisp, in ways that are most obvious once you start looking at its C API. Pairlists barely see any use even internally these days (who would have thought that relying on linked lists might not be the best idea?), but they're still all present and have all the associated CAR and CDR macros that you'd expect for interacting with them, while everything is represented as an SEXP (for S-expression).
The C-like syntax is a reference to actual R as written looking enough like C that it's regarded as part of the C family of languages (at least by Wikipedia), with the JS analogy for the same reason: it too started out with grand plans of Lisp - Brendan Eich intended to embed Scheme in the browser - while ending up in the C family. In both cases, there was also a bit of indirection in the process - R followed S and JS followed Java, but they both ended up under the big umbrella.
There are quite a few private and governmental organizations that use R and a huge open source community around it. I wouldn't say R is a Python alternative as such. R is specifically targeted at statistics and data science where Python is a more general-purpose programming language. They now overlap in what was once strictly R's domain. I would say R continues to do quite a few things better which is why Python hasn't made R redundant.
I think we're generally in agreement here; I've even run across a number of such private organisations myself.
I'm pretty sure base R doesn't have a fully functional dictionary type like Python does, which is why r2r exists.
The fun part of the open-source community is, of course, that you have a great many of them. For dictionaries, I've recently been happy with the ones provided by the new-ish collections, which has a decent set of benchmarks, although r2r isn't among the set of dictionaries benchmarked at the link.
 
I'm a firm believer that beginners should at least learn with a strongly typed language. As I have mentioned previously, I started out with C++ a little over 20 years ago, back when programming was much less n00b friendly. While I probably wouldn't recommend doing it the way I did (at least not with fucking C++), I think starting with a less hand-holdy language helped teach me good habits early on.

IMO, JS and Python devs write some of the worst code I have read on average. They're great languages, but they allow for all sorts of unholy abominations in implementations, the downsides of which often aren't readily apparent. They typically end up biting the programmer in the ass way down the line after he has written tons of additional parts that depend on these flawed implementations. This is largely because of the languages' abstracted, hand-holdy nature. Something I like a lot about C is that you'll find out pretty quickly if you did something retarded.

As an aside, I think beginners would be better served learning Python with numpy or scipy instead of R. It's more practical in the long term, since you can take those skills and apply them directly with other Python projects rather than having to abstract one's knowledge gained from learning R. R is cool and all that, but it's not used a lot outside of stats related applications.
 
javascript-the-good-parts.jpg
 
Anyone remember when Yahoo! was actually an interesting company who actually did stuff?
"Yahoo! press"

I still have a little thing around here somewhere I got at a conference that goes "YAHOOOOOOO".

Yes, it's been a few years.
"Fetch, Lycos!" (My hair is falling out.)

Doubleposting because, hey, no choice:
The FP leanings are there and admirable, but it's more about the language's underlying structure. It's changed significantly since, but R was initially written as a Lisp, in ways that are most obvious once you start looking at its C API. Pairlists barely see any use even internally these days (who would have thought that relying on linked lists might not be the best idea?)
Your post was all quite informative! I too like to write performant machine learning code using lists with O(n) lookup. But seriously, the plan was initially to be a Lisp dialect but, like JS, later switched to an ALGOL- or C-like syntax in imitation of the commercial S language (that I think R pretty much killed), presumably all the way down to the same global datasets?
IMO, JS and Python devs write some of the worst code I have read on average. They're great languages, but they allow for all sorts of unholy abominations in implementations, the downsides of which often aren't readily apparent.
What are some good guides not to be #ThatGuy for someone who's obviously had experience with a bit thornier stuff like pointers and DS&A but still has mainly written things like Monte Carlo simulations, web scrapers and Project Euler solutions? To get things to scale, that is? I have the Gang of Four design patterns book for example but all the examples are written in languages I don't have a ton of experience with. (Definitely want to get better at Smalltalk through Pharo, though.)
 
Last edited by a moderator:
But seriously, the plan was initially to be a Lisp dialect but, like JS, later switched to an ALGOL- or C-like syntax in imitation of the commercial S language (that I think R pretty much killed), presumably all the way down to the same global datasets?
As I recall it, backwards compatibility with S was always a goal and was mostly if not entirely achieved. You're correct that S is pretty much dead - the last release of S-PLUS was before the turn of the millennium and I don't recall when last I ran across anything related to it in the wild. It's just that the plan was to reimplement S on top of a Scheme-inspired Lisp dialect, which must have seemed perfectly reasonable to the pair of Emacs-using academics throwing it together as a teaching aid in the early '90s. With all the talk of globals, it's worth noting that having any notion of scope at all was an improvement R made to S, with Scheme's lexical scoping being the explicit template.
 
  • Like
Reactions: Belisarius Cawl
As I recall it, backwards compatibility with S was always a goal and was mostly if not entirely achieved. You're correct that S is pretty much dead - the last release of S-PLUS was before the turn of the millennium and I don't recall when last I ran across anything related to it in the wild.
Apparently the last release was in 2010. Young enough for Lucas Werner but software-old, perhaps even by Debian stable standards.
It's just that the plan was to reimplement S on top of a Scheme-inspired Lisp dialect, which must have seemed perfectly reasonable to the pair of Emacs-using academics throwing it together as a teaching aid in the early '90s. With all the talk of globals, it's worth noting that having any notion of scope at all was an improvement R made to S, with Scheme's lexical scoping being the explicit template.
So, in S, I could define niggerlicious in a function dedicated to calculating statistics about niggers and it would be available everywhere?
black-templars-gross.jpg
 
Apparently the last release was in 2010. Young enough for Lucas Werner but software-old, perhaps even by Debian stable standards.
Looks like I was mixing it up with the final version of the S standard being S4 in 1998. That said, it's a reasonably long delay, especially when the latest release of R just went stable a month ago and actually brought some nice functionality - for all the talk of starting out as a Lisp dialect, it's actually somewhat shocking that it took over 30 years to add support for tail-call optimisation.
So, in S, I could define niggerlicious in a function dedicated to calculating statistics about niggers and it would be available everywhere?
I believe so and fully agree with the sentiment.
 
Back