text:
The House of Santa Claus
The House of Santa Claus
Note: This is the first challenge that I have attempted to set. It has been through the Sandbox however if you find something wrong with it please do not just downvote but leave a comment so that I can improve it.
Background
There is a old childrens puzzle where the challenge is to draw a box with a roof and a cross through the middle without lifting your pen from the paper or going over any line twice.
In Germany it is known as "das Haus des Nikolaus" or "The House of Santa Claus". I honestly can't remember what we used to call it. For anyone who is not familiar with the puzzle, full details are available here.
Here is an ASCII art representation of the house.
 /\
/__\
|\/|
|/\|
----

Challenge
Write a program or function to draw the House of Santa Claus in any language of your choice.
Sounds too easy? Well here's the catch. It must also output each stage of the drawing and comply with the rules of the puzzle. Your program is not required to take any input. The finished house must look exactly as shown above.
According to the site above there are 44 possible solutions. You may use any one of them. This is an ASCII art challenge so you are not required to calculate the solution but only to draw it.
Output
An example of the required output from one of the 44 solutions is shown below:
----

 \
  \
----

 __
 \
  \
----

  \
 __\
 \
  \
----

 /\
/__\
 \
  \
----

 /\
/__\
|\
| \
----

 /\
/__\
|\/
|/\
----

 /\
/__\
|\/|
|/\|
----

Rules

I have added 1 extra newline between each expected output to try to make the requirements clearer. This is optional. Any number of blank lines between each output is allowed.
Your output must consist only of the characters /,\,-,_, and space as
shown above. Trailing spaces are allowed.
Each line in your drawing must continue from the end of the previous
line and you may not repeat any line.
Standard loopholes prohibited.
You are not required to output the rhyme mentioned in the above link.
This is code golf so the shortest answer in bytes will be the winner.

Result
Some great answers and thanks and respect to all who posted. I did say lowest byte count but I have marked as top answer not just for that but also for the great explanation of the code. Nice one @Dennis.

This could have spent some time in the sandbox. Try adding a parameter for the size of the house - or number of concatenated houses (or both). I find it too easy as it is. You may also want to add the rhyme to your example output - or not mention it at all. I find this gif nice, or this one.

@Titus This has been in the sandbox?

@Titus Thanks for the feedback. My intention was not to create a particularly difficult challenge but to create one which is fairly easily doable and so encourage as many people as possible to propose solutions. I'll take your suggestions on board for my next attempt.

My fault; I was expecting too complex things for ascii art. :) But I still like the gifs.

The gifs are cool and I also like the idea of including the rhyme also in a choice of language :)

Jelly, 40 39 36 bytes
“ḥ%DtƊVḍI’ḃ9W;“|_/-\/\|‘Ė¤y@\FỌ»⁶s4Y

Try it online!
How it works
“ḥ%DtƊVḍI’

is a bijective base-250 literal; each character corresponds to its code point in Jelly's code page. The result is the integer 13192938935880491074.
          ḃ9

converts the generated integer to bijective base 9, yielding the integer array
[9, 6, 7, 9, 6, 2, 2, 7, 1, 5, 3, 8, 1, 3, 5, 8, 4, 4, 4, 4]. The integers correspond to the order of the stroke, with the exception of 9, which indicates a space.
            W

wraps the generated array into a singleton array, which will be required to prepend it to the array we'll generate now.
              “|_/-\/\|‘Ė¤

works as follows. ¤ combines the two links to the left into a niladic chain. The first one, “|_/-\/\|‘ yields the code points of the specified characters, yielding [124, 95, 47, 45, 92, 47, 92, 124]. Then, Ė enumerates the code points, yielding
[[1, 124], [2, 95], [3, 47], [4, 45], [5, 92], [6, 47], [7, 92], [8, 124]]. The pair [n, c] means that the nth stroke will be the ASCII character with code point c.
             ;

concatenates the generated arrays. The result is the array
[[9,6,7,9,6,2,2,7,1,5,3,8,1,3,5,8,4,4,4,4],[1,124],[2,95],[3,47],[4,45],[5,92],[6,47],[7,92],[8,124]].
                          y@\

performs a cumulative (i. e., showing all intermediate steps) reduce, using transliteration (y) with swapped arguments (@). In the first step, e.g., we replace each 1 in the original array with 124, which is the code point of the character |.
                             FỌ

flattens the result and replaces all code points with the corresponding ASCII characters. In all steps, this will generate some unprintable characters with code points 1 to 9.
                               »⁶

takes the character-wise maximum with the space character, replacing all unprintable characters with spaces.
                                 s4Y

splits the generated string into chunks of length four and joins them with a linefeed as separator.

Wow. Simply just wow. +1

But wait, those are bytes?

@LeifWillerts Yes. To avoid unprintable characters, Jelly uses a custom code page that encodes the 256 characters it understands as a single byte each. The bytes link in the header points to it.

Sorry then for not figuring out to click that link :D

It wins as much for the explanation as anything. Respect.

Javascript (ES6), 119 116 96 92 91 bytes

for(i=8;i--;)console.log(`834
3554
2610
2160
7777`.replace(/./g,c=>'|/|/\\_\\- '[c<i?8:c]))

Nice answer. I had a feeling that Javascript would be there or thereabouts :-)

Sorry for the multiple edits. I should not post before the 2nd coffee.

Multiple edits are good. Nice to see the byte count going down.

Is there any point in having two identical copies of the code in your answer?

@Neil - I'll keep only one till I find a good reason to have two of them. ^^

Batch, 356 344 341 337 bytes
@set s=@set "
%s%g=@goto 1
%s%r=
%s%c=
%s%u=|
%s%l=|
%s%f=
@for /l %%i in (1,1,7)do @call:%%i
%s%u=|\/|
%s%l=|/\|
%g%
:7
%s%u=|\/
%s%l=|/\
%g%
:6
%s%f=----
%g%
:5
%s%u=|\
%s%l=| \
%g%
:4
%s%c=/__\
%g%
:3
%s%r= /\
%s%c=/  \
%g%
:2
%s%r= /
%s%c=/
:1
@for %%l in ("%r%" "%c%" "%u%" "%l%" "%f%")do @echo(%%~l

Stupid Batch | quoting rules... if you want a | in a variable, you need to quote it with three ^s, so it's cheaper to use @ instead and substitute it on output, although to achieve this I have to start with the left wall. Line one has a trailing space. echo( is used because the r, c, and f variables could be empty and we don't want ECHO is off. printed.
Edit: Saved 12 bytes by using fallthrough for the last part. Saved 3 bytes by using a for loop to print each part, this means that I now use |s in my variables which makes the code slightly easier to read. Saved 4 bytes by using explicit @ characters instead of @echo off. I think starting with the left wall still requires the fewest bytes.

May not be the shortest but gets an upvote from me for actually managing to do it in Batch  +1

echo: is more standard but echo( looks like you're abusing a language feature, so +1.

@wizzwizz4 echo: fails in some obscure edge cases, but I don't know of any failure cases for echo(.

@wizzwizz4 If you have a file foo.bat in the current directory, echo(\..\foo.bat echos \..\foo.bat but echo:\..\foo.bat executes foo.bat.

@Neil Do you know why that is? It seems like echo:.\foo.bat would have that effect instead. Is it because of a directory stack glitch, where the "UP" from the root directory is the current directory?

@wizzwizz4 It occurs to me that cmd takes : as a legal file name character, and therefore decides that echo:\..\foo.bat is a path, but then removes the "redundant" echo:\..\  and executes foo.bat.

@wizzwizz4 You can add any legal file name characters after the : and you can of course have further path components, so echo:foo\.\..\bar.bat still executes bar.bat.

@Neil Ah. I understand now. It thinks that echo:foo is a folder name, but doesn't check because it's navigating UP immediately. I'll update the Batch documentation.

C, 118 bytes
main(){char *p,n;for(n='B';n++<'J';)for(p="ZFEAFDDEAGCHIAGHCIABBBBAA";*p;p++)putchar(" \n-\\_\\/|/|"[(*p<n)**p&15]);}

Impressive! Nice first answer, and welcome to the site!

To save 3 bytes: char*p (no space) and change 'B' and 'J' to their ASCII codes.

Thanks for the answer. I didn't expect C to even compete.  This is really impressive and well worth a +1

///, 112 bytes
/!/\/\///*/----
 !@/\\\\!$/ @@!^/
*@\/@@
@\/__@@
/*@
 $
*__
$
 $
*$
 __@
$
 $^$
 $^|@
|$^|@\/
|\/@^|@\/|
|\/@|
*

Try it online!

I don't understand a single byte of the 112 but I tried it online and it does exactly what it says on the tin so +1

@ElPedro Try clicking the link on the header, you might understand the concept, but, if not, then just get back to me. I want more and more people to be able to understand a language, and, if you don't, it's a sad fact. I know I can't just make everyone understand /// (some people just want food and water, /// and PPCG are far away from that, although not impossible).

Thanks. There are so many languages to learn! I'll definitely take a look. I'm still golfing in Python and Lotus Formula but getting into it more. More languages is more fun. Thanks again  for your contribution :)

PHP, 98 95 bytes
inspired by Arnauld´s solution
for($i=8;$i--;)for($p=24;$p--;)echo"|/|/\\_\\-
"[($c="977779061290162945539438"[$p])<$i?8:$c];

Note: The first code line has a trailing space.

Nice one @Titus. Trailing spaces are allowed.

@ElPedro: I just know some people who have configured there editors to automatically trim them; that´s why I mentioned it.

PHP with GD, 348 338 bytes (not competing)
not exactly what was being asked for, but ...
function f($v,$w){global$x,$y,$i;imageline($i,$x,$y,$x=$v,$y=$w,1);ob_start();imagepng($i);$s=ob_get_clean();ob_end_clean();echo' ';}$i=imagecreate($w=9,$h=$w+$z=$w/2);imagecolorallocate($i,255,255,255);f(--$w,$y=--$h);f(0,$z);f($w,$z);f($w/2,0);f(0,$z);f(0,$h);f($w,$z);f($w,$h);

save to file, call in a browser
breakdown
function f($v,$w)
{
    global$x,$y,$i;
    imageline($i,$x,$y,$x=$v,$y=$w,1);      // draw line, set end coords as new start coords
    ob_start();imagepng($i);$s=ob_get_clean();ob_end_clean();           // get image output
    echo' ';    // print  tag
}
// calculate dimensions, create image, allocate background color (foreground implicitly black)
$i=imagecreate($w=9,$h=$w+$z=$w/2);imagecolorallocate($i,255,255,255);
// paint lines: implicit `$x=0`
f(--$w,$y=--$h);f(0,$z);f($w,$z);f($w/2,0);f(0,$z);f(0,$h);f($w,$z);f($w,$h);

To draw a larger house, change $w=9 to your desired width.

And I give this one a +1 as well. Even though it does not address the direct challenge it covers your suggested improvements and looks very cool :)


text:
Bake a slice of Pi
Write a program or function that prints or outputs this exact text (consisting of 142 characters):
()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|

Your program must take no input (except in languages where this is impossible, such as sed), and produce the above text (and only the above text) as output. A trailing newline is acceptable.
This is code-golf, so the shortest answer (in bytes) wins.

This seems to be overly complex in the kolmogorov sense. I will be impressed if anyone can compress this

@RohanJhunjhunwala For proof that this can be compressed, Luis Mendo did it.

Lol, I have been proven wrong (and I am glad!) very impressive

You cold have made them take an integer input N to output a slice whose number of () at the top is N. It would be very complex tho.

Just so you know, you need 43 decimal places of π.

So close to the meaning of life....

MATL, 70 68 67 bytes
'()'12:)l10:&<toYP43Y$51hb(!10Xy'\::\'FFhZ++'|'3$Yc'||\'3:(95'Zd'o(

Try it online!
Explanation
What a mess. But hey, there's a convolution!
The explanation will be clearer if you can inspect the stack contents after a given statement. To do it, just insert X#0$% at that point. (This means: X#  show stack contents, 0$ don't implicitly display anything else, % comment out rest of the code). For example, see the stack right after the convolution.
'()'       % Push this string
12:        % Range [1 2 ... 12]
)          % Index into string (modular, 1-based): gives '()()()()()()'
l          % Push 1 (will be used later)
10:        % Range [1 2 ... 10]
&<         % All pairwise "less than" comparisons. Gives matrix with "true"
           % below the main diagonal, and the remining entries equal to "false"
to         % Duplicate. Convert to numbers (true becomes 1, false becomes 0)
YP43Y$     % Compute pi with 43 significant digits (42 decimals). Gives a string
51h        % Append last decimal, '3' (ASCII 51). This is needed to avoid rounding
b          % Bubble up the true-false matrix, to be used as logical index
(          % Fill the chars from the pi string into the 0-1 matrix, at the positions
           % indicated by the true-false matrix. Thus each 1 is replaced by a char
           % from the pi string. Entries that were 0 remain as 0. This is done in
           % columm-major order...
!          % ...so transpose to make it row-major
10Xy       % Identity matrix of size 10
'\::\'     % Push this string...
FFh        % ...and append two zeros
Z+         % 2D convolution keeping size. The identity matrix convolved with the
           % above string gives the diagonal bands with chars '\'  and ':'
+          % Add to the matrix containing the digits of pi. At each entry, only one
           % of the two matrices is nonzero
'|'        % Push this string
3$Yc       % Three-input string concatenation. This prepends the 1 (which was pushed
           % a while ago) and appends '|' to each row of the matrix. This converts
           % the matrix to char. Note that char 1 will be displayed as a space. We
           % used char 1 and not char 0 (which would be displayed as a space too)
           % because function `Yc` (`strcat`) strips  off trailing space from the
           % inputs, counting char 0 as space, but not char 1
'||\'      % Push this string
3:(        % Assign it to the first 3 entries of the matrix (column-major), that is,
           % to the top of the first column
95         % Push ASCII for '_'
'Zd'o      % Push string 'Zd' and convert to numbers: gives [90 100]. These are the
           % (column-major) indices where the '_' char should appear in the last row
(          % Fill those chars
           % Implicitly display. (Chars 0 and 1 are displayed as space)

Luis Mendo, this is impressive. I would upvote twice if I could. I thought this would be an incompressible kolmogorov challenge. Thank you for proving me wrong!

@Rohan Thanks for your kind words!

:D  No problem! :D

+1 for the :) that appears in your code.

What would happen if you calculated the first 47 digits of π instead?

@Neil Thanks! That's what I initially did, but removing the last two digits took more bytes  than adding a final three

@EriktheGolfer But there's also a :(...

@Neil See the bright side of life...

There's also a :/ with a backslash.

Perl, 93 bytes
$_=bpi$=;printf'()'x6x!$`.'
%12s',F.ee x!$\--^substr"\32::\\$&|",-12while/.{$\}/g

Requires the command line option -l71Mbignum=bpi, counted as 14. The \32 should be replaced by a literal character 26.
Sample Usage
$ perl -l71Mbignum=bpi pi-slice.pl
()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|

Perl, 111 bytes
$_=bpi$_*($l=($.=$_)-3);printf'()'x($./2)x!$`."
%$.s",F.ee x!$l--^substr"\32::\\$&|",-$.while/.{$l}/g

Parameterized version. Requires the command line option -nMbignum=bpi, counted as 12.
Sample Usage
$ echo 10 | perl -nMbignum=bpi pi-slice.pl
()()()()()
|\3.14159|
|:\265358|
\::\97932|
 \::\3846|
  \::\264|
   \::\33|
    \::\8|
     \__\|

$ echo 20 | perl -nMbignum=bpi pi-slice.pl
()()()()()()()()()()
|\3.141592653589793|
|:\2384626433832795|
\::\028841971693993|
 \::\75105820974944|
  \::\5923078164062|
   \::\862089986280|
    \::\34825342117|
     \::\0679821480|
      \::\865132823|
       \::\06647093|
        \::\8446095|
         \::\505822|
          \::\31725|
           \::\3594|
            \::\081|
             \::\28|
              \::\4|
               \__\|

JavaScript (ES6), 187 174 bytes
This is 1 byte shorter than just displaying the plain text.

for(y=n=0,s=`()()()()()()
`;y<10;y++,s+=`|
`)for(x=-2;x++<9;)s+=x>y?(Math.PI+'2384626433832795028841971693')[n++]:`\\${y>8?'__':x+1|y>2?'::':'||'}\\`[y-x]||' ';console.log(s)

Isn´t it one byte shorter than console.log("") + 12*11 characters + 18 backslashes + 10 linebreaks?

@Titus - You're right. I forgot to count backslash escaping. Thanks!

Mildly interesting, but 2384626433832795028841971693 happens to be prime.

@ElementW - Funny that you mentioned it, because I did check that too. :)

Would writing the number as hex and converting it to a string save any bytes?

@ElementW What about close numbers? You could multiply or exponentiate to get a close number, then add the difference.

@QPaysTaxes - This number is 91-bit long, which is far beyond JS capacity. It could not be converted from/to hexadecimal in a single pass.

@Arnauld Yeah, I just figured that out. You can't represent numbers larger than 2**53 as a literal.

@Arnauld Ah, I underestimated the size. Thanks for the explanation.

Math.PI+'238462643383'+0x9ee105d433fed is sadly no better than Math.PI+'2384626433832795028841971693', and collapsing more digits in drops precision

///, 129 127 bytes
/-/\\\\//&/--::--//%/  //#/|
%//!/()()/!!!
|-3.1415926|
|:-53589793|
&2384626|
 &433832#&79502# &8841#%&971#% &69#%%&3#%% -__-|

Try it online!

-2 bytes if you do /!/()()/!!! instead of ()()()()()() and replace /#/|\n%%/ with /#/|\n%/ and adjust the rest of the code to make it work with that.

@daHugLenny Oh thanks, I didn't know 4 * 3 was a valid candidate for replacement. For your second suggestion, I think it will be longer.

@daHugLenny ^^ I can confirm that your second suggestion is indeed longer.

It isn't, I got 127 bytes with it.

@DestructibleWatermelon I did it intentionally. There are also other faces: -:, :-, :- and -__-.

Python 2, 131 bytes
print'()'*6+'\n|\\3.1415926|\n|:\\53589793|'
for n in 2384626,433832,79502,8841,971,69,3,'':print'%11s|'%('\%s'*2%('_:'[n<'']*2,n))

Joint effort between Sp3000 and Lynn. Copper saved a byte, too! Ideone link.

That's elegant  +1

You should be able to save 1 byte by removing the brackets in the for loop.

Bash, 153 bytes
cat << _
()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|
_

Considering how many of the other answers fell into the trap of producing code longer than printing the literal pie, I think this is a smart answer indeed. Also, it’s only 153 bytes by my count.

@Lynn However, it is just dumping the example to the output with no attempt of golfing, and so is discouraged. At least the other answers made an effort...

You can remove the spaces before and after the <<. And your bytecount is of 153 bytes.

Isn't echo '()()()()()()...\__\|' 4 bytes shorter?

@Lynn I'm glad I didn't have that problem; Batch requires 100 bytes of overhead to simply print the pie.

@DJMcMayhem I think it's a valid golf, seeing as most answers are longer than this.

Arguably you could call cat your interpreter at this point, and make your source code be literally the output

Batch, 195 bytes
@echo ()()()()()()
@echo ^|\3.1415926^|
@echo ^|:\53589793^|
@set i=\
@for %%d in (2384626 433832 79502 8841 971 69 3)do @call:l %%d
@echo %i%__\^|
@exit/b
:l
@set i= %i%
@echo%i%::\%1^|

Turtlèd, 135 129 bytes
(the interpreter isn't really  slightly buggèd (anymore :]), but it does not affect this program)
By restructuring and rewriting my program, I golfed... six bytes
And now I have to make new explanation...
Still could be shorter probs though

At least the best solution in this lang isn't just writing in the raw data ¯\(ツ)/¯

#3.141592653589793238462643383279502884197169#")()()()()()">10:[)'|l]:[)d'\l]d"(||"2uuu[|;"::"uuu];>"__"[|r'\d]dl[ l[|.+l][\r]ul]

Try it online
Explanation
Honestly, this doesn't describe the actual program very well, but it does give hints about the commands, so you might understand a little better
#3.141592653589793238462643383279502884197169# Some pi. Set the string to thing between #s
                                               the last digit was same as first, and the
                                               string wraps, so digit could be removed
")()()()()()"  Write this string, by writing char 1 to current cell, moving right, char 2...

>              turn right

10             set register to ten

:[)'|l]:       move right by amount in register, while current cell isn't ), write |
               and move left. move right by amount in register

[)d'\l]        while cell is not (, move down, write \, move left

d"(||"         move down and string-write "(||"

2              set register to 2

uuu[|;"::"uuu] Move up three, and while the cell is not |, move down by
               register (2), string-write "::", move up three

               Just remember the turtle is currently pointing right, so up is right.

;>"__"         move down by amount in register, turn right, string-write "__"

[|r'\d]dl      while cell is not |{ move right, write \, move down}, move down, left

COMPLEX THING: NESTED LOOPS
[ l[|.+l][\r]ul]

While the current cell is not space {move left, execute loop:(While cell not |, write current char of string variable (remember that pi?), increment string pointer, move left), execute loop:(while cell not \, move right), move up, left}

Fourier, 196 190 bytes
New feature alert!
Code
|SaCaaSa|f|~Y0~jY(32aj^~j)|w6(40a41ai^~i)10a~N124a~W92a~S3o46a1415926oWaNaWa58a~CSa53589793oWaNaf2384626oWaNa1wf433832oWaNa2wf79502oWaNa3wf8841oWaNa4wf971oWaNa5wf69oWaNa6wf3oWaNa7wSa95aaSaWa

Explanation
This program is my first demonstration of functions in Fourier:
Functions are defined like so:
|code goes here|f

The first pipe starts the function declaration. You then put the code in between the pipes. The last pipe ends the function declaration. Finally, the f is the variable in which the function is stored. This can be any character, as long as it isn't a reserved function.
For example, in my code, one of the function s is:
|SaCaaSa|f

Where the variable S stores the number 92 and C stores the number 58.
When called, the function outputs the following:
\::\

Since it is the most repeated thing in the pie.
Similarly, to golf down the output, I have used a loop:
6(40a41ai^~i)

Which repeats the code 40a41a 6 times. 40a41a on its own outputs:
()

So repeating the code six times outputs:
()()()()()()

Thereby outputting the crust of the pie.
Try it on FourIDE!
Because I haven't implemented functions in the Python interpreter, this program will not work on http://tryitonline.net

Jelly, 83 bytes
surely still quite golfabale
7Ḷ⁶ẋ;€“\::\”“|:\”ṭṙ7
⁾()ẋ6⁷⁾|\8ØPæp”|⁷8RUR€µ“⁾ḅ|Za"~ṅỵþȷ^ṇ⁷Ċ’Dṁ;€”|ż@¢Y⁷ø⁶ẋ7“\__\|”

TryItOnline
How?
7Ḷ⁶ẋ;€“\::\”“|:\”ṭṙ7 - Link 1, left side padding and filling
7Ḷ                   - lowered range of 7 ([0,1,2,3,4,5,6])
      “\::\”         - filling ("\::\")
  ⁶ẋ;€               - space character repeated that many times and concatenate for each
            “|:\”    - top crust edge filling ("|:\")
                 ṭ   - tack (append to the end)
                  ṙ7 - rotate to the left by 7 (move top crust filling to the top)

⁾()ẋ6⁷⁾|\8ØPæp”|⁷8RUR€µ - Main Link (divided into two for formatting)
⁾()ẋ6⁷                  - "()" repeated 6 times and a line feed
      ⁾|\               - "|\"
          ØP            - pi
         8  æp          - round to 8 significant figures (top edge of the glaze)
              ”|⁷       - "|" and a line feed
                 8R     - range of 8 ([1,2,3,4,5,6,7,8])
                   U    - reverse ([8,7,6,5,4,3,2,1])
                    R€  - range for each ([[1,2,..8],[1,2,..7],...,[1,2],[1]])
                      µ - monadic chain separation

“⁾ḅ|Za"~ṅỵþȷ^ṇ⁷Ċ’Dṁ;€”|ż@¢Y⁷ø⁶ẋ7“\__\|” - Main link (continued)
“⁾ḅ|Za"~ṅỵþȷ^ṇ⁷Ċ’                       - base 250 representation of the rest of the digits
                 D                      - decimalise (makes it a list)
                  ṁ                     - mould (into the shape of the array formed above)
                     ”|                 - "|"
                   ;€                   - concatenate for each
                         ¢              - call last link (1) as a nilad
                       ż@               - zip (with reversed operands)
                          Y⁷            - join with line feeds, and another line feed
                            ø           - niladic chain separation
                             ⁶ẋ7        - space character repeated 7 times
                                “\__\|” - "\__\|" the very bottom of the pie wedge

Wow, that's the longest Jelly program I've ever seen :o

@BetaDecay no doubt it can be done in 11 bytes...

Pyth, 89 bytes
J_2K+.n0."09\07´\C2\84J\01£\07Nl:?í"*"()"6Vr9Zp*dJp?!Z\|?qZ9"|:""\::"p\\p:KZ+ZN\|=+ZN=hJ)p*dJ"\__\|"

Try it online!
Replace \xx (hexadecimal) with the corresponding ASCII character if you copy/paste the code from this answer; it contains unprintable characters in the packed string which SE filters out.
Explanation
J_2        Sets J to -2
  .n0      Pi; returns 3.141592653589793
  ."(...)" Packed string; returns "2384626433832795028841971693"
 +         Concatenation; returns "3.1415926535897932384626433832795028841971693"
K          Sets K to that string
*"()"6     Repetition; returns "()()()()()()", which is implicitly printed with a newline
 r9Z       Range; returns [9, 8, 7, 6, 5, 4, 3, 2, 1] (Z is initialized to 0)
V          Loop through r9Z, using N as the loop variable
  *dJ      Repetition; d is initialized to " " (returns an empty string if J <= 0)
 p         Print without a newline
  ?!Z      Ternary; if not Z
   \|      then return "|"
   ?qZ9    else, ternary; if Z == 9
    "|:"   then return "|:"
    "\::"  else, return "\::"
 p         Print without a newline
  \\       One-character string; returns "\"
 p         Print without a newline
  :KZ+ZN   Slice; returns K[Z:Z+N], not including K[Z+N]
 p         Print without a newline
 \|        One-character string; returns "|", which is implicitly printed with a newline.
 =+ZN      Adds N to Z
 =hJ       Increments J by 1
)          Ends loop
 *dJ       Repetition; d is initialized to " "
p          Print without a newline
"\__\|"    Returns "\__\|", which is implicitly printed with a newline

PowerShell, 105 bytes
'()'*6
'|\3.1415926|
|:\53589793|'
2384626,433832,79502,8841,971,69,3|%{" "*$i+++"\::\$_|"}
' '*7+'\__\|'

Try it online!
Not sure how I never answered this challenge ... I upvoted it and several of the other answers. Oh well, better late than never?
This puts six balanced parens as a string on the pipeline, then a literal string (saves two bytes) of the next two rows. Then, we loop through the rest of the numbers, each iteration incrementing the number of prepended spaces ($i) concatenated with \::<number>|. Finally, we create a string of the tip of the pie. Those strings are all left on the pipeline, and an implicit Write-Output sticks a newline between.
This is 39 bytes shorter than just printing the pie.

Python 2, 193 176 bytes
P="3.1415926 53589793 2384626 433832 79502 8841 971 69 3".split()
f="()"*6+"\n|\%s|\n|:\%s|\n"%(P[0],P[1])
for s in range(7):f+=" "*s+"\::\\"+P[s+2]+"|\n"
print f+" "*7+"\__\|"

Or a shorter, more boring answer:
print r"""()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|"""

Are you aware that print r'''(the pie)''' is 38 bytes shorter? :)

+1 for your second effort but using single quotes makes it shorter to look at. Pixel count is better  :)

C# 220 213 209 208 202 201  (171*) Bytes
*I find this to be unoriginal and cheating
void F()=>Console.Write(@"()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|");

201 Bytes:
void f(){var s="()()()()()()\n";for(int i=0;i<9;)s+=(i<1?"|":i<2?"|:":"\\::".PadLeft(i+1))+$"\\{new[]{3.1415926,53589793,2384626,433832,79502,8841,971,69,3}[i++]}|\n";Console.Write(s+@"       \__\|");}

220 bytes:
I'm sure that there is something to be golfed here
void f(){string s="()()()()()()\n",x="       ";for(int i=9,j=0;i>0;j+=i--)s+=(i>7?"|"+(i<9?":":"")+"\\":x.Substring(i)+@"\::\")+$"{Math.PI}32384626433832795028841971693".Substring(j,i)+"|\n";Console.Write(s+x+@"\__\|");}

Thanks for the answer! You can save a least one byte by removing the extra space in .Substring(j, i).

That was an oversight from auto-formatting in VS, but I saved a bunch a different way anyhow =)

An anonymous function returning the pie verbatim is >25% shorter: ()=>@"(pie)" is 149 bytes.

It's also boring and feels like cheating. Rules say to print, not return

@pinkfloydx33 Printing and returning are both allowed by default according to community consensus.

That's what I thought but the wording and the fact a lot of the other answers (that I understand) use some form of print/echo unless it'd simply because they are shorter than return

Ruby, 140 138 137 bytes
My solution to this problem in ruby, this is my first code golf answer :D
[0,2384626,433832,79502,8841,971,69,3,1].map{|n|puts n<1?"()"*6+"\n|\\3.1415926|\n|:\\53589793|":"\\#{n>1?"::\\#{n}":"__\\"}|".rjust(12)}

Readable version and explanation:
for n in [-1,2384626,433832,79502,8841,971,69,3,0]
  if n < 0 # n == -1
    puts "()"*6+"\n|\\3.1415926|\n|:\\53589793|"
  else
    if n > 0 # digits of pi
      puts "\\::\\#{n}|".rjust(12)
    else # edge of pie
      puts "\\__\\|".rjust(12)
    end
  end
end

Nothing really clever, just using some simple loops :)
Output:
()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|

Welcome to PPCG! Nice first post!

Charcoal, 31 bytes
×⁶()↙↓¹⁰↖↖¹⁰↓↓²↘⁸Ｍ↑__↖←¤:↗¤ＵＧPi

Try it online!
You may be wondering: what is this sorcery? How can you fill with ＵＧPi? Well, Charcoal is starting to get Wolfram Language support, in the hope that one day it can be competitive in more challenges!
Previous, 71 bytes
×⁶()↙↓¹⁰↖↖¹⁰↓↓²↘⁸Ｍ↑__↖←¤:↗¤3.141592653589793238462643383279502884197169

Try it online!
Verbose
Print(Multiply(6, "()"));
Move(:DownLeft)
Print(:Down, 10)
Move(:UpLeft)
Print(:UpLeft, 10)
Move(:Down)
Print(:Down, 2)
Print(:DownRight, 8)
Move(:Up)
Print("__")
Move(:UpLeft)
Move(:Left)
Fill(":")
Move(:UpRight)
Fill("3.141592653589793238462643383279502884197169")

Note that this is different as the deverbosifier automatically compresses strings and does not remove redundant commands.
With compressed strings, 52 bytes
×⁶¦()↙↓¹⁰↖↖¹⁰↓↓²↘⁸↑__↖←¤:Ｍ↗¤”i¶∧²uτ¶R›    §Ｑ´⌈#_⮌ＰOÞ”

xxd output
0000000: aab6 ba28 291f 14b1 b01c 1cb1 b014 14b2  ...()...........
0000010: 1eb8 125f 5f1c 11ef 3acd 1def 0469 0a01  ...__...:....i..
0000020: b275 f40a 52be 0999 9fa4 d1e0 1a23 5f86  .u..R........#_.
0000030: d04f de04                                .O..

Try it online!

PHP, 170 bytes
no arbritrary precision Pi in PHP? Calculating takes much more space than Copy&Paste.  Doesn´t matter that the last digit here is cut, not rounded;  but in 64 bit Pi the last digit gets rounded up.
for(;$i<11;)echo str_pad($i?["\\__\\","|\\","|:\\","\\::\\"][$i>9?0:min(3,$i)].[3.1415926,53589793,2384626,433832,79502,8841,971,69,3][$i-1]."|
":"
",13,$i++?" ":"()",0);

Run with php -r '<code>'
uncommented breakdown
for(;$i<11;)
    echo str_pad($i?
         ["\\__\\","|\\","|:\\","\\::\\"][$i>9?0:min(3,$i)]
        .[3.1415926,53589793,2384626,433832,79502,8841,971,69,3][$i-1]
        ."|\n"
    :"\n"
    ,13,$i++?" ":"()",0);

The output is missing 1 space (which you can fix by changing that 13 with a 14). And, for some bizarre reason, You are missing the closing parenthesis at the top. Making the change fixes the output.

PHP answers need a <?php tag, otherwise they just produce constant output. PHP Hello, World! actually depends on this. However, speaking of constant output, a PHP answer that just contains the literal cake and no <?php tag at all would beat yours by a big margin…

@Lynn: PHP does not need the <?php tag when you run it with -r.

Python 2, 183 171 bytes
p,d=[2384626,433832,79502,8841,971,69,3],"|\n"
c=("()"*6)+d[1]+"|\\"+`3.1415926`+d+"|:\\"+`53589793`+d
for x in range(7):c+=" "*x+"\\::\\"+`p[x]`+d
print c+" "*7+"\\__\\|"

Does't really do anything clever. Just builds up a big string then prints it out.
EDIT
Reduced to 171 after reading @Lynn's answer and learning. Sorry if it is wrong to (shamelessly) steal some bytes from you without you suggesting it. Please tell me if so and I will roll back the change.
Output
python pi.pie.py

()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|

Are you aware that print r'''(the pie)''' is 28 bytes shorter? :)

@Lynn Is that not cheating? ;-)

It's not cheating, just not very interesting (and we don't need that answer for every language, IMO.  The bash answer is sufficient).  More like something you'd want to mention when posting an answer like this, to acknowledge that your golfing attempt ended up being a loss.  Maybe still worth posting in case someone else sees a way to take your golfing idea and improve on it, maybe beating the naive approach.

I take your comments on board @Peter. i was not trying to be disrespectful hence the smiley. Anyone can just print out an ASCII art challenge like this. I'm pretty new to this and am here to learn. If it means anything I did put a comment and a +1 on Lynn's answer when I saw that it was not just a print statement but addressed the issue in a way that totally outclassed my effort. I have learned...

As long as your answer still has a different approach, it's fine to get ideas from other answers (in the same language or not).  The only thing that would be not ok is if your answer ended up with exactly the same code as Lynn's.  Usually if you see a small improvement to someone else's answer, you'd suggest that in a comment.  But if you have multiple new ideas after seeing someone else's answer, you can even post your improved version as a new answer.  I'm not totally sure about the etiquette of this, but I think it's fine as long as your answer is significantly different.

My answer is significantly worse than Lynn's so I hope there are no objections :)

Stax, 63 bytes
ü?½Pi<Θ*q}ü¿▒5Ç>cdƒ±<Gw►,─ô╟▒g•iâÑ♠514Φ⌂!Ñεùáèè♂ÑD╔«dÿ47¡ô#UV•╧

Run and debug online!
Shorter than the accepted MATL answer. It would definitely be shorter if more digits were stored as the constant pi in Stax.
(What is that Pi<0 in the code?)
Explanation
Uses the ASCII equivalent to explain, which is
.()6*PVP$2ME.|\a+"|:\"a+"!RNyb2L$-!mV=223w+&O-"!{"\::\"s$+mELr"\__\"]+|>m'|+

Expalantion:
.()6*PVP$2ME.|\a+"|:\"a+
.()                           "()"
   6*P                        Print 6 times
      VP$                     First two lines of pi in the output
         2ME                  Push the two lines separately on the stack
            .|\a+             Prepend the first line with "|\"
                 "|:\"a+      Prepend the second line with "|:\"

"..."!{"\::\"s$+mELr"\__\"]+|>m'|+
"..."!                                [2384626,433832,79502,8841,971,69,3]
      {"\::\"s$+m                     Convert each element to a string and prepend "\::\"
                 ELr                  Prepend the first two lines to array
                    "\__\"]+          Append "\__\" to the converted array
                            |>        Right align text
                              m'|+    Append "|" to each array element and print

Javascript, 172 bytes
Paste into your console to run.
for(y=n=0,s=`()()()()()()
`;y<10;y++,s+=`|
`)for(x=-2;x++<9;)s+=x>y(Math.PI+'2384626433832795028841971693'[n++]:`\\${y>8?'__':x+1|y>1?'::':'||'}\\`[y-x]||' ';console.log(s)

Welcome to PPCG! Just so you know, you can format your code with four spaces (see my edit). Also, put the amount of bytes in your program at the top of your answer (e.g. Javascript: 100 bytes).

Seems to have weird syntax errors, can you fix those?

Java 7, 260 236 191 bytes
String d(){return"()()()()()()\n|\\3.1415926|\n|:\\53589793|\n\\::\\2384626|\n \\::\\433832|\n  \\::\\79502|\n   \\::\\8841|\n    \\::\\971|\n     \\::\\69|\n      \\::\\3|\n       \\__\\|";}

Sigh, simply outputting the pie is shorter, even with all the escaped backslashes.. >.>
Here is previous answer with a tiny bit of afford, although still not very generic or fancy (236 bytes):
String c(){String n="\n",p="|",q=p+n,x="\\::\\",s=" ",z=s;return"()()()()()()"+n+p+"\\"+3.1415926+q+p+":\\53589793"+q+x+2384626+q+s+x+433832+q+(z+=s)+x+79502+q+(z+=s)+x+8841+q+(z+=s)+x+971+q+(z+=s)+x+69+q+(z+=s)+x+3+q+(z+=s)+"\\__\\|";}

A pretty boring answer, since simply outputting the result without too much fancy things is shorter in Java than a generic approach.
Ungolfed & test code:
Try it here.
class M{
  static String c(){
    String n = "\n",
           p = "|",
           q = p + n,
           x = "\\::\\",
           s = " ",
           z = s;
    return "()()()()()()" + n + p + "\\" + 3.1415926 + q + p + ":\\53589793" + q + x + 2384626 + q + s
            + x + 433832 + q + (z += s) + x + 79502 + q + (z += s) + x + 8841 + q
            + (z += s) + x + 971 + q + (z += s) + x + 69 + q + (z += s) + x + 3 + q
            + (z += s) + "\\__\\|";
  }

  public static void main(String[] a){
    System.out.println(c());
  }
}

Output:
()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|

Qbasic, 175 bytes
?"()()()()()()":?"|\3.1415926|":?"|:\53589793|":?"\::\2384626|":?" \::\433832|":?"  \::\79502|":?"   \::\8841|":?"    \::\971|":?"     \::\69|":?"      \::\3|":?"       \__\|"

Lua, 152 Bytes
print[[()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|]]

Try as I might I could not compress this pi.
Lua is just too verbose to do it, maybe a pi of greater size, but not this one.
Another solution, 186 Bytes.
s="()()()()()()\n|\\3.1415926|\n|:\\53589793|\n"i=0 for z in('2384626|433832|79502|8841|971|69|3|'):gmatch'.-|'do s=s..(' '):rep(i)..'\\::\\'..z.."\n"i=i+1 end print(s..'       \\__\\|')

Annoyingly Lua's pi isn't accurate enough to even fill the pi. :(

Deadfish~, 871 bytes
{iiii}cicdcicdcicdcicdcicdcic{ddd}dc{{i}}{i}iiiic{ddd}ddc{dddd}dcdddddciiiciiicdddciiiiciiiic{d}iiiciiiic{{i}ddd}c{{d}}{d}ddddc{{i}}{i}iiiic{dddddd}ddddddc{iii}iiiic{dddd}icddciiciiicicddciicddddddc{{i}ddd}iiic{{d}}{d}ddddc{{i}dd}iic{ddd}ddddcc{iii}iiiic{dddd}ddciciiiiicddddciicddddciiiic{{i}ddd}c{{d}}{d}ddddc{ii}iic{iiiiii}c{ddd}ddddcc{iii}iiiic{dddd}cdcciiiiicdddddcdc{{i}ddd}iiiic{{d}}{d}ddddc{ii}iicc{iiiiii}c{ddd}ddddcc{iii}iiiic{dddd}iiiciicddddcdddddciic{{i}ddd}iiiic{{d}}{d}ddddc{ii}iiccc{iiiiii}c{ddd}ddddcc{iii}iiiic{ddd}ddddddccddddcdddc{{i}ddd}iiiiic{{d}}{d}ddddc{ii}iicccc{iiiiii}c{ddd}ddddcc{iii}iiiic{ddd}dddddcddcddddddc{{i}ddd}iiiiic{{d}}{d}ddddc{ii}iiccccc{iiiiii}c{ddd}ddddcc{iii}iiiic{dddd}iiciiic{{i}ddd}dddc{{d}}{d}ddddc{ii}iicccccc{iiiiii}c{ddd}ddddcc{iii}iiiic{dddd}dc{{i}ddd}iiic{{d}}{d}ddddc{ii}iiccccccc{iiiiii}ciiiccdddc{iii}iic{{d}}{d}ddddc

Try it online!
Just because.

JavaScript (ES6), 170 bytes 165 bytes
is a bit "cheated", since if run on the console, the return value would be displayed
v=0;("()()()()()()\n|9|:87654321".replace(/\d/g,(o)=>"\\"+(Math.PI+'2384626433832795028841971693').substr(v,o,v-=-o)+"|\n"+(o<9?" ".repeat(8-o)+(o>1?"\\::":"\\__\\|"):""))

After some teaking, the function looks like this(function must be called with parameter with the value 0):
v=>`()()()()()()
 |9 |:87654321\\__\\|`.replace(/\d/g,o=>`\\${(Math.PI+"2384626433832795028841971693").substr(v,o,v-=-o)}|
${" ".repeat(9-o)+(o<9&o>1?"\\::":"")}`)

If you want to call the function 167 bytes:

z=v=>`()()()()()()
 |9 |:87654321\\__\\|`.replace(/\d/g,o=>`\\${(Math.PI+"2384626433832795028841971693").substr(v,o,v-=-o)}|
${" ".repeat(9-o)+(o<9&o>1?"\\::":"")}`)

/*could be run like this or directly in the console*/
console.info("\n"+z(0));

1: Needs extra closing paren. 2: replace "|\n" with |<newline> where <newline> is a literal newline. 3: Add y=> to the beginning and it won't be cheating. 4: Welcome to the site!

@programmer5000 thanks for your input, I used it on my latest tweak. :-D

Save 2 bytes by removing the () enclosing the v parameter. Your output seems to have an extra space in front of the 2nd & 3rd lines. Also, you don't need to pass 0 as an argument, your function will work fine without it and it's also not permitted by the challenge.

yes thank you, I had before default value. :-D

This is longer than the string itself.

@emanresuA true that, but was is the fun in writing a string. :)

PHP, 142 bytes
Sneaky-sneaky :) php just prints everything out without trying to interpret them as PHP code if it does not see any <?php ?> pairs.
()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|

Husk, 76 bytes
`:+R' 7"¦__¦|":*"()"6§+(mo:'|t↑2)↓2m↓3z+zR¢" "Nmo`:'|+"¦::¦"Cṫ9Γ·::'.ṁs↑54İπ

Try it online!
There's probably some interesing way to shorten this further.

Vyxal, 64 bytes
‛()6*15∆Iṅ\.1Ṁ½÷$‛|\p$`|:\\`p"43∆I16ȯ7ɾṘẇvṅ‛\:mvp‛\_mJJ\|vJJ12↳⁋

Try it Online!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Expand the variadic expression
One of the cool features introduced in the C++11 standard is the ability to declare a template parameter as being variadic; i.e. that parameter represents a sequence of an arbitrary number of arguments (including zero!).
For example, suppose the parameter pack args expands contains the sequence A0, A1, A2. To expand the pack, an expression is followed using the expansion operator ..., and the expression is repeated for each argument with the parameter pack replaced by each element of the pack.
Some example expansions (assume f and g are not variadic packs):
args... -> A0, A1, A2
f(args)... -> f(A0), f(A1), f(A2)
args(f,g)... -> A0(f,g), A1(f,g), A2(f,g)

If the expansion operator is used on an expression which contains multiple un-expanded parameter packs, the packs are expanded in lock-step. Note that it is required that all parameter packs which participate in a single expansion operator must all have the same length.
For example, consider the packs args0 -> A0, A1, A2 and args1 -> B0, B1, B2. Then the following expressions expand to:
f(args0, args1)... -> f(A0, B0), f(A1, B1), f(A2, B2)
g(args0..., args1)... -> g(A0, A1, A2, B0), g(A0, A1, A2, B1), g(A0, A1, A2, B2)

The goal of this challenge is given an expression and set of parameter packs, produce the expanded equivalent.
Note that there must be at least one un-expanded parameter pack as the argument to the expansion operator. All of the following are syntax errors (assume args0 = A0, A1, A2, args1 = B0, B1):
f(args0, args1)... // packs must have the same length
f(c)... // no un-expanded packs in expansion operator
f(args0...)... // no un-expanded packs in expansion operator

Your program needs not handle any expressions which result in a syntax error.
Input
Your program/function should take as input a dictionary-like object which associates a parameter pack name with it's arguments, and an expression to be expanded (expression syntax explained later). For example, in Python-like syntax the dictionary of packs might look something like this:
{'args0': ['A0', 'A1', 'A2'],
 'args1': [],
 'args2': ['B0', 'A1', 'B2']}

Feel free to adapt the parameter pack input dictionary as desired. For example, it could be a list of strings where each string is a space-separated list and the first value is the pack name:
args0 A0 A1 A2
args1
args2 B0 A1 B2

Expressions to be expanded will contain only valid C++ identifiers (case-sensitive alpha-numerics and underscore), function call operators, parenthesis grouping, commas, and the expansion operator. Any identifiers in the expression which are not in the dictionary of parameter packs are not variadic. You may assume the given expression has a valid expansion.
It is your decision on what restrictions there are on how whitespace is used (for example, every token has a space between it and other tokens, or no whitespace at all).
The input may come from any source desired (stdin, function parameter, etc.)
Output
The output of your program/function is a single string representing the expanded expression. You are allowed to remove/add any whitespace or parenthesis grouping so long as the expression is equivalent. For example, the expression f(a,b,c,d) is equivalent to all of the following:
(f(((a,b,c,d))))
f ( a,  b, c , d )
f((a), (b), (c), (d))

The output can be to any source desired(stdout, function return value, etc.)
Examples
All examples are formatted as such:
The dictionary of packs are expressed as lines of strings in the example format given above (space separated, first value is the pack name), followed by the expression, and the expected result.
case 1:
args0 A0
args2 B0 A0
args1
args0...
A0

case 2:
args0 A0
args2 B0 A0
args1
args1...
// nothing

case 3:
args0 A0
args2 B0 A0
args1
f(args1)...
// nothing

case 4:
args0 A0
args2 B0 A0
args1
f(args1...)
f()

case 5:
args0 A0
args2 B0 A0
args1
f(C0, args0..., args2)...
f(C0, A0, B0), f(C0, A0, A0)

case 6:
args0 A0 A1
args1 B0 B1
args2 C0 C1
f(args0, args1, args2)...
f(A0, B0, C0), f(A1, B1, C1)

case 7:
args0 A0 A1
args0(C0)...
A0(C0), A1(C0)

case 8:
args0 A0 A1
args1 B0 B1
args0(args1(f))...
A0(B0(f)), A1(B1(f))

case 9:
args0 A0 A1
args1 B0 B1
f_(c)
f_(c)

case 10:
args0
args1 A0 A1
f(args0..., args1)...
f(A0), f(A1)

Scoring
This is code-golf; shortest code in bytes wins. Standard loop-holes apply. You may use any built-ins desired.

Do we need to handle the case where an empty parameter pack is part of a larger comma-separated list? Example: with args empty, f(a, args...) -> f(a) or f(args..., b) -> f(b)

@feersum yes, I added case 10 to test something similar to that case

Happy 1000 rep!

Python 3, 567 bytes
lambda v,q:w(g(v,p(q),-1))
def c(s):
	a=[];b=0;l=""
	for x in s:
		if x!=","or b:l+=x;b+=~-")(".find(x)%3-1
		else:a+=[p(l)];l=""
	return a+[p(l)]
p=lambda s:(0,p(s[:-3]))if"..."==s[-3:]else(1,(2,s.split("(")[0]),c(s[s.find("(")+1:-1]))if")"==s[-1]else(2,s)
def g(v,q,i):
	if q[0]>1:return q[1]if q[1]not in v or i<0else v[q[1]][i]
	if q[0]:return(g(v,q[1],i),[g(v,k,i)for k in q[2]])
	a=[];i=0
	while 1:
		try:a+=[g(v,q[1],i)];i+=1
		except:return a
w=lambda k:",".join(q for q in[w(x)for x in k]if q)if type(k)==list else k if type(k)==str else k[0]+"("+w(k[1])+")"

Try it online!
Could use a lot of golfing but I'm pretty happy with this answer. Tested on all 10 example cases.
-9 bytes thanks to Neil

I'm convinced there's some way to golf [-1,1,0]["()".find(x)] but I can't find it :/

@cairdcoinheringaahing I got -2 bytes with -~-~"()".find(x)%3-1 :P

What are the possible values of x and the desired value in each case?

@Neil I want "(" to give -1, ")" to give 1, and anything else to give 0 (it's my bracket balance count for splitting on commas).

In that case, does ~-")(".find(x)%3-1 work?

@Neil Seems that it does. Thanks!

Wolfram Language (Mathematica), 267 246 bytes
Reverse[R=StringReplace@{"("->"[",")"->"]","..."->"!",a:(WordCharacter|"_")..:>"\""<>a<>"\""},3]@ToString[a@ToExpression@R@#2//.a_String@b___:>a~q~b/.p@@@#//.a_?(FreeQ[_!])!:>(a//.s_/;FreeQ[s,p,{3,∞}]:>s~Thread~p/.p->(##&))/.q->Construct]&
a=""

Try it online!
As far as I can tell there's no built-in way to Thread beyond the first level (or Thread heads, for that matter).
a=""                                        (* ensures Reverse[R,3] works properly  *)
R=StringReplace@{                           (* parses input: *)
  "("->"[",")"->"]",                        (*  convert brackets to mathematica-style *)
  "..."->"!",                               (*  `...` is costly to manipulate, so instead use something that isn't. *)
  a:(WordCharacter|"_")..:>"\""<>a<>"\""};  (*  wrap symbols in quotes so they won't evaluate. *)
a@ToExpression@R@#                          (* parse input and wrap it with "" to allow multiple outputs *)
 //.a_String@b___:>a~q~b                    (* convert expressions to a form suitable for calling Thread *)
  /.p@@@#                                   (* substitute packed arguments *)
 //.a_?(FreeQ[_!])!]:>                      (* expand ...s from the bottom up: *)
   (a//.s_/;FreeQ[s,p,{3,∞}]:>s~Thread~p    (*  thread over packed arguments from the bottom up, *)
      /.p->(##&))                           (*  and unpack into sequences. *)
  /.q->Construct                            (* convert back into an expression *)
Reverse[R,3]@ToString[ % ]                  (* convert to c-style output. *)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Print a better layered cake
I was looking at my previous challenge and thought I could make a better version, but I didn't want to modify that one, so here it is!

Challenge
Given an input n,

print an ASCII art cake n layers tall,
viewed from the side,
with two candles on top,
using box drawing characters.
First layer is thinner than the others.
Refer to the examples below.

Example output
>> cake(1)
╭─╨─╨─╮
└─────┘

>> cake(2)
  ╭─╨─╨─╮
╭─┴─────┴─╮
│         │
└─────────┘

>> cake(3)
    ╭─╨─╨─╮
  ╭─┴─────┴─╮
  │         │
╭─┴─────────┴─╮
│             │
└─────────────┘

>> cake(4)
      ╭─╨─╨─╮
    ╭─┴─────┴─╮
    │         │
  ╭─┴─────────┴─╮
  │             │
╭─┴─────────────┴─╮
│                 │
└─────────────────┘

...and so on.
Rules

Standard loopholes prohibited
Please make an attempt at a clever solution
Since multi-byte box drawing characters are used, solution size is measured in characters, not bytes. (Compiled/binary sizes are still measured in bytes, however.)
This is code-golf, so shortest answer in characters wins. However, the answer will not be selected.

Have fun!

I will be happy if someone gives me an answer in silos. This seems doable. https://github.com/rjhunjhunwala/S.I.L.O.S

@RohanJhunjhunwala seems like a nice language, great job!

@DJMcMayhem are you accusing me of ripping off my own challenge?

I'm not accusing you of ripping anything off. I just don't see the point of having two different challenges with an almost identical goal, and since "Answers from one question could be copied over to the other with little or no modification and still be competitive", I voted to closed.

@DmitryKudriavtsev thanks

@DJMcMayhem You now have to properly join the cake layers instead of just printing them out sequentially, then adding a bottom layer. Many strategies used in the original code golf would not work.

Besides being a duplicate, I think this the other version is more interesting. Though this cake is prettier, the bottom being distinct from others and the "┴" characters limits reuse of parts of the string, limiting the optimizations you can make and pushing more towards printing the individual parts.


text:
Minecraft castle fractal
Inpsired by a youtube video from a fellow PPCG user...
You challenge is to use ASCII-art draw a Minecraft castle wall of Andesite and Diorite. The shape of the wall is the Cantor Set. For reference, the Cantor Set is made by repeating the following N times:

Triple the current step
Replace the middle one with blank space
Add a full line below it

This creates the following for the first four steps:
*

* *
***

* *   * *
***   ***
*********

* *   * *         * *   * *
***   ***         ***   ***
*********         *********
***************************

However, your challenge is not quite that simple. You see, after the cantor set gets really big, it becomes boring to look at the same character repeated over and over and over. So we're going to change that by overlaying an alternating series of asterisks * and pound signs #. You should alternate on every three characters horizontally, and on every row vertically. (Of course leaving the spaces the same) For example, the second example will become:
* *
###

and the third example will become:
* *   * *
###   ###
***###***

For completeness, here are examples four and five:
#4
* *   * *         * *   * *
###   ###         ###   ###
***###***         ***###***
###***###***###***###***###

#5
* *   * *         * *   * *                           * *   * *         * *   * *
###   ###         ###   ###                           ###   ###         ###   ###
***###***         ***###***                           ***###***         ***###***
###***###***###***###***###                           ###***###***###***###***###
***###***###***###***###***###***###***###***###***###***###***###***###***###***

And one mega example, the 6th iteration:
* *   * *         * *   * *                           * *   * *         * *   * *                                                                                * *   * *         * *   * *                           * *   * *         * *   * *
###   ###         ###   ###                           ###   ###         ###   ###                                                                                ###   ###         ###   ###                           ###   ###         ###   ###
***###***         ***###***                           ***###***         ***###***                                                                                ***###***         ***###***                           ***###***         ***###***
###***###***###***###***###                           ###***###***###***###***###                                                                                ###***###***###***###***###                           ###***###***###***###***###
***###***###***###***###***###***###***###***###***###***###***###***###***###***                                                                                ***###***###***###***###***###***###***###***###***###***###***###***###***###***
###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###***###

The challenge
You must write a full program or function that accepts a positive integer for input, and outputs the N'th generation of this minecraft castle fractal. You can take Input and output by any reasonable method, and you do not have to worry about invalid inputs (such as numbers less than 1, floating point numbers, non-numbers, etc.).
The shortest answer, measured in bytes wins!

Related

Jelly, 43 36 35 bytes
ḶṚ3*µ5B¤xÐ€ṁ€Ṁ×\Ṛ©1,‘xS$¤ṁ×®ị“*# ”Y

Just a start, I'm sure this could be shorter.
Try it online!
*For n > 5, your browser might wrap the output but if you copy-paste it into a non-wrapping editor, you will see the proper output.
Explanation
ḶṚ3*µ5B¤xÐ€ṁ€Ṁ×\Ṛ©1,‘xS$¤ṁ×®ị“*# ”Y  Input: integer n
Ḷ                                    Create the range [0, n)
 Ṛ                                   Reverse it
  3*                                 Raise 3 to the power of each
    µ                                Begin a new monadic chain on the powers of 3
     5B¤                             Nilad. Get the binary digits of 5 = [1, 0, 1]
        xÐ€                          Duplicate each of [1, 0, 1] to a power of 3 times
             Ṁ                       Get the maximum of the powers of 3
           ṁ€                        Reshape each to a length of that value
              ×\                     Cumulative products
                Ṛ©                   Reverse and save the result
                  1,‘xS$¤            Niladic chain.
                  1                    Start with 1
                    ‘                  Increment it
                   ,                   Pair them to get [1, 2]
                       $               Operate on [1, 2]
                      S                  Sum it to get 3
                     x                   Repeat each 3 times to get [1, 1, 1, 2, 2, 2]
                         ṁ           Reshape that to the saved table
                          ×®         Multiply elementwise with the saved table
                            ị“*# ”   Use each to as an index to select from "*# "
                                  Y  Join using newlines
                                     Return and print implicitly

JavaScript (ES7), 132 125 bytes
n=>[...Array(n)].map((_,i)=>[...Array(3**~-n)].map((_,j)=>/1/.test((j/3**i|0).toString(3))?" ":`*#`[j/3+i&1]).join``).join`\n`

Where \n represents the literal newline characer. ES6 version for 141 bytes:

f=
n=>[...Array(n)].map((_,i)=>[...Array(Math.pow(3,n-1))].map((_,j)=>/1/.test((j*3).toString(3).slice(0,~i))?" ":`*#`[j/3+i&1]).join``).join`
`
;
<input type=number min=1 oninput=o.textContent=f(+this.value)><pre id=o>

Python 2, 142 138 136 bytes
r=range
def f(n):
 for i in r(n+1):
  s="";d=i%2<1
  for k in r(3**i):s+="#*"[(6+d-1+k*(d*2-1))%6<3]
  exec"s+=len(s)*' '+s;"*(n-i);print s

This is the piece of code from here, and then edited for this challenge.
Will post an explanation later.
Also, BTW, two spaces are tabs.
Edit 1: 4 bytes saved thanks to @DJMcMayhem.
Edit 2: 2 bytes saved thanks to @daHugLenny.

Since it's Python 2, can't you remove the parentheses in exec("s+=len(s)*' '+s;"*(n-i))?

@daHugLenny Ah yeah, thanks! (Sorry for not replying soon enough)

Ruby, 115 103 102 bytes
->n{g=->{T.tr"*#","#*"}
*s=?*
(n-1).times{|i|T=s[-1]
s=s.map{|l|l+' '*3**i+l}+[i<1??#*3:g[]+T+g[]]}
s}

Based on jsvnm's solution to the standard Cantor set golf.
-12 bytes thanks to Jordan.

g=->{T.tr"*#","#*"}

Also, s.map!{...} instead of s=s.map{...};s.

@Jordan s.map! would require the + to change to <<, and it'd end up the same length. I believe the s is still necessary at the end either way - the map is inside of a .times loop.

Ah, right you are.

J, 47 45 bytes
' *#'{~3(]*$@]$1 2#~[)(,:1)1&(,~],.0&*,.])~<:

Based on my solution to the Cantor set challenge.
Usage
   f =: ' *#'{~3(]*$@]$1 2#~[)(,:1)1&(,~],.0&*,.])~<:
   f 1
*
   f 2
* *
###
   f 3
* *   * *
###   ###
***###***

Explanation
' *#'{~3(]*$@]$1 2#~[)(,:1)1&(,~],.0&*,.])~<:  Input: n
                                           <:  Decrement n
                      (,:1)                    A constant [1]
                           1&(           )~    Repeating n-1 times on x starting
                                               with x = [1]
                                        ]        Identity function, gets x
                                   0&*           Multiply x elementwise by 0
                                      ,.         Join them together by rows
                                ]                Get x
                                 ,.              Join by rows
                           1  ,~                 Append a row of 1's and return
       3                                       The constant 3
        (                 )                    Operate on 3 and the result
                    [                          Get LHS = 3
               1 2                             The constant [1, 2]
                  #~                           Duplicate each 3 times
                                               Forms [1, 1, 1, 2, 2, 2]
           $@]                                 Get the shape of the result
              $                                Shape the list of [1, 2] to
                                               the shape of the result
         ]                                     Get the result
          *                                    Multiply elementwise between the
                                               result and the reshaped [1, 2]
' *#'                                        The constant string ' *#'
     {~                                       Select from it using the result
                                             as indices and return

PHP, 159 bytes
for($r=($n=--$argv[1])?["* *","###"]:["*"];++$i<$n;$r[]=$a.$b.$a){$a=strtr($b=end($r),"#*","*#");foreach($r as&$s)$s.=str_pad("",3**$i).$s;}echo join("\n",$r);

breakdown
for(
    $r=($n=--$argv[1])  // pre-decrease argument, initialize result
    ?["* *","###"]      // shorter than handling the special iteration 2 in the loop
    :["*"]              // iteration 1
    ;
    ++$i<$n             // further iterations:
    ;
    $r[]=$a.$b.$a       // 3. concatenate $a, $b, $a and add to result
)
{
                        // 1. save previous last line to $b, swap `*` with `#` to $a
    $a=strtr($b=end($r),"#*","*#");
                        // 2. duplicate all lines with spaces of the same length inbetween
    foreach($r as&$s)$s.=str_pad("",3**$i).$s;  # strlen($s)==3**$i
}
// output
echo join("\n",$r);


text:
Periodic Arrays
Challenge
The challenge is to write a function that prints the number of repeats a given array of integers has.
What are repeats?
Repeats of a slice (as in a section of an array) [ a1, a2, a3, ..., an] are any other non-overlapping slices of the forms [ a1+an, a2+an, a3+an, ..., an+an], [ a1+2an, a2+2an, a3+2an, ..., an+2an], and so on. Incomplete repeats, e.g. [ a1+3an, a2+3an], are not counted.
Input and output
Inputs should be ordered collections of integers, e.g. arrays, lists, tuples, etc. The integers will be sorted and unique.
Output a single integer that is the number of repeats that covers the whole input. The output should correspond to the greatest possible number of repeats. E.g. certain inputs could be modeled to have 3 repeats of a 4-element slice, or 6 repeats of a 2-element slice; 6 should be the output because it is greater than 3.
Examples
Input -> Output

[ 1,  3,  5,
  6,  8, 10,
 11, 13, 15,
 16, 18, 20]
-> 4

[ 3,  5, 7, 10,
 13, 15]
-> 1

[1,
 2,
 3]
-> 3

[1,2,4]
-> 1

[ 3, 5, 7, 9,
 12,14,16,18]
-> 2

This is a code-golf challenge, so the shortest code possible wins
If you have any questions related to the challenge feel free to ask.
I know that my attempts to explain something can be difficult to understand sometimes.

As far as I can see the challenge is roughly: "What is the maximum number of equal sized chunks into which an array can be split so that the difference between corresponding elements in any chunk and the next chunk (if any) is a constant. The array is a sorted list of positive (?) numbers (the minumum number of elements is not yet clear)

@TonHospel: That would return 5 for the initial example: [5,8],[7,10],[8,11],[15,18],[17,20] differ by 3 and [1,11],[5,15],[7,17],[8,18],[10,20] differ by 10. Maybe the indexes count too? Still, we have a difference of 10 in 5 pairs. And [5,8,11,17,20]?

@Titus: The chunks consist of consecutive elements in the original array and the difference must be a constant over chunks too (otherwise an array of length n can always be split in n). Anyways, I hope this gets clarified and reopened. If my interpretation is correct this is actually a fun little challenge. I have a perl solution just itching to be posted.

Why does the second example give 1 and not 3?

"Find maximum number of equal sized chunks where the delta in the columns is equal and the same in all columns" is a little bulky

@Titus I chose a bad example... I updated it again to hopefully be correct this time

@RoiEX just wanna introduce you the sandbox: http://meta.codegolf.stackexchange.com/questions/2140/sandbox-for-proposed-challenges/ Next time when you come up with a challenge, you can use it to let other users find problems or bugs in your challenge before actually posting it :-)

What is a slice? The elements at any arithmetic progression of indices? 2. Why does the last test case not have output 2? It seems to me that [1] repeats as [2] (and [2] repeats as [4], but max(2, 2) = 2). 3. How about some test cases with non-trivial gaps between the repeats, etc.?

@PeterTaylor 1) Basically an array slice. 2) that would make two sequences overlap. 3) The gaps are fixed to be an.

That doesn't answer my question. I want a definition, not a repetition. 2. How? They're disjoint. 3. I'm talking about gaps in the indices, not gaps in the values.

@PeterTaylor 1) For the sake of this question a definition like "a section of the whole sequence" might work. 2&3) OP should probably explicitly state that: you can assume all input to consist only of repetitions, complete or not. For question 2, this means you can't treat 2 and 4 without including 1 as part of the repetition, or 1 and 2 without 4([1,2,...] needs to continue with 3 if it were a part of a repetition).

@RoiEX You might want to explicitly state in the "Output" section that "you can assume that all input consists only of repetitions, whereas the final repetition can be incomplete."

Does a slice consist only of contiguous elements?  In Python, a slice could refer to, say, every second element.

Would [1,3,4,6,11] give 2 or 1?

@xnor Example [1,2,4] gives 1, so [1,3,4,6,11] should also give 1

Still to be clarified: Can the input array contain 0 ? negative values ? Is a single integer as input allowed. In particular is a single 0 allowed ? If the intention is non-negative integers then 0 is still weird since it can then only appear at the start, so it becomes a1, but then the next repeat must start with a1+an which is an which is therefore a repeat of the previious number which is forbidden. So starting with 0 implies only 1 repeat (simular argument for starting with a negative number). So it seems more logical to only allow positive integers in the input

One of my three questions has been answered (although not by the OP, so I hope they agree with the edits), but the other two haven't.

I just noticed that there is no test case where the gaps within each chunk vary (e.g. [1, 2, 4, 7, 8, 9, 11, 14, 15, 16, 18, 21], which I think should give 3). This should probably be added if I've got it right.

05AB1E, 21 20 bytes
0)«¥©v®NôÙgi®Nôg}})Z

Explanation
0)«                   # prepend a 0 to the beginning of the list
   ¥©                 # calculate deltas and store in register
     v           }    # for each N in range(0, len(deltas))
      ®Nô             # split deltas into N chunks
         Ù            # uniquify list
          gi    }     # if length == 1
            ®Nôg      # push chunk length
                  )Z  # return max chunk length

Try it online!
Modified test suite

Perl, 48 47 bytes
Includes +3 for -p
Give input as a list of numbers on STDIN
repeats.pl <<< "3 5 7 9 12 14 16 18"

repeats.pl:
#!/usr/bin/perl -p
s//0 /;s/\d+/$'-$&/eg;/(.+?)\1*-/;$_=s/$1//g

Does not work if the input is a single 0 (not clear if that is a valid input). Fixing that takes 2 more bytes:
#!/usr/bin/perl -p
$_=s//0 /%s/\d+/$'-$&/eg-/^(.+?)\1*-/||s/$1//g

Explanation
Adds a 0 in front of the sequence and then constructs a list of differences. The example input
3 5 7 9 12 14 16 18

becomes:
3 2 2 2 3 2 2 2 -18

The -18 is because the last difference is calculated relative to the end of the string which in perl will behave like 0. On this transformed list the problem is equivalent to finding the most often repeating substring before the - sign (this is why a single 0 as input does not work because only in that case there is no minus sign)

Retina, 38 bytes
\d+
$*
(?<=(1*) )\1

(.+?)(| \1)+$
$#2

Input should be space-separated.
Try it online! (The first line enables a linefeed-separated test suite.)
Explanation
\d+
$*

Convert input to unary by replacing each number n with n copies of 1.
(?<=(1*) )\1

Compute consecutive differences, by removing from each number the previous number.
(.+?)(| \1)+$
$#2

Try to match the entire input as a repetition of difference (favouring more repetitions of fewer differences) and replace it with the number of repetitions.


text:
Draw some ASCII-boxes
Take two lists of non-negative integers, and output an ASCII-box as it's defined below.

Corners and intersections are pluses: + (ASCII-code 43)
Vertical lines are bars | (ASCII-code 124)
Horizontal lines are minuses - (ASCII-code 45)

The first input list specifies the number of minuses between each plus sign, in the horizontal direction.
The second input list specifies the number of bars between each plus sign, in the vertical direction.
It's easier to explain with a few examples:
0    // No minuses between each + sign
0    // No bars between + signs

++
++

------------------
1 2   // First a single minus, then two minuses
1 2   // First  one bar, then two bars

+-+--+
| |  |
+-+--+
| |  |
| |  |
+-+--+

------------------
1 0 3 0 2 0
2 1 0 0

+-++---++--++
| ||   ||  ||
| ||   ||  ||
+-++---++--++
| ||   ||  ||
+-++---++--++
+-++---++--++
+-++---++--++

Clarifications:

Input order and format are optional
Only the boxes should be printed/displayed, but a trailing space or newlines are accepted.
You may optionally add 1 to all input values if that's more convenient. The second example would then be: 2 3; 2 3.

This is code golf, so the shortest code in bytes win.

Related: http://codegolf.stackexchange.com/questions/70377/ascii-box-rendering

MATL, 25 22 21 bytes
'|-+ '2:"1tiYsQ(]E!+)

Uses inputs with 1 added (allowed by the challenge).
Try it online!
Explanation
The code initially builds an array containing 1 for the column indices of non-space characters in the final result, and 0 otherwise. So if the first input is [2 1 4 1 3 1] (would be [1 0 3 0 2 0] in the 0-based format) this array will be
1 0 1 1 0 0 0 1 1 0 0 1 1

Note how the length of runs of zeros is related to the input. Specifically, this array is built as follows:

Initiallize the array to a single 1.
Compute the cumulative sum of the input and add 1. In the example this gives [3 4 8 9 12 13].
Extend the array from step 1 by assigning 1 to the entries with (1-based) indices given by step 2. Intermediate entries are automatically set to 0.

A similar array is built for the rows. Second input [3 2 1 1] (or [2 1 0 0 ]) gives
1 0 0 1 0 1 1 1

Now the second array is multiplied by 2, transposed and added with broadcast to the first. This gives the 2D array
3 2 3 3 2 2 2 3 3 2 2 3 3
1 0 1 1 0 0 0 1 1 0 0 1 1
1 0 1 1 0 0 0 1 1 0 0 1 1
3 2 3 3 2 2 2 3 3 2 2 3 3
1 0 1 1 0 0 0 1 1 0 0 1 1
3 2 3 3 2 2 2 3 3 2 2 3 3
3 2 3 3 2 2 2 3 3 2 2 3 3
3 2 3 3 2 2 2 3 3 2 2 3 3

Indexing into the string '|-+ ' gives the final result as a 2D char array. Since indexing is modular and 1-based, index 0 corresponds to the last element (space).
'|-+ '                   % Push this string
      2:"       ]        % Do this twice
         1               % Push 1 (initial array)
          t              % Push another 1 (contents to be filled in)
           i             % Take input
            Ys           % Cumulative sum
              Q          % Add 1
               (         % Fill 1 into those entries of the array
                 E       % Multiply by 2
                  !      % Transpose
                   +     % Add, with broadcast
                    )    % Index (modular, 1-based) into the string

Python 2, 117 Bytes
def f(h,v):r="+"+"+".join("-"*i for i in h)+"+\n";print r+r.join(("|"+"|".join(" "*i for i in h)+"|\n")*i for i in v)+r

Try it on ideone.
Not expecting too much from this. Really simple, just uses python joins and string multiplication to pull everything together.

JavaScript (ES6), 83 bytes
(a,b,g=(a,[s,t])=>t+a.map(n=>s.repeat(n)+t).join``+`
`)=>g(b,[g(a,` |`),g(a,`-+`)])

Output includes two trailing newlines.

Wow. So similar answers posted almost at the same time. ;)

(You beat me by 2 minutes and 2 bytes, though.)

@Arnauld You wasted time on your demo ;-)

Yeah, I guess so. ^^ Interestingly, my version would be 81 bytes with the two trailing newlines.

CJam, 50 Bytes
0lS/:i0++:H;lS/:i0+{H{'-*}%'+*N+o{H{S*}%'|*N+o}*}%

Try it online!

Pyth, 45 bytes
AQj.i*hlH]Js.i*hlG\+m*d\-G-mjb*d]XJ"+-""| "Hk

A program that takes input of two comma-separated lists on STDIN and prints the result.
There is probably still some golfing to be done here.
Try it online
Explanation coming later

Haskell, 55 bytes
f[a,b]x=a:do n<-x;(b<$[1..n])++[a]
g x=f[f"+-"x,f"| "x]

Defines a function g which takes the two input lists and returns a list containing the lines of the output

Jelly, 30 26 bytes
Ḣị“+-“| ”ị@
1;+\Ṭ
Ç€,€/Ñ€Y

Test it at TryItOnline
How?
The input taken is a list of the two lists, [vertical, horizontal], and uses the incremented option
- so example 3 takes [[3,2,1,1], [2,1,4,1,3,1]]
Each of these is then converted to a boolean array indicating the rowType or rowCharacterType respectively, e.g. [[1,0,0,1,0,1,1,1], [1,0,1,1,0,0,0,1,1,0,0,1,1]]
The boxes are then constructed by making the rows from the characters identified by the rowType and rowCharacterType combinations - i.e. a rowType identifies either "+-" or "| " and a rowCharacterType identifies one of those two characters.
Ḣị“+-“| ”ị@ - Link 1, create a row: [rowType, [rowCharaterTypes]]
Ḣ           - head - get the rowType
  “+-“| ”   - list of strings ["+-", "| "]
 ị          - index into (if rowType is 1 "+-"; if rowType is 0 "| ")
         ị@ - index into with reversed operands (index into that from rowCharaterTypes)
                (replace each 1 in rowCharaters with "+" or "|" and each 0 with "-" or " ")

1;+\Ṭ - Link 2, create the Type lists from the inputs: int[] nCharacters
1;    - 1 concatenated with the input
  +\  - reduce with addition (accumulation provides the indices)
    Ṭ - boolean array with 1s at those indices
            As an example take the vertical of example 3:
            [3,2,1,1] -> [1,3,2,1,1] -> [1,4,6,7,8] -> [1,0,0,1,0,1,1,1]
            each of which will be passed as a rowType for Link 1

Ç€,€/Ñ€Y - Main link, takes one argument: [Vertical, Horizontal] (incremented option)
Ç€       - call the last link (2) for each of the two lists in the input
  ,€/    - pair each and reduce (making a list of [rowtype [rowCharacterTypes]])
     Ñ€  - call the next link (1) for each
       Y - join on line feeds

PowerShell v2+, 89 bytes
param($a,$b)($x="+$(($a|%{'-'*$_})-join'+')+")
$b|%{,"|$(($a|%{' '*$_})-join'|')|"*$_;$x}

Dang, don't think I can quite catch JavaScript.
Takes input $a and $b as explicit arrays. Sets variable $x to be the top row of the boxes based on looping through $a and some string concatenation. That's encapsulated in parens so it's placed on the pipeline. Then, we loop through $b, each iteration putting two strings on the pipeline -- the same style string but with spaces and | instead of hyphens and +, and $x. Those strings are all gathered from the pipeline with an implicit Write-Output at program completion, with default newline between them.
Examples
PS C:\Tools\Scripts\golfing> .\make-some-ascii-boxes.ps1 @(0) @(0)
++
++

PS C:\Tools\Scripts\golfing> .\make-some-ascii-boxes.ps1 @(1,0,3,0,2,0) @(2,1,0,0)
+-++---++--++
| ||   ||  ||
| ||   ||  ||
+-++---++--++
| ||   ||  ||
+-++---++--++
+-++---++--++
+-++---++--++

PS C:\Tools\Scripts\golfing> .\make-some-ascii-boxes.ps1 @(1,4,1) @(1,2,1)
+-+----+-+
| |    | |
+-+----+-+
| |    | |
| |    | |
+-+----+-+
| |    | |
+-+----+-+

Ruby, 66 bytes
->x,y{d=->c,m,z=x{c+z.map{|w|m*w}*c+c+$/}
d[d[?+,?-],d[?|,' '],y]}


text:
Draw an ASCII Rectangle
Given two integers as input in an array, draw a rectangle, using the first integer as width and second as height.
Or, if your language supports it, the two integers can be given as separate inputs.
Assume the width and height will never be less than 3, and they will always be given.
Example Outputs:
[3, 3]
|-|
| |
|-|

[5, 8]
|---|
|   |
|   |
|   |
|   |
|   |
|   |
|---|

[10, 3]
|--------|
|        |
|--------|

This is code-golf, so the answer with the lowest amount of bytes wins.

Jolf, 6 bytes
,ajJ'|

Try it here! My box builtin finally came in handy! :D
,ajJ'|
,a       draw a box
  j      with width (input 1)
   J     and height (input 2)
    '    with options
     |    - corner
          - the rest are defaults

Jelly, 14 bytes
,þ%,ỊḄị“-|| ”Y

Try it online! or verify all test cases.
How it works
,þ%,ỊḄị“-|| ”Y  Main link. Left argument: w. Right argument: h

,þ              Pair table; yield a 2D array of all pairs [i, j] such that
                1 ≤ i ≤ w and 1 ≤ j ≤ h.
   ,            Pair; yield [w, h].
  %             Take the remainder of the element-wise division of each [i, j]
                by [w, h]. This replaces the highest coordinates with zeroes.
    Ị           Insignificant; map 0 and 1 to 1, all other coordinates to 0.
     Ḅ          Unbinary; convert each pair from base 2 to integer.
                  [0, 0] -> 0 (area)
                  [0, 1] -> 1 (top or bottom edge)
                  [1, 0] -> 2 (left or right edge)
                  [1, 1] -> 3 (vertex)
       “-|| ”   Yield that string. Indices are 1-based and modular in Jelly, so the
                indices of the characters in this string are 1, 2, 3, and 0.
      ị         At-index; replace the integers by the correspoding characters.
             Y  Join, separating by linefeeds.

This is a wonderful use of Ị :)

Matlab, 69 65 56 bytes
Thanks @WeeingIfFirst and @LuisMendo for some bytes=)
function z=f(a,b);z(b,a)=' ';z([1,b],:)=45;z(:,[1,a])='|'

This is really simple in Matlab: First make a matrix of the desired size, then index the first and last row to insert the -, and do the same with the first and last column to insert |.
For example f(4,3) returns
|--|
|  |
|--|

@WeeingIfFirst Oh, of course, thank you very much!

6 bytes shorter: z([1,b],1:a)=45;z(1:b,[1,a])=124;z=[z,'']

Even shorter: z(b,a)=' ';z([1,b],:)=45;z(:,[1,a])=124

@LuisMendo Thanks! We still need the string tough, otherwise the array is converted to a numerical one.

@flawr z(b,a)=' ' initiallizes as char. After that you can fill with numbers and they are automatically cast to char. z maintains its original type

That is strange, I always had the impression that this won't work =/ Anyway, thanks a lot!

PHP, 74 Bytes
for(;$i<$n=$argv[2];)echo str_pad("|",$argv[1]-1,"- "[$i++&&$n-$i])."|\n";

You can still win one byte with a physical linebreak.

-2 bytes with !$i|$n==++$i instead of !$i|$n-1==$i++

another byte with $i++&&$n-$i?" ":"-"

$i++&&$n-$i?" ":"-" --> "- "[$i++&&$n-$i] (-2)

JavaScript (ES6), 63 bytes

f=
(w,h,g=c=>`|${c[0].repeat(w-2)}|
`)=>g`-`+g` `.repeat(h-2)+g`-`
;

<input id=w type=number min=3 value=3><input id=h type=number min=3 value=3>

Passing a template function as a default argument? Clever!

Haskell, 62 55 bytes
f[a,b]n=a:(b<$[3..n])++[a]
g i=unlines.f[f"|-"i,f"| "i]

Usage example:
*Main> putStr $ g 10 3
|--------|
|        |
|--------|

The helper function f takes a two element list [a,b] and a number n and returns a list of one a followed by n-2 bs followed by one a. We can use f thrice: to build the top/bottom line: f "|-" i, a middle line: f "| " i and from those two the whole rectangle: f [<top>,<middle>] j (note: j doesn't appear as a parameter in g i because of partial application).
Edit: @dianne saved some bytes by combining two Char arguments into one String of length 2. Thanks a lot!

I like the # idea!

I think you can save a few bytes by defining (a:b)#n=a:([3..n]>>b)++[a] and writing ["|-"#i,"| "#i]#j

@dianne: Very clever. Thanks a lot!

Python 2, 61 58 bytes
-3 bytes thanks to @flornquake (remove unnecessary parentheses; use h as counter)
def f(w,h):exec"print'|'+'- '[1<h<%d]*(w-2)+'|';h-=1;"%h*h

Test cases are at ideone

('- '[1<i<h]) doesn't need the parentheses.

Save another byte by using h as the counter: exec"print'|'+'- '[1<h<%d]*(w-2)+'|';h-=1;"%h*h

@flornquake I had meant to check the necessity of those parentheses, but forgot. Using h as the counter is smart! Thanks.

Vimscript, 93 83 75 74 73 66 64 63 bytes
Code
fu A(...)
exe "norm ".a:1."i|\ehv0lr-YpPgvr dd".a:2."p2dd"
endf

Example
:call A(3,3)

Explanation
fun A(...)    " a function with unspecified params (a:1 and a:2)
exe           " exe(cute) command - to use the parameters we must concatenate :(
norm          " run in (norm) al mode
#i|           " insert # vertical bars
\e            " return (`\<Esc>`) to normal mode
hv0l          " move left, enter visual mode, go to the beginning of the line,  move right (selects inner `|`s)
r-            " (r)eplace the visual selection by `-`s
YpP           " (Y) ank the resulting line, and paste them twice
gv            " re-select the previous visual selection
r<Space>      " replace by spaces
dd            " Cut the line
#p            " Paste # times (all inner rows)
2dd           " Remove extra lines

Note that it is not using norm! so it might interfere with vim custom mappings!

05AB1E, 23 22 20 bytes
Input taken as height, then width.
F„ -N_N¹<Q~è²Í×'|.ø,

Explanation
F                          # height number of times do
    N_                     # current row == first row
          ~                # OR
      N¹<Q                 # current row == last row
 „ -       è               # use this to index into " -"
            ²Í×            # repeat this char width-2 times
               '|          # push a pipe
                 .ø        # surround the repeated string with the pipe
                   ,       # print with newline

Try it online!
Saved 2 bytes thanks to Adnan

Using substrings instead of the if-else statement saves two bytes: F„ -N_N¹<Q~è²Í×'|.ø,.

MATL, 19 bytes
'|-| '2:"iqWQB]E!+)

Try it online!
Explanation
The approach is similar to that used in this other answer. The code builds a numerical array of the form
3 2 2 2 3
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
3 2 2 2 3

and then its values are used as (1-based, modular) indices into the string '|-| ' to produce the desired result.
'|-| '                % Push this string
      2:"     ]       % Do this twice
         i            % Take input
          q           % Subtract 1
           W          % 2 raised to that
            Q         % Add 1
             B        % Convert to binary
               E      % Multiply by 2
                !     % Transpose
                 +    % Add with broadcast
                  )   % Index (modular, 1-based) into the string

C, 73 bytes
i;f(w,h){for(i=++w*h;i--;)putchar(i%w?~-i%w%~-~-w?i/w%~-h?32:45:124:10);}

Common Lisp, 104 bytes
Golfed:
(defun a(w h)(flet((f(c)(format t"|~v@{~A~:*~}|~%"(- w 2)c)))(f"-")(loop repeat(- h 2)do(f" "))(f"-")))

Ungolfed:
(defun a (w h)
  (flet ((f (c) (format t "|~v@{~A~:*~}|~%" (- w 2) c)))
    (f "-")
    (loop repeat (- h 2) do
     (f " "))
    (f "-")))

Python 2, 56 bytes
w,h=input()
for c in'-%*c'%(h-1,45):print'|'+c*(w-2)+'|'

flornquake saved one byte.

Nice use of string formatting! You can save a byte using %c conversion: '-%*c'%(h-1,45)

Oh, I thought %*c wasn’t even a thing! Thank you. :)

'-%%%dc'%~-h%45 also works for the same length.

Mathematica, 67 64 bytes
Thanks to lastresort and TuukkaX for reminding me that golfers should be sneaky and saving 3 bytes!
Straightforward implementation. Returns an array of strings.
Table[Which[j<2||j==#,"|",i<2||i==#2,"-",0<1," "],{i,#2},{j,#}]&

Use 0<1 in place of True

I think that j==1 can be reduced to j<1, and i==1 to i<1.

Turtlèd, 40 bytes
Interpreter is slightly no longer buggèd
?;,u[*'|u]'|?@-[*:l'|l[|,l]d@ ],ur[|'-r]

Explanation
?                            - input integer into register
 ;                           - move down by the contents of register
  ,                          - write the char variable, default *
   u                         - move up
    [*   ]                   - while current cell is not *
      '|                     - write |
        u                    - move up
          '|                 - write | again
            ?                - input other integer into register
             @-              - set char variable to -
               [*             ] - while current char is not *
                 :l'|l          - move right by amount in register, move left, write |, move left again
                      [|,l]     - while current cell is not |, write char variable, move left
                           d@   - move down, set char variable to space (this means all but first iteration of loop writes space)
                               ,ur   -write char variable, move up, right
                                  [|   ] -while current char is not |
                                    '-r - write -, move right

Python 3, 104 95 bytes
( feedback from @mbomb007 : -9 bytes)
def d(x,y):return'\n'.join(('|'+('-'*(x-2)if n<1or n==~-y else' '*(x-2))+'|')for n in range(y))

(my first code golf, appreciate feedback)

Welcome! You can remove some of the spaces, use range(y) instead of range(0,y), and if n is never negative you can use if n<1or n==~-y else

See the Python tips page

@mbomb007 thanks! I'll check it out.

Ruby, 59 54 52 bytes
Oh, that's a lot simpler :)
->x,y{y.times{|i|puts"|#{(-~i%y<2??-:' ')*(x-2)}|"}}

Test run at ideone

You can save a couple bytes by using a literal newlines instead of \n.

You can save bytes by not defining i and j. Replace i's definition with x-=2. Instead of j, just use (y-2).

PHP, 82 bytes
list(,$w,$h)=$argv;for($p=$h--*$w;$p;)echo$p--%$w?$p%$w?$p/$w%$h?" ":"-":"|
":"|";

indexing a static string including the newline
list(,$w,$h)=$argv;         // import arguments
for($p=$h--*++$w;$p;)       // loop $p through all positions counting backwards
    // decrease $h and increase $w to avoid parens in ternary conditions
    echo" -|\n"[
        $p--%$w             // not (last+1 column -> 3 -> "\n")
        ?   $p%$w%($w-2)    // not (first or last row -> 2 -> "|")
            ?+!($p/$w%$h)   // 0 -> space for not (first or last row -> 1 -> "-")
            :2
        :3
    ];

Dear downvoter: why?

It could be because a user saw that your answer was flagged as low quality in the review queue. If you post an explanation of your code, or anything more than a one-liner, you can avoid it being automatically flagged.

@mbomb: I have never seen anyone post a description for a oneliner in a non-eso language.

Or output, or a non-golfed version. It doesn't matter as long as the content is not too short. But you probably haven't been around long if you haven't seen that. Some Python one-liners can be pretty complicated. Look at some of @xnor's.

Batch, 128 bytes
@set s=
@for /l %%i in (3,1,%1)do @call set s=-%%s%%
@echo ^|%s%^|
@for /l %%i in (3,1,%2)do @echo ^|%s:-= %^|
@echo ^|%s%^|

Takes width and height as command-line parameters.

Haxe, 112 106 bytes
function R(w,h){for(l in 0...h){var s="";for(i in 0...w)s+=i<1||i==w-1?'|':l<1||l==h-1?'-':' ';trace(s);}}

Testcases
R(5, 8)
|---|
|   |
|   |
|   |
|   |
|   |
|   |
|---|

R(10, 3)
|---------|
|         |
|---------|

Java 135 bytes
public String rect(int x, int y){
String o="";
for(int i=-1;++i<y;){
o+="|";
for(int j=2;++j<x)
if(i<1||i==y-1)
o+="-";
else
o+=" ";
o+="|\n";
}
return o;
}

Golfed:
String r(int x,int y){String o="";for(int i=-1;++i<y;){o+="|";for(int j=2;++j<x;)if(i<1||i==y-1)o+="-";else o+=" ";o+="|\n";}return o;}

I count 136 :) You can also save a char by removing the space after the first comma.

First of all, this code doesn't compile. Even if this would compile, it wouldn't 'draw' a rectangle as the OP currently wants. -1.

@TuukkaX I fixed that newline problem, but I don't see any reason why it should not compile. Of course you have  to put that code in a class, but then it should work.

"I don't see any reason why it should not compile". What's this then: o+=x "|\n"? Did you mean to put an + there?

Thanks. I didn't wanted to place any characters there.

Lua, 120 93 bytes
Saved quite a few bytes by removing stupid over complexities.
function(w,h)function g(s)return'|'..s:rep(w-2)..'|\n'end b=g'-'print(b..g' ':rep(h-2)..b)end

Ungolfed:
function(w,h)                           -- Define Anonymous Function
    function g(s)                       -- Define 'Row Creation' function. We use this twice, so it's less bytes to function it.
        return'|'..s:rep(w-2)..'|\n'    -- Sides, Surrounding the chosen filler character (' ' or '-'), followed by a newline
    end
    b=g'-'                              -- Assign the top and bottom rows to the g of '-', which gives '|---------|', or similar.
    print(b..g' ':rep(h-2)..b)          -- top, g of ' ', repeated height - 2 times, bottom. Print.
end

Try it on Repl.it

PowerShell v3+, 55 bytes
param($a,$b)1..$b|%{"|$((' ','-')[$_-in1,$b]*($a-2))|"}

Takes input $a and $b. Loops from 1 to $b. Each iteration, we construct a single string. The middle is selected from an array of two single-length strings, then string-multiplied by $a-2, while it's surrounded by pipes. The resulting strings are left on the pipeline, and output via implicit Write-Output happens on program completion, with default newline separator.
Alternatively, also at 55 bytes
param($a,$b)1..$b|%{"|$((''+' -'[$_-in1,$b])*($a-2))|"}

This one came about because I was trying to golf the array selection in the middle by using a string instead. However, since [char] times [int] isn't defined, we lose out on the savings by needing to cast as a string with parens and ''+.
Both versions require v3 or newer for the -in operator.
Examples
PS C:\Tools\Scripts\golfing> .\draw-an-ascii-rectangle.ps1 10 3
|--------|
|        |
|--------|

PS C:\Tools\Scripts\golfing> .\draw-an-ascii-rectangle.ps1 7 6
|-----|
|     |
|     |
|     |
|     |
|-----|

Perl, 48 bytes
Includes +1 for -n
Give sizes as 2 lines on STDIN
perl -nE 'say"|".$_ x($`-2)."|"for"-",($")x(<>-1-/$/),"-"'
3
8
^D

Just the code:
say"|".$_ x($`-2)."|"for"-",($")x(<>-1-/$/),"-"

Nice one, as always. Note that you've got a backtick at the end of the line while you probably wanted to write a single quote ;-)

@Dada Fixed. Thanks.

bash, sed and coreutils, 95 89 bytes
You can define a function like this
f(){ n=$[$1-2];yes \ |sed $[$2*n]q|tr -d \\n|fold -w$n|sed 's/^\|$/|/g;1!{$!b};s/ /-/g';}

Or in a more readable format:
f() {
  n=$(($1-2))

  # The next couple of lines create a rectangle of spaces
  # matching the desired size
  yes ' '          |
  head -n$(($2*n)) |
  tr -d '\n'       |
  fold -w$n        |

  # Add the pipes and dashes
  sed '
    s/^\|$/|/g   # Replace first and last character by a pipe
    1! {$!b }    # Do nothing if not on first or last line
    s/ /-/g      # Add the dashes
  '
  echo
}

You can now say f 4 3:
|--|
|  |
|--|

If you care about trailing new-line, add an echo at the end of function.

Python 2, 67 bytes
def f(a,b):c="|"+"-"*(a-2)+"|\n";print c+c.replace("-"," ")*(b-2)+c

Examples
f(3,3)

|-|
| |
|-|

f(5,8)

|---|
|   |
|   |
|   |
|   |
|   |
|   |
|---|

f(10,3)

|--------|
|        |
|--------|

MATL, 21 17 bytes
Z"45ILJhY('|'5MZ(

This is a slightly different approach than the one of the MATL-God.
Z"                   Make a matrix of spaces of the given size
  45ILJhY(           Fill first and last row with '-' (code 45)
          '|'5MZ(    Fill first and last column with '|' (using the automatic clipboard entry 5M to get ILJh back)

Thanks @LuisMendo for all the help!
Try it Online!

PHP 4.1, 76 bytes
<?$R=str_repeat;echo$l="|{$R('-',$w=$W-2)}|
",$R("|{$R(' ',$w)}|
",$H-2),$l;

This assumes you have the default php.ini settings for this version, including short_open_tag and register_globals enabled.
This requires access through a web server (e.g.: Apache), passing the values over session/cookie/POST/GET variables.
The key W controls the width and the key H controls the height.
For example: http://localhost/file.php?W=3&H=5

@Titus You should read the link. Quoting: "As of PHP 4.2.0, this directive defaults to off".

Ouch sorry I take everything back. You have the version in your title. I should read more carefully.

@Titus That's alright, don't worry. Sorry for being harsh on you.

Nevermind; that´s the price I pay for being pedantic. :D

@Titus Don't worry about it. Just so you know, around half of my answers are written in PHP 4.1. It saves tons of bytes with input

Python 3, 74 chars
p="|"
def r(w,h):m=w-2;b=p+"-"*m+p;return b+"\n"+(p+m*" "+p+"\n")*(h-2)+b

Python (70 bytes)
def r(w,h): print '\n'.join(['|'+('-' if i%(h-1)==0 else ' ')*(w-2)+'|' for i in range(h)])

Edit: lambda function for a few less bytes (thanks @DJMcMayhem)
r=lambda w,h:'\n'.join(['|'+('-'if i%(h-1)==0 else' ')*(w-2)+'|'for i in range(h)])

Edit#2: if notation is greedy
r=lambda w,h:'\n'.join(['|'+(0<i<h-1 and' 'or'-')*(w-2)+'|'for i in range(h)])

Edit#3: -8 bytes with list trick
r=lambda w,h:'\n'.join(['|'+'- '[0<i<h-1]*(w-2)+'|'for i in range(h)])

Hello, welcome to the site! Some tips, 1) you have some unnecessary whitespace that you could remove. 2) A lambda function is shorter since you don't need to call print (you can just return instead)

I count 83 bytes

C#, 102 93 bytes
Saved 9 bytes thanks to milk - completely forgot to concatenate strings. The compare trick is pretty cool too.
w=>h=>{var s="";for(int i=0;i<h;)s+="|"+new String(1>i++%(h-1)?'-':' ',w-2)+"|\n";return s;};

Try it online!
Full source, including test cases:
using System;

namespace DrawASCIIRectangle
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<int,Func<int,string>> d= w=>h=>{var s="";for(int i=0;i<h;)s+="|"+new String(1>i++%(h-1)?'-':' ',w-2)+"|\n";return s;};
            Console.WriteLine(d(3)(3));
            Console.WriteLine(d(5)(8));
            Console.WriteLine(d(10)(3));
        }
    }
}

Using 1>i++%(h-1) instead of i++<1||i>h-1 will save 1 byte. You can also put all the string concats into a single statement so the for is a one liner and doesn't need braces, saving another 8 bytes: s+="|"+new string(1>i++%(h-1)?'-':' ',w-2)+"|\n"

Swift(2.2) 190 bytes
let v = {(c:String,n:Int) -> String in var s = "";for _ in 1...n {s += c};return s;};_ = {var s = "|"+v("-",$0-2)+"|\n" + v("|"+v(" ",$0-2)+"|\n",$1-2) + "|"+v("-",$0-2)+"|";print(s);}(10,5)

I think Swift 3 could golf this a lot more but I don't feel like downloading Swift 3.

C 87 bytes
f(b,a,c,k){for(;c<a*b;++c)printf("%s",(k=c%b)==b-1?"|":!k?"\n|":ca*b-b?"-":" ");}

this is the main for some test...
main()
{f(3,3,0,0); f(5,8,0,0); f(10,3,0,0);
 return 0;
}

|-|
| |
|-|
|---|
|   |
|   |
|   |
|   |
|   |
|   |
|---|
|--------|
|        |
|--------|

F#, 131 bytes
let d x y=
 let q = String.replicate (x-2)
 [for r in [1..y] do printfn "%s%s%s" "|" (if r=y||r=1 then(q "-")else(q " ")) "|"]

Pyth, 22 bytes
VJE.[Q*-Q2?}N,0tJ\-d\|

A program that takes input of the width, followed  by the height, on STDIN and prints the result.
Try it online
How it works
VJE.[Q*-Q2?}N,0tJ\-d\|  Program. Inputs: Q, E
 JE                     Assign E to J
V                       For N in [0, 1, 2, ..., J-1]:
             ,0tJ        Yield [0, J-1]
           }N            N is in that list
          ?              If that:
                 \-       Yield "-"
                         Else:
                   d      Yield " "
      *-Q2               Repeat that Q-2 times
   .[Q              \|   Evenly pad that with "|" on both sides to length Q
                         Implicitly print

Actually, 35 bytes
¬'|@α(¬;)' *╗`╜o'|o`Mi('-*"|%s|"%;)

Try it online!
Explanation:
¬'|@α(¬;)' *╗`╜o'|o`Mi('-*"|%s|"%;)
¬                                    height - 2
 '|@α                                ["|" for _ in range(height-2)]
     (¬;)                            width - 2, duplicate, move to bottom of stack
         ' *                         " "*(width-2)
            ╗                        save to register 0
             `╜o'|o`M                for each "|" in list of "|"s:
              ╜o                       append (width-2) spaces
                '|o                    append a second "|"
                     i               flatten list
                      (              bring copy of (width-2) back to top
                       '-*           "-"*(width-2)
                          "|%s|"%    surround with "|"s
                                 ;)  dupe, move copy to bottom of stack
                                     (implicitly print stack contents, one element per line)

Racket 108 bytes
(λ(w h)(for((j h))(display #\|)(for((i(- w 2)))(display(if(or(= j 0)(= j(- h 1)))#\-" ")))(displayln #\|)))

Ungolfed:
(define f
  (λ (w h)
    (for ((j h))
      (display #\|)
      (for ((i (- w 2)))
        (display (if (or
                      (= j 0)
                      (= j (- h 1)))
                     #\-
                     " ")))
      (displayln #\|))))

Testing:
(f 5 3)

Output:
|---|
|   |
|---|

Python 3, 68 bytes
def f(a,b):
 c='|'+'-'*(a-2)+'|\n';print(c+c.replace(*'- ')*(b-2)+c)

Python, 105 bytes
[a,b]=input().split()
def d(e):print("|"+e*(int(a)-2)+"|")
d("-")
for f in range(2,int(b)):d(" ")
d("-")

Try it online

tcl, 99
puts [set M |[string repe - [incr w -2]]|]
incr w
time {puts |[format %$w\s |]} [incr h -2]
puts $M

demo

APL (Dyalog Unicode), 25 bytes
'|','|',⍨'-'⍪'-'⍪⍨''⍴⍨-∘2

Try it online!
-∘2 subtract two
''⍴⍨ use that as height and width to reshape an empty string (padding with spaces)
'-'⍪⍨ put dashes below
'-'⍪ put dashes on top
'|',⍨ put stiles on the right
'|', put stiles on the left