I think I’m happy with my RSS-to-email setup now but I feel like I’m only passively reading things and can do better. I’m going to try summarising (on this micro blog) the interesting posts I see (RSS feeds, newsletters, social feeds, general web finds) as a way to share some links, to be able to find them again later, and to reinforce what I’m learning. This is informal, largely unstructured, largely unedited, and possibly only interesting to me, but if you don’t like it then don’t read it. Feel free to comment (here or elsewhere) and start a conversation on any of the topics (or anything).

I think I’ll aim for a weekly post with all the things I read that week. That way I can add to them as I revisit each day. This post already ended up longer than I expected, but I was able to piece it together over many updates via a web text input box rather than re-building my static website.

This is valid Python syntax


Source: HN toot (now substack subscribed)

I really like this post for the fact that it teaches a pile of interesting (python) syntax and invites the reader to see if they can unpack all the pieces. Fun little puzzles like code-golf are great for this.

One thing that really struck me was python’s ability to use a variable number of arguments in a function

def a_lot(*of_stuff): # accept 0, 1 or more params
...     print(of_stuff)

which we can do in R with ...

a_lot <- function(...) {
a_lot(a = 1, b = 2)
[1] 1

[1] 2

but python can also unpack (“splat”?) the arguments

>>> def square_area(x1, y1, x2, y2):
...     side_length = abs(x2 - x1)
...     area = side_length ** 2
...     return area
... coords = [0, 0, 3, 3]
>>> square_area(coords[0], coords[1], coords[2], coords[3])
>>> square_area(*coords)

which R can’t do (well, do.call(what, args) does that, but not as cleanly).

I bet some interesting results could be made with R syntax - there’s an idea for a post.

Get the most out of Python dicts


Source: Substack subscription

dict is a structure in python that I suppose the R equivalent of is a named vector or a list, but there’s some hashset-like quality to them (the keys are unique) so that’s not exact at all. There’s a lot of semantics specific to dict that I haven’t appreciated yet, so this was a nice little tour.

How to Write Conditional Statements in R: Four Methods


Source: Mastodon boost

This is a post for R beginners, but I’m wary that the ifelse() vector example could be misleading since it will error if the logic is applied back to the if() scenario (length > 1). The post isn’t wrong per-se, but it would be worth pointing out. I’ve also hit bugs in the past because the shape of the condition needs to match the shape of the result

ifelse(TRUE, 1:4, 2)
[1] 1

The author also says

This makes ifelse a clean way of evaluating lots of simple conditions without needing slow, messy loops.

and it should be noted that for-loops aren’t slow; your code is slow https://youtu.be/TdbweYvwnss

Emulated build and test of Bioconductor packages for Linux ARM64


Source: Mastodon follow

along with rocker/rstudio arm64 builds https://hub.docker.com/r/rocker/rstudio/tags

I’ve been waiting for this for a while! I got an M1 mac when I started my current job over a year ago and while I can deploy docker images in a cloud solution, I couldn’t test them locally. Time to build all the things!

Feeling rusty: counting characters


Source: the Julia post below

Just when you think R is sort of okay at performance - not terrible, but by no means the fastest - Rust goes and shows you that you’re wasting your time even trying to keep up and has already gone to lunch after completing all its tasks. This was a great intro to ‘Rust as an RCpp replacement’ via {rextendr} (a fuller intro from the same author is https://youtu.be/tRm-Qq2_Ap0).

String Matching in Julia


Source: RT

This reminds me what I like so much about Julia syntax. Those function definitions are just so clean!

function compare_strings(x::String, y::String)
    s = 0
    for i  eachindex(x)
        x[i] != y[i] ? break : s += 1
    return s

And being able to add more definitions just by writing them out is so compact (a full post on that coming soon).

As for performance, that looks hard to beat. I plan to run the R, Rust, and Julia functions on one machine and see how they compare, but I’m not going to let it get in the way of writing this.

What’s so special about arrays?


Source: r-contributors slack

I commented in the slack thread but my take on this is that matrix is pretty much a vector with a dim attribute, so I’m not so surprised that unclass() doesn’t really “un-class” it. ?class seems to refer to this as an “implicit class”.

Effective Spaced Repetition


Source: originally via https://borretti.me/article/depth-first-procrastination via RSS Feed

This is a longer read, but I’m on board with the principle.

(Research) Sum Types

Trigger: Corecursive podcast

I’m digging through some older episodes for a once-a-week rare commute somewhere and this term caught my ear so I decided to look into it a bit and it turns out to be super interesting! I haven’t dug through all of these, but this serves as a sort of bookmark for me to come back to.

Is That a Compiler Bug?


An older post (circa 2010) that I don’t recall how I came across. Interesting, though not something I’m likely to encounter myself anytime soon.

Writing R in VSCode: Working with multiple R sessions


Source: rOpenSci slack

I’ve been starting to use tmux in terminals lately and am really enjoying it, so when a question came up about connecting a VSCode session to it (which could be remotely connected) my interest was piqued. The linked post might be a solution to that, though I’m yet to try it myself.

List one task, do it, cross it out


Source: can’t recall… HN? This echos a lot of what the ‘minimalist’ folks are saying about organising and cleaning; trying to decide which of the dozen semi-important things you need to work on often leads to doing none of them, but by choosing just one you know exactly what you need to do.

Finish your projects


Source: TLDR newsletter

Similar to the above article in terms of message; pick something and do it.

Iterating on Testing in Rust


Source: HN

Good overview of how tests work in Rust.

Row relational operations with slice()


Source: RWeekly

Winners: slice() as a filter() being able use row indices with cond + 1; outer() to get non-recycling addition. A very in-depth article that goes through lots of uses of slice().

On updating a chat assistant app for the RStudio IDE

Source: RWeekly

The auto-updating streaming output is very cool! I wonder if there’s an open streaming resource I could use to try this?

This also demonstrates adding ‘copy’ button to code blocks which I don’t have on my blog - perhaps I could? They used

$('pre').each(function() {
  const $codeChunk = $(this);
  const $copyButton = $('<button>').text('Copy');

  $copyButton.on('click', function() {
    const codeText = $codeChunk.text();

A terminal case of Linux


Source: ? (Mastodon?)

I don’t recall where or why I found this 2021 article but as usual, Amos goes reeeeally deep into some Rust code (and libc / Linux in this case). I got hooked on these posts when (re-)doing AoC 2022 and for day 1 Amos went mile-deep (25mins read) on Rust in general when the problem to be solved was “straightforward”.

Friction, Baby


Source: HN

This makes a lot of sense to me and made me consider a lot of the patterns (anti-, dark-, or otherwise) I see in my media consumption. The goal of this micro blog is to have as little friction as possible when publishing some markdown text. Sometimes, some interactions could use a bit more friction.