Generate a right triangle
APL (30)

{' x'[1+(⍎⍵⌷'⌽+⍉⊖')≤/¨⍳2⍴⍺]}/⎕


Explanation:


{...}/⎕: reduce given function over the input (so if the input has 2 numbers, just calls the function with those two numbers, ⍺ being the left number and ⍵ the right number)
≤/¨⍳2⍴⍺: Make an ⍺-by-⍺ coordinate matrix and set those positions where the X coordinate is not greater than the Y coordinate, giving a bitfield.
(⍎⍵⌷'⌽+⍉⊖'): select a transformation function given by ⍵ to put the triangle right-side-up.
' x'[1+...]: add one to the bitfield, and use the result as an index into the string ' x', so putting space for 0 and x for 1.