Programming Leftovers
-
Little useless-useful R functions – Transforming dataframe to markdown table
Writing markdown documents outside RStudio (using the usual set of packages) has benefits and struggles. Huge struggle is transforming dataframe results into markdown table, using hypens and pipes. Ugghhh…
This useless functions takes R dataframe as input and prints out dataframe wrapped in markdown table.
-
The absurdity of stacks
The argument that the stack should be small often seems to be that, if it’s not, people will write programs which run away. That’s spurious: if such a program is, in fact, iterative, then good compilers will eliminate the tail calls and it will not use stack: a small limit on the stack will not help. If it’s really recursive then why should it run out of storage before its conversion to a program which manages the stack explicitly does? Of course that’s exactly what compilers which do CPS conversion already do: programs written using compilers which do that won’t have these weird stack limits in the first place. But it should not be necessary to rely on a CPS-converting compiler, or to write in continuation-passing style manually to avoid stack usage: it should be used for other reasons, because the stack is not, in fact, expensive.
-
Measuring some tree-traversing functions
In a previous article my friend Zyni wrote some variations on a list-flattening function, some of which were ‘recursive’ and some of which ‘iterative’, managing the stack explicitly. We thought it would be interesting to see what the performance differences were, both for this function and a more useful variant which searches a tree rather than flattening it.
-
Raster. Vector. Generative.
A self-hosted AI image generator takes, very roughly, a few hundred GB of disk space, plus a large amount of RAM, and some fairly hefty compute. But, once that's done, you could "compress" images by specifying an AI engine and weighted prompts like this: [...]
-
Implementing multi-file analysis for linters
Recently I’ve been in a few discussions about adding support for multi-file analysis in several single-file linters. I believe that to be an amazing feature and that it is done quite well in elm-review, so I wanted to write down how it works to help other tools do the same. Hopefully it will be interesting for non-tooling authors as well!