Every line of code I write is a protest against the incumbent best practices.

Over time the local timeline has become more useless to me because I follow most of the active people on this instance.

For a bit I was opening netbeans just so that I could click a green play button to start a php server. I realized today that I can just run the same simple command as netbeans from my project root, and I get the same environment.

Now if I can figure out how to make gradle build and install an android app, I can skip opening android-studio as well.

I used to think I was good at not talking, but then I realized there's little motivation to talk when nobody listens to you, so I'm just doing the easiest thing.

Sigh. Do I *really* have to vertically center this login div? I hate how we try to make rectangular UIs with the browser's scrolling-document oriented model.

All software is garbage.

When writing a parser in a low-level language like C, how does one allocate strings with good performance? I can't find anything online about this problem, but it seems significant to me.

I've settled on allocating a large char array up front, and exposing two functions.

void add_char(builder* b, char c);
char* end_string(builder* b);

`end_string` adds a null character to finish the current string, and returns a pointer to where that string started.

Is this a good approach?

Can you spot the bug? I wrote this code a couple days ago and am only now testing it.

for (size_t i = cs.name_stack.size - 1; i >= 0; i--) {
...
}

I'm not sure how I feel about passing parameters by reference in D and C++. I like it because it abstracts the integer nature of the pointer, so I can guarantee that pointer arithmetic mistakes don't exist. I dislike it because the caller syntax make no distinction between ref and value parameters, so I can't tell if a function will modify a variable.

Related is how D overloads `.` to be used where `.` and `->` are used in C/C++.

By switching from malloc to a pool allocator, I improved my lambda calculus parser from 1.16 seconds for 300k lines of code to 1.25 seconds for 500k. Not too shabby I would say.

Close only counts in horseshoes, hand grenades, and hashing algorithms.

Of course, T* and T** may refer to arrays and 2D arrays, so the meaning is overloaded and must be communicated out-of-band, but that's not really the point here.

My affection for functional programming makes me want to only take values and return values, but I've begun to appreciate data-oriented design through watching guys like Jonathan Blow and Mike Acton. There are two many slow/memory-hungry programs these days.

I haven't written much code which has to manually manage memory. I am doing so now, and I'm struggling to understand when to malloc, when to use the stack, where to allocate, and where to modify/fill memory.

It seems to me that for function parameters:

T = caller allocates, caller fills
T* = caller allocates, callee modifies
T** = callee allocates, callee modifies

The matrix is completed when returning T, which means callee allocates, callee modifies.

Does this pattern make good sense?

To leave #vim with a non-zero exit code use `:cq`.

Useful to abort a #Git commit or a #Bash `fc` command

Go programs might compile fast but Scala programs give you the opportunity to spend time thinking about your life choices and how you ended up writing enterprise software.

#GoLang #Scala

When your only hammer is JavaScript, everyone else's thumb looks like a nail

In my type, I have the constructors

Var ...
Val ...
Lam String Expr
App Expr Expr

For HM , these are not sufficient to handle recursion, so we need Let-polymorphism, for which we have

Let String Expr Expr

Seems to me that the following forms are equivalent:

Let var x e === App (Lam var e) x

In other words, Let is just a special case for immediately applied lambdas, so I can avoid adding it to my type, right?

Hello,

Thank you for your email. Unfortunately I will not be reading it because it uses HTML rather than plain text. Please consider resending this message in plain text format. In the interest of making the web better and safer, I would also suggest making this the default for all of your emails.

If you choose not to comply and are annoyed by this reply to all of your emails, reply with BLOCK ME in the subject line.

Consult useplaintext.email/ for help and the reason to use plain text.

Show more
Functional Café

functional.cafe is an instance for people interested in functional programming and languages.