Re: NthPermutation: how to change output format?
- To: mathgroup at smc.vnet.net
- Subject: [mg49822] Re: NthPermutation: how to change output format?
- From: pnardon <pnardon at ulb.ac.be>
- Date: Tue, 3 Aug 2004 01:10:53 -0400 (EDT)
- References: <cejsat$cpo$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
BV wrote:
> Result of a calculation {a, b, 2, c, 3, e, d, 1} needs to be printed out
> immediately as ab2c3ed1 (without commas and parentheses)
>
> How is this done?
>
>
> For example, when this is typed:
>
> << DiscreteMath`Combinatorica`
> NthPermutation[500, {a, b, c, d, e, 1, 2, 3}]
>
> result is:
> {a, b, 2, c, 3, e, d, 1}
>
> How do I get directly:
>
> ab2c3ed1
>
> without commas and parentheses?
>
Try this:
res={a, b, 2, c, 3, e, d, 1}
StringJoin[Map[ToString[#]&,res]]
you can even trnasform it in a "variable" with the
ToExpression[StringJoin[Map[ToString[#]&,res]]]
I hope this will help
--
Pasquale Nardone
UniversitÂ? Libre de Bruxelles
Physique GÂ?nÂ?rale CP 231,
Sciences-Physique-AgrÂ?gation
Bld du Triomphe, 2
1050 Bruxelles, Belgium
tel: +32.2.6505515
tel secr: +32.2.6505618
fax: +32.2.6505332
web: http://homepages.ulb.ac.be/~pnardon/
ou encore http://physinfo.ulb.ac.be/