• 0 Posts
  • 40 Comments
Joined 1 year ago
cake
Cake day: July 3rd, 2023

help-circle
  • A language is not functional just because it supports higher order functions. Technically C even supports them (even though the ergonomics and safety of them are terrible). Would you call C a functional programming language? Obviously not. Rust is also not a functional language, even though it comes closer than most OO/imperative languages.

    Kotlin and plenty of other OO languages have borrowed some ideas from functional languages in recent years because those ideas are useful. That doesn’t make them functional languages. If Kotlin were a functional language, then it wouldn’t need libraries like arrow to try to make doing FP in Kotlin even (kind of) possible.

    Hallmarks of FP (beyond higher-order functions), in no particular order:

    • Organization around functions as the fundamental unit of code
    • Code primarily defined in terms of expressions and data transformations rather than statements manipulating object state (so languages that have big blocks of imperative statements like Kotlin don’t count)
    • A general orientation around pure functions, even if they vary on the degree to which they enforce purity
    • Explicit parameter passing being the standard and preferred way of providing data to functions, rather than methods operating on implicit state
    • First class support for function composition (method chaining doesn’t count)
    • Pattern matching and destructuring as a first-class and ubiquitous concept (what Kotlin does have is a joke comparatively and no one would actually call it that)
    • For statically-typed functional languages, first class support for algebraic data types (Kotlin has sealed classes which can kind of be used to try to emulate it, but it’s pretty awkward in comparison and requires you to write very OO-ish code to use)

    There are some minor exceptions, such as Clojure lacking pattern matching, but on the whole functional languages generally fit these descriptions.


  • That list also counts Java and C# as “functional languages”. I wouldn’t take it too seriously. Ocaml, Scala, F#, etc. are impure functional languages. Kotlin absolutely is not. Having a couple of features you might find in functional languages does not make a language functional. Kotlin is still very much an OOP-based language. It’s basically a somewhat nicer Java.


  • Minor nit: Kotlin is decidedly not a functional language.

    Design patterns in OOP exist purely to solve the problems created by OOP itself. If you have a language with proper ADTs and higher order functions, the need for traditional design patterns disappear since the problems they solve are first-class features baked into the language.

    The first-class replacement for the Strategy pattern (and many other patterns such as the Visitor pattern) is sum types (called enums in Rust).







  • Glad you got fired. Vaccines should always be mandatory save for legitimate, doctor-validated medical exemptions.

    Anti-vaxxers are fucking stupid and should either be educated properly or, if they still refuse to do their civic duty after being de-programmed of misinformation, punished. You are only allowed to participate in society if you take the necessary steps that you are morally and ethically obligated to do in order to protect it from preventable, transmissible disease. We had eradicated polio until stupid motherfuckers like yourself decided that it would be a good idea to forgo the standard polio vaccine schedule that we’ve had for decades. Now, we saw the first case in 30 years in 2022 because someone selfishly thought that their personal beliefs were more important than the health and livelihood of everyone else.












  • You do not understand how these things actually work. I mean, fair enough, most people don’t. But it’s a bit foolhardy to propose changes to how something works without understanding how it works now.

    There is no “database”. That’s a fundamental misunderstanding of the technology. It is entirely impossible to query a model to determine if something is “present” or not (the question doesn’t even make sense in that context).

    A model is, to greatly simplify things, a function (like in math) that will compute a response based on the input given. What this computation does is entirely opaque (including to the creators). It’s what we we call a “black box”. In order to create said function, we start from a completely random mapping of inputs to outputs (we’ll call them weights from now on) as well as training data, iteratively feed training data to this function and measure how close its output is to what we expect, adjusting the weights (which are just numbers) based on how close it is. This is a gross simplification of the complexity involved (and doesn’t even touch on the structure of the model’s network itself), but it should give you a good idea.

    It’s applied statistics: we’re effectively creating a probability distribution over natural language itself, where we predict the next word based on how frequently we’ve seen words in a particular arrangement. This is old technology (dates back to the 90s) that has hit the mainstream due to increases in computing power (training models is very computationally expensive) and massive increases in the size of dataset used in training.

    Source: senior software engineer with a computer science degree and multiple graduate-level courses on natural language processing and deep learning

    Btw, I have serious issues with both capitalism itself and machine learning as it is applied by corporations, so don’t take what I’m saying to mean that I’m in any way an apologist for them. But it’s important to direct our criticisms of the system as precisely as possible.