Pinned Tweet
I'm making an array-oriented language. Here's a short sample that searches for prime numbers:
github.com/JeffIrwin/syntran…
![{ // Search for the first n primes let n = 200; // Pre-allocate an array of n primes let primes = [0: n]; // Start at 2 because 1 is not prime by definition let i = 2; let num_primes = 0; while num_primes < n { let is_composite = false; let j = 0; while j < num_primes and not is_composite { let p = primes[j]; // Is i divisible by p? let divisible = p * (i / p) == i; // mod == 0 is_composite = is_composite or divisible; j = j + 1; } if not is_composite { primes[num_primes] = i; num_primes = num_primes + 1; } i = i + 1; } // Final list of primes primes; // [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, ... ] }](https://pbs.twimg.com/media/FmjoyrDWIAMiffy.jpg?name=small&format=webp)
ALT { // Search for the first n primes let n = 200; // Pre-allocate an array of n primes let primes = [0: n]; // Start at 2 because 1 is not prime by definition let i = 2; let num_primes = 0; while num_primes < n { let is_composite = false; let j = 0; while j < num_primes and not is_composite { let p = primes[j]; // Is i divisible by p? let divisible = p * (i / p) == i; // mod == 0 is_composite = is_composite or divisible; j = j + 1; } if not is_composite { primes[num_primes] = i; num_primes = num_primes + 1; } i = i + 1; } // Final list of primes primes; // [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, ... ] }
BREAKING: Trump publishes a list of bogus voters fabricated by Communist China. None of these people are real
www.jeffirwin.xyz retweeted
NEW: I’ll be speaking at 10pm Eastern tonight to discuss my 1975 elementary school student council loss which still irks me 51 years later.
isn't the whole point of *shared* libraries supposed to be that you *share* copies of it between multiple apps all from the same company using the same version instead of wasting space on duplicates
trying so hard not to look at the hot lady in the grocery store that i'm now in an aisle i've never been in before holding a product i can't identify
for the last ten years i've been enduring an in-house binary package manager at work. all it does is download files, unzip them, and generate some cmake lists. sounds simple right? 30 python spaghetti files. painful to use. slow as hell. and it needs pip just to bootstrap itself
but it's 6 minutes faster in ci/cd. zero security vulnerabilities from random pip dependencies. and i never have to fix it again because python shipped a "minor" update that broke everything
www.jeffirwin.xyz retweeted
Notepad++, the popular text editor used by programmers, was hacked by the Chinese government…
www.jeffirwin.xyz retweeted
This is bad.
Putty level bad.
notepad-plus-plus.org/news/h…
guys, be very careful with granting permissions to claude outside of a sandbox!
it just implemented a 1000 line module system in my programming language and then added new functionality using the module framework without breaking compatibility. i didn't ask for this!
#include("ut.syn");let g=read_char_mat("i.txt");let m=size(g,0);let n=size(g,1);let i=[0'i64;m,n];for y in[1:n]for x in[0:m]{let z=y-1;if"S"==g[x,z]i[x,z]=1;if i[x,z]>0and"^"!=g[x,z]i[x,y]=i[x,z];for w in[x-1,x+1]if w>=0and w<m if"^"==g[w,y]i[x,y]+=i[w,z];}println(sum(i[:,n-1]));
if you're looking through a text file and trying to find numbers with at least 3 or 4 digits, it's a good opportunity for regex! #regex #programming #coding












