Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#CJam, (削除) 43 (削除ここまで) 42 bytes

CJam, (削除) 43 (削除ここまで) 42 bytes

#CJam, (削除) 43 (削除ここまで) 42 bytes

CJam, (削除) 43 (削除ここまで) 42 bytes

added 178 characters in body
Source Link
Xwtek
  • 2k
  • 12
  • 28

#CJam, 43(削除) 43 (削除ここまで) 42 bytes

q~:Z;'-'o{[\Z*1$N]}:X;q~:Z;'-'oX['X~['-_'+X\'|XZ*]@*1>1$
q~:Z;'-'o{[\Z*1$N]}:X;X~['-_'+X\'|XZ*]@*1>1$
q~ e# A function. The {} is mandatory \ e# read input
 e#:Z; Capture two arguments
 Z* e# The separator is repeated e# Record the size timesin Z and discard
 1$'-'o{[\Z*1$N]}:X~  e# RepeatCreate the firstinitial argumentline (and final). also creates a shorcut to do this later
 N \  e# AddCapture newlinetwo arguments
 Z*  e# XThe separator is arepeated functionsize totimes
 create line in a ladder
q~:Z;'-'oX['-_'+X\'|XZ*]@*1>1$
q~ 1$  e# readRepeat inputthe first argument
 :Z; N e# Record the size in Z and discard e# Add newline
 '-'oX e# CreateX theis initiala function to create line (andin final)a ladder
 ['-_'+X\'|XZ*] e# Design the repeating part
 @* e# Repeat the pattern n times
 1> e# Discard the initial
 1$ e# Since the final line is same than the initial, we just write it.
 e# Implicit printing

#CJam, 43 bytes

{[\Z*1$N]}:X;q~:Z;'-'oX['-_'+X\'|XZ*]@*1>1$
{[\Z*1$N]}:X; e# A function. The {} is mandatory \ e# Capture two arguments
 Z* e# The separator is repeated size times
 1$ e# Repeat the first argument
 N e# Add newline
 e# X is a function to create line in a ladder
q~:Z;'-'oX['-_'+X\'|XZ*]@*1>1$
q~ e# read input
 :Z; e# Record the size in Z and discard
 '-'oX e# Create the initial line (and final)
 ['-_'+X\'|XZ*] e# Design the repeating part
 @* e# Repeat the pattern n times
 1> e# Discard the initial
 1$ e# Since the final line is same than the initial, we just write it.
 e# Implicit printing

#CJam, (削除) 43 (削除ここまで) 42 bytes

q~:Z;'-'o{[\Z*1$N]}:X~['-_'+X\'|XZ*]@*1>1$
q~:Z;'-'o{[\Z*1$N]}:X~['-_'+X\'|XZ*]@*1>1$
q~ e# read input
 :Z; e# Record the size in Z and discard
 '-'o{[\Z*1$N]}:X~  e# Create the initial line (and final). also creates a shorcut to do this later
  \  e# Capture two arguments
 Z*  e# The separator is repeated size times
 1$  e# Repeat the first argument
 N  e# Add newline
 e# X is a function to create line in a ladder
 ['-_'+X\'|XZ*] e# Design the repeating part
 @* e# Repeat the pattern n times
 1> e# Discard the initial
 1$ e# Since the final line is same than the initial, we just write it.
 e# Implicit printing
edited body
Source Link
a spaghetto
  • 11.3k
  • 3
  • 48
  • 83

#Cjam#CJam, 43 bytes

I'm not sastified by the score. But I'm not Dennis, right?

{[\Z*1$N]}:X;q~:Z;'-'oX['-_'+X\'|XZ*]@*1>1$

Input is 2 space separated items. Length first

2 3
o---o
| |
| |
| |
+---+
| |
| |
| |
o---o

Explanation

{[\Z*1$N]}:X; e# A function. The {} is mandatory 
 \ e# Capture two arguments
 Z* e# The separator is repeated size times
 1$ e# Repeat the first argument
 N e# Add newline
 e# X is a function to create line in a ladder
q~:Z;'-'oX['-_'+X\'|XZ*]@*1>1$
q~ e# read input
 :Z; e# Record the size in Z and discard
 '-'oX e# Create the initial line (and final)
 ['-_'+X\'|XZ*] e# Design the repeating part
 @* e# Repeat the pattern n times
 1> e# Discard the initial
 1$ e# Since the final line is same than the initial, we just write it.
 e# Implicit printing

#Cjam, 43 bytes

I'm not sastified by the score. But I'm not Dennis, right?

{[\Z*1$N]}:X;q~:Z;'-'oX['-_'+X\'|XZ*]@*1>1$

Input is 2 space separated items. Length first

2 3
o---o
| |
| |
| |
+---+
| |
| |
| |
o---o

Explanation

{[\Z*1$N]}:X; e# A function. The {} is mandatory 
 \ e# Capture two arguments
 Z* e# The separator is repeated size times
 1$ e# Repeat the first argument
 N e# Add newline
 e# X is a function to create line in a ladder
q~:Z;'-'oX['-_'+X\'|XZ*]@*1>1$
q~ e# read input
 :Z; e# Record the size in Z and discard
 '-'oX e# Create the initial line (and final)
 ['-_'+X\'|XZ*] e# Design the repeating part
 @* e# Repeat the pattern n times
 1> e# Discard the initial
 1$ e# Since the final line is same than the initial, we just write it.
 e# Implicit printing

#CJam, 43 bytes

I'm not sastified by the score. But I'm not Dennis, right?

{[\Z*1$N]}:X;q~:Z;'-'oX['-_'+X\'|XZ*]@*1>1$

Input is 2 space separated items. Length first

2 3
o---o
| |
| |
| |
+---+
| |
| |
| |
o---o

Explanation

{[\Z*1$N]}:X; e# A function. The {} is mandatory 
 \ e# Capture two arguments
 Z* e# The separator is repeated size times
 1$ e# Repeat the first argument
 N e# Add newline
 e# X is a function to create line in a ladder
q~:Z;'-'oX['-_'+X\'|XZ*]@*1>1$
q~ e# read input
 :Z; e# Record the size in Z and discard
 '-'oX e# Create the initial line (and final)
 ['-_'+X\'|XZ*] e# Design the repeating part
 @* e# Repeat the pattern n times
 1> e# Discard the initial
 1$ e# Since the final line is same than the initial, we just write it.
 e# Implicit printing
Source Link
Xwtek
  • 2k
  • 12
  • 28
Loading

AltStyle によって変換されたページ (->オリジナル) /