by ryandv | 2025-04-06 07:08:58+00:00
ROT13

Gur nafjre vf lrf, ohg jvgu n yvggyr ovg zber ahnapr guna rkcrpgrq. Jr arrq bayl fubj gur gjb shapgbe ynjf, `sznc vq == vq` naq `sznc (s . t) = sznc s . sznc t`. Gubhtu gur dhrfgvba jnf (cerfhznoyl) cbfrq sbe Qngn.Frg (sebz gur pbagnvaref cnpxntr), pbafvqre vafgrnq gur pnfr bs Qngn.UnfuFrg sebz gur habeqrerq-pbagnvaref cnpxntr sbe vgf fvzcyre vzcyrzragngvba bs `Qngn.UnfuFrg.znc` juvpu jvyy nffvfg jvgu gur sbyybjvat qrzbafgengvba [0]:

UnfuFrg.znc vq = sebzYvfg . Yvfg.znc vq . gbYvfg UnfuFrg.znc vq = sebzYvfg . vq . gbYvfg -- fvapr Yvfg vf n shapgbe haqre Yvfg.znc, Yvfg.znc borlf gur svefg shapgbe ynj UnfuFrg.znc vq = sebzYvfg . gbYvfg UnfuFrg.znc vq = vq -- pbzcbfgvba bs vairefrf gbYvfg naq sebzYvfg (zbqhyb beqre...) UnfuFrg.znc s = sebzYvfg . Yvfg.znc s . gbYvfg UnfuFrg.znc s . UnfuFrg.znc t = sebzYvfg . Yvfg.znc s . gbYvfg . sebzYvfg . Yvfg.znc t . gbYvfg UnfuFrg.znc s . UnfuFrg.znc t = sebzYvfg . Yvfg.znc s . vq . Yvfg.znc t . gbYvfg -- pbzcbfgvba bs vairefrf gbYvfg naq sebzYvfg (zbqhyb beqre...) UnfuFrg.znc s . UnfuFrg.znc t = sebzYvfg . Yvfg.znc s . Yvfg.znc t . gbYvfg UnfuFrg.znc s . UnfuFrg.znc t = sebzYvfg . Yvfg.znc (s . t) . gbYvfg -- fvapr Yvfg vf n shapgbe haqre Yvfg.znc, Yvfg.znc borlf gur frpbaq shapgbe ynj UnfuFrg.znc s . UnfuFrg.znc t = UnfuFrg.znc (s . t)

Gurer vf n ovg bs unaqjnivat urer nf, fgevpgyl fcrnxvat, `UnfuFrg.gbYvfg . UnfuFrg.sebzYvfg` qbrf abg arprffnevyl pbzcevfr gur vqragvgl shapgvba - gur yvfg pbhyq va snpg or erghearq va n qvssrerag beqre, fhpu gung, sbe vafgnapr, `(UnfuFrg.gbYvfg . UnfuFrg.sebzYvfg $ [2,1]) == [1,2]` juvpu vf boivbhfyl abg gur bevtvany vachg `[2,1]`; ohg fvapr jr'er cnpxvat rirelguvat vagb na habeqrerq UnfuFrg va gur raq naljnl, V qba'g guvax vg znggref naq jr pna punyx vg hc gb "vzcyrzragngvba qrgnvyf" bs gbYvfg naq sebzYvfg.

Fb jul qbrfa'g Qngn.UnfuFrg vafgnapr gur Shapgbe glcrpynff va Unfxryy? Vs lbh gel vg bhg lbh'yy trg lbhe nafjre:

Ceryhqr> vzcbeg dhnyvsvrq Qngn.UnfuFrg nf UnfuFrg Ceryhqr UnfuFrg> vafgnapr Shapgbe UnfuFrg.UnfuFrg jurer sznc = UnfuFrg.znc <vagrenpgvir>:2:47: reebe: • Ab vafgnapr sbe (unfunoyr-1.3.0.0:Qngn.Unfunoyr.Pynff.Unfunoyr o) Ceryhqr UnfuFrg> :g UnfuFrg.znc UnfuFrg.znc :: (unfunoyr-1.3.0.0:Qngn.Unfunoyr.Pynff.Unfunoyr o, Rd o) => (n -> o) -> UnfuFrg.UnfuFrg n -> UnfuFrg.UnfuFrg o

Fb, juvyr UnfuFrg znl or n "shapgbe" va fcvevg, vg pna'g or gur cnegvphyne pncvgny-S Shapgbe va Unfxryy qhr gb gur grpuavpnyvgl bs gur nqqrq Unfunoyr glcrpynff pbafgenvag.

Jung qbrf guvf zrna sbe Qngn.Frg? UnfuFrg vf shapgvbanyyl gur fnzr nf Qngn.Frg sebz pbagnvaref; gurl obgu fhccyl n "frg" nofgenpg qngn glcr, ohg qvssre va gur qngn fgehpgher hfrq gb vzcyrzrag vg (unfuzncf if. ovanel gerrf), naq lbh raq hc abg orvat n Shapgbe qhr gb na rkgen Beq glcrpynff pbafgenvag vafgrnq bs gur Unfunoyr bar vzcbfrq ol UnfuFrg. Guhf, vs UnfuFrg pna or n "shapgbe", V frr abguvat ceriragvat Frg sebz orvat bar nf jryy nf gurl ner zber be yrff gur fnzr qngn glcr, ybbxvat cnfg gurve vzcyrzragngvba qrgnvyf.

Abgr gung gur pnirng tvira va gur qbphzragngvba:

> Vg'f jbegu abgvat gung gur fvmr bs gur erfhyg znl or fznyyre vs, sbe fbzr (k,l), k /= l && s k == s l

... vf n erq ureevat, nf guvf unf ab ornevat ba gur shapgbe ynjf.

[0] uggcf://unpxntr.unfxryy.bet/cnpxntr/habeqrerq-pbagnvaref-0.2.20/qbpf/fep/Qngn.UnfuFrg.Vagreany.ugzy#znc