• 0 Posts
  • 17 Comments
Joined 3 years ago
cake
Cake day: June 26th, 2023

help-circle

  • Regarding what “sounds” hot, I think 100 makes more sense as the “super hot” number than 40. Although both numbers are arbitrary, 100 is less arbitrary. (Sorta. We just culturally define 100 to be an important number) Fahrenheit makes more sense if you think of it as “0 feels super cold, 100 feels super hot” although I’ll admit it’s a little strange that room temperature is 3/4s up the scale. That could be solves with a logarithmic scale, but that would probably be worse than either system.





  • I think there are programming paradigms that haven’t even been discovered yet. Rock music was “discovered” centuries after baroque music, and composers back then would have thought baroque music is the ultimate musical genre, which could not have been improved upon.

    I’ve been working on a programming language recently that sort of programs itself. It’s hard to explain how it works, since I approached it from a mathematical direction, but for a domain and range defined with a set of correct input-output pairs, there are an infinite number of functions which correctly maps one input to its corresponding output. If we define f_1 as all functions which correctly map the first IO pair, f_2 as functions which correctly map the second IO pair… Etc etc until we reach f_N, then the set intersection of all f_1…f_N is the set off all functions which satisfy our requirements. From this set of known correct functions, we can sort them by speed or some other trait.

    But the devil’s in the details there. I won’t go into how I get f_1…f_N, but I’m having fun thinking about it & designing it. It may even be useful some day.


  • I disagree that comments are an indication of messy code. The purpose of comments are to 1) translate low level concepts into higher ones for improved readability and 2) to maintain information in the design process that can’t be represented by the code itself.

    Obviously I don’t have to comment mathematical operations, but it makes sense to comment the algebra of how I derived an equation and it’s use in the code. Now, I could refactor that section of code into a function in order to give it a name, but that would make it more difficult to read as the programmer would then have to find the definition of that function somewhere else in the file. It is objectively more spaghetti-like to pull out single-use code into a function rather than just label the block of code with a comment.



  • I’ve been working on developing a CPU architecture based around my own variant of lisp called “dollhouse lisp” the big twist is that DHlisp executes code by reducing a syntax tree, so all code is destroyed once it’s been executed. It’s a very elegant solution, but a very difficult implementation. (Especially when it comes to loops and garbage collection.)


  • FP & OOP both have their use cases. Generally, I think people use OOP for stateful programming, and FP for stateless programming. Of course, OOP is excessive in a lot of cases, and so is FP.

    OOP is more useful as an abstraction than a programming paradigm. Real, human, non-computer programming is object-oriented, and so people find it a natural way of organizing things. It makes more sense to say “for each dog, dog, dog.bark()” instead of “map( bark, dogs)”.

    A good use case for OOP is machine learning. Despite the industry’s best effort to use functional programming for it, Object oriented just makes more sense. You want a set of parameters, unique to each function applied to the input. This allows you to use each function without referencing the parameters every single time. You can write “function(input)” instead of “function(input, parameters)”. Then, if you are using a clever library, it will use pointers to the parameters within the functions to update during the optimization step. It hides how the parameters influence the result, but machine learning is a black box anyway.

    In my limited use of FP, I’ve found it useful for manipulating basic data structures in bulk. If I need to normalize a large number of arrays, it’s easy to go “map(normalize, arrays)” and call it a day. The FP specific functions such as scan and reduce are incredibly useful since OOP typically requires you to set up a loop and manually keep track of the intermediate results. I will admit though, that my only real use of FP is python list comprehension and APL, so take whatever I say about FP with a grain of salt.


  • I think ‘implies’ asks whether it’s possible that A causes B to be true. In other words, it is false if there is evidence that A does not cause B.

    So:

    If A is true and B is false, then the result is false, since A could not cause B to be true.

    If A and B are both true, then the result is true, since A could cause B.

    If A is false and B is true, then the result is true since A could or could not make B true (but another factor could also be making B true)

    If A and B are both false we don’t have any evidence about the relationship between A and B, so the result is true.

    I don’t know for sure, though. I’m not a mathematician.


  • I personally think the change from master & slave was kind of silly, as far as I’m aware, it was a bunch of people with no background in CS who thought the application of the term to something that has neither race nor agency was an insult to black people.

    But I digress. It led to better guidelines in the Linux kernel, which I think are useful. You should tailor the terms you’re using to the specifics of the task. If you have a master process that only has outward interfaces through the slave processes, you could use the term ‘director’ and ‘actor.’ if the master process is managing slave processes which compete over the same resources, you can use the terms ‘arbiter’ and ‘mutex holder.’ If the slaves do some independent processing the master does not need to know the details of, you can use the term ‘controller’ and ‘peripheral.’

    Basically, use a term that is the most descriptive in the context of your program.

    Edit: also, I don’t know why no one mentions this, but you can also use master/servant. Historically, there wasn’t a difference between servant and slave, but in modern days there is, so it’s technically different, technically the same.


  • stingpie@lemmy.worldtoProgrammer Humor@programming.devGot Em!
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    11 months ago

    Unused memory is not useless, it is just unused. If I want to pull up a guide on how to giggle the grables in my favorite game Grable Giggler, I would be very happy if I had unused memory which I can now use for my browser.

    Also, smaller RAM usage generally correlates to smaller file size, which is very useful on computers with limited storage.

    And finally, there’s also low spec gaming and accessibility. Minecraft, at least prior to the microsoft acquisition, was a very low spec game. I wouldn’t say it was optimized, but a game of minecraft took less ram than chrome. There was nearly no computers at the time which couldn’t run minecraft. At the time of minecraft’s early boom, kids were getting low-spec hand-me-downs, and so minecraft was one of the most open-ended games they could play. What I’m trying to say is that minecraft—and Doom for that matter—owe a large part of their success to low memory usage.



  • What’s your preferred default pronoun? As far as I’m aware, there isn’t a universally accepted replacement, since any pronoun comes with drawbacks. ‘he’ & ‘she’ are gendered, ‘it’ typically refers to non-sentient things, and ‘they’ can cause confusion about number. Of course, there’s also neopronouns, but people have come up with a billion, and there’s no consensus or standard, so I can’t confirm the person I’m talking to will understand.


  • I struggle to learn rust because the semantics and syntax are just so awful. I would love to be enthusiastic about rust, since every seems to love it, but I can’t get over that hurdle. Backporting the features into C, or even just making a transpiler from C to rust that uses annotations would be great for me. But the rust community really does not seem interested in making stepping stones from other languages to rust.