$include "defs.icn"
$include "global_vars.icn"
#
# cand_cond(d1, d2)
#
# input: d1,d2 are syntax trees coresponding to some denotation.
#        They should be lists with a single element.
#
# output: the syntax tree corresponding to (d1 cand d2), i.e.
#         corresponding to  IF d1 ==> d2 # ELSE ==> Boolean$false FI.
#

procedure cand_cond(d1, d2)
    local gl, ge1, ge2

    if (d1.is_empty() | d2.is_empty()) then {
	return(mknode(GUARDEDLIST, emptylist()))
    }
    ge1 := mknode([GUARDEDELEMENT, d1.first(), d2.first()])
    ge2 := mknode([GUARDEDELEMENT, mknode([WORDELSE]), sel_false])
    gl := mknode([GUARDEDLIST, mklist([ge1, ge2, -1])])
    return( gl )
end
