swh:1:snp:3af89e0c6f482ba7e9545bf8e295ed747de3e1ee
Raw File
Tip revision: 74aa793fb3f7dd653b5bad8d1ffe800fb481aba0 authored by Dan Malec on 28 January 2023, 17:40:04 UTC
Merge pull request #152 from jrincayc/manual_updates
Tip revision: 74aa793
foreach
;;; -*- logo -*-

.macro foreach [:foreach.inputs] 2
catch "foreach.catchtag ~
      [op foreach.done runresult ~
	    [foreach1 bl :foreach.inputs last :foreach.inputs 1]]
op []
end

to foreach1 :template.lists :foreach.template :template.number
if emptyp first :template.lists [throw "foreach.catchtag]
apply :foreach.template firsts :template.lists
.maybeoutput foreach1 bfs :template.lists :foreach.template :template.number+1
end

to foreach.done :foreach.result
if emptyp :foreach.result [op [stop]]
op (list "output "first (list first :foreach.result))
end

to ?rest [:which 1]
output bf item :which :template.lists
end

bury [foreach foreach1 foreach.done ?rest]
back to top