Want more GNU in Linux, so Guix, btw. पूंजीपति will be sent to corrective labour camp.

  • 14 Posts
  • 16 Comments
Joined 8M ago
cake
Cake day: Oct 03, 2023

help-circle
rss
Do (pure) functional system programming language exist?
Sorry if the question is a little vague. Lately, I've been exploring functional languages, and I'm really ill-informed about them. I'm aware that most of these languages use some sort of garbage collection or reference counting, also that they're (slightly) slow, and that there's no other way for them to clear their memory manually apart from having to use inline C/C++. I know that some functional language can convert to C, but I'm not really interested in that. I would like to understand if a system programming language, that is also purely functional, exists? If so, how does memory management work in such circumstances? Can be accommodated in a way such that it helps in the creation of, let's say, the OS kernel, and not the other way round. Can it run without having to use any inline assembly/C/C++ code? If not pure functional languages, then what about impure ones?
fedilink

I’ve been procrastinating every day staring the roof. Neither do I have any project to show to employer, nor did I prepare for any coding round. Haven’t applied anywhere, be it internship or full-time, because I am so exhausted, I don’t feel like doing anything.


What's a good way to configure git with multiple providers using the conditional clause?
I have forge accounts from three respective sites: GitHub, GitLab and Codeberg. In all of these forges, I've opted to use secret e-mail. The reason for this is that when I had my original e-mail, I was spam-bombed job roles by a company from Shanghai within the Linux foundation, called Zilliz. Apparently, they extracted emails from git patches or something, I don't know much about it. I want it to be configured, such that when I clone projects from respective sites, I will use their respective secret emails. However, the issue with this is that it is only configured for SSH, and not HTTPS-based URL - when I forget to fork and clone, and instead directly clone the repo from where it originally was, that is where I start to have problems - I can no longer commit, because I did not associate HTTPS URLs with an e-mail. I could, but the git config becomes really messy. So far, I've come up with a setup that makes use of the if-clause supported by git. But the worst thing about configuring this is that it is so damn painful - I have to setup three different SSH keys, followed by setting up the config, and then also make sure that the keys are working for each sites individually, as well as check that the if-clause is working properly for email. Finally, I also have to create another set of SSH keys for signing commits, and at last, a allowed signer's file so that I can verify my own commits locally, all of this process is so damn frustrating. And again, the same mess on another desktop. Is there an easier way to go about this?
fedilink

Trying to understand how project isolation works in a SAAS platforms.
By project, I am talking about a "virtual" instance. I get to use a computer on their server, but how? Are those virtual machines, or containers? If the former, then why - given how virtual machines have a large overhead? If the latter, then containers have a low degree of isolation compared to VMs, right? I've also heard about K3 and K8 before, but I don't know exactly what they are, and what role they place here. And speaking about either of them - how are they introduced through a backend - by using bindings? Or is there a port-equivalent to pass instructions, similar to how we connect to a database?
fedilink

This is going to take a bit longer to grasp, because I converted the formula from Wikipedia, and I don’t remember doing this in my high school or college before.


Is modern C (C11, C17 and C2x) strongly typed compared to C99?
I saw the video for C23 by ACCU, and I couldn't help but feel that C2x has gotten a bit stricter than what I had learnt. Since this is based on my intuition, and that is not reflective of the reality, I was wondering if modern versions of the language post C99 is a little bit strongly-typed?
fedilink

Opinions on this implementation of perfect square root finder?
This is a small program I've come up with, with the intention of finding the root of a perfect square. I wanted some comments on the performance impact, as well as the use of resources. ::: spoiler **square_root.c** ```c #include "square_root.h" static uint64_t power(uint8_t base, uint8_t exp) { uint64_t result = 1; while (exp--) { result *= base; } return result; } static uint64_t seed(uint64_t radicand) { uint64_t a = radicand; uint64_t n = 0; while (radicand /= 100) { a = radicand; ++n; } return ((a < 10) ? ((0.28 * a) + 0.89) : ((0.089 * a) + 2.8)) * power(10, n); } static uint64_t heron(uint64_t x, uint64_t s) { while (s != power(x, 2)) { x = (x + (s / x)) / 2; } return x; } uint16_t square_root(uint64_t radicand) { return heron(seed(radicand), radicand); } ``` ::: ::: spoiler **square_root.h** ```c #ifndef SQUARE_ROOT_H #define SQUARE_ROOT_H #include <stdbool.h> #include <stdint.h> #include <stddef.h> uint16_t square_root(uint64_t radicand); #endif ``` :::
fedilink

That is not my program actually. Here’s what I’ve come up with:

rna_transcription.c

#include "rna_transcription.h"

static char transcribe_nucleotide(char nucleotide) {
    switch (nucleotide) {
        case 'G':
            return 'C';
        case 'C':
            return 'G';
        case 'T':
            return 'A';
        case 'A':
            return 'U';
        default:
            return nucleotide;
    }
}

char *to_rna(const char *dna) {
    size_t len = strlen(dna);
    char *rna = malloc((len + 1) * sizeof(char));

    for (size_t i = 0; i <= len; ++i) {
        rna[i] = transcribe_nucleotide(dna[i]);
    }

    return rna;
}

rna_transcription.h

#ifndef RNA_TRANSCRIPTION_H
#define RNA_TRANSCRIPTION_H

#include <string.h>
#include <stdlib.h>

char *to_rna(const char *dna);

#endif

I could not find the equivalent of map in standard library, so that is why I was interested in the community solutions.


Is this an efficient version of RNA Transcription in C?
Here's the program: **rna_transcription.c** ```C #include "rna_transcription.h" #include <malloc.h> #include <string.h> static const char lookup[] = { ['A'] = 'U', ['C'] = 'G', ['G'] = 'C', ['T'] = 'A' }; char *to_rna(const char *dna) { if (!dna) return NULL; char *rna = calloc(strlen(dna) + 1, 1), *start_rna = rna; if (rna) { for (; *dna; dna++, rna++) { if (!(*rna = lookup[(int)*dna])) { free(rna); return NULL; } } } return start_rna; } ``` **rna_transcription.h** ```C #ifndef RNA_TRANSCRIPTION_H #define RNA_TRANSCRIPTION_H char *to_rna(const char *dna); #endif ``` I can't help but wonder how much of a waste of space the array would be. Surely, using a map is better, right?
fedilink

At the time of writing this comment, does there exist any programming language ecosystem that does not stick to the “primitive” PDP-11 abstraction/virtual machine/whatever the author is trying to say? I’m just interested to know if such options do exist.


As a C beginner, should I be bothered by not being able to understand this?
Most of the stuff went over my head, Why should I care that C is no longer low-level? What exactly is considered close-to-metal in today's time, apart from binary and assembly?
fedilink

Where does arena allocator fail, when it comes to memory safety?
I've recently come across arena allocator, and I can already see how they are a big improvement to the standard heap allocator present in C. What are the other areas it fails to address, when it comes to memory safety?
fedilink

The project is almost 24 years old, the same age as me. It does not appear to have any sort of license in it’s earlier stage, but later on, they’ve added GPL 2.0 and LGPL 2.1.



I read their webpage, but it is really vague. From a legacy point-of-view, wouldn’t it be better to incrementally add better language features, and if there happens to be a huge, breaking paradigm shift, initiate necessary refactoring of code base?

Basically, what I mean is something like:

C --> Cyclone --> improved dialect v1 --> improved dialect v2 --> Memory-safe unintelligible future dialect


Why did Cyclone fail?
Cyclone was supposed to be a safer dialect of C. Shouldn't it have replaced C by now, while also adding some improvements and reducing the burden of legacy code?
fedilink

Well, the thing is that I have some experience with multiple full stack framework, but I get overwhelmed and leave my projects unfinished.


Looking for a few good project ideas that are ideally good for internship or full-time entry-level jobs for 2024
2022 grad, missed the narrow gap for getting a job, and in this recession, it's been really hard to get one. I'm sick of the tutorial hell. It will also be hard to explain this gap for master's degree, and I also don't want to take a loan for master's, so right now, I want to be able to get a job to fill my resume/CV. I want a few good project ideas, that are ideally between the difficulty of easy to medium for internship or entry-level full-time roles for SWE. I'm interested in embedded or system programming, but I don't know anything about it. I have most experience with fullstack development, however, within which, I am interested in backend dev, but also open to frontend stack. Few of the ideas that I've come across on the internet are being told as very generic or instant-reject, that is why I'm requesting for an updated list that would interest my future employer. Ps. I used to contribute to open-source, but I've stopped this activity temporarily since December 2023. Not that this is relevant, but hey, just want to let people know.
fedilink

There’s a dedicated page for my country, but I’m hearing about this for the first time. I’m not really sure on how to leverage this page to my current requirement.


Perhaps it’s a little different in other countries, but where I’m from, a CS degree is the most expensive of all B.E. or B.Tech degrees (well, engineering and medical degrees are pretty expensive). I have nothing on me, and I don’t want to stress my old parents. It’s not about me knowing CS stuff, truth be told, I didn’t learn shit during those years because I’m a tier-3 college grad.



Where do I look out for an accountability partner or a mentor?
I am trying to complete a few web-based projects as well as a developer portfolio. I am also learning C from scratch. I would appreciate it if I had an opportunity to take part in an open-source project that is based on system programming, or something like that.
fedilink

I’m going to lost my mind with all the libraries they release for the web. And now, there’s another runtime, as if Deno and Bun weren’t enough.


Is this issue persistent in RISC-based processors too, like SPARC, POWER or RISC-V? Or is this a modular component that can go in with any architecture?



What would a worst-case input for quick-union look like?
From Sedgewick's book **Algorithms in C**: >**Property 1.2** > >For M > N, the quick-union algorithm could take more than MN/2 instructions to solve a connectivity problem with M pairs of N objects. I am not really able to follow up this. From what I understand, if M (number of union operations) exceed the count of N objects, it could lead to a performance penalty. What would the inputs look like for the worst-case scenario? From the book, it says that of all the M pairs, the first N-1 pair will be connected in the consecutive pattern 0-1, 1-2, 2-3, and from what I understand, it creates a tall tree. But, is that all? What about the remaining pairs?
fedilink

I don’t know at this point. I’ve been jobless for too long, and at this point, I’m re-learning the stuff they teach in college.


What are the solutions to these questions?
I am trying to re-learn algorithms, since I'm feeling really unconfident about solving interview questions. These are some of the starter questions from the book "Algorithms in C, Part 1-4" by Robert Sedgewick. I am not really confident in any of my answers. 1. Give the output that a connectivity algorithm should produce when given the input 0-2, 1-4, 2-5, 3-6, 0-4, 6-0, and 1-3. **My solution:** |Input|Output|Connection| |-|-|-| |0-2|0-2|-| |1-4|1-4|-| |2-5|2-5|-| |3-6|3-6|-| |0-4|0-4|-| |6-0|6-0|-| |1-3|-|1-4-0-6-3| 2. List all the different ways to connect two different objects for the ex­ample in Figure I.I. ![](https://lemmy.ml/pictrs/image/a6893d99-aa47-45d2-ae42-39f9dfe8174c.png) **My solution:** No idea, honestly. 3. Describe a simple method for counting the number of sets remaining after using the union and find operations to solve the connectivity problem as described in the text. **My solution:** We use a variable "count" that increments for the pair of objects that were not previously connected, using the find function.
fedilink




In case if a function prototype is not used, then what about that scenario? Is the information in the function header used?


***
cross-posted from: https://lemmy.ml/post/6465571 > I'm looking for a good resource to learn back-end development in Go, preferably from a micro-framework. Not just CRUD, but also stuff like caching, security and scalability. Are there any good resources out there?
fedilink