Re: How can I concatenate elements
- To: mathgroup at smc.vnet.net
- Subject: [mg119872] Re: How can I concatenate elements
- From: Armand Tamzarian <mike.honeychurch at gmail.com>
- Date: Mon, 27 Jun 2011 07:31:28 -0400 (EDT)
- References: <iu4a05$jpm$1@smc.vnet.net>
On Jun 25, 7:32 pm, "Leandro Tenfen" <leandroten... at hotmail.com>
wrote:
> Hi,
>
> I have two lists:
>
> s1={1,2,3,4,5,6};
> s2={c,k};
>
> How can I concatenate elements of lists as follows:
>
> s3={1c,2c,3c,4c,5c,6c,1k,2k,3k,4k,5k,6k}
>
> Many Thanks!
It depends on the form of your elements. For example:
Distribute[f[s1, s2], List] /. f -> Times
for if you have or want strings then:
g[x_, y_] := ToString[x] <> ToString[y]
Distribute[f[s1, s2], List] /. f -> g
Maybe a more detailed example/description would help.
Mike