Skip to content

Instantly share code, notes, and snippets.

@maxcai314
maxcai314 / spreadsheet_oop.txt
Last active May 4, 2025 14:42
Object-Oriented Programming in Google Sheets
=LET(
BEGIN_LIB_OOP, "smalltalk-style message handler framework",
message_match, LAMBDA(expected, LAMBDA(actual,
IFERROR((actual = expected), FALSE)
)),
is_nil, LAMBDA(obj, IFERROR(obj("is_nil__"), FALSE)),
as_err_string, LAMBDA(message, fallback_message,
IFERROR(
CONCAT("", message),
@maxcai314
maxcai314 / spreadsheet_lambda_calculus.txt
Last active April 18, 2025 16:21
Pure Lambda Calculus in Google Sheets
=LET(
BEGIN_LIB_BOOL, "standard boolean library",
identity_l, LAMBDA(x, x),
true_l, LAMBDA(a, LAMBDA(b, a)),
false_l, LAMBDA(a, LAMBDA(b, b)),
not_l, LAMBDA(a, a(false_l)(true_l)),
and_l, LAMBDA(a, LAMBDA(b, a(b)(false_l))),
bool_to_literal, LAMBDA(b, b(TRUE)(FALSE)),
literal_to_bool, LAMBDA(a, IF(a, true_l, false_l)),
@maxcai314
maxcai314 / Quine.java
Created September 20, 2023 08:16
java-quine
public class Quine {
public static void main(String[] args) {
// todo: make it print all the other stuff such as the psvm signature, etc.
String s = "String s = %s;System.out.printf(s, (char) 34 + s + (char) 34, ';')%s";System.out.printf(s, (char) 34 + s + (char) 34, ';');
}
}