Post History
Scala, 90 89 88 bytes Saved 2 bytes thanks to Shaggy n=>1 to n map{x=>val s=if(x<2)"╔╦╗"else if(x<n)"╠╬╣"else"╚╩╝";s(0)+(""+s(1))*(n-3)+s(2)} Try it in Scastie! I feel like there'...
Answer
#4: Post edited
- # Scala, <s>90 89</s> 88 bytes
Saved 2 byte thanks to Shaggy- ```scala
- n=>1 to n map{x=>val s=if(x<2)"╔╦╗"else if(x<n)"╠╬╣"else"╚╩╝";s(0)+(""+s(1))*(n-3)+s(2)}
- ```
- [Try it in Scastie!](https://scastie.scala-lang.org/FoJw50KbQpm7MXkGnGeauw)
- I feel like there's a nicer way to repeat middle elements of a list n times, but this is all I can golf it for now.
- ```scala
- n => //The input
- 1 to n //Make a range [1..n]
- map{x=> //For each x in that range, make a line:
- val s= //s is a string in the form "$left$inner$right"
- if(x<2)"╔╦╗" //For the top
- else if(x<n)"╠╬╣" //For the inner parts
- else"╚╩╝"; //For the bottom
- s(0)+(""+s(1))*(n-3)+s(2)} //Repeat the inner part n-3 times
- ```
- # Scala, <s>90 89</s> 88 bytes
- Saved 2 bytes thanks to Shaggy
- ```scala
- n=>1 to n map{x=>val s=if(x<2)"╔╦╗"else if(x<n)"╠╬╣"else"╚╩╝";s(0)+(""+s(1))*(n-3)+s(2)}
- ```
- [Try it in Scastie!](https://scastie.scala-lang.org/FoJw50KbQpm7MXkGnGeauw)
- I feel like there's a nicer way to repeat middle elements of a list n times, but this is all I can golf it for now.
- ```scala
- n => //The input
- 1 to n //Make a range [1..n]
- map{x=> //For each x in that range, make a line:
- val s= //s is a string in the form "$left$inner$right"
- if(x<2)"╔╦╗" //For the top
- else if(x<n)"╠╬╣" //For the inner parts
- else"╚╩╝"; //For the bottom
- s(0)+(""+s(1))*(n-3)+s(2)} //Repeat the inner part n-3 times
- ```
#3: Post edited
# Scala, <s>90</s> 89 bytesSaved 1 byte thanks to Shaggy- ```scala
n=>1 to n map{x=>val s=if(x<2)"╔╦╗"else if(x==n)"╚╩╝"else"╠╬╣";s(0)+(""+s(1))*(n-3)+s(2)}- ```
[Try it in Scastie!](https://scastie.scala-lang.org/Y4kI63eCS8ev2atIcmZkww)- I feel like there's a nicer way to repeat middle elements of a list n times, but this is all I can golf it for now.
- ```scala
- n => //The input
- 1 to n //Make a range [1..n]
- map{x=> //For each x in that range, make a line:
- val s= //s is a string in the form "$left$inner$right"
- if(x<2)"╔╦╗" //For the top
else if(x==n)"╚╩╝" //For the bottomelse"╠╬╣"; //For the inner parts- s(0)+(""+s(1))*(n-3)+s(2)} //Repeat the inner part n-3 times
- ```
- # Scala, <s>90 89</s> 88 bytes
- Saved 2 byte thanks to Shaggy
- ```scala
- n=>1 to n map{x=>val s=if(x<2)"╔╦╗"else if(x<n)"╠╬╣"else"╚╩╝";s(0)+(""+s(1))*(n-3)+s(2)}
- ```
- [Try it in Scastie!](https://scastie.scala-lang.org/FoJw50KbQpm7MXkGnGeauw)
- I feel like there's a nicer way to repeat middle elements of a list n times, but this is all I can golf it for now.
- ```scala
- n => //The input
- 1 to n //Make a range [1..n]
- map{x=> //For each x in that range, make a line:
- val s= //s is a string in the form "$left$inner$right"
- if(x<2)"╔╦╗" //For the top
- else if(x<n)"╠╬╣" //For the inner parts
- else"╚╩╝"; //For the bottom
- s(0)+(""+s(1))*(n-3)+s(2)} //Repeat the inner part n-3 times
- ```
#2: Post edited
# Scala, 90 bytes- ```scala
n=>1 to n map{x=>val s=if(x<2)"╔╦╗"else if(x==n)"╚╩╝"else "╠╬╣";s(0)+(""+s(1))*(n-3)+s(2)}- ```
[Try it in Scastie!](https://scastie.scala-lang.org/5CIZZy8hQverVAEawS0l5g)I feel like there's a nicer way to repeat middle elements of a list n times, but this is all I can golf it for now.
- # Scala, <s>90</s> 89 bytes
- Saved 1 byte thanks to Shaggy
- ```scala
- n=>1 to n map{x=>val s=if(x<2)"╔╦╗"else if(x==n)"╚╩╝"else"╠╬╣";s(0)+(""+s(1))*(n-3)+s(2)}
- ```
- [Try it in Scastie!](https://scastie.scala-lang.org/Y4kI63eCS8ev2atIcmZkww)
- I feel like there's a nicer way to repeat middle elements of a list n times, but this is all I can golf it for now.
- ```scala
- n => //The input
- 1 to n //Make a range [1..n]
- map{x=> //For each x in that range, make a line:
- val s= //s is a string in the form "$left$inner$right"
- if(x<2)"╔╦╗" //For the top
- else if(x==n)"╚╩╝" //For the bottom
- else"╠╬╣"; //For the inner parts
- s(0)+(""+s(1))*(n-3)+s(2)} //Repeat the inner part n-3 times
- ```
#1: Initial revision
# Scala, 90 bytes ```scala n=>1 to n map{x=>val s=if(x<2)"╔╦╗"else if(x==n)"╚╩╝"else "╠╬╣";s(0)+(""+s(1))*(n-3)+s(2)} ``` [Try it in Scastie!](https://scastie.scala-lang.org/5CIZZy8hQverVAEawS0l5g) I feel like there's a nicer way to repeat middle elements of a list n times, but this is all I can golf it for now.