The triangle inequality applies.
In order for ACD to be a triangle, the length of AC must lie between CD-DA=0 and CD+DA=8.
In order for ABD to be a triangle, the length of AC must lie between BC-AB=3 and BC+AB=9.
The values common to both these restrictions are numbers between 3 and 8. Assuming we don't want the diagonal to be coincident with any sides, its integer length will be one of ...
{4, 5, 6, 7}
Basically, it is not a function because 1 domain (in this case, 5) can not be connected to two different ranges(1 and -2). Each domain must only connect to one range.