home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!menudo.uh.edu!sugar!claird
- From: claird@NeoSoft.com (Cameron Laird)
- Subject: In search of good idioms.
- Organization: NeoSoft Communications Services -- (713) 684-5900
- Date: Wed, 16 Dec 1992 14:24:52 GMT
- Message-ID: <BzCw1H.H24@NeoSoft.com>
- Lines: 45
-
- I'm a newbie perl-plucker. I'm working through some
- exercises I've set myself, in an effort to develop
- some taste in matters of perl style. Current problem:
- write a permute program. Such a program would, for
- example, when presented with input
-
- permute a1 zebra third
-
- generate output something like
-
- a1 zebra third
- a1 third zebra
- zebra a1 third
- zebra third a1
- third a1 zebra
- third zebra a1
-
- I don't like any of the solutions I've conceived, and
- seek the judgment of those with more experience. My
- current summary of the situation goes something like
- this:
-
- The natural expressions of this problem involve an
- abstract data type, "collection of (sub)permutations",
- or its proceduralization by way of a parametrized re-
- cursion. Procedure calls with more than one formal
- parameter look gross in perl (don't they? Is there a
- way to handle them without clutter?), and there is no
- intrinsic support for data abstraction. Therefore,
- all perl solutions of this problem look clunky.
-
- Is this true? Is there some slick way to use associative
- arrays to solve this? Have I inadvertently hit on a
- well-known demo that's available on some ftp site I
- haven't yet visited? I suspect that working through this
- to some conclusion will help me better understand the
- <<esprit de perl>>; thanks for any assistance.
-
- I'm also having problems with wafe that the FAQ doesn't
- answer, but I'll save that for another time ...
- --
-
- Cameron Laird
- claird@Neosoft.com (claird%Neosoft.com@uunet.uu.net) +1 713 267 7966
- claird@litwin.com (claird%litwin.com@uunet.uu.net) +1 713 996 8546
-