All pastes #401128 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-03-19 03:38 UTC
rendered paste body
column(A,B,S,Carry,Left,CarryOut,LeftOut) :-
  (nonvar(A) -> L = Left;delete(Left,A,L)),
  (nonvar(B) -> M = L;delete(L,B,M)),
  Sum is A + B + Carry,
  S2 is Sum mod 10,
  CarryOut is (Sum - S2) / 10,
  (nonvar(S) -> S = S2,LeftOut = M;S = S2,delete(M,S,LeftOut)).