This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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! | |
;; [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")) |