Skip to content

Instantly share code, notes, and snippets.

@lwhjp
lwhjp / day09-1.js
Created December 15, 2023 10:41
AoC 2023 day 09 (part 1) in Javascript
var a=(...x)=>e(x[1])?eval("a("+b(x,...x)):x[0],b=(_,...x)=>e(x[1]
)?x[1]+`- ${x[0]},`+b(...x): `)+`+x[0],c=x=>"eval('"+"^+a(/\n)/ ,"
.split(/\//).reduce((x,y)=>x.replaceAll(RegExp(y[0],"mg"),y.slice(
1)),x.trim()+")')"),d=x=> eval(c(f.readFileSync(x).toString())),e=
x=>x!=undefined,f=require('node:fs');console.log(d("input09.txt"))
@lwhjp
lwhjp / factorial.rkt
Created October 19, 2014 08:18
Factorials in Racket
#lang racket
;;
;; These are some examples of different ways to compute factorials
;; using various paradigms and features provided by Racket. There
;; are more options available in packages which are not imported
;; by default, but that rabbit hole goes very deep indeed.
;;
;; Comments and suggestions welcome!
;; leo@lwh.jp