Help for this page

Select Code to Download


  1. or download this
    [12,2,2,w,3,3,s,s,s,] maps to [1*12,2*2,1*w,2*3,3*s]
    
  2. or download this
    runcode([],C,N,[N*C]).
    runcode([H | T],H,N,Z) :- N1 is N+1,runcode(T,H,N1,Z).
    runcode([H | T],C,N,[N*C| Z]) :- H\==C,runcode(T,H,1,Z).