4
$\begingroup$

Obviously I am missing something obvious.

I have:

lis = {"a"}|{"b"}|{"c"}

but I want:

lis2 = "a"|"b"|"c"

Thanks as always for suggestions...

$\endgroup$

2 Answers 2

6
$\begingroup$

Use lis[[All, 1]] or First /@ list. See Part and First.

$\endgroup$
6
$\begingroup$

You can also Apply (@@@) Sequence at level 1:

Sequence @@@ lis

"a" | "b" | "c"

Also

## & @@@ lis

"a" | "b" | "c"

Alternatively, use ReplaceAll to replace List with Sequence:

lis /. List -> Sequence

"a" | "b" | "c"

Additional methods:

MapAt[Sequence &, lis, {All, 0}]
ReplacePart[lis, {_, 0} :> Sequence]
lis[[All, 0]] = Sequence; lis

all give "a" | "b" | "c".

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.