Skip to main content
deleted 9 characters in body
Source Link
Olivier Grégoire
  • 14.4k
  • 3
  • 32
  • 56

Java (JDK 10), 301251 bytes

a->b->{String s[]="(,[,),],],[,[,],,=,,=".split("(a,"b),u="%s%sq]a,%s%sb[q{a<x<b} = ";for(intq{a<x&&x<b} i=0;i<4; q"+-~a+".."+~-b+"\n[a,b)q[a,b[q{vara<=x<b} t="q{%s<%sx<%s%sa<=x&&x<b}%"+(3 qa.."+~-b+"\n(i+1)/2)+"s=a,b]q]a,b]q{a<x<=b} ";Systemq{a<x&&x<=b} q"+-~a+".out.printf(u+u+t+tb\n[a,b]q[a,b]q{a<=x<=b}q{a<=x&&x<=b}qa..b").replace("x""a","x&&x"a+"")+"%s..%s%n",s[i%2],a,b,s[i/2+2],s[i%2+4],a,b,s[i/2+6],a,s[i%2+8],s[i/2+10],b,"",a,s[i%2+8],s[i/2+10],b,""replace("b",a+1-i%2b+"").replace("q",b-1+i++/2" = ");}}

Try it online!Try it online!

Credits

Java (JDK 10), 301 bytes

a->b->{String s[]="(,[,),],],[,[,],,=,,=".split(","),u="%s%s,%s%s = ";for(int i=0;i<4;){var t="{%s<%sx<%s%s}%"+(3-(i+1)/2)+"s= ";System.out.printf(u+u+t+t.replace("x","x&&x")+"%s..%s%n",s[i%2],a,b,s[i/2+2],s[i%2+4],a,b,s[i/2+6],a,s[i%2+8],s[i/2+10],b,"",a,s[i%2+8],s[i/2+10],b,"",a+1-i%2,b-1+i++/2);}}

Try it online!

Java (JDK 10), 251 bytes

a->b->("(a,b)q]a,b[q{a<x<b}  q{a<x&&x<b}  q"+-~a+".."+~-b+"\n[a,b)q[a,b[q{a<=x<b} q{a<=x&&x<b} qa.."+~-b+"\n(a,b]q]a,b]q{a<x<=b} q{a<x&&x<=b} q"+-~a+"..b\n[a,b]q[a,b]q{a<=x<=b}q{a<=x&&x<=b}qa..b").replace("a",a+"").replace("b",b+"").replace("q"," = ")

Try it online!

Credits

deleted 19 characters in body
Source Link
Olivier Grégoire
  • 14.4k
  • 3
  • 32
  • 56

Java (JDK 10), 336301 bytes

a->b->{varString s="s[]="(a,b[,) = ]a,b[ = {a<x<b}   = {a<x&&x<b}   = c..d\n[a],b) = [a],b[ = {a<=x<b}  = {a<=x&&x<b}  [,[,],,= a.,,=".d\nsplit(a",b] = ]a"),b] = {a<x<=b}  = {a<x&&x<=b}  = c..b\n[au="%s%s,b]%s%s = [a,b] =";for(int i=0;i<4;){a<=x<=b} =var t="{a<=x&&x<=b%s<%sx<%s%s} =%"+(3-(i+1)/2)+"s= a";System.out.b";forprintf(var e:javau+u+t+t.utilreplace("x","x&&x")+"%s.Map.of("a"%s%n",""+as[i%2],"b"a,""+bb,"c"s[i/2+2],a+1+""s[i%2+4],"d"a,b,s[i/2+6],a,s[i%2+8],s[i/2+10],b,"",a,s[i%2+8],s[i/2+10],b,"",a+1-1+"").entrySet())s=s.replace(e.getKey()i%2,e.getValue()b-1+i++/2);return s;;}}

Try it online!Try it online!

Java (JDK 10), 336 bytes

a->b->{var s="(a,b) = ]a,b[ = {a<x<b}   = {a<x&&x<b}   = c..d\n[a,b) = [a,b[ = {a<=x<b}  = {a<=x&&x<b}  = a..d\n(a,b] = ]a,b] = {a<x<=b}  = {a<x&&x<=b}  = c..b\n[a,b] = [a,b] = {a<=x<=b} = {a<=x&&x<=b} = a..b";for(var e:java.util.Map.of("a",""+a,"b",""+b,"c",a+1+"","d",b-1+"").entrySet())s=s.replace(e.getKey(),e.getValue());return s;}

Try it online!

Java (JDK 10), 301 bytes

a->b->{String s[]="(,[,),],],[,[,],,=,,=".split(","),u="%s%s,%s%s = ";for(int i=0;i<4;){var t="{%s<%sx<%s%s}%"+(3-(i+1)/2)+"s= ";System.out.printf(u+u+t+t.replace("x","x&&x")+"%s..%s%n",s[i%2],a,b,s[i/2+2],s[i%2+4],a,b,s[i/2+6],a,s[i%2+8],s[i/2+10],b,"",a,s[i%2+8],s[i/2+10],b,"",a+1-i%2,b-1+i++/2);}}

Try it online!

Source Link
Olivier Grégoire
  • 14.4k
  • 3
  • 32
  • 56

Java (JDK 10), 336 bytes

a->b->{var s="(a,b) = ]a,b[ = {a<x<b}   = {a<x&&x<b}   = c..d\n[a,b) = [a,b[ = {a<=x<b}  = {a<=x&&x<b}  = a..d\n(a,b] = ]a,b] = {a<x<=b}  = {a<x&&x<=b}  = c..b\n[a,b] = [a,b] = {a<=x<=b} = {a<=x&&x<=b} = a..b";for(var e:java.util.Map.of("a",""+a,"b",""+b,"c",a+1+"","d",b-1+"").entrySet())s=s.replace(e.getKey(),e.getValue());return s;}

Try it online!