Low-level primitive: For a list of domain variables or domain values, return the domain name and a list of integers or integer variables reflecting the corresponding integer index within the domain order. If the domain name is instantiated at call time, the list elements will be checked to be all from this domain.
An error will be reported if not all list elements come from the same domain. If the list contained domain-less variables, then, as a side effect, these will be given a domain to be compatible with the other list elements.
?- symbols_domain_indices([we], D, Is). D = eclipse:weekday Is = [3] Yes (0.00s cpu) ?- X &:: weekday, symbols_domain_indices([X], D, Is). X = X{[mo, tu, we, th, fr, sa, su]} D = weekday Is = [X_ic{1 .. 7}] Yes (0.00s cpu) ?- X &:: weekday, symbols_domain_indices([X, Y, we], D, Is). X = X{[mo, tu, we, th, fr, sa, su]} Y = Y{[mo, tu, we, th, fr, sa, su]} D = eclipse:weekday Is = [X_ic{1 .. 7}, X_ic{1 .. 7}, 3] Yes (0.00s cpu)