Skip to content

Instantly share code, notes, and snippets.

View nick-chandoke's full-sized avatar

chinarin nick-chandoke

View GitHub Profile
@nick-chandoke
nick-chandoke / refactoring.adoc
Last active May 11, 2026 03:46
Refactoring in K & Factor Examples

examples of refactoring in k/apl & factor

consider the following factor definition:

:: julian-day-number ( $year $month $day -- n )
    14 $month - 12 /i :> $a $year 4800 + $a -
    :> $y $month 12 $a * + 3 - :> $m $day 153 $m * 2 + 5 /i +
    365 $y * + $y 4 /i + $y 100 /i - $y 400 /i + 32045 - ;

factoring and symbolic algebra

factor gets its name from the fact that factor code is easy to factor. factoring is, like in elementary algebra, a compression scheme whereby common information is separated. consider the following:

lyrics from the hit dmx song, party up
y'all gonna make me lose my mind
up in here, up in here
y'all gonna make me act a fool
up in here, up in here