https://github.com/jrincayc/ucblogo-code
Raw File
Tip revision: 7d4fd39c6d7afe4b0946839a1342c4ee4ef18d9b authored by Joshua J. Cogliati on 31 July 2020, 22:31:27 UTC
macOS needs to get the CXX and CC from wx to compile correctly.
Tip revision: 7d4fd39
cond
;;; -*- logo -*-

.macro cond :cond.clauses
localmake "cond.result cond.helper :cond.clauses
if equalp first :cond.result "error [(throw "error last :cond.result)]
output last :cond.result
end

to cond.helper :cond.clauses
if emptyp :cond.clauses [output [[] []]]
if emptyp first :cond.clauses [output [error [Empty COND clause]]]
if equalp first first :cond.clauses "else ~
   [output list [] butfirst first :cond.clauses]
ignore error
catch "error [localmake "cond.result run first first :cond.clauses]
localmake "cond.error error
if not emptyp :cond.error [output list "error item 2 :cond.error]
if not memberp :cond.result [true false] ~
   [output list "error fput :cond.result [not TRUE or FALSE]]
if :cond.result [output list [] butfirst first :cond.clauses]
output cond.helper butfirst :cond.clauses
end

bury [cond cond.helper]
back to top