Guest User

Untitled

a guest
Oct 21st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. [][]
  2. [][]
  3.  
  4. [][]
  5. [][]
  6. [][]
  7.  
  8. Ƨ[]*∙
  9.  
  10. Ƨ[] push "[]"
  11. * multiply horizontally (repeating width times)
  12. ∙ get an array with input (height) items of that
  13. implicitly output the array joined with newlines
  14.  
  15. Grid@Table["[]",{#2},{#}]&
  16.  
  17. v&DiiX"
  18.  
  19. v % Concatenate the (non-existing) stack contents: gives []
  20. &D % String representation: gives '[]'
  21. ii % Take two inputs
  22. X" % Repeat those numbers of times vertically and horizontally. Implicit display
  23.  
  24. VE*`Y
  25.  
  26. VE*`Y
  27. V # Loop
  28. E # <input> number of times
  29. `Y # String representation of empty list (used to be "[]", but insert_name_here pointed out this shorter alternative)
  30. * # repeat string implicit input number of times
  31. # implicit print
  32.  
  33. f(w,h){for(h*=w;h--;)printf(h%w?"[]":"[]n");}
  34.  
  35. f(w,h){for(h*=w;h--;)printf("[]%c",h%w?0:10);}
  36.  
  37. F„[]×,
  38.  
  39. F # height times do
  40. „[] # push "[]"
  41. × # repeat width times
  42. , # print with newline
  43.  
  44. >;;;;;;~++++++++:>~;;;;:>~*(-:~<~+-::>-:::<~<-+++++++++~:::<~+-:::>-::*)-::<-::::>-::(;)::>-::*(-:~<~+-::>-:::<~<-+++++++++~:::<~+-:::>-::*)-:<~<;;;;;-+>-:<-:-(-:::~<-:::(~<#<-;;-#~;)-:<#-::<;>-:-)
  45.  
  46. *(-:~<~+-::>-:::<~<-+++++++++~:::<~+-:::>-::*)-::<-::::>-::(;)::>-::*(-:~<~+-::>-:::<~<-+++++++++~:::<~+-:::>-::*)
  47.  
  48. +++++++++[>++++++++++<-]>+[>+>+<<-]>>++>,>+++++++++[<----->-]<--->>>,>+++++++++[<----->-]<--->++++++++++<[<<<[>+>+<<-]>[<<<.>.>>-]>[<<+>>-]>>.<-]
  49.  
  50. +++++++++[>++++++++++<-]>+ Get the opening square bracket into first position
  51. [>+>+<<-] Get it into the second and third position
  52. >>++ Get the third position to be the closing bracket
  53. >
  54. ,>+++++++++[<----->-]<--- Get first number into fourth cell
  55. >>>
  56. ,>+++++++++[<----->-]<--- Get second number into seventh cell
  57. >++++++++++ get newline into 8th position
  58. <
  59.  
  60. [ Start our height loop
  61. <<<[>+>+<<-] Get the width into the fifth and sixth positions
  62. >[ Start our width loop at the fifth position
  63. <<<.>. Print the second and third positions
  64. >>-] Decrement the fifth position
  65. >
  66. [<<+>>-] copy the sixth position into the fourth position
  67. >>. print newline
  68. <-]
  69.  
  70. '[]'$~],+:@[
  71.  
  72. '[]'$~],+:@[ input: y, x
  73. +:@[ double y
  74. ], pair with x
  75. this gives (x, 2y)
  76. $~ shape the left argument into the right argument's shape
  77. '[]' 2-length character string
  78.  
  79. n,m=input()
  80. exec"print'[]'*n;"*m
  81.  
  82. ẋ⁾[]ẋ$Y
  83.  
  84. ẋ⁾[]ẋ$Y - Main link: number w, number h e.g. 2, 3
  85. ẋ - repeat w h times [2,2,2]
  86. $ - last two links as a monad:
  87. ⁾[] - literal ['[',']'], "[]"
  88. ẋ - repeat list (vectorises) ["[][]","[][]","[][]"]
  89. Y - join with newlines "[][]n[][]n[][]"
  90. - if a full program, implicit print
  91.  
  92. .+
  93. $*
  94. 1(?=1*(¶1+))|.
  95. $1
  96. G`1
  97. 1
  98. []
  99.  
  100. ×⁺×[]N¶N
  101.  
  102. Ài[]<esc>ÀÄ
  103.  
  104. Ài[]<esc> " arg1 times insert []
  105. ÀÄ " arg2 times duplicate this line
  106.  
  107. M"[]"َJ,
  108.  
  109. M"[]"َJ,
  110. M //Executes code input1 times
  111. "[]" //Pushes []
  112. َ //Duplicates [] input2 times
  113. J //Joins the stack
  114. , //Prints with a trailing newline
  115.  
  116. param($w,$h),("[]"*$w)*$h
  117.  
  118. "[]"pN× òU*2
  119.  
  120. VÆç"[]
  121.  
  122. VÆ ç"[]
  123. VoX{Uç"[]"} // Ungolfed
  124. // Implicit: U, V = input integers
  125. VoX{ } // Create the range [0...V) and replace each item X with
  126. Uç"[]" // U copies of the string "[]".
  127. -R // Join the result with newlines.
  128. // Implicit: output result of last expression
  129.  
  130. [:|?[:|?@[]`';
  131.  
  132. [:| FOR a = 1 to (read input from cmd line)
  133. ? PRINT a newlne
  134. [:| FOR c = 1 to (read input from cmd line)
  135. ?@[]` PRINT A$ (containing the box)
  136. '; and inject a semicolon in the compiled QBasic code to suppress newlines
  137.  
  138. }A;**"[]
  139.  
  140. F2K*"[]
  141.  
  142. (w,h)=>"".PadLeft(h).Replace(" ","".PadLeft(w).Replace(" ","[]")+'n').Trim();
  143.  
  144. l~"[]"*N+*
  145.  
  146. w=>h=>("[]".repeat(w)+`
  147. `).repeat(h)
  148.  
  149. proc B w h {time {puts [string repe {[]} $w]} $h}
Add Comment
Please, Sign In to add comment