Efficient way to code "(symbol,multiplicity)-counting" - how?
Dylan Thurston
dpt@math.harvard.edu
Fri, 24 May 2002 00:31:17 -0400
--ZGiS0Q5IWpPtfppv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thu, May 23, 2002 at 04:44:25PM +0930, Mark Phillips wrote:
=2E..
> We "count" as follows:
> [] [x] [y] [z] [x,y] [x,z] [y,x] [y,y] [y,z] [z,x] [z,y] [x,y,y] [x,y,z]
> [x,z,y] [y,x,y] [y,x,z] [y,y,x] [y,y,z] [y,z,x] [y,z,y] [z,x,y] [z,y,x]
> [z,y,y] [x,y,y,z] [x,y,z,y] [x,z,y,y] [y,x,y,z] [y,x,z,y] [y,y,x,z]
> [y,y,z,x] [y,z,x,y] [y,z,y,x] [z,x,y,y] [z,y,x,y] [z,y,y,x]
> and then start back at the beginning again (with []).
>=20
> I want to define a function
> next :: [(a,Int)] -> [a] -> [a]
Is there a reason you frame the problem this way? Would it be OK to
give a function
> count :: [(a,Int)] -> [[a]]
which would return, e.g., the list you gave above? That would
probably be more natural to code.
--Dylan Thurston
--ZGiS0Q5IWpPtfppv
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE87cIUVeybfhaa3tcRAj6mAJoDLSH6kgQwzy4iKc+U3u35x394XACePWH2
A8muTDyO/OXow8WS1v49IYk=
=0ToP
-----END PGP SIGNATURE-----
--ZGiS0Q5IWpPtfppv--