Quantcast
Channel: Active questions tagged string-manipulation - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 189

Decomposing input to two list

$
0
0

Suppose I have $j[1,a1,a2,a3,a4,a5]$, I want to extract this as $\{1,\{a1,a2,a3,a4,a5\}\}$.

--My first trial:

Using the command Split, I can make

 Split[List @@ j[1, a1, a2, a3, a4, a5]] {{1}, {a1}, {a2}, {a3}, {a4}, {a5}}

Which is not desired form.

-- Second trial

Let

 aa= List @@ j[1, a1, a2, a3, a4, a5]  bb= List @@ j[1, a1, a2, a3, a4, a5] // Delete[1] List[aa[[1]],bb]

It seems to work but is there any more simplified version?


Viewing all articles
Browse latest Browse all 189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>