{ Let fold. fold Let reduce. reduce Let for_each. for_each Let for_each_numbered. for_each_numbered Let map list transform. (fold list [] Func elem list. (transform elem::list)) Let filter list pred. (fold list [] Func elem list. If (pred elem) (elem::list) list) Let length list. (reduce list 0 Func count _. (count + 1)) Let reverse. reverse Let reverse_append. reverse_append Let append. append Let concat lists. (reduce lists [] append) Let fetch list n. If (n < 0) `nothing Begin (searching list n) Define searching list n. Match list | `cons.{item list} If (n = 0) `just.item Goto (searching list (n + -1)) | `nil `nothing ; Let zip a b. Begin (zipping a b []) Define zipping a b z. Match a | `cons.{ai a} Match b | `cons.{bi b} Goto (zipping a b ({ai bi}::z)) | `nil (reverse z) ; | `nil (reverse z) ; Let last items. (reduce items `nothing Func _ item. `just.item) } Where Let append left right. (reverse_append (reverse left) right) Where Let reverse list. (reverse_append list []) Where Let reverse_append queue tail. (reduce queue tail Func list elem. (elem::list)) Where Let fold list nil cons. Begin (folding list) Define folding list. Match list | `nil nil | `cons.{elem list'} (cons elem (folding list')) ; Let reduce list zero plus. Begin (reducing list zero) Define reducing list sum. Match list | `nil sum | `cons.{elem list'} Goto (reducing list' (plus sum elem)) ; Let for_each list command. Begin (executing list) Define executing list. Match list | `nil {} | `cons.{elem list'} Do (command elem) In Goto (executing list') ; Let for_each_numbered list command. Begin (executing 0 list) Define executing i list. Match list | `nil {} | `cons.{elem list'} Do (command i elem) In Goto (executing (i + 1) list') ;