[12,2,2,w,3,3,s,s,s,] maps to [1*12,2*2,1*w,2*3,3*s]
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).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: PPGA - Prolog-Perl Golf Association: Run-length encoding
by scain (Curate) on Jul 02, 2001 at 19:10 UTC | |
Re: PPGA - Prolog-Perl Golf Association: Run-length encoding
by japhy (Canon) on Jul 02, 2001 at 20:32 UTC | |
Re: PPGA - Prolog-Perl Golf Association: Run-length encoding
by clemburg (Curate) on Jul 02, 2001 at 20:30 UTC | |
Re: PPGA - Prolog-Perl Golf Association: Run-length encoding
by chipmunk (Parson) on Jul 02, 2001 at 20:55 UTC | |
by mikeB (Friar) on Jul 02, 2001 at 21:14 UTC | |
Re: PPGA - Prolog-Perl Golf Association: Run-length encoding
by tye (Sage) on Jul 02, 2001 at 22:46 UTC | |
Re: PPGA - Prolog-Perl Golf Association: Run-length encoding
by MeowChow (Vicar) on Jul 02, 2001 at 22:06 UTC | |
Re: PPGA - Prolog-Perl Golf Association: Run-length encoding (take 2)
by MeowChow (Vicar) on Jul 04, 2001 at 10:55 UTC |