Re: Inserting Blank Lists
- To: mathgroup at smc.vnet.net
- Subject: [mg68288] Re: [mg68231] Inserting Blank Lists
- From: Adriano Pascoletti <pascolet at dimi.uniud.it>
- Date: Mon, 31 Jul 2006 03:45:58 -0400 (EDT)
- References: <200607300847.EAA25113@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bruce,
three possible alternatives to your solution:
L={{"a","b"},{"c","d"},{"e","f"}};
Map[Sequence@@{#,{}}&,L]
{{a,b},{},{c,d},{},{e,f},{}}
Replace[L,{x_ -> Sequence[x,{}]}, {1}]
{{a,b},{},{c,d},{},{e,f},{}}
Join@@Transpose[{#,Table[{},{Length@#}]}]&@L
{{a,b},{},{c,d},{},{e,f},{}}
Adriano Pascoletti
On 30 lug 2006, at 10:47, Bruce Colletti wrote:
> Re Mathematica 5.2.
>
> The code below inserts a null list between L-elements:
>
> L={{"a","b"},{"c","d"},{"e","f"}};
> Most@Flatten[Map[{#,{}}&,L],1]
>
> Out[9]=
> {{a,b},{},{c,d},{},{e,f}}
>
> What is a shorter way to do this? Thankx.
>
> Bruce
>
- References:
- Inserting Blank Lists
- From: Bruce Colletti <vze269bv@verizon.net>
- Inserting Blank Lists