🔍 Spot the difference?

Both define an outer function (plus).

Both return an inner, anonymous function.

Both "close over" the variable in the parent scope.

R uses environments; Perl uses lexicals. Same logic, different syntax. 🤝

#FunctionalProgramming #CodingTips #ComputerScience #RStats #Perl

💡 R and Perl are more alike than you think!Both use lexical scoping to create closures. The inner function "captures" the variable from the outer scope, creating a persistent environment.

#rstats
plus <- function(x) {
function(y) x + y
}
plus_one <- plus(1)
plus_one(10) #11

#perl
sub plus {
my ($x) = @_;
sub {
my ($y) = @_;
$x + $y
}
}
my $plus_one = plus(1);
$plus_one->(10); # 11
#FunctionalProgramming #CodingTips #ComputerScience

💡 R and Perl are more alike than you think!Both use lexical scoping to create closures. The inner function "captures" the variable from the outer scope, creating a persistent environment.

#rstats
plus <- function(x) {
function(y) x + y
}
plus_one <- plus(1)
plus_one(10) #11

#perl
sub plus {
my ($x) = @_;
sub {
my ($y) = @_;
$x + $y
}
}
my $plus_one = plus(1);
$plus_one->(10); # 11
#FunctionalProgramming #CodingTips #ComputerScience

🔍 Spot the difference?

Both define an outer function (plus).

Both return an inner, anonymous function.

Both "close over" the variable in the parent scope.

R uses environments; Perl uses lexicals. Same logic, different syntax. 🤝

#FunctionalProgramming #CodingTips #ComputerScience #RStats #Perl

🔍 Spot the difference? Both define an outer function (plus). Both return an inner, anonymous function. Both "close over" the variable in the parent scope. R uses environments; Perl uses lexicals. Same logic, different syntax. 🤝 #FunctionalProgramming #CodingTips #ComputerScience #RStats #Perl 3/3
#perl sub plus { my ($x) = @_; sub { my ($y) = @_; $x + $y } } my $plus_one = plus(1); $plus_one->(10); # 11 #FunctionalProgramming #CodingTips #ComputerScience #RStats #Perl 2/
Readings shared April 4, 2026

The readings shared in Bluesky on 4 April 2026 are: Why Lean?. ~ Leonardo de Moura. #LeanProver #ITP A formalization of the Gelfond-Schneider theorem. ~ Michail Karatarakis, Freek Wiedijk. #LeanProve

Vestigium
🥴 Who knew that the secret to fixing AI agents was dusting off a 40-year-old programming fad? 🙄 Apparently, immutable magic and functional fairy dust are the keys to agentic bliss, because who needs modern solutions when you have retro frameworks like SUPER and SPIRALS? 🚀
https://cyrusradfar.com/thoughts/functional-programming-is-the-only-way-to-scale-with-ai #AIagents #functionalprogramming #retroframeworks #programmingfad #techinnovation #HackerNews #ngated
AI agents keep failing. The fix is 40 years old. — Cyrus Radfar

AI agents fail in production because of mutable state, hidden dependencies, and side effects the agent can't see. The fix is functional programming. SUPER and SPIRALS are the frameworks I use.

AI agents keep failing. The fix is 40 years old. — Cyrus Radfar

AI agents fail in production because of mutable state, hidden dependencies, and side effects the agent can't see. The fix is functional programming. SUPER and SPIRALS are the frameworks I use.