Experimental browser for the Atmosphere
I've found the perfect way to make #rstats programmers scream in existential terror. Behold zero-indexed R! Redefining reality with <15 lines of code is so hot right now. Now watch as I calmly refer to v[0] while maintaining direct eye contact. #cursedcode
Mar 11, 2025, 11:41 PM
{ "uri": "at://did:plc:fgeozid7uyx2lfz3yo7zvm3b/app.bsky.feed.post/3lk5akri4tc2e", "cid": "bafyreibye46e4g2z2hkpdahlv2kzwjhn6rus3zujpmeniin4u5toqsgjpy", "value": { "text": "I've found the perfect way to make #rstats programmers scream in existential terror. Behold zero-indexed R!\n\nRedefining reality with <15 lines of code is so hot right now.\n\nNow watch as I calmly refer to v[0] while maintaining direct eye contact.\n\n#cursedcode", "$type": "app.bsky.feed.post", "embed": { "$type": "app.bsky.embed.recordWithMedia", "media": { "$type": "app.bsky.embed.images", "images": [ { "alt": "A screenshot containing the following code and output from redefining subset operations to be able to start at 0 instead of 1.\n\n# Subset ----\n# Save original subset operators\noriginal_bracket <- `[`\noriginal_double_bracket <- `[[`\n\n# Create zero-based versions of subset operators\n`[` <- function(x, i, ...) {\n if (is.numeric(i) && length(i) > 0 && !all(is.na(i))) {\n i <- i + 1\n }\n original_bracket(x, i, ...)\n}\n\n`[[` <- function(x, i, ...) {\n if (is.numeric(i) && !all(is.na(i))) {\n i <- i + 1\n }\n original_double_bracket(x, i, ...)\n}\n\n# Demo ----\nv <- c(\"a\", \"b\", \"c\")\nv[0]\n#> [1] \"a\"\n\nmy_name_is <- function(name) {\n paste(\"My name is\", name[0])\n}\n\nmy_name_is(c(\"coatless\", \"r\", \"james\"))\n#> [1] \"coatless\"", "image": { "$type": "blob", "ref": { "$link": "bafkreibbm7mv4knbwqjbl4dhad7zcm6hzrvn3gqnbb44v33erf45b5vt5u" }, "mimeType": "image/jpeg", "size": 552399 }, "aspectRatio": { "width": 1262, "height": 1526 } } ] }, "record": { "$type": "app.bsky.embed.record", "record": { "cid": "bafyreicp6anqb6aonnqes5xauqcwbzpp4beolro4iz5iqawj2qcrspl2jy", "uri": "at://did:plc:gwkilic3yqjxybhkupcu5rjv/app.bsky.feed.post/3ljzotlapzc2r" } } }, "langs": [ "en" ], "facets": [ { "index": { "byteEnd": 42, "byteStart": 35 }, "features": [ { "tag": "rstats", "$type": "app.bsky.richtext.facet#tag" } ] }, { "index": { "byteEnd": 259, "byteStart": 248 }, "features": [ { "tag": "cursedcode", "$type": "app.bsky.richtext.facet#tag" } ] } ], "createdAt": "2025-03-11T23:41:41.508Z" } }