atax1a

plural atomic queer, OG demon core

  • they/them^xe/xer

we make bad posts // discord: atax1a


posts from @atax1a tagged #factor

also:

joeatwork
@joeatwork

In computing, the suit of disks is the suit of the physical reality of computers, computers as metals and devices and clever wiring schemes, apart from their mathematical ideals. The tenth card in a suit represents the wasted ending of the suit as a process - the suit has travelled through its stages and is now a leftover, divorced from its original purpose, a husk or shell. In computing, we can observe the 10 of disks as a crash, a graceless ending to a process.

A crash (also called panic in some places) is actually an intentional function. Presented with hostile circumstances, rather than allow the system roll off into the unknown, we instead do our best to emit whatever information we can quickly put together to provide to detectives post-mortem, and then stop completely. Crashes are bad, but they’re the least-bad things we can think of happening given the circumstances surrounding them. A crash is the fuse burning out before the house catches fire. A crash is a cry for help from the system to the larger system surrounding it; come, human, change the fuse (and look at the source of the power surge); come, operating system, release our resources and take a snapshot of what we looked like before we went down.

When drawing this card, we’re invited to think about what happens when our assumptions fail, and what the response of the larger world is to the halting of our bit of it. What will we need to know to debug what has happened? What safety net can we rely on? Which bits of grace are optional and which are required?

Edit: @tambalaya, creator of the card in today's photo, is actually on Cohost.


atax1a
@atax1a

it allocates two bits to a suit, 1 bit to a face/pip flag, and 3 bits to a face or pipcount, and bitwise hashes it out using the following Factor code:

USING: formatting io kernel math math.bitwise
math.parser random sequences syntax.terse ;

IN: tarot
: face ( n -- s )
    { "fool" "input" "error" "output"
      "test" "failure" "(untitled)" "user" }
    nth ;
: suit ( n -- s )
    4 `>>
    { "network" "storage" "computation" "cache" } nth ;
: decode-card ( n -- n ? )
    [ 3 on-bits mask ] [ 3 bit? ] bi ;
: card ( -- )
    6 random-bits
    [ >bin 6 CHAR: 0 pad-head ]
    [ decode-card
      [ face ]
      [ number>string ] if ]
    [ suit ] tri
    "%s %s of %s\n" printf ;
: deal ( -- ) 6 [ card ] times ;

after a USE: tarot:

IN: scratchpad deal
000111 7 of network
001110 (untitled) of network
010110 6 of storage
001111 user of network
001100 test of network
110011 3 of cache


atax1a
@atax1a

#rustlang is a programming language from the early 2010s that uses techniques from programming language theory that were discovered sometime after 1970

this upsets nerds who think the only way to write a performant operating system is to write it in C, a literally conservative language from 1970 with very little compiler-time protection against memory corruption or type-check mismatches, because it means that they have to learn about something new, that prevents them from doing stupid things, because they think they just want to be able to do whatever they want without any safeguards or even a warning

rust stops an entire massive class of memory-corruption bugs by design, so of course fragile cis men who think they need control over every single thing hate it

like, we have beef with the rust programming language community at large, but the language itself is an untrammeled good and the more it replaces C, the better.




JoshJers
@JoshJers

The question here is "what's your favorite non-C-like flow control statement/construct that you've seen in a programming language" but I'm gonna start with a little preamble.


I'm very familiar with C-style flow control:

if (condition)
  { thing; }
else 
  { otherThing; }


// And, thanks to C++17:
if (auto v= initializer(); condition) 
  { thing(v); }
else 
  { otherThing(v); }
for (int i = 0; i < 5; i++)
  { thing(); }
for (var e : elements)
  { thing(e); }
while (condition)
  { thing(); }

(plus, ya know, do/while and goto)

I've seen a few others, like Rust's loop (basically a while(true)):

loop
{ 
  thing(); 
  if (something) 
    { break; }
}

and Swift's ranges, which are nice:

for i in 0..<4
  { thing(i); }

What I'm wondering is: what are your favorite bits of flow control logic (loops, jumps, conditionals, etc) that don't show up in C or C++? Are there loop forms that you think are truly elegant? Is there a switch-like construct that doesn't suck like C's switch statement does?



NireBryce
@NireBryce

choosing the chaotic option and offering up for-else

for num in range(10):
  print(x)
else:
  print("I only go off if loop completed with no break statement")

millenomi
@millenomi

I love Swift's guard:

guard let index,
      index >= 0 else {
    throw Issues.noIndexProvided
}

If you don't use Swift, the else block must exit the current scope (with a return, throw, break or continue), so subsequent statements will always see any variables captured/deconstructured by the guard. In that way, you can signal an early break or return very prominently without silly stuff like 'no early returns, so enjoy your pyramid of if indents'.


atax1a
@atax1a

Factor has probabilistic combinators ifp, whenp, unlessp, and casep that take a probability for each function or case.

The following [form] will output 1 with 0.2 probability, 2 with 0.3 probability and 3 with 0.5 probability

USING: combinators.random prettyprint ;
{
    { 0.2 [ 1 ] }
    { 0.3 [ 2 ] }
    { 0.5 [ 3 ] }
} casep .