Your shortcode name ('$name' ) is invalid. If you want to use the variable, it should be add_shorcode( $name, ...
. Also, the function name is invalid. Since you want to make it "dynamic" (I'm assuming you want it to be {$name}_sc, then maybe you should use an anonymous function.
What you have is somewhat unconventional (IMO), so I don't know if this will work, but try this:
$shortcodes = array("foo", "bar");
foreach ($shortcodes as $name) {
add_shortcode( $name, function ( $atts ) use ( $name ) {
remove_filter( 'the_content', 'wpautop' );
$content = apply_filters( 'the_content', '<div class=con>[block slug=' . $name . ']</div>' );
add_filter( 'the_content', 'wpautop' );
return $content;
});
}