List taxonomies according to whether this post is in another taxonomy in taxonomy archive

Well I got there, my public brain functions for all to see, hopefully someone somewhen will pass this was and find it useful.

The code;

// First get the type
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$type = $term->slug;
// we need to do some comparisons, here's the variable
 $this_instance = "";
// loop through all 'type1' posts 
while ( have_posts() ) : the_post();
 $group_terms = get_terms( 'group' );
 //print_r($group_terms);
 // then loop through all terms for this post
 foreach ($group_terms as $group_term) :
   if (has_term($group_term, 'group')) {
     $first_instance = $group_term->slug;
     // if this is the first do something
     if ($this_instance !== $first_instance) { ?>
       <li><?= $group_term->name; ?></li>
        <? $this_instance = $first_instance;
      }
    }
  endforeach;
endwhile;