Programming thread

At the moment I'm mostly just looking to make some little utility programs.
Nice! In that case, you probably don't have to worry about memory management too much either way, for instance. You could program in a language that has sophisticated memory management and garbage collection (like C# or any of the languages @Shoggoth recommended) and not worry about it; or if you're curious for the experience, you could also try handling the memory yourself by writing in C/C++, since keeping track of memory won't be too much of a headache at this scale of program.

A thing that can separate a long MP3 into separate files based on where it detects silence,
Sounds nifty! As @ConcernedAnon pointed out, unless you're hankering (and/or have the mathematical aptitude) to write all the signal processing/FFT routines yourself, you're probably going to want to use library functions. That's not too much of an issue, since a lot of languages have well-documented libraries for such a thing (e.g. PortAudio for C/C++, or pydub for Python, or for C# with the .NET framework the NAudio libraries look particularly impressive and fun to use).

another thing that can immediately display which spots on a guitar fretboard will sound good over a particular chord, stuff like that.
This project sounds like you might want graphics or at least basic drawing and GUI stuff (to display the guitar fretboard upon which you programmatically draw the chords, if I'm picturing it right). There's a plethora of options available depending on your operating system. One of the good things about using C#/.NET I guess is that the choice is fixed for you in this regard and you don't have to think about it: your program will run (very well!) on Windows, and all of the functions/classes for coding Windows Forms are right there, easily usable, and supremely-documented. For other platforms and programming languages there are many choices too, with varying levels of quality in use and documentation (e.g. for C/C++ the Qt framework is particularly great, for Python you can also use Qt bindings but most people use Tkinter for their GUI stuff).

Alternatively for more advanced graphical stuff you can hook into OpenGL from just about any language you want: C/C++ obviously but also e.g. Python, C#, or even weirdo languages like Haskell and Lisp (sorry @Marvin and @Shoggoth, couldn't resist :P. Those guys can tell you more about functional languages than I could though, so this friendly jab gave me an excuse to @ them.).

I think I ended up making this post too long; you have plenty of options is the point I was trying to make I guess. Sounds like some fun projects either way, no matter how you decide to code them. Have fun with it!
 
Ah, gotcha. Is there any particular language you'd recommend as being a good example of "the functional side" to start with?
If you're going to dabble with C# anyway, and I guess you should at least get familiar with it (or Java), I'd recommend F# which is built in C#. But there's always a place for Lisp in my heart, and SICP is educational, so I recommend everyone go through it. Then you can try Clojure because I like having more than one data structure for everything.
I'd say common lisp and haskell.
Dear lord I wouldn't begin there with either of them. Haskell is hard and getting into F# will surely be easier, and CL is a mess, and absolutely not Functional. The best lisp IMO for FP is Clojure, although you can program in a functional style in all lisps. Something the Clojure community figured out is that macros aren't the magic solution for everything, and sometimes they complicate things needlessly. It's better to work with functions and data.
At the moment I'm mostly just looking to make some little utility programs. A thing that can separate a long MP3 into separate files based on where it detects silence, another thing that can immediately display which spots on a guitar fretboard will sound good over a particular chord, stuff like that. The copy of Gamemaker Studio that I bought back in high school is alright as far as making games goes (as long as they're 2D and not particularly resource intensive), but it's not particularly well-suited for making tools.
Sounds like you want to do some signal processing. The mp3 stuff I'd actually do in Matlab (or Octave). Once you get the algorithm down it'd probably be easiest to port it to python.
Technically speaking C# has both lambdas and records as well.
Furthermore, C# resembles C++ in many regards. So if you are familiar with C++, C# shouldn't be too much of a shock.
lipstick on a pig

C# is a lot like java really, though it has innumerable improvements over java.
Wasn't it just Microsoft's attempt at the time to compete with Java? I'm not holding the torch for either of them, btw. My money is where there's an open source platform, like openJDK, which MS has recently signed a contributor's agreement for.
or even weirdo languages like Haskell and Lisp (sorry @Marvin and @Shoggoth, couldn't resist :P.
I know those are weirdo languages and take no offense by it. They're just so damn good that I don't care I look like a crazy person to everyone else. You tend to get drunk on that sort of power, but it's enough power to blow your own face off. The ol' Evil Overlord List comes to mind.
 
Then you can try Clojure because I like having more than one data structure for everything.
Scheme (and probably CL but I've never used CL proper) has "vectors", which are just an array with a length and X number of cells you can read and assign to. On top of vectors you can implement structures or hash tables or whatever else you're looking to implement.

There are scheme standards (like SRFI-9 or SRFI-69) that implement these additional datatypes, and most scheme's will say "yes, I implement srfi-9 and srfi-69", and these SRFIs are generally designed so they can be implemented in standard scheme with some pretty simple copy-and-paste bullshit.

But usually, they're treated as important niceties you'd expect a modern programming language to implement, so they often get implemented in C or some other native module format.
 
  • Informative
Reactions: Yotsubaaa
Scheme (and probably CL but I've never used CL proper) has "vectors", which are just an array with a length and X number of cells you can read and assign to. On top of vectors you can implement structures or hash tables or whatever else you're looking to implement.

There are scheme standards (like SRFI-9 or SRFI-69) that implement these additional datatypes, and most scheme's will say "yes, I implement srfi-9 and srfi-69", and these SRFIs are generally designed so they can be implemented in standard scheme with some pretty simple copy-and-paste bullshit.

But usually, they're treated as important niceties you'd expect a modern programming language to implement, so they often get implemented in C or some other native module format.
Yeah, but
- They aren't "first class" citizens in the language, as everything in scheme is still done with lists, you just get vectors as "a nicety"
- They don't have first class reader support. The only literal in scheme is a list. Clojure gives you literal lists, vectors, maps and sets.
- They aren't immutable by default. An array is hella mutable, and doesn't grow or remove elements in O(1), same goes for hash tables. Which scheme has hashes implemented as immutable HAMTs by default?
- They don't implement universal interfaces. car, cdr and cons have to go. I want to first, rest and conj all day.
And you get the JVM's JIT and GC for free.
 
  • Like
Reactions: Marvin
Yeah, but
- They aren't "first class" citizens in the language, as everything in scheme is still done with lists, you just get vectors as "a nicety"
- They don't have first class reader support. The only literal in scheme is a list. Clojure gives you literal lists, vectors, maps and sets.
- They aren't immutable by default. An array is hella mutable, and doesn't grow or remove elements in O(1), same goes for hash tables. Which scheme has hashes implemented as immutable HAMTs by default?
- They don't implement universal interfaces. car, cdr and cons have to go. I want to first, rest and conj all day.
And you get the JVM's JIT and GC for free.
Actually...
1 and 2. Vectors are a first class citizen in the language, and they do have reader support. The reader support is built into the standard scheme standard (since at least r5rs, probably earlier), as #(a b c d)
1b and 2b
- also, when it comes to structures, there's aspects of the scheme reader which you're allowed to fuck with that don't actually break the scheme standard. so I've had scheme standards that permit reader macros (ie custom syntax) for structures and hash tables.
3. Scheme is inherently a mutable language, admittedly. Although, I feel that mutability is an escape hatch you'll want for implementing anything moderately complicated (even if you end up hiding 99% of the mutable changes) with functional libraries. Which is fine and really how you should do things. But with Clojure, I tried to implement a game engine in it one time (just fucking around, not too serious), I ended up getting deep enough until I realized that I can't actually store things without it being java or javascript dependent, so fuck me, right?
4. I think car, cdr and cons are fine.
And there are schemes that compile to the jvm which are fine. They also compile to javascript and C and their own bytecodes and a whole bunch of other bullshits.

I mean, clojure is nice and I'd take a job working in it and be the happiest programmer in the world. But... not that I'd have zero complaints, y'know?
 
CL is a mess, and absolutely not Functional.
CL is totally functional. It's not pure functional. It's multi-paradigm but functional is the first among them. In the same way C# gets listed as a functional language on it's wikipedia page but you'd still call it an OO language. The only real arguments against it being functional involve redefining "functional" away from the normal meaning, usually to mean either pure functional or specifically the group theory sort of functional. Normally functional just refers to it being descended from lambda calculus, in the same way imperative refers to it being descended from turing machines, and all lisps fit this bill.

macros aren't the magic solution for everything
The thing is they are. A large part of the point I was trying to make at the end there is that everything is the magic solution for everything. Certainly I could write a CL program with a macros based style to solve any problem you give me and for people who prefer CL this would be the easiest to write and understand solution.

Also fuck the fucking JVM for functional languages. I would honestly swear the devs just hate functional languages. "We're not doing tail recursion elimination because it doesn't maintain the call stack right and that's a security flaw because we were huffing far too much gas when we wrote this." So now every functional language needs some hacked in bullshit, none of which maintains a "proper" stack trace, so you can actually run the programs without melting your CPU. I don't blame the languages for this mind. I blame the JVM.
 
Actually...
1 and 2. Vectors are a first class citizen in the language, and they do have reader support. The reader support is built into the standard scheme standard (since at least r5rs, probably earlier), as #(a b c d)
1b and 2b
- also, when it comes to structures, there's aspects of the scheme reader which you're allowed to fuck with that don't actually break the scheme standard. so I've had scheme standards that permit reader macros (ie custom syntax) for structures and hash tables.
3. Scheme is inherently a mutable language, admittedly. Although, I feel that mutability is an escape hatch you'll want for implementing anything moderately complicated (even if you end up hiding 99% of the mutable changes) with functional libraries. Which is fine and really how you should do things. But with Clojure, I tried to implement a game engine in it one time (just fucking around, not too serious), I ended up getting deep enough until I realized that I can't actually store things without it being java or javascript dependent, so fuck me, right?
4. I think car, cdr and cons are fine.
And there are schemes that compile to the jvm which are fine. They also compile to javascript and C and their own bytecodes and a whole bunch of other bullshits.

I mean, clojure is nice and I'd take a job working in it and be the happiest programmer in the world. But... not that I'd have zero complaints, y'know?
1&2 - I'm not updated on the scheme standards, admittedly. Do vectors give you O(1) insertion, deletion, lookup, immutability, structural sharing, over every generation? If so, it's more mature than I thought.
3. you brave, brave man. I can't see not having to dip into Java if you try to implement a game engine in Clojure, although some guy already did, this hero. There's also Arcadia which is CLR Clojure on Unity. I know there's also something in CLJS.
If you got to the point of storing stuff you have to make a choice between implementations. that's a pretty advanced point, no?
4. I think they're really not. You can say that the cons cell is a leaky implementation. I'm really happier without it.

I've never written serious programs with Scheme, and admittedly I came into Clojure with my nose a bit in the air thinking Scheme was better, but having mostly written data manipulation and backend programs with it, I'm a very happy clam, no complaints as of yet.

CL is totally functional. It's not pure functional. It's multi-paradigm but functional is the first among them. In the same way C# gets listed as a functional language on it's wikipedia page but you'd still call it an OO language. The only real arguments against it being functional involve redefining "functional" away from the normal meaning, usually to mean either pure functional or specifically the group theory sort of functional. Normally functional just refers to it being descended from lambda calculus, in the same way imperative refers to it being descended from turing machines, and all lisps fit this bill.


The thing is they are. A large part of the point I was trying to make at the end there is that everything is the magic solution for everything. Certainly I could write a CL program with a macros based style to solve any problem you give me and for people who prefer CL this would be the easiest to write and understand solution.

Also fuck the fucking JVM for functional languages. I would honestly swear the devs just hate functional languages. "We're not doing tail recursion elimination because it doesn't maintain the call stack right and that's a security flaw because we were huffing far too much gas when we wrote this." So now every functional language needs some hacked in bullshit, none of which maintains a "proper" stack trace, so you can actually run the programs without melting your CPU. I don't blame the languages for this mind. I blame the JVM.
Saying a language which supports writing in a functional style is functional doesn't seem right to me. That would make Go functional. I think immutability is actually a strong prerequisite for being functional. Also, functional, as being derived from lambda calculus, would only apply to the ML family. Lisps are derived from the study of recursive functions, so even that taxonomy fails. I don't think lisps not being functional makes them less strong, worthwhile, or anything of that sort, I just think they are multi paradigm, and that's a-ok. I also think starting off with CL is one hell of a mind bending experience.

What I was referring to regarding macros maybe has to do with Clojure getting wider industry experience. Correct me if I'm wrong, but most CL projects were usually teams working closely together? It isn't that macros don't work, or are bad, but they don't scale on the "people" axis over the lifetime of a software project.
This is the experience Metosin had with it: https://www.youtube.com/watch?v=WtdegIqQbrg
Full disclosure, I like that crazy Finn.

In the end, regarding tco on the JVM, you got me there. But Clojure's solution isn't bad. Maybe one day we'll get it. In the meanwhile `recur` works fine. Everything else on the JVM is pretty nice, so I'm not in a rush.
 
  • Winner
Reactions: Yotsubaaa
If you're going to dabble with C# anyway, and I guess you should at least get familiar with it (or Java), I'd recommend F# which is built in C#.
Strictly speaking F# is built for the same VM, not compiled into C# code. The two are largely compatible though, so I'd agree with the sentiment.

Wasn't it just Microsoft's attempt at the time to compete with Java? I'm not holding the torch for either of them, btw. My money is where there's an open source platform, like openJDK, which MS has recently signed a contributor's agreement for.
It's true C# started off mimicking Java and it roughly fills the same niche, however It's original designer described it as closer to C++ with a focus on portability, and avoiding the various quality and reliability problems that native programs and libraries suffer from (DLL hell, seg faults, etc.). Realistically it is in fact more similar to Java than C++ though. Fortunately, C# has grown since then and now far outclasses Java.

As for open source, there are currently two notable implementations of the C# compiler; Mono, and Roslyn. Furthermore, Mono also provides an open source implementation of the VM that backs C#, and Microsoft has introduced a open source and cross-platform implementation of the VM called .Net Core. I'll grant that is probably another one of Microsoft's schemes, but it delivers for the most part.

I wouldn't shed any tears if Microsoft somehow actually managed to kill Java. Having worked with both, Java is a miserable experience, and a shadow of what it's clone has become.
 
Last edited:
The WinForms portion of Mono is plagued with show stopping bugs, and is basically unmaintained. I regularly use a bunch of WinForms based mono applications on Linux and they're constantly crashing just due to minor interactions with the window manager. I have to baby them by basically never resizing their windows, and avoiding touching the super key. Seriously.

The devs just shrug when bug reports come in, saying no one is working on that code.

Examples: Mesen, KeePassX, CKAN, they all have the exact same crashing bugs. Fortunately I moved to KeePassXC but I still use Mesen and CKAN.
 
3. you brave, brave man. I can't see not having to dip into Java if you try to implement a game engine in Clojure, although some guy already did, this hero. There's also Arcadia which is CLR Clojure on Unity. I know there's also something in CLJS.
Man. Gotta say, all this Lisp/Clojure talk, but particularly that guy's presentation about functional game programming that you linked, has really got me hungry to code in one of those languages again. I might have to think about a small project or something I could do to whet my appetite after work.

The WinForms portion of Mono is plagued with show stopping bugs, and is basically unmaintained. I regularly use a bunch of WinForms based mono applications on Linux and they're constantly crashing just due to minor interactions with the window manager. I have to baby them by basically never resizing their windows, and avoiding touching the super key. Seriously.

The devs just shrug when bug reports come in, saying no one is working on that code.

Examples: Mesen, KeePassX, CKAN, they all have the exact same crashing bugs. Fortunately I moved to KeePassXC but I still use Mesen and CKAN.
Geez, still? I remember weird windowing bugs being an issue back when I was working with Mono ages ago.
 
McCarthy's lisp paper references Church's lambda calculus paper and uses it heavily throughout.
The word LAMBDA appears 10 times, mostly in explanations and some in definitions. First appearance is halfway through the paper.
A. CHURCH, The Calculi of Lambda-Conversion (Princeton University Press, Princeton, N. J., 1941). is one reference out of 5.
I'd say it isn't enough to prove me wrong or to prove you right, but definitely not heavily.
 
The word LAMBDA appears 10 times,

It's written λ, it comes up more than 10 times in the first section and you can't just search for a word or symbol to show how much a concept is used. Part of the point of the paper comes from λ-notation not being able to handle recursive functions so he defines a new notation. It's still using lambda calculus as a concept if not as a symbol.
 
  • Agree
Reactions: Shoggoth
It's written λ, it comes up more than 10 times in the first section and you can't just search for a word or symbol to show how much a concept is used. Part of the point of the paper comes from λ-notation not being able to handle recursive functions so he defines a new notation. It's still using lambda calculus as a concept if not as a symbol.
I'm just being autistic at this point...
 
The WinForms portion of Mono is plagued with show stopping bugs, and is basically unmaintained. I regularly use a bunch of WinForms based mono applications on Linux and they're constantly crashing just due to minor interactions with the window manager. I have to baby them by basically never resizing their windows, and avoiding touching the super key. Seriously.

The devs just shrug when bug reports come in, saying no one is working on that code.

Examples: Mesen, KeePassX, CKAN, they all have the exact same crashing bugs. Fortunately I moved to KeePassXC but I still use Mesen and CKAN.
Microsoft basically treats winforms as a legacy technology nowadays. They're all about that UWP.
 
  • Agree
Reactions: Strange Looking Dog
Microsoft basically treats winforms as a legacy technology nowadays. They're all about that UWP.
Does any serious developer actually use UWP though?
I once (Not very seriously) tried my hand at it and it's basically a clone of apple's shit ecosystem with all the required developer certification bollocks included.
 
  • Like
Reactions: Strange Looking Dog
It's both satisfying and frustrating when you clean up some mess someone left in a code base. On one hand, you boost performance by at least 2x. Took one hour of lunacy. If your radical proposal gets accepted move that to 30x. Took a few hours. But that don-kehy still works there. Who knows what the fuck he's up to?
 
Does any serious developer actually use UWP though?
I once (Not very seriously) tried my hand at it and it's basically a clone of apple's shit ecosystem with all the required developer certification bollocks included.
I imagine it's fine as a display technology.
 
Also math, math, math. Shockingly big amount of "programmers" that are on a barely-highschool math level. (and below) Many will tell you you don't need to be good at math to be a programmer and I guess that's true but if you aren't you'll always be very mediocre, believe me, that is also true. Look at older books for learning, don't use some random online tutorials or ebooks, in my experience they're often just not that good. You don't need to be physicist-level proficient at math but it can be just so incredibly helpful in problem solving. That all being said, maybe consider another industry and keep it as a hobby. Working in that industry sucks often and hard.

I'm primarily a web developer who also does some simple desktop and mobile stuff, and I almost never have use for mathematics outside of basic algebra and the concepts of modulus (not sure if that counts as algebra). Plus, of course, logic, if you count that as math. Sometimes I have to do geometry like the Pythagorean theorem, but that's maybe once a decade.

Granted, if you're going to be making games, you're probably going to be doing some trigonometry. Polygonal graphics and even 2D graphics tricks like sprite rotation is all trig. But for the most part, I'd say that you can get away with just a command of high-school-level math.

2. What is the most lazy laid back programming field that makes a living wage? How does one get into it?

Again, as a web dev, I can attest that there are many shitty half-assed devs in this part of the industry, and probably most of them are making more money than me. I suggest for your own sake that you try to be better than "lazy," though.
 
  • Thunk-Provoking
Reactions: Coolio55
Not that big of a deal, I've just heard that certain things that are a bit of a pain in the dick with C++ (Memory management, GUIs, etc.) aren't as much of a pain in the dick with C# and the like. Would I be correct in that assumption or have I been misinformed here?
I've used c++ for full blown games before, using SDL2. It's not the hardest but also not easy. Checkout the powder toy.
see if you can link this account to my github, bet you cant
 
Back