2
$\begingroup$

I have the following list, I want to remove all commas and just be left with the elements of the set.

Tuples[{I, l}, 16]

{{I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I}, {I, I, I, I, I, I, 
      I, I, I, I, I, I, I, I, I, l}, {I, I, I, I, I, I, I, I, I, I, I, I, 
      I, I, l, I}, {I, I, I, I, I, I, I, I, I, I, I, I, I, I, l, l}, ....}

So what I want is something like:

{{IIIIIIIIIIIIIIII}, {IIIIIIIIIIIIIIIl}, {IIIIIIIIIIIIIIlI}, {IIIIIIIIIIIIIIll}, ....}

This above question was answered, however now I want to find a particular item in the above set, how must I proceed?

for example say I wanted to find the permutation

{IIIIIIIlIIlllIlI}

how must I proceed?

$\endgroup$
3
$\begingroup$
lst =  (Symbol@*StringJoin /@ Tuples[{"I", "l"}, 16]);
Position[lst, IIIIIIIlIIlllIlI][[1, 1]]

315

lst[[315]]

IIIIIIIlIIlllIlI

highlighted = MapAt[Style[#, Red, Bold] &, lst, {pos}];
highlighted[[300 ;; 360]]

enter image description here

Alterantively,

highlighted = st /. IIIIIIIlIIlllIlI -> Style[IIIIIIIlIIlllIlI, Bold, Red]
| improve this answer | |
$\endgroup$
  • $\begingroup$ This is good but is there a way to pinpoint the desired element in the whole list? I mean, trying to locate position 315 out of 65000+ elements is quite difficult! $\endgroup$ – Maths Jan 29 '19 at 16:51
  • $\begingroup$ @A.E., can elaborate on "pinpoint" (and what "finding" {IIIIIIIlIIlllIlI} means)? $\endgroup$ – kglr Jan 29 '19 at 16:54
  • $\begingroup$ so suppose we have {{IIIIIIIIIIIIIIII}, {IIIIIIIIIIIIIIIl}, {IIIIIIIlIIlllIlI} ,{IIIIIIIIIIIIIIlI}, {IIIIIIIIIIIIIIll}, ....} and I want to locate {IIIIIIIlIIlllIlI}. Now I want mathematica to show me where this element lies in the list $\endgroup$ – Maths Jan 29 '19 at 16:56
  • $\begingroup$ @AE,you mean you want to display 65000+ elements of lstwith {IIIIIIIlIIlllIlI} marked/highlighted? $\endgroup$ – kglr Jan 29 '19 at 16:59
  • $\begingroup$ yes this is what I'm looking for :) $\endgroup$ – Maths Jan 29 '19 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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