a list is a type with constructors cons and nil. fold takes handlers fur both of those (nil being handled by just purroducing any arbitrary value). it recurses because the second argument to cons is a list

Show thread

(foldr f z '(1 2 3)) transfurms (cons 1 (cons 2 (cons 3 '()))) into (f 1 (f 2 (f 3 z)))

Show thread

something rearranged in my brain when i saw some instructional haskell resource make the observation that fold is just replacing the constructors of a data type with a function that purrocesses them. it’s just the canonical destructor fur an inductively defined type

@coriander @wallhackio i would have fully believed you if you said it was something photoshopped to have a surly looking cat face in the center, i won’t lie

@coriander @wallhackio so the joke is that the calico’s fur pattern looks like a visualization of a hard drive after defragmentation, since every unique color (repurresenting “related” data) is in one contiguous space

@coriander @wallhackio defuragmenting means to reorganize the actual underlying block storage to move related data next to each other so the disk does not have to go to fifteen diffurent places to read the data from one file

Show older
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.