OK, I got it to work. I'll post the solution because I know some of you,
frustrated that the typing doesn't work, can learn from this.


The idea, specific to my typing, is as follows:
-Each function (If, And, Or) has its own type (*-sort-of and nil for
terminals) that is returned in the nc.
-For every function a special set typing is added that basically state what
kind of arguments are allowed. For example an And can accept everything
except an If thus this set type (and-or-nil) has as members: nil,
and-sort-of, or-sort-of. An Or can only accept terminals, no special set
typing is used. The arguments are simply nil.

It's actually very simple. Maybe more documentation could be added because
figuring this out is not easy and took me a few days.

# Atomic typing
gp.type.a.0.name = if-sort-of
gp.type.a.1.name = nil
gp.type.a.2.name = or-sort-of
gp.type.a.3.name = and-sort-of
gp.type.a.size = 4

# Set Typing
gp.type.s.0.name = if-type
gp.type.s.0.size = 4
gp.type.s.0.member.0 = if-sort-of
gp.type.s.0.member.1 = nil
gp.type.s.0.member.2 = or-sort-of
gp.type.s.0.member.3 = and-sort-of
gp.type.s.1.name = or-nil
gp.type.s.1.size = 2
gp.type.s.1.member.0 = nil
gp.type.s.1.member.1 = or-sort-of
gp.type.s.2.name = and-or-nil
gp.type.s.2.size = 3
gp.type.s.2.member.0 = nil
gp.type.s.2.member.1 = or-sort-of
gp.type.s.2.member.2 = and-sort-of

gp.type.s.size = 3

gp.nc.0 = ec.gp.GPNodeConstraints
gp.nc.0.name = if-constraint
gp.nc.0.returns = if-sort-of
gp.nc.0.size = 3
gp.nc.0.child.0 = and-or-nil
gp.nc.0.child.1 = if-type
gp.nc.0.child.2 = if-type

gp.nc.1 = ec.gp.GPNodeConstraints
gp.nc.1.name = and-constraint
gp.nc.1.returns = and-sort-of
gp.nc.1.size = 2
gp.nc.1.child.0 = and-or-nil
gp.nc.1.child.1 = and-or-nil

gp.nc.2 = ec.gp.GPNodeConstraints
gp.nc.2.name = nc0
gp.nc.2.returns = nil
gp.nc.2.size = 0

gp.nc.3 = ec.gp.GPNodeConstraints
gp.nc.3.name = or-constraint
gp.nc.3.returns = or-sort-of
gp.nc.3.size = 2
gp.nc.3.child.0 = nil
gp.nc.3.child.1 = nil