text:
Create a Paint program!
Introduction
One day, you were showing your kid how to draw on a computer. You type mspaint.exe in the run bar. To your horror, it says "No items match your search". You must create a simple version of paint so your kid can draw!
Challenge
You must create a simple drawing program. To do this, open a white display window (larger than 99x99 pixels). Anytime the mouse is pressed down, change the pixel that the mouse is on to black.
This is code-golf, so shortest answer in bytes wins!

Does it need to be pixels? or can it be 99x99 squares?

How long does it need to run for?

When TI-Basic's Pen does exactly this :o

@Riker it should run for at least 10 seconds, preferably forever

@fəˈnɛtɪk it should be pixels, unless it would add 50 bytes or more to do so. also, larger than 99x99

Is larger than 99×99 just so we have to use three digits in decimal notation for each dimension? Would 99×100 or 100×99 be valid?

@Xufox It is that size so that it is big enough to be an (okay) drawing program. No, those would not be valid.

8086 machine code, 32 31 28 26 bytes
00000000  b8 0f 00 cd 10 b8 02 10  ba 18 01 cd 10 b8 03 00  |................|
00000010  cd 33 4b b8 01 0c eb f3  3f 00                    |.3K.....?.|
0000001a

Assumes the presence of a VGA graphics card, and any Microsoft-compatible mouse driver.
-2 bytes thanks to @berendi!

How it works:
            |   org 0x100
            |   use16
b8 0f 00    |       mov ax, 0x000f      ; set screen mode: 640x350 monochrome
cd 10       |       int 0x10            ; call video bios
b8 02 10    |       mov ax, 0x1002      ; set palette
ba 18 01    |       mov dx, palette     ; pointer to palette data
cd 10       |   @@: int 0x10            ; call video bios
b8 03 00    |       mov ax, 0x0003      ; get mouse position in (CX, DX) and button status in BL
cd 33       |       int 0x33            ; call mouse driver
4b          |       dec bx              ; if no buttons pressed, --BX = 0xFFFF (invalid page)
b8 01 0c    |       mov ax, 0x0c01      ; plot pixel with color AL at (CX, DX) in page BH
eb f3       |       jmp @b              ; repeat
3f 00       |   palette db 0x3f, 0x00   ; palette in 2:2:2 rgb. color 0 = white, 1 = black.
            |                           ; this should be a 17-byte struct, but we only care about the first two colors here

That's all there is to it. No magic involved, just a few function calls.

Setting up the palette colors takes 10 bytes here. I wonder if there's a shorter way to do it?

Would you be able to make it shorter by using CGA rather than VGA?

The CGA has no way to change indivitual palette colors, as far as I can tell. You could change the background color to white, but it won't let you draw black pixels.

Clean, clear, and clever code. Very nicely done! I don't see anywhere this can be further optimized for size. For some reason, when I tried this using the CuteMouse driver, this draws without the mouse button having to be held down, but that may just be an issue with CuteMouse not being 100% Microsoft-compatible. Which driver did you use for testing?

Only tested on Dosbox so far, which has a mouse driver built-in. I can try it on a dos machine with Cutemouse tomorrow. The trick with "dec bx" to set the page number assumes the reserved bits in bx to be clear, that assumption may be incorrect. Or perhaps the video bios doesn't perform proper bounds checking on the page number.

Hmm. After running the code with a debugger (good old DEBUG.COM, of course!), it appears it's not a problem with the CuteMouse driver. Without a button held down, INT 33h is returning 0 in BX, and this gets decremented to FFFFh as expected, but a line is still being drawn. Perhaps this is because mode 11h only has one video page, and the invalid page number is automatically being fixed up? I'm testing on VM VirtualBox, so maybe that's something its BIOS implementation is doing.

Oh that's definitely a BIOS issue. I don't think it should do anything if the page number is invalid. I have a disassembled VGA-compatible bios somewhere, again, I can check it out tomorrow.

Looks like VirtualBox is to blame here, it simply ignores the page number altogether: https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/Graphics/BIOS/vgabios.c#L1350

Also you're right in that mode 0x11 isn't guaranteed to have multiple pages. I'll change it to use mode 0x0F which should have at least two.

Bill Atkinson himself would be proud of this.  Splendid work.

-2 bytes remove the last int 0x10, jmp back to the second int 0x10 instead. Offset in jmp remains the same, adjust address in mov dx

Oooh, nice catch! That is so obvious once you see it. Thank you!

Nah, Bill Atkinson is not a hacker. :-) @wossname

this answer is now at 86 votes

Scratch, 10 Scratch bytes

Scratch was practically designed for things like this.
Try it online!

Does this actually do pixels? Also, if you click the mouse fast vs holding it for a bit, it produces different results (without moving it of course). I think that invalidates this.

@Riker This produces pixels. The holding thing is because Scratch by default runs at the screen refresh rate, so it takes a bit to detect that the mouse is down.

I highly doubt it does pixels, as I can see antialiasing around the edges.

Pen size is set to 1 by default which is 1 pixel. I can't control the antialiasing as it is automatically applied.

This is not 10 Scratch bytes, according to the scoring we currently use.

You should probably use the scratchblocks app to convert to text, or the SB2 file size.

I'm using the scoring that I used with earlier Scratch answers. Can someone please link me to the current scoring? @Okx

@Mendeleev I'm not certain, but he's probably referring to this Scratch scoring system.

@FreeAsInBeer That is the top voted answer on the meta question

HTML + JavaScript (ES6), 66 64 62 bytes
HTML
<canvas id=c>

JavaScript
onclick=e=>c.getContext`2d`.fillRect(e.x,e.y,1,1)

Saved 2 bytes thanks to Gustavo Rodrigues and 2 bytes from Shaggy.

onclick=e=>c.getContext`2d`.fillRect(e.x,e.y,1,1)
/* This css isn't needed for the program to work. */
*{margin: 0}
#c{border:1px solid black}
<canvas id=c>

How about <canvas id=c>?

This actually puts the dot not where my cursor goes, but to the bottom right of the arrow. Is this intentional?

Save 2 bytes by dropping the c. from the start of your JS. @Anoplexian, that's the default body margin throwing things off by a few pixels.

How do I make this work? I'm clicking in the result area and it's not doing anything.

And you can save a 3rd bytes by omitting the closing > from your HTML.

@Shaggy Thanks for both the suggestions, but dropping the > from the html didn't seem to work.

That seems to be something particular to Stack Snippets; if you give it a try on JSFiddle, for example, it'll work.

@Anoplexian That's a known issue; there's no reliable way to get the relative position of the mouse cursor on an element (short of large, browser-specific functions that fail when a new type of CSS padding is introduced).

C + Win32, 209 200 195 178 159 bytes

2022 Update: Saved 19 bytes by removing #include <windows.h>.

short m[9];main(h){for(h=CreateWindowExA(0,"EDIT","",1<<28,0,0,199,199,0);GetMessageA(m,h,0,0);m[4]^513?DispatchMessageA(m):SetPixel(GetDC(h),m[12],m[13],0));}

Thanks, Cody and Quentin! I was hoping to get rid of the #include <windows.h> but this leads to all sort of errors. At least it is working correctly with multiple monitors...
Saved 17 bytes thanks to inspiration by @c--!!!

I can't test right now, bu I think you can merge the declaration of h into the for initializer to save two bytes :)

I realize this is code golf and it may be desirable here, but LOWORD and HIWORD are not the correct way to extract cursor coordinates from a packed LPARAM. You should be using GET_X_LPARAM and GET_Y_LPARAM, otherwise you will get wrong results with multiple monitors.

@Quentin, that will work in c++ but not in c. I could have used c++ but then I would have written int main which would have added 4 more bytes.

@Cody, Fair comment. I don't have a multi monitor system to test but do you think using (short)LOWORD() and (short)HIWORD() would solve the issue?

What Quentin suggested works fine in any modern version of C, including C99. Of course, you are using Microsoft's C compiler, which is stuck back in C89/90, with its demented variable scoping rules. C89 is also why you're allowed to omit the main function's return type (because of the implicit-int rule). Only problem is, omitting the return 0; causes undefined behavior in C89 and MSVC. In C99 and C++, you need a return type for main, but the return 0; is implicit and thus unnecessary. Well, the language wasn't made for code golfing. :-)

And sure, an explicit cast to signed short will work. The deal is just that the coordinates are actually signed values, but the LOWORD and HIWORD macros treat them as unsigned values, which means you'll get incorrect coordinates when you have multiple monitors, since the virtual desktop always has the origin (0, 0) at the top-left of the primary monitor, and if a secondary monitor is to the left of and/or the top of the primary monitor, it will have negative coordinates. But (short)LOWORD is not only less readable/idiomatic than the recommended macro, but is also more characters!

@CodyGray yep, didn't realize that this was probably MSVC. Note that GCC is great for golfing, as it can accept a mixture of pretty much every C dialect without complaining too much.

I'm not certain, but I think I saw someone drawing pictures on the console before.

I'm surprised that no one is more concerned with the blinking caret in the window :-)

There shouldn't be a blinking caret. In fact, there shouldn't be a command prompt appearing at all. If there is, that suggests that you have the linker misconfigured. You shouldn't be targeting the Console subsystem; you are creating a Win32 app.

Processing, 98 79 bytes
19 bytes saved thanks to @dzaima
void setup(){background(-1);}void draw(){if(mousePressed)point(mouseX,mouseY);}

Explanation (outdated)
void setup() {
  size(100,100);            // size of the sketch
  background(-1);           // set the background to white
                            // 1 byte shorter than background(255);
}

void draw(){}               // required for mousePressed to work

void mousePressed() {       // function that is called whenever the mouse is pressed
  point(mouseX, mouseY);    // draw a point at the mouse's coordinates
                            // the colour is set to black as default
}

@dzaima I did not know the size(100,100); does not have to be mentioned, thanks! (also I don't know why I did not see the if(mousePressed) bit)

Haskell, 189 184 170 169 bytes
import Graphics.Gloss.Interface.Pure.Game
main=play FullScreen white 9[]Pictures(#)(\_->id)
EventKey(MouseButton LeftButton)Down _(x,y)#l=Translate x y(Circle 1):l
_#l=l

This uses the Gloss library (v1.11). It opens a full screen window and paints black pixels (in fact circles with radius 1) by pressing the left mouse button. Press ESC to exit.
How it works:
play                 -- handles the whole event handling, screen update, etc. process
    FullScreen       -- use a full screen window
    white            -- use a white background
    9                -- 9 simulation steps per second (see simulation handler below)
    []               -- the initial world state, an emtpy list of circles
    Pictures         -- a function to turn the world state into a picture.
                     -- The world state is a list of translated circles and
                     -- "Pictures" turns this list into a single picture
    (#)              -- event handler, see below
    (\_->id)         -- simulation step handler. Ignore time tick and return the
                     -- world state unchanged. More readable: "\tick world -> world"

EventKey ... # l=... -- if the left mouse button is pressed, add a circle with
                     -- radius 1 translated to the current position of the mouse
                     -- to the world state
_#l=l                -- on all other events do nothing

Edit: @ceased to turn counterclockwis told me about the newst version of gloss which saves 5 bytes when using full screen windows. Thanks!

FullScreen is nullary in gloss>=1.11, reducing the score by 5. (I'm getting an error unknown GLUT entry glutInit though, but probably my glut setup just doesn't work; never used it on this machine.)

@ceasedtoturncounterclockwis: ah, thanks for the hint. I had 1.10.2.3 on my system and now updated to the latest version.

JavaScript ES6, 126 bytes
Tested in chrome.
onclick=e=>document.body.outerHTML+=`<a style=position:fixed;top:${e.y}px;left:${e.x}px;width:1px;height:1px;background:#000>`

Try it online!

onclick=e=>document.body.outerHTML+=`<a style=position:fixed;top:${e.y}px;left:${e.x}px;width:1px;height:1px;background:#000>`

SmileBASIC 2, 52 51 bytes
This one runs in SmileBASIC's daddy, Petit Computer (and is one two byte shorter.)
PNLTYPE"OFF
GPAGE 1GCLS 15@A
GPSET TCHX,TCHY
GOTO@A

Explanation:
PNLTYPE"OFF       'turn off keyboard
GPAGE 1           'set graphics to lower screen
GCLS 15           'clear with color 15 (white)
@A                'loop begin
GPSET TCHX,TCHY   'set black pixel at draw location
GOTO@A            'loop

You can save 1 byte by doing GPSET TCHX,TCHY:GOTO@A since the default color is 0 (transparent).

Javascript + jQuery 138 bytes
d=$(document.body).click((e)=>d.append("<div style='background:black;width:5;height:5;position:fixed;top:"+e.pageY+";left:"+e.pageX+"'>"))

Check it out online!
Adding click and drag support would be simple, you'd set a variable, however, per the instructions and to shorten code, it is not supported, "Anytime the mouse is pressed down, change the pixel that the mouse is on to black".  I interpretted the instruction as a click event.

Hiya! Next time, you should undelete your old answer instead of making a new answer. Also, I'm afraid that this must work in a specified environment--if this is vanilla javascript, you'll have to include the byte count of jQuery with your submission. You could call this submission "JavaScript + jQuery", and that would be fine: there you could assume jQuery is installed. As this answer currently stands, its more of a "HTML" answer,n ot a javascript one.

@ConorO'Brien I'll make sure to do that next time.  I updated the answer using your suggestions.

SpecBAS - 61 59 bytes
1 CLS 15
2 IF MOUSEBTN=1 THEN PLOT MOUSEx,MOUSEy
3 GO TO 2

Black is already the default pen colour, but the background is usually a nasty shade of grey, so CLS 15 sets it to bright white.

Most Basic variants don't require a space between the command number and the code on that line.

SpecBAS adds all the spaces after you hit return (including GOTO becoming GO TO)

But can you remove the spaces, and still have it run fine? If so, you don't count them.

If the user doesn't mind only painting with black, why would he mind a grey background?

Clojure, 91 71 bytes
-20 bytes thanks to @cfrick for pointing out that I can use use to shrink my importing.
(use 'quil.core)(defsketch P :mouse-dragged #(point(mouse-x)(mouse-y)))

Uses the Quil library. Draws a dot whenever the mouse is dragged.
Basically the Processing answer, since Quil is a Processing wrapper for Clojure.
(q/defsketch P ; Start a new drawing

             :mouse-dragged ; Attach a mouse drag listener
             ; that draws a point at the current mouse location
             #(q/point (q/mouse-x) (q/mouse-y)))

71: (use 'quil.core)(defsketch P :mouse-dragged #(point(mouse-x)(mouse-y)))

@cfrick LOL, I always forget about use because it's "not proper". Thank you.

Tcl/Tk, 45 46 51 57
gri [can .c]
bind . <1> {.c cr o %x %y %x %y}

That is one fugly pentogram

@JohanduToit: Don't you like stars?

SmileBASIC, 70 58 53 Bytes
XSCREEN 4GCLS-1@L
TOUCH OUT,X,Y
GPSET X,Y+240,0GOTO@L

Explained:
XSCREEN 4 'display one graphics page on both screens
GCLS -1 'fill screen with white
@L 'loop
TOUCH OUT,X,Y 'get touch location
GPSET X,Y+240,0 'draw black pixel at touch position, offset by the height of the top screen.
GOTO @L 'loop

Excel VBA, 62 Bytes
Anonymous VBE immediate window function that allows the user to draw on the any sheet by simply selecting it
Cells.RowHeight=48:Do:DoEvents:Selection.Interior.Color=0:Loop

Sample Output

TI-Basic, 1 byte
Pt-Change(

I'm sure that most of you with TI calcs thought of the Pen command, but it turns out that it's not tokenized so it would make most sense to count that as 3 bytes. You can read about the interactive version of Pt-Change( at http://tibasicdev.wikidot.com/pt-change

This does not answer the challenge: TI calcs can’t handle mouse input, as far as I know.

@Grimy If you insist you can always use the usb8x library to get USB mouse input instead. But I'm sure that the default cursor navigation will suffice.

Python2 and Python3, 82 bytes (or 77?)
from turtle import *;up();onscreenclick(lambda x,y: goto(x,y)or dot(1));mainloop()

Using the Turtle module, this isn't too bad :)
Ungolfed:
import turtle
turtle.up()

def fun(x, y):
    turtle.goto(x,y)
    turtle.dot(1)

turtle.onscreenclick(fun)
turtle.mainloop()

If it's OK to have lines between the dots, you can actually save 5 bytes:
from turtle import *;onscreenclick(lambda x,y: goto(x,y)or dot(1));mainloop()

from turtle import *;up();onclick(lambda *x:goto(*x)or dot(1));done()

That's 70 bytes

Java 7, 353 bytes
import java.awt.*;import java.awt.event.*;class M{static int x,y;public static void main(String[]a){Frame f=new Frame(){public void paint(Graphics g){g.drawLine(x,y,x,y);}};f.addMouseListener(new MouseAdapter(){public void mousePressed(MouseEvent e){x=e.getX();y=e.getY();f.repaint(x,y,1,1);}});f.setBackground(Color.WHITE);f.resize(500,500);f.show();}}

Ungolfed:
import java.awt.*;
import java.awt.event.*;

class M {
    //store the last point
    static int x, y;
    public static void main(String[] a) {
        Frame f = new Frame() {
            @Override
            public void paint(Graphics g) {
                g.drawLine(x, y, x, y);
            }
        }
        f.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                x = e.getX();
                y = e.getY();
                //repaint only the "new pixel"
                f.repaint(x, y, 1, 1);
            }
        });
        //default background is grey
        f.setBackground(Color.WHITE);
        f.resize(500, 500);
        f.show();
    }
}

Lua (love2d Framework), 180 bytes
golfed version
l=love v,g,m,p=255,l.graphics,l.mouse,{}d=m.isDown function l.draw()g.setBackgroundColor(v,v,v)if d(1)or d(2)then p[#p+1],p[#p+2]=m.getPosition()end g.setColor(0,0,0)g.points(p)end

ungolfed
l=love
v,g,m,p=255,l.graphics,l.mouse,{}
d=m.isDown
function l.draw()
  g.setBackgroundColor(v,v,v)
  if d(1)or d(2)then
    p[#p+1],p[#p+2]=m.getPosition()
  end
  g.setColor(0,0,0)
  g.points(p)
end

quite easy how it works.
First a few initialisations to make things shorter.
After it it will check the mous is clicked and saves the points to the array.
After that it draws the points.Also it sets the color to white& black cause default is the other way around :)
And here comes the picture:

Believe it or not, I came here to post an answer using Love2d as I only recently found out about it and love it, so +1 for the nice effort! Anyway, I think you can shorten it down a bit more as like this: l=love v,g,m,p=255,l.graphics,l.mouse,{}function l.draw()g.setBackgroundColor(v,v,v)if m.isDown(1)then p[#p+1],p[#p+2]=m.getPosition()end g.setColor(0,0,0)g.points(p)end which results into 169 bytes!

I came here kind of the same reason, nice to see that there are other people out here who know it :D  Thank you :)

HTML + CSS + JavaScript (ES6), 8 + 31 + 64 = 103 bytes
Fun with CSS box-shadow!

s='0 0 0',onclick=e=>p.style.boxShadow=s+=`,${e.x}px ${e.y}px 0`
*{margin:0;width:1px;height:1px
<p id=p>

HTML + CSS + JavaScript (ES6), 8 + 22 + 69 = 99 bytes
This one attempts to offset the default margin of the <body> element, but it may be different across browsers and user agent stylesheets. Tested successfully in Chrome.

s='0 0 0',onclick=e=>p.style.boxShadow=s+=`,${e.x-8}px ${e.y-16}px 0`
*{width:1px;height:1px
<p id=p>

HTML + CSS + JavaScript (ES6), 8 + 18 + 69 = 95 bytes
Pixels in this one may appear bigger as they are drawn at half-pixel coordinates.

s='0 0 0',onclick=e=>p.style.boxShadow=s+=`,${e.x}px ${e.y}px 0 .5px`
*{margin:0;width:0
<p id=p>

HTML + Javascript, 152 148 bytes
<body onclick="document.body.innerHTML+='<x style=position:fixed;width:1;height:1;left:'+event.clientX+';top:'+event.clientY+';background:#000;>'"/>

Turing, 77 bytes
var x,y,b:int loop mousewhere(x,y,b)if b=1then drawdot(x,y,1)end if end loop

Ungolfed:
var x,y,b : int
loop
  mousewhere(x,y,b)  % Set (x,y) to mouse co-ords, and b to 1 or 0 indicating if the button is pressed
  if b=1 then
    drawdot(x,y,1)  % Draw a black pixel at (x,y)
  end if
end loop

Processing, 65 bytes
void draw(){if(mousePressed)line(mouseX,mouseY,pmouseX,pmouseY);}

glslsandbox 232 bytes
Old post but found this interesting.
Since processing already been done I decided to do something different.
This draws whether the mouse is pressed or not, so not what pydude asked for but almost.
#ifdef GL_ES
precision lowp float;
#endif
uniform float time;uniform vec2 mouse,resolution;uniform sampler2D t;void main(){vec2 f=gl_FragCoord.xy,r=resolution;gl_FragColor=vec4(time<2.||length(f-mouse*r)>2.&&texture2D(t,f/r).x>.1);}

Try it on glslsandbox

Processing, 93 bytes, 91 bytes if spaces don't count
void setup(){size(100,100);background(-1);}void draw(){if(mousePressed) point(mouseX,mouseY);}

In PPCG, if not mentioned in the challenge, spaces and everything count as normal (as bytes in the encoding of choice, by default UTF-8). So your score would be 92 bytes as the 1st space can't be removed without breaking the program, but the second space can be safely removed.

UCBlogo with wxWidgets, 65 bytes
setbg 7
setpc 0
ht
pu
make "buttonact[setpos clickpos pd fd 1 pu]

Explanation (the code assigned to the variable buttonact is executed on each button click):
SetBackground 7 ; white
SetPenColor 0 ; black
HideTurtle
PenUp
make "buttonact [
  SetPos ClickPos
  PenDown
  Forward 1
  PenUp
]

At least, I think this works. It should according to the documentation, but apparently the buttonact variable only works in a wxWidgets build and I'm struggling to build UCBLogo with wxWidgets on a modern Linux (waddyamean you can't cast a pointer to int and back?).
UCBlogo without wxWidgets, 73 bytes
To see the intended effect, you can run this longer version with an infinite loop.
setbg 7 setpc 0 ht pu
while[1=1][setpos mousepos if[button?][pd] fd 1 pu]

But this crashes ucblogo on my machine... Looks like a race condition.
UCBlogo, actually working on my machine, 80 bytes
setbg 7 setpc 0 ht pu
while[1=1][setpos mousepos if[button?][pd] fd 1 pu wait 1]

APL (dzaima/APL), 37 bytes
P5.draw←{P5.Lm.p:P5.G.pt P5.mx P5.my}

Try it online!
Machine code is OP.

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


text:
Finding the center point between two points on a plane
Challenge:
To take two points on the plane and figure out the position of the point that's a) on the line that connects them, and b) equally distant from each of the original points.
Example:
(0,0), (3,3) -> (1.5,1.5)

(-1,-1), (1,1) -> (0,0)

(-7,3), (2,-2) -> (-2.5,0.5)

(3, 1), (-5,9) -> (-1,5)

Rules:

The input and output can be a tuple, array, list, or any other type of sequence.
There must be two inputs, each representing a point.
The output has to support floating point numbers.

Shortest solution in bytes wins.

Some more test cases would probably be a good idea. Maybe ((-2,3), (5,4)), ((-7,-5),(-7,-5)) would be a good start.

May input be two complex numbers? May output be a complex number?

Is there any relevance of the "on a plane" part? Any two arbitrary points share infinitely many planes, and the desired point is shared by all of them.

@JulianWolf I take "point on a plane" to signify a 2d coordinate system.

@Sparr: that makes sense, thanks. I guess my mind treats "on a plane" as being distinct from "on the plane". (This is probably due to me not talking to enough actual mathematicians.)

contrast to "point on a line" or "point in a volume/space"

Can we take input as a list containing both pairs?

@Riker. No, there must be two input values, each representing a single point.

Jelly, 7 2 bytes
-5 bytes (ha ha, yes I am an idiot) thanks to FryAmTheEggman!
+H

Takes two lists each of length d and returns one list of length d where d is the dimensions of the Cartesian space (question is posed for 2 dimensions, but should work for any d).
Try it online!
How?
+H - Main link: a, b (lists of coordinates)
+  - add (vectorises across the dimensions)
 H - halve (vectorises across the result)

Mathematica, 4 bytes
Mean

Works on lists of vectors: for example, Mean[{{-7, 3}, {2, -2}}] returns {-5/2, 1/2}. (If the input consists of floating-point numbers, so will the output.)

Python 3, 39 35 bytes
lambda*x:[sum(a)/2for a in zip(*x)]

Try it online!

If you place an * before the first x (for 0 bytes) it will actually take multiple (and variable) arguments rather than the single (wrapped) list.

@JonathanAllan Thanks! I didn't know that was possible, but it does look neater and more clean.

Haskell, 22 19 bytes
zipWith$((/2).).(+)

Can be called with (zipWith$((/2).).(+)) (p1::[a]) (p2::[a]) where a is any type deriving Fractional. Works in arbitrary dimensions.

TI-BASIC, 8 bytes
.5(L₁+L₂

Takes input on List 1 and List 2. Works for all dimensions.

Julia 0.6, 13 bytes
(x->x/2)∘(+)

Common Lisp, 70 54 49 bytes
Thanks to @Julian Wolf for helping to save a bunch of bytes!
(defun f(a b)(mapcar(lambda(c d)(/(+ c d)2))a b))

Try it online!

car and cadr can shave a bunch of bytes off of those calls to nth. mapcar is also your friend.

@JulianWolf Thanks! I don't really know Lisp, so that was of a lot of help.

No problem! LISP is super duper awesome once you get the hang of it. The next step would be putting both operations into a single lambda—no need to call mapcar separately for addition and division.

JavaScript , 30 bytes
valid for any number of dimensions
a=>b=>a.map((c,i)=>(c+b[i])/2)

Try it online!

R, 22 bytes
As an unnamed function that takes 2 vectors as parameters.  Simply returns the mean of input vectors the same as a lot of answers.
function(a,b)((a+b)/2)

Try it online!
And 16 bytes using the pryr library
pryr::f((a+b)/2)

Python + NumPy, 18 bytes
lambda a,b:(a+b)/2

Works in two dimensions for points inputted as imaginary numbers, or (since OP specifies that inputs must be taken as sequences) in arbitrary dimensions for points inputted as NumPy arrays.
Try it online!

Thanks for the TIO link, @Riker! I really ought to get into the habit of adding those.

Math.JS, 14 bytes
f(a,b)=(a+b)/2

Creates function f which takes 2 One Dimensional Matricies as input.
As expected, this just adds the two, then halfs the result.
Try it!

Julia, 13 bytes
a->b->(a+b)/2

Call with currying syntax, i.e. (a->b->(a+b)/2)([1,2])([3,4]).

Shoot, didn't see that you'd beat me to this one

@JulianWolf it's not a problem! Yours is actually a byte shorter, so you can definitely leave it up. I don't even have v0.6, so I think tha'ts pretty cool.

Yeah, I'm definitely leaving the composition solution up (they seem sufficiently different); there's no need for the two equivalent v0.5 solutions to stay though

Not familiar with Julia specifically, but could you save a byte with currying to a->b->(a+b)/2?

@Cyoce yes, thanks!

Python + NumPy, 17 bytes
lambda a:sum(a)/2

A slightly less boring version of the other python answer. Takes args as 1 numpy array, containing both pairs.
Try it online!

Does this not work in normal Python?

@Cyoce Python doesn't support division across a vector.

nvm. I see it now.

source: Stack Exchange

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

sort: votes


text:
Connect Four Validator
Introduction
Connect Four is a game where you attempt to get four in a row: horizontally, vertically, or diagonally.  In this code golf, we will be trying to find who won, given a game board.  There will always be one winner, and only one winner.

Task
Given a Connect Four board, figure out who the winner is: X or Y.  There will always be one winner, and only one winner.  The board size will always be 6 by 7 like how the game board is in the in picture.
Given a board the following board, in this instance, X is red and Y is blue:

Your input would be:
OOOOOOO
OOOOOOO
OOOOOOO
OOOOXOO
OOOXXOO
OOXYYYY

You can separate rows of the game by newline character (like above), no dividing character, divide the rows into an array or list, or you can input a matrix of characters.
Correct output for this example:
Y

Y has four in a row; so, Y is the winner. So, we output Y.

Test cases
Input:
OOOOOOO
OOOOOOO
OOOOOOO
OOOOOOO
OOYYOOO
OYXXXXO

Output:
X

Input:
OOOOOOO
OOOOOOO
OOOOOOO
XXXXOOO
YXYYOOO
YXYYXYX

Output:
X

Input:
YXYYXOO
XYXXYOO
XXXYYOO
YYYXXOO
XXYYYYO
XXYYXXO

Output:
Y

Input:
OOOOOOO
OOOOOOO
OYOOOOO
OOYOOOO
OOOYOOO
OOOOYOO

Output:
Y

Input:
OOOOOOO
OOOOOOO
OYOOOOX
OOYOOOX
OOOXOOX
OXOXYOX

Output:
X

Scoring
Least number of bytes wins!

This is the perfect challenge for PMA/Snails https://codegolf.stackexchange.com/questions/47311/language-design-2-d-pattern-matching/47495#47495

@nfnneil Maybe I will make a bounty for an answer in PMA/Snails ...

Can we assume that the winner will always have one more token than the loser?

@mathjunkie I was wrong, you can't assume that.

@nfnneil does the output have to be X or Y or can we choose two other consistent outputs to indicate the winner?

Can we choose to use other characters as input? Or to input a numeric matrix?

Can we assume the four pieces of each colour will be in a connected set?

Related.

Almost a duplicate. It looks somewhat different, but the main body of the solution is going to be rather similar in both languages. I'm not confident enough that this is a duplicate to put in a close vote, but think this might be worth extra eyes.

Jelly, 19 bytes
UŒD;ŒD;Z;ṡ€4;/ṢEÞṪṪ

Try it online!
The core of this answer is copied from my answer to this very similar question.
Explanation
UŒD;ŒD;Z;ṡ€4;/ṢEÞṪṪ
   ;  ; ;             Append {the input} and the following three values:
UŒD                     the antidiagonals of {the input};
    ŒD                  the diagonals of {the input};
       Z                the transposed {input}.
         ṡ 4          Find all length-4 substrings
          €             of each subarray within that.
            ;/        Flatten one level.
                Þ     Sort, with the following sort order:
               E        If all elements are the same, sort later.
              Ṣ         Tiebreak via lexicographical order.
                 ṪṪ   Take the last element of the last element.

Fairly simple: we take all rows, columns, diagonals, and antidiagonals (just as in the n-queens validator), then take all length-4 substrings of those, then sort them in such a way that the winning line of 4 sorts to the end. (We need the tiebreak in case there's an OOOO in addition to the XXXX or YYYY.) Take the last element of the last element, and that'll be X or Y as required.

Retina, 51 48 bytes
 Thanks to Martin Ender for saving 3 bytes
M`X((.{6}X){3}|(.{8}X){3}|(.{7}X){3}|XXX)
T`d`YX

Try it Online!
Takes input as a comma-separated list of rows

You can save a few bytes by using a match stage and shortening (.{7}X){3}|XXX to (.{7}X|X)\4\4: https://tio.run/nexus/retina#fc4xCsMwDAXQPfcI2GC6NDS5QaeipcP/kMFDbpH47K4sJQQCqZdnf76E@/DO9ZMRwmN9FcT1WTa9Tud1LNgQ52EeYvfNSyZqJUiIJBBgU2lSY8v1qYGpQSd@0lWdQ5M27urO2/6p94W24W8fLlz72N5HupO2Xg5/

@MartinEnder I don't see how you can use \4 - you want to repeat the effect of the .{7}, not the matched string. (And balancing groups would probably be far too long.)

@Neil oh yeah, nevermind, somehow I didn't consider that there are other OXY cells than the match in the grid. using the match stage still saves 3 bytes then.

Javascript (ES6), 54 55
Edit 1 byte saved thanks @Arnauld
I just check if X is the winner, as There will always be one winner, and only one winner
Input is a string with any separator, like in @Arnauld's answer

F=
b=>'YX'[+[0,6,7,8].some(x=>b.match(`X(.{${x}}X){3}`))]

;['OOOOOOO OOOOOOO OOXOOOO OOXOOOO OOXOOOO OOXOYYY'
 ,'OOOOOOO OOOOOOO OOXOOOO OOYXOOO OOYOXOO OOYYOXY'
 ,'OOOOOOO,OOOOOOO,OOOOOOO,OOOOOOO,OOYYOOO,OYXXXXO'
 ,'OOOOOOO,OOOOOOO,OOOOOOO,XXXXOOO,YXYYOOO,YXYYXYX'
 ,'YXYYXOO,XYXXYOO,XXXYYOO,YYYXXOO,XXYYYYO,XXYYXXO']
.forEach(s => console.log(s,F(s)))

JavaScript (ES6), 77 76 69 bytes
Saved 7 bytes thanks to Neil
Takes input as a something-separated string, where something is basically any character.
b=>[...'XXXXYYYY'].find((c,i)=>b.match(`(${c}.{${(i%4+6)%9}}){3}`+c))

Test cases

let f =

b=>[...'XXXXYYYY'].find((c,i)=>b.match(`(${c}.{${(i%4+6)%9}}){3}`+c))

console.log(f("OOOOOOO,OOOOOOO,OOOOOOO,OOOOOOO,OOYYOOO,OYXXXXO"))
console.log(f("OOOOOOO,OOOOOOO,OOOOOOO,XXXXOOO,YXYYOOO,YXYYXYX"))
console.log(f("YXYYXOO,XYXXYOO,XXXYYOO,YYYXXOO,XXYYYYO,XXYYXXO"))

Why not use b.match()? Should save on the RegExp call.

@Neil I totally forgot that match() was doing an implicit conversion to RegExp. Thanks!

Jelly, 25 22 bytes
ŒgL⁼¥Ðf
;UŒD€;Z;$ç€4FṀ

Takes a list of strings (or list of list of characters) formed of X, Y, and O (would also work with replacements such that the space has a lower ordinal than both counters).
Try it online! or run an augmented version that takes a multiline string.
How?
ŒgL⁼¥Ðf - Link 1, runs of given length: list A, length B  e.g. "XYYYXXO", 4
Œg      - group runs of equal elements of A                     ["X","YYY","XX","O"]
     Ðf - filter keep:
    ¥   -     last two links as a dyad:
  L     -         length                                         1   3     2    1
   ⁼    -         equal to B?         (none kept in this case->) 0   0     0    0

;UŒD€;Z;$ç€4FṀ - Main link: list of list of chars (or list of stings) I
 U             - reverse each row of I
;              - I concatenated with that
  ŒD€          - positive diagonals of €ach (positive and negative diagonals)
        $      - last two links as a monad:
      Z        -     transpose of I (i.e. the columns)
       ;       -     concatenated with I (columns + rows)
     ;         - concatenate (all the required directional slices)
         ç€4   - call the last link (1) as a dyad for €ach with right argument = 4
            F  - flatten the result
             Ṁ - take the maximum ('Y'>'X'>'O') - this has the bonus effect of returning:
                               'Y' or 'X' for a winning board; and
                               'O' or '' for a (valid) game in progress.

Python 2, 143 bytes
m=input()
u=[r[::-1]for r in m]
print"YX"[any(any('X'*4in''.join(t[i][j-i]for i in range(j+1))for j in range(6))for t in(m[::-1],m,u,u[::-1]))]

Takes a list of strings or a list of list of chars. Hard-coded for 6 rows by 7 columns, as the specification guarantees.
Try it online!

K (ngn/k), 45 bytes
{"YX"@|//{&/'(x;+x),x@'/:|:\!4}''+'4'4''~2!x}

Try it online!
Takes a matrix of characters and returns one of X or Y. If simplified I/O is allowed (0, 1, 2 for X, O, Y for input and boolean for output), I can remove 2! from preprocessing and "YX"@ from postprocessing, giving 38 bytes.
How it works
{"YX"@|//{&/'(x;+x),x@'/:|:\!4}''+'4'4''~2!x}   x: matrix of chars
~2!x       for each char, convert X to 1 and O/Y to 0
+'4'4''    extract all 4x4 sub-matrices using size-4 windows
{...}''    for each submatrix...
|:\!4        (0 1 2 3;3 2 1 0)
x@'/:        for each row of above, extract one element from each row of x
             which gives the diagonal and the antidiagonal of x
(x;+x),      prepend x and transpose of x
&/'          reduce each by boolean AND
             x -> vertical test, +x -> horizontal test
|//        repeat reducing by boolean OR until only one value remains
"YX"@      convert 1 to X and 0 to Y

-3: trainify by removing { x}

PHP, 71 Bytes
echo preg_match('#X(XXX|(.{8}X){3}|(.{7}X){3}|(.{9}X){3})#',$argn)?X:Y;

Online Version

Python 2, 201 143 129 128 107 Bytes
I decided to add horizontal, vertical, and diagonal together into one list and then add increment then look for X for times in it. And since there will always be a winner, I can assume Y won if X doesn't.  This codes takes a matrix of all the different pieces and empty places.
lambda m:"YX"[any("X"*4in"".join(a)for a in zip(*m)+m+zip(*["0"*(7-i)+m[i]+"00"*i+m[i]for i in range(6)]))]

Try it online!
Credits

From 129 to 107 bytes by ASCII-only.

It's perfectly acceptable to self-answer.

Without looking too much at it, there seems to be useless whitespaces at: i:] for, i, r, r] for and 1 for.

@TuukkaX Thanks for the input, updated.

Also, *(len(m)-1) could be *~-len(m). How it works.

The ] for and 1 for are still there.

@TuukkaX fixed.

As the size of the the field is fixed, you can can replace ["0"]*~-len(m) by ["0"]*7. Then you can combine these lines in a single lambda expression. Additionally use in instead of find to check whether a string is contained in another string. Tio

Useless space after lambda m,b:  as well

@ASCII-only Thanks and updated.  Have a good one.

also, invalid - AFAICT you don't have a second input, and you can't pass a second input to the function if the question doesn't say so. so... back to 128 i guess?

@ASCII-only lol, did not notice that.  Thanks for trying.

@ASCII-only How did you do it?  Good job, thanks again.

Let us continue this discussion in chat.

PowerShell, 66 65 58 54 bytes
I just check if X is the winner, as There will always be one winner, and only one winner. Thanks to edc65.
Input is a string with no dividing character. Thanks to Arnauld.
param($b)'YX'[1-in(0,5,6,7|%{$b-match"X(.{$_}X){3}"})]

Try it online!

Python 3, 105 90 81 80 bytes
Regex based. Lines are space separated. Saved 9 bytes thanks to @Lynn.
Saved 1 byte by utilizing the fact that there is a guaranteed match. So if there's no win for X then there must be a win for Y.
lambda x:re.findall('X(XXX'+'|(.{%d}X){3}'*3%(6,7,8)+')',x)and'X'or'Y'
import re

Try it online!

I think you can do something like: lambda x:re.findall('(X|Y)(z'+'|(.{%d}\\1){3}'*4%(0,6,7,8)+')',x)[0][0]

@Lynn Good catch! Thanks. Saved 9 bytes.

Zsh, 207 ... 158 bytes
Version history: 4 iterations for ~25 bytes first week; then 3 more iterations for ~25 bytes 6 months later, 1 more for 1 byte 11 months later.
t(){a=($^a-$^@_);for s l (${w:^^argv}){s+=$l;i=;repeat $#s a[++i]+=$s[i+1];}}
w=(+)
t $@
for s;w[++j]=${(l:j:)}_
t $@
t ${(Oa)@}
[[ $a = *XXXX* ]]&&<<<X||<<<Y

(first)
(second)
(third)
(fourth)
(fifth)
(sixth)
(seventh)

(eigth)
In the footer, I print both the input board and the array we build from it to stderr. Scroll down to debug to see them. The array we build is a lot longer now, since t does a cartesian product with input board on every call. (Hey, it shortened the code by a few bytes.)
There's a lot to cover here, so I moved the (sixth edition) comments to an annotated gist.
(tl;dr: concatenate transpositions of the original array, but make sure to keep them separated)

K (ngn/k), 58 55 56 bytes
{"XY"@|/&/'88<x ./:/:,/{x+/:/:+3+[4#1-+!3 3;]\&4}'+!6 7}

Try it online!
{ } function with argument x
+!6 7 all possible pairs of 0..5 and 0..6
{ }' for each of them do
4#1-+!3 3 are 4 of the 8 ortho-diagonal directions: (1 1;1 0;1 -1;0 1)
3+[ ]\&4 start with a list of four zeroes (&4) and make 3 steps in each of the directions
x+/:/: start from each possible position and take the steps in each possible direction
,/ concatenate. at this point we have a matrix of 4-lists of coordinate pairs, some of them extending beyond the board
x ./:/: look up the corresponding cells from x
88< which of them are "Y"-s? (88 is the ascii code of "X")
&/' which 4-lists consist only of "Y"-s? (and-reduce-each)
|/ is there at least one such? (or-reduce)
"XY"@ if false return "X", if true return "Y"

05AB1E (legacy), 29 26 25 bytes
í‚εεÐм«NFÁ]€ø`IIø)J»γ4ùSà

Input as a character-matrix.
Uses the legacy version for -1 byte, since min/max also works on characters. In the new version of 05AB1E, the trailing à (maximum) should have been {θ instead (sort, keep last item).
Try it online or verify all test cases.
Explanation:
í                 # Reverse each row of the (implicit) input-list
 ‚                # Pair it with the (implicit) input-list
  ε               # Map over both matrices:
   ε              #  Map over each row:
    Ð             #   Triplicate the current row
     м            #   Remove all these characters, leaving a list of empty strings of the
                  #   same size as the row
      «           #   Merge this list of empty strings to the row
       NF         #   Loop the (0-based) row-index amount of times:
         Á        #    And rotate the row with appended empty strings towards the right
  ]               # Close the nested maps and inner loop
   €              # For both mapped matrices:
    ø             #  Zip/transpose; swapping rows/columns
                  # (we now have a list of all diagonals and anti-diagonals)
     `            # Push both lists of lists separated to the stack
      I           # Push the input again
       Iø         # And push the input, zipped/transposed
         )        # Wrap everyone on the stack into a list
                  # (we now have a list of all diagonals, anti-diagonals, rows, and columns)
          J       # Join each inner-most list of characters together to a string
           »      # Join each inner list together to a string; and then join these strings
                  # with newline delimiter
            γ     # Split everything into parts with equal adjacent characters
             4ù   # Only keep the parts of length 4
               S  # Flatten it to a list of characters
                à # And get the maximum character of this list
                  # (after which it is output implicitly as result)

Ruby, 84 bytes
Takes the board as a single continuous string with no separators. Finds a non-O character
that's in a connect-4 and returns it.
->b{b[(0..41).find{|i|b[i]!=?O&&[1,6,7,8].any?{|j|(1..3).all?{|n|b[i+j*n]==b[i]}}}]}

Try it online!

J, 42 bytes
1 e.[:,4 4(*/"1@,|:,,{~3 0+3 5*/i.@4);._3]

Try it online!
Takes input as a matrix of integers where 0 is blank, 1 is X, and 2 is Y.  Returns 1 if X wins, 0 if Y wins.

Python 3.8 (pre-release), 114 112 bytes
Using a bitboard approach to check for 4 in a row.
Input: a 2D list of integers, where 0 represents empty cell, 1 is X, and 2 is Y.
Output: a positive integer if X wins, or 0 if Y wins.
lambda L:(b:=sum(sum(zip(*(L+[[0]*7])),())[i]%2<<i for i in range(49)))*any((r:=b&b<<i)&r<<i*2for i in(1,6,7,8))

Try it online!
Explanation
The bitboard's layout is as follow (the missing positions in the last row is padded with 0):
0  8 16 24 32 40 48
1  9 17 25 33 41 49
2 10 18 26 34 42 50
3 11 19 27 35 43 51
4 12 20 28 36 44 52
5 13 21 29 37 45 53
6 14 22 30 38 46 54

This is the core of the function: given the bitboard b representing X's occupancies, check if X is winning:
any(
    # shift the board by i, 2i, 3i, 4i and and all of them together
    # if there's a set bit in the result (aka result != 0), then there is a 4-in-a-row
    (r:=b&b<<i)&r<<i*2
    # do this for all 4 directions
    # 1: vertical, 7: horizontal, 6 and 8: diagonal
    for i in(1,6,7,8)
)

This part contructs the bitboard b for X:
b:=sum(
    sum(zip(*
        (L+[[0]*7]) # append a row of 0 at the bottom of L
    ),())           # flatten L into a list, with the index correspond
                    #   to the correct position in the bitboard layout
    [i]%2<<i        # set the ith bit to 1 if the new list has X (=1) at that index
    for i in range(49)
) # sum all the set bits together to create the bitboard

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

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


text:
Palindromic Primes without 11

Every palindrome with an even number of digits is divisible by 11, so 11 is the only [palindromic prime] with an even number of digits. - David Wasserman, OEIS

I learned this today the manual way, before I did my research, when my program skipped numbers with an even number of digits (except 11) when calculating palindromic primes. Your task: create a program or function that when given an integer input N, outputs the Nth term in Stephen's Palindromic Sequence™.
Stephen's Palindromic Sequence™
Stephen's Palindromic Sequence™ starts with 11, and continues with palindromic semiprimes divisible by 11. Basically, all of the semiprimes that would be primes if 11 didn't "count." The upside is that this list contains numbers with an even number of digits! Yay. And, a lot of numbers with an odd number of digits are skipped, since they were already prime.
The beginning of the sequence:
1   : 11
2   : 22
3   : 33
4   : 55
5   : 77
6   : 121
7   : 737
8   : 979
9   : 1111
10  : 1441
11  : 1661
12  : 1991
13  : 3113
14  : 3223
15  : 3443
16  : 3883
17  : 7117
18  : 7447
19  : 7997
20  : 9119
21  : 9229
22  : 9449
23  : 10901

*Although 1331 (11^3) and similar fit the spirit of this sequence, they do not fit the rules.
Longer test cases:
26  : 91619
31  : 103301
41  : 139931
51  : 173371
61  : 305503
71  : 355553
81  : 395593
91  : 725527
101 : 772277
127 : 997799
128 : 1099901
141 : 3190913
151 : 3739373
161 : 7589857
171 : 9460649
200 : 11744711
528 : 39988993

Input
Integer N, >= 1. You can use a 0-indexed N (be sure to adjust test cases) if you specify so in your answer. Trailing newlines allowed.
Output
The Nth term in Stephen's Palindromic Sequence™. Trailing newlines allowed.
Rules

The only input your program/function can take is N. Your program cannot, for example, fetch a sequence from OEIS (aka standard loopholes apply).
You must be able to print an output up to six digits (N=127). Time is not a factor - however, if your program/function gets very long very fast, you must prove that the algorithm works. If your language naturally allows longer outputs, it you can let it expand naturally up to its limit, or cap it at ten digits, whichever you prefer. Output/termination beyond your limit does not matter, as long as it does not appear to be a valid output.
Program/function function on invalid input is irrelevant.

Related: Shortest code to find next prime palindrome

Should 11 be included? It's not semiprime.

@xnor 11 is defined as the start of the sequence. You are correct that it is not a semiprime, but the 1 is not a Fibonacci number by definition either :)

Husk, 12 bytes
!:11foṗ/11İ↔

Try it online!
!               # get element at input-th index of
 :11            # prepend 11 to
          İ↔    # palindromic numbers
    fo          # that satisfy
       /11      # when they're divided by 11
      ṗ         # the result is a prime

Python 2, 76 73 72 70 69 68 bytes
n=input();c=k=m=11
while n:m*=k/c;k+=c;n-=`k`==`k`[::~m%k-c]
print k

Thanks to @WheatWizard for golfing off 3 bytes!
Thanks to @ØrjanJohansen for golfing off 1 byte!
Thanks to @xnor and @ØrjanJohansen for paving the way to 68 bytes!
Input is 0-indexed. Try it online! or verify the first 31 test cases.
Background
Recall that Wilson's theorem states that for all integers p > 1,

meaning that (p - 1)! + 1 is evenly divisible by p if and only if p is prime.
If p > 1 is not prime, it is composite; let q be the smallest prime divisor of p. Clearly, q ≤ p/q. There are two cases:

If q = p/q, we have that p = q².
If q = 2, (p - 1)! = 3! = 6, so (p - 1)! is congruent to 2 modulo p.
If p/q = q > 2, so 2q < p. This way, q and 2q are both among 1, …, p - 1, whose product is the factorial of p - 1, so 2p = 2q² = q · 2q divides (p - 1)! evenly.
If q < p/q, q and p/q are both among 1, …, p - 1, so p = q · p/q divides (p - 1)! evenly.

Summing up,

for all integers p > 1.
Now, for all integer congruences and all integers a, b, and c, the following holds.

When a = -1, b = 11, and c = -1, we follow that

and, since 21 and -23 are congruent modulo 44 and -1 and 11p-1 are congruent modulo 11p, we arrive at the following conclusion.

For all possible values of p, the outcome (11, 21, or 11p - 1) will fall in the range 0, …, 11p - 1, so these values match those that will be returned by Python's % operator.
How it works
We initialize c, k, and m to 11 after the saving the input in n. c will be constant for the remainder of the program. Since there are three occurrences of c on the following line and assigning c costs only two bytes, this saves a byte. k can be thought of 11p using the meaning of p from the previous paragraph; initially, k = 11 = 11 · 1!. m takes the place of 11 · (p - 1)!; initially, m = 11 = 11 · 0!. k and m will satisfy the relationship m = 11 · (k/11)! at all times.
n represents the number of “Stephen's palindromes” we have to find. Since k = 11 initially, we can output k verbatim without further computation. However, when n is positive, we enter the while loop. The loop begins by multiplying m by k/c = p, then adding 11 to k, thus incrementing p. If k is a member of the sequence, we subtract 1 from n and start over. Once n reaches 0, we found the sequence member at the desired index and break out of the loop, then print the last value of k.
The expression
`k`==`k`[::~m%k-c]

performs the actual test, and it's result (True / 1 for sequence members, 0 / False otherwise) is subtracted from n. As seen before, ~m % k = (-m - 1) % k = (-11 · (p - 1)! - 1) % 11p equals 10 if p is prime, 21 if p = 4, and 11p - 1 > 43 if p > 4 is composite. Thus, after subtracting c = 11, we're left with -1 for prime p and a positive integer larger than 9 otherwise.
For prime p, `k`[::-1] gives us the string representation of k with reversed digit order, so comparing it to `k` checks whether k is a palindrome. If it is, all conditions are fulfilled and k is a sequence member. However, if p is not prime, the large range step and the fact that k will always have more than one digit mean that `k`[::-1] cannot have the same number of digits as `k`, let alone be equal to it.

I have to say, your primality test is truly brilliant.  I can't compete with this answer.

This is promising but skips 121.

@xnor Managed to include 121 at the cost of an extra byte. Thanks!

Jelly, 18 13 bytes
ṬÆẸ×©11ŒḂµ#ṛ®

For some reason, this is much slower than my initial revision, despite doing exactly the same.
Try it online!
N = 127
dennis-home:~$ time jelly eun 'ṬÆẸ×©11ŒḂµ#ṛ®' <<< 127
997799

real    1m43.745s
user    1m43.676s
sys     0m0.113s

How it works
ṬÆẸ×©11ŒḂµ#ṛ®  Main link. No arguments.

         µ     Combine all links to the left into a chain.
          #    Read an integer n from STDIN and call the chain monadically, with
               argument k = 0, 1, 2, ... until n values of k result in a truthy
               output. Return the array of all matching values of k.
Ṭ                Untruth; yield [0, 0, 0, ..., 1] (k-1 zeroes followed by a 1) or
                 [] if k = 0.
 ÆẸ              Unexponents; consider the resulting array as exponents of the
                 sequence of primes and yield the corresponding integer. For k = 0,
                 this yields 1. For k > 0, it yields the k-th prime.
   ×©11          Multiply the result by 11 and copy the product to the register.
       ŒḂ        Test if the product is a palindrome.
           ṛ®  Replace the resulting array with the integer in the register.

Brachylog, 17 bytes
:I{11|ṗ×₁₁≜.↔}ᶠ⁽t

Try it online!
This is 1-indexed.
Explanation
:I{          }ᶠ⁽t    Find the Input'th result of the following:
   11                  Output = 11
     |                 Or
          ≜.           Output is an integer…
      ṗ×₁₁             …which is the result of multiplying a prime by 11…
           .↔          …and Output reversed is still the Output

Two realizations with this answer:

I need to fix the fact that superscript passing to metapredicates (with ⁽) does not work if there is no input to pass (which is why I have to add :I).
I need to add a metapredicate to get the Nth result of a predicate (which would avoid using ᶠ⁽t and instead e.g. ⁿ⁽).

Implementing both changes would make that answer 14 bytes.

Mathematica, 65 60 bytes
n=NextPrime;11Nest[n@#//.x_/;!PalindromeQ[11x]:>n@x&,1,#-1]&

Iterates directly through primes using NextPrime and checks whether 11 times the prime is a palindrome. Works up to N = 528. The results 528 and 529 are more than 216 primes apart, at which point //. will fail to attempt a sufficient number of substitutions.

Python 2, 111 107 103 102 101 100 91 90 89 bytes
Dennis has me beaten here, so go check out his answer.
This answer is zero indexed
n=input()
r=1
while n:r+=1;c=`r*11`;n-=all(r%x for x in range(2,r))*c==c[::-1]
print r*11

Try it online!
One byte saved thanks to math junkie
Explanation
First we take input and set it to n we also make a new variable r=1.  We will count up r searching for palindromes that are the product of a prime and 11.  Each time we find one we will decrement n until it reaches 0.
So we start a the loop:
while n:

The first thing we do is increment r
r+=1

We also predefine a variable c as the string representation of r*11
c=`r*11`

Now we want to decrement n if we have found such a number.  We will simply subtract a boolean representing if r*11 fits the pattern from r.  If this is False we will subtract zero and if it is True it will subtract 1.
To calculate the boolean we do:
all(r%x for x in range(2,r))*c==c[::-1]

The first part all will determine if r is prime.  We multiply the result by c if r is prime this will just be c but if r is composite it will be "", the empty string.  We then compare this to c[::-1] which is the reverse of c.  If r is prime and c is a palindrome this will be True, if either fails the whole thing will evaluate as false.
When n is zero we simply print c.
83 bytes
Here is a recursive solution that is shorter but unfortunately doesn't meet the specs because it hits python's recursion cap too fast.
f=lambda n,r=1:n and f(n-all(r%x*(`r*11`==`r*11`[::-1])for x in range(2,r)),r+1)+11

Try it online!

05AB1E, 15 bytes
0-indexed.
11Iµ11N*DÂQNp*½

Try it online!
Explanation
11               # initialize stack with 11
  Iµ             # loop over N in [1 ... inf] until counter equals input
    11N*         # multiply N by 11
        D        # duplicate
         ÂQ      # check if the copy equals its reverse
           Np    # check if N is prime
             *   # multiply the results of the checks together
              ½  # if 1, increase counter

Haskell, 94 90 bytes
h#n|n<2=0|mod n h<1=1+h#div n h|j<-h+1=j#n
([n|n<-[0,11..],(==)=<<reverse$show n,3>2#n]!!)

Try it online! Example usage: ([n|n<-[0,11..],(==)=<<reverse$show n,3>2#n]!!) 127.
[0,11..] constructs the infinite list [0,11,22,33, ...] (the zero is needed to make the sequence 1-indexed). For each n in this list we check n==(read.reverse.show)n, that is whether n is a palindrome. 3>2#n checks if n has at most  two prime divisors. Because n is always divisible by 11, we don't get any real primes but only semiprimes.
Edit: Thanks to Ørjan Johansen for golfing 4 bytes!

You don't need parentheses around div n h. Also, it only affects efficiency, but the first 2# can probably be h#.

(==)=<<reverse$show n is shorter.

PHP, 82 Bytes
for(;$d<$argn;$i>1||($p=11*$n)!=strrev($p)?:$d++)for($i=++$n;--$i&&$n%$i;);echo$p;

Try it online!

in "try it online" where i have to write the input? if i write 1 in the box "input" it return 395593

@RosLuP Normally it runs from the command line with the -R option. In the Online Version you have limits and $argn=81; is the input variable which is available in a command line version

so one has just to write input variable in the "$argn=81" so for example if  input is 10 just rewrite it "$argn=10" ok, Thank you

@RosLuP Yes replace the number 81 with the input you wish

Axiom, 105 bytes
g(n)==(i:=c:=1;repeat(c=n=>break;i:=i+1;if(prime? i)then(x:=(11*i)::String;x=reverse(x)=>(c:=c+1)));i*11)

ungolf, test code and results
f(n)==
   i:=c:=1
   repeat
      c=n=>break
      i:=i+1
      if(prime? i)then(x:=(11*i)::String;x=reverse(x)=>(c:=c+1))
   i*11

(5) -> [[i,g(i)]  for i in 1..23]
   (5)
   [[1,11], [2,22], [3,33], [4,55], [5,77], [6,121], [7,737], [8,979],
    [9,1111], [10,1441], [11,1661], [12,1991], [13,3113], [14,3223], [15,3443],
    [16,3883], [17,7117], [18,7447], [19,7997], [20,9119], [21,9229],
    [22,9449], [23,10901]]
                                          Type: List List PositiveInteger
(6) -> [[i,g(i)]  for i in [26,31,41,101,151,200]]
   (6)
   [[26,91619], [31,103301], [41,139931], [101,772277], [151,3739373],
    [200,11744711]]

Here g(700)=92511529 so the limit would be >700; ww(1000)=703999307 but using nextPrime()


text:
Braille-ify a string

And no, This is not a dupe of Translate ASCII text to braille.

There are 28=256 Braille patterns in Unicode. (By 'Braille' I mean 8-cell ones)
W, wait. How many ASCII characters were there?
27 = 128?
Well then, Let's turn ASCII into Braille, 'cause there is absolutely no reason not to!

The way from ASCII, to Braille
We can see each cells represent a bit, which each cell is 'punched' or not.
Now we can allocate each cells to represent the bits of the ASCII character as binary.
(1  )(16 )
(2  )(32 )
(4  )(64 )
(8  )( - )

* ( - ) is blank
Now we can convert ASCII to Braille. For example, A(65=01000001) equals to ⠡.
Examples
Input -> Output
Braille! -> ⠢⠺⠱⡱⡴⡴⠵⠑
(Upscaled)
.. .o o. o. .. .. o. o.
o. oo .o .o .o .o .o .o
.o .o .o .o oo oo oo ..
.. .. .. o. o. o. .. ..

Surely a is ⠱, not ⠹ (which I think is q)?

@Neil The challenge isn't just "convert char codes + 10240 to chars." And yes, a is ⠱.

@EriktheOutgolfer I didn't suggest it was, but ⠹ would have been wrong either way, since it has the wrong number of punched cells.

@Neil Oh nice. I just recalculated and found out you're right.

Does it feel weird to anyone else that the LSB (bottom right) is left unused, rather than the MSB (top left)?

Not really. The ordering is column-major little-endian. The missing bit, which would go at the bottom right, is the MSB (bit 7, the 128s bit).

Of course for real Braille the difficulties in discerning different one-dot values should be obvious.  As for "reasons not to."  :)

@SIGSEGV : Where can I find all Unicode Braille signs ?

@Buster, you're right. I guess my brain wanted the numbers to be descending, despite the clear diagram showing otherwise in the question ¯\_(ツ)_/¯

@user7185318 The characters used in the question are <U+2822><U+283A><U+2831><U+2871><U+2874><U+2874><U+2835><U+2811>. Found using $ echo ⠢⠺⠱⡱⡴⡴⠵⠑ | iconv -t ascii --unicode-subst="<U+%04X>".

CJam, 27 26 bytes
80qf{i2b7Te[4/~\)\@+++2bc}

Try it online!
Explanation
The Braille code points are neatly ordered so that the individual dots do count up in binary. However, the ordering of the bits in the code points is different. We want the following order:
04
15
26
37

Whereas the characters are laid out in Unicode in this order:
03
14
25
67

(Which kinda makes sense, because historically, Braille only used the first six dots.) Note that we don't need the 7 dot, since the input is guaranteed to be in the ASCII range. So given a list of bits [6 5 4 3 2 1 0] of an input character, we want to reorder them into [3 6 5 4 2 1 0], to pull the bit representing the bottom-left dot to the most significant position.
80     e# Push 80... we'll need this later.
q      e# Read all input.
f{     e# Map this block onto each character, putting a copy of the 80
       e# below each character.
  i    e#   Convert the character to its code point.
  2b   e#   Get its binary representation.
  7Te[ e#   Pad it to 7 bits with zeros. We've now got some bit list
       e#   [6 5 4 3 2 1 0].
  4/   e#   Split into chunks of 4: [[6 5 4 3] [2 1 0]]
  ~    e#   Dump them onto the stack: [6 5 4 3] [2 1 0]
  \    e#   Swap them: [2 1 0] [6 5 4 3]
  )    e#   Pull off the last element: [2 1 0] [6 5 4] 3
  \    e#   Swap: [2 1 0] 3 [6 5 4]
  @    e#   Rotate: 3 [6 5 4] [2 1 0]
  ++   e#   Concatenate twice: [3 6 5 4 2 1 0]
       e#   That's the reordering done.
  +    e#   Prepend the 80. That puts it in the 2^7 position of the
       e#   binary digit list, which gives it a value of 10240, which
       e#   is where the Braille characters start.
  2b   e#   Convert the bits back to an integer.
  c    e#   Convert the code point to the corresponding integer.
}%

Clever trick with the 80.

JavaScript (ES6), 83 bytes

f=
s=>s.replace(/./g,c=>String.fromCharCode((c=c.charCodeAt())&7|c*8&64|c/2&56|10240))
<input oninput=o.textContent=f(this.value)><pre id=o>

Oh yeah, I should probably divide by 2 before taking that AND to save a byte as well.

Maybe jQuery abuse can be used?

Python 3, 98 71 66 bytes
lambda s:''.join(chr(i*8&64|i//2&56|i&7|10240)for i in map(ord,s))

Try it online!

CJam, 27 bytes
1 byte stolen from Neil.
q{i__8&8*@7&@2/56&++'⠀+}%

Try it online!
Explanation
This uses the same basic idea as my other CJam answer but uses bitwise arithmetic instead of base conversion and list manipulation to reorder the bits.
q        e# Read all input.
{        e# Map this block over each character...
  i__    e#   Convert the character to its code point and make two copies.
  8&     e#   AND 8. Gives the 4th bit, which we need to move to the 7th place.
  8*     e#   Multiply by 8 to move it up three places.
  @7&    e#   Pull up another copy and take it AND 7. This extracts the three
         e#   least significant bits which shouldn't be moved at all.
  @2/    e#   Pull up the last copy and divide by 2 to shift all bits down
         e#   by one place.
  56&    e#   AND 56. Extracts the three most-significant bits.
  ++     e#   Add all three components back together.
  '⠀+    e#   Add to the empty Braille character which is the offset for all
         e#   the code points and which converts the value to a character.
}%

PHP, 109 Bytes
foreach(str_split($argn)as$c)echo json_decode('"\u'.dechex(10240+(($d=ord($c))&7)+($d/2&56)+(($d&8)*8)).'"');

Online Version

Mathematica 100 Bytes
FromCharacterCode[10240+#~Drop~{4}~Prepend~#[[4]]~FromDigits~2&/@ToCharacterCode@#~IntegerDigits~2]&

Ungolfed:
ToCharacterCode["Braille!0"]
PadLeft@IntegerDigits[%,2]
Prepend[Drop[#,{4}],#[[4]]]&/@%
FromDigits[#,2]&/@%
FromCharacterCode[%+10240]

+60 bytes of this tied up in long function names.

Jelly, 21 bytes
O&€“¬®p‘æ.1,8,.+“'ṁ’Ọ

Try it online!
How it works
O&€“¬®p‘æ.1,8,.+“'ṁ’Ọ  Main link. Argument: s (string)

O                      Ordinal; map all characters to their Unicode code points.
   “¬®p‘               Yield the code points of the enclosed characters in Jelly's
                       code page, i.e., [1, 8, 112].
 &€                    Take the bitwise AND of each code point to the left and the
                       three code points to the right.
          1,8,.        Yield [1, 8, 0.5].
        æ.             Take the dot product of the array to the right and each flat
                       array in the array to the left.
                “'ṁ’   Yield 10240 = 250 × 39 + 239, where 39 and 239 are the
                       indices of ' and ṁ in Jelly's code page.
               +       Add 10240 to all integers to the left.
                    Ọ  Unordinal; convert all code points to their respective
                       Unicode charcters.

Chip, 62 59 bytes
h*
 Z~.
z.g+b
>xv<
||sf
Zx^<
Z< |
A/a/D
B/b
C/c
E/d
F/e
G/f

Try it online!
I suspect I can golf it more, just gotta figure out how...
Chip reads in each byte of input as a collection of bits, referred to by the first eight letters of the alphabet (uppercase is input, lower is output):
HGFEDCBA

We simply need to map those bits of the input to the following three bytes of output:
11100010 101000hd 10gfecba

The top half of the code is doing all the sequencing, and generates the first two bytes, the bottom half generates the third byte.
Since the specification only requires handling 7 bits for ASCII, we don't examine H. To include the eighth bit, change line B/b to B/b/H.

C#, 63 bytes
s=>string.Concat(s.Select(c=>(char)(c*8&64|c/2&56|c&7|10240)));

Try it online!
Inspiration from @ovs and @Neil

Retina, 59 bytes
T`-- -'0-7@-GP-W\`-gp-w--(-/8-?H-OX-_h-ox-`⠀-⡿

Try it online! Hex dump:
0000  54 60 00 2a 07 10 2a 17  20 2a 17 30 2a 17 40 2a  T`-- -'0-7@-
0010  47 50 2a 57 5c 60 2a 67  70 2a 77 08 2a 0f 18 2a  GP-W\`-gp-w--
0020  1f 28 2a 2f 38 2a 3f 48  2a 4f 58 2a 5f 68 2a 6f  (-/8-?H-OX-_h-o
0030  78 2a 7f 60 e2 a0 80 2a  e2 a1 bf                 x-`⠀-⡿


text:
Row, row, row your boat
Everyone is likely familiar with the following song, which is a musical round:

Background
Fewer people might recall trying to sing the 4-person version of this with a few friends and failing. Offsetting the lyrics of a song with different harmonious pitches is known as singing a "round" and that's what we're here to simulate today using static output. Here's an example of someone actually performing the piece  (link to audio/video, will have sound).
The Challenge
This challenge is to output the text as follows exactly as it follows:
Row, row, row your boat,           |-----------------------------------|-----------------------------------|-----------------------------------
Gently down the stream.            |Row, row, row your boat,           |-----------------------------------|-----------------------------------
Merrily, merrily, merrily, merrily,|Gently down the stream.            |Row, row, row your boat,           |-----------------------------------
Life is but a dream.               |Merrily, merrily, merrily, merrily,|Gently down the stream.            |Row, row, row your boat,
-----------------------------------|Life is but a dream.               |Merrily, merrily, merrily, merrily,|Gently down the stream.
-----------------------------------|-----------------------------------|Life is but a dream.               |Merrily, merrily, merrily, merrily,
-----------------------------------|-----------------------------------|-----------------------------------|Life is but a dream.

Rules

Trailing whitespace is acceptable, but not required, this includes newlines.
Hyphens and bars are part of the required output, yes.
Commas, periods, capitalization and all syntactical elements related to grammar are required.

This is code-golf, the lowest byte-count code without using standard loopholes is the winner.

I just want to say, I greatly enjoy your large [tag:kolmogorov-complexity] and [tag:ascii-art] challenges! Both this one and a keyboard so real have been extremely fun to write solutions for. :)

@DJMcMayhem ever since finding this site I see challenges randomly in my daily life and keep a small notepad for the ideas I get, I'll keep trying to make fun ones!

05AB1E, 80 77 bytes
“¢ã,¢ã,¢ã€žžÄ,““èî„‹€€šæ.“"merrily, "4×¨“‚ì€ˆ€³€…žâ.“'-35×Ð)€ª.B3FDÁ})øvy'|ý,

Try it online!
Work in progress.

I was pretty unimpressed by the dictionary not having "05AB1E" in it, by the way. It made it near impossible to efficiently sing 05AB1E happy birthday. Cool answer though, was hoping to see a dictionary-base 05AB1E answer haha. Also DJMcMayhem is correct, it does.

Wait, what is ª? Nevermind, sentence cased, brilliant.

@carusocomputing: Yeah, I only recently noticed that it exists. Have needed it several times in the past :P

vy can be ʒ to save a byte.

V, 139, 128 bytes
iLife is but a dream ±µ |4amerrily, x7b~A|Gently down the stream.±² |3arow, X5b~Ayour boat,±± |3I³µ-|3AòÄó.û-}|ò5DÎ4f|C|

A one-liner! (sortof :P)
Try it online!
Hexdump:
00000000: 694c 6966 6520 6973 2062 7574 2061 2064  iLife is but a d
00000010: 7265 616d 20b1 b520 7c1b 3461 6d65 7272  ream .. |.4amerr
00000020: 696c 792c 201b 7837 627e 417c 4765 6e74  ily, .x7b~A|Gent
00000030: 6c79 2064 6f77 6e20 7468 6520 7374 7265  ly down the stre
00000040: 616d 2eb1 b220 7c1b 3361 726f 772c 201b  am... |.3arow, .
00000050: 5835 627e 4179 6f75 7220 626f 6174 2cb1  X5b~Ayour boat,.
00000060: b120 7c1b 3349 b3b5 2d7c 1b33 4101 1bf2  . |.3I..-|.3A...
00000070: c4f3 2efb 2d7d 7cf2 3544 ce34 667c 437c  ....-}|.5D.4f|C|

Do I get bonus points for landing exactly on 2^7?
This took a while to figure out. I'm hoping I can golf tons off like my keyboard ASCII art answer, but I'm not sure. We'll see. They are very similar challenges (and both very fun :D)
Originally I tried this (180):
3irow, ch your boat,±± ||"rCLife is but a dream.±µ ||"lD4imerrily, r||"mCGently down the stream.±² ||"gC³µ-|B"dCR³D
GRDD
MGRD
LMGR
DLMG
DDLM
³DLÍR/r
ÍG/g
ÍM/m
ÍL/l
ÍD/d

Try it online!
Which inserts this:
RDDD
GRDD
MGRD
LMGR
DLMG
DDLM
DDDL

and then does substitution to expand it out. But building it ascii-art style is much shorter (and more fun TBH)

You get 0^(2^7) bonus points for landing on 2^7 haha. Interesting first thought though on the 180 version.

@carusocomputing Aww, why not give him (2^7)/0 bonus points?

Batch, 292 288 275 bytes
@set d=-------
@set "d=%d%%d%%d%%d%%d%^|
@set "m=M_ m_ m_ m_^|
@set "s=           ^|
@set "s=Life is but a dream.    %s%%m:_=errily,%Gently down the stream. %s%Row, row, row your boat,%s%%d%%d%%d%"
@for /l %%i in (1,1,6)do @call:c
:c
@echo %s:~111,146%
@set "s=%d%%s%

Edit: Saved 13 bytes by rewriting the code to use a version of the substring trick I used in my Retina answer. Conveniently I can loop six times and then fall through for a seventh iteration of the loop body, which means the quoting needed to output |s doesn't get too onerous, however I have to be careful to take the ^s into account when selecting the substring.

Python 3, 252 235 208 206 205 bytes
Alright, alright. Here's a less boring answer:
w=' '*11
t=["Row, row, row your boat,"+w,"Gently down the stream. "+w,"Merrily,"+" merrily,"*3,"Life is but a dream.    "+w,*['-'*35]*3]
for a in zip(*[t[z:]+t[:z]for z in range(7,3,-1)]):print(*a,sep='|')

Old answer, 252 bytes:
Boring answer, and the other Python answer is shorter, but I thought I'd try if this approach is shorter. Python 3 despite the savings in byte/string 2-3 difference because both gzip and base64 are shittier in Python 2.
from base64 import*
from gzip import*
print(decompress(b85decode('ABzY8Fgf~I0{;ujFV|5hf)Waq`K3h)N%@H-ItmC-qe~c2OAVKMYF<fBr9w)6d7eT^Myf(_Nl|KIuATz2dxGfaW-i~<qN2>4N*#q<oQxVex|z!-Gc8pivsfXiv_v6MAqB%CkU6w=GZ!&|OJj#}Q7chW$(>wu%p_Rd3;?AKH=M}>000')).decode())

25% of the original length, pretty impressive, but you could be far smarter and compress just the first iteration, split on newlines and perform 4 shifts. This would likely beat the other implementation of python. Thoughts to consider. I wasn't the one to -1, don't know who did that.

@carusocomputing True. I was really just interested how well run-off-the-mill compression works on such a highly redundant fixed output task. Converted my answer to a shorter, less dumb one though.

Can you also edit back in the compression one? I, personally, found that approach interesting as well. Namely how low the byte-count got via simple gzip. It must use Huffman or something... +1 regardless for the effort.

@carusocomputing I'll add it at the bottom I guess. Also, I think it's not the Huffman part of deflate that is making this relatively great, but the LZ part.

@JonathanAllan Indeed, I missed that. Fixed, lost a byte.

PowerShell, 224 207 202 bytes
$a=' '*11;0..6|%{((0..4+4+4)[($_,($_+=6),--$_,--$_|%{$_%7})]|%{("Row, row, row your boat,$a","Gently down the stream.$a ","Merrily,$(' merrily,'*3)","Life is but a dream.$a    ",('-'*35))[$_]})-join'|'}

Try it online! (the output is wrapped if your screen isn't wide enough)
Good grief, this array generation thing is ugly, but it saved 17 bytes, so ...
0..6|%{((0..4+4+4)[($_,($_+=6),--$_,--$_|%{$_%7})]

We loop from 0 to 6. Each iteration, we're indexing into an array (0,1,2,3,4,4,4). The indexing is based on the current digit, the current digit +6, that -1, and then that -1. Each of those is then fed through a loop where we modulo with %7. For example, if we're on 0 of the outer 0..6 loop, then these would be 0,6,5,4, then each %7, so 0,6,5,4. That's indexed into the (0,1,2,3,4,4,4) array, so the output is 0,4,4,4. For input 1 we get 1,7,6,5 then 1,0,6,5 which yields 1,0,4,4. And so on. (things would be so much easier if we had a .clamp function)
Those are one-at-a-time spit into a loop |%{}. Each iteration, we index into the proper spot in the song-lyrics-array, and leave that string on the pipeline. Those strings are then -joined together with | to format the output line. Those strings are left on the pipeline and output is implicit.
Saved some bytes thanks to Value Ink.

Considering that you already have $a saved to 11 spaces, you can change the fourth line to end in $a plus 4 spaces instead of $(' '*15) for -3 bytes, yes?

JavaScript (ES8), 285 256 240 231 229 217 214 213 211 210 206 bytes
_=>"0444104421043210432144324443".replace(/./g,(x,y)=>["Row, row, row your boat,","Gently down the stream.","Merrily,"+(m=" merrily,")+m+m,"Life is but a dream.","-".repeat(35)][x].padEnd(35)+`
|||`[++y&3])

Saved a few bytes by borrowing a trick from Arnauld's answer
Try it online!

'0444,1044,2104,3210,4321,4432,4443'.split,.map saves you 10 bytes. Also, padEnd isn't part of ES6, or even ES7.

Oops, meant to update that to ES8 - thanks, @Neil. And thanks for the tip, but I was in the process of working on another solution that ended up saving me 12 bytes.

PHP, 191 Bytes
for(;$n<7;$n++)for($m=0;$m<4;)echo $m?"|":"\n",str_pad($i=["Row, row, row your boat,","Gently down the stream.",M.($t="errily,")." m$t m$t m$t","Life is but a dream."][$n-$m++],35," -"[!$i]);

Try it online!
Expanded
for(;$n<7;$n++)
  for($m=0;$m<4;)
    echo $m?"|":"\n"
     ,str_pad($i=["Row, row, row your boat,","Gently down the stream."
       ,M.($t="errily,")." m$t m$t m$t","Life is but a dream."][$n-$m++]
       ,35," -"[!$i]);

You could save a character by removing the brackets from echo (it's not a function)

@RobbieAverill I know but the brackets include a ternary operator and I could remove it only it I replace the point through a comma

Python 2, 199 bytes
w=' '
s=['-'*35]
t=['Row, row, row your boat,'+w*11,'Gently down the stream.'+w*12,'Merrily,'+' merrily,'*3,'Life is but a dream.'+w*15]
print'\n'.join(map('|'.join,zip(t+s*3,s+t+s+s,s+s+t+s,s*3+t)))

Try it online!

Thanks to @mathjunkie for saving 14 bytes

'Merrily, merrily, merrily, merrily,' could be ('merrily, '*4).capitalize() right? Or is that not Python?

Or even shorter, 'Merrily,'+' merrily,'*3

CJam, 128 122 bytes
"Row, row, row your boat,""gently down the stream."'M" merrily,"4*2>+"Life is but a dream."'-35*__]{35Se]}%a4*4,.m>z'|f*N*

Try it online!
Explanation
"Row, row, row your boat,"  e# Push this string.
"gently down the stream."   e# Push this string.
'M                          e# Push the character 'M'.
" merrily,"4*               e# Push the string " merrily, merrily, merrily, merrily,".
2>+                         e# Remove the first two letters of it, and append it to 'M',
                            e#   fixing the capitalization.
"Life is but a dream."      e# Push this string.
'-35*__                     e# Push a string containing 35 hyphens and make two copies of it.
]                           e# Collect all these strings in an array.
{35Se]}%                    e# Pad each of them to length 35 by adding spaces to the right.
a4*                         e# Repeat the array 4 times.
4,                          e# The range [0 1 2 3].
.m>                         e# Rotate each subarray of strings rightward by the corresponding
                            e#   number in the range.
z                           e# Transpose the array.
'|f*                        e# Join the strings on each row with '|' characters.
N*                          e# Join the rows together with newlines.

JavaScript (ECMAScript 2017), 191 187 182 bytes
Saved 3 bytes thanks to Shaggy

f=(i=27,s=['Life is but a dream.','Merrily,'+(m=' merrily,')+m+m,'Gently down the stream.','Row, row, row your boat,'][(i>>2)-i%4]||'')=>i?s.padEnd(35,' -'[+!s])+`
|||`[i&3]+f(i-1):s

o.innerHTML = f();

I think 'Merrily,'+' merrily,'.repeat(3) saves a byte.

Oh, and I forgot to mention that padEnd isn't in ES7, let alone ES6.

M${s='errily, '}m${s}m${s}m instead of M${s='errily,'} m${s} m${s} m saves 2 bytes

Bah, beaten again! :p One of these days, I'll outgolf you! I borrowed your trick for determining the string separator, if that's OK.

You can save 3 bytes with "Merrily,"+(s=" merrily,")+s+s.

@Shaggy Ah yes. That seems to be the best option. Thanks!

C (GCC), 231 230 bytes
-1 byte thanks to ceilingcat!
#define m"errily, "
char s[7][35]={"Life is but a dream.","M"m"m"m"m"m"m"m,"Gently down the stream.","Row, row, row your boat,"};f(l,c){memset(s[4],45,'k');for(l=7;l--;)for(c=0;c<4;)printf("%-35.35s%c",s[(4+l+c++)%7],"|||\n"[c]);}

Pretty straightforward. First it builds the 7 lines string array, part via a macro to factorise out the "merrily" part, then the lines of dashes are filled in with a memset. Then the lines are printed with the adequate offset and separators.
Try it online!

SOGL, 83 bytes
┌׀0ρMVxDrž|⁷ΨB≈π93|↑D~Νķ‰¤t╤▼ΣΗ⁶⅔¾№⁷Ζ÷│²╥Ν9°‘-”)0ΔH«‘4*jŗ"ΣΨ¬¹‘4*;+7{’⁄{»}⁽:’∞n1wpX

The 1st part ┌׀0ρMVxDrž|⁷ΨB≈π93|↑D~Νķ‰¤t╤▼ΣΗ⁶⅔¾№⁷Ζ÷│²╥Ν9°‘ is a compressed string resulting in
`life is but a dream.               |-|gently down the stream.            |row, row, row your boat,           |`

These are the lines reversed (since this is printing them line-by-line), with the "merrily" part cut out to be replaced in the program.
The rest of the program:
...‘                                        Push the compressed string
      )0ΔH«‘                                push "merrily, "
            4*                              repeat it 4 times
              j                             take the last letter off
    -”         ŗ                            replace "-" with the merrily line
                "ΣΨ¬¹‘                      push 35 dashes with an appending "|"
                      4*                    repeat it 4 times
                        ;+                  add inverted ("---|---..."+"Life is but a dream  ...")
                                            The resulting string of above is "-----------------------------------|-----------------------------------|-----------------------------------|-----------------------------------|life is but a dream.               |merrily, merrily, merrily, merrily,|gently down the stream.            |row, row, row your boat,           |"
                          7{                repeat 7 times
                            ’⁄{»}            rotate right 35 times
                                 ⁽           uppercase the 1st letter
                                  :          duplicate
                                   ’∞n       split into parts of length 135
                                      1w     get the 1st one
                                        p    output that
                                         X   delete the splat array

///, 200 bytes
/_/     //&/errily,//*/ m&//+/-------//@/Row, row, row your boat, __//#/Gently down the stream.  __//$/M&***//%/Life is but a dream.___//~/+++++/@|~|~|~
#|@|~|~
$|#|@|~
%|$|#|@
~|%|$|#
~|~|%|$
~|~|~|%

Try it online!
Simple, uses common occurrences as replacements.

PHP, 179 bytes:
for($m="errily,";$i<28;)echo str_pad($s=["Row, row, row your boat,","Gently down the stream.","M$m m$m m$m m$m","Life is but a dream."][($i>>2)-$i%4],35," -"[!$s]),"
|||"[++$i%4];

ungolfed
for($i=0;$i<28;$i++)
{
    $x=$i%4;
    $y=$i>>2;

    $s=["Row, row, row your boat,",
        "Gently down the stream.",
        M.($m="errily,")." m$m m$m m$m",
        "Life is but a dream."
    ][$y-$x];

    $pad_string = $s ? " ":"-";
    $postfix = $x<3 ? "|" : "\n";
    echo str_pad($s,35,$pad_string),$postfix;
}

Microsoft Sql Server, 421 bytes
with v as(select left(s+space(35),35)s,n from(values('Row, row, row your boat,',1),('Gently down the stream.',2),('Merrily, merrily, merrily, merrily,',3),('Life is but a dream.',4))t(s,n))select isnull(v.s,s.s)+'|'+isnull(b.s,s.s)+'|'+isnull(c.s,s.s)+'|'+isnull(d.s,s.s)from v full join v b on v.n=b.n+1 full join v c on b.n=c.n+1 full join v d on c.n=d.n+1 cross apply(select replicate('-',35)s)s order by isnull(v.n,9)

Check It Online

I love it.  Database is my message!

T-SQL, 296 277 276 bytes
PRINT REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE('1|0|0|0
2|1|0|0
3|2|1|0
4|3|2|1
0|4|3|2
0|0|4|3
0|0|0|4',0,REPLICATE('-',35))
        ,1,'Row, row, row your boat,6')
        ,2,'Gently down the stream. 6')
        ,3,'M5 m5 m5 m5')
        ,4,'Life is but a dream.    6')
        ,5,'errily,')
        ,6,SPACE(11))

Line breaks at the beginning are part of the original string, line breaks near the end are for display purposes only, and are not counted toward the byte total.
Inspired largely by Conrade SparklePony's answer. Different technique than Andrei Odegov's SQL answer.
Pretty straight-forward multi-replacement, but a few things that help save bytes:

SQL allows line breaks in the original string
Using numerals instead of characters allows me to eliminate a whole bunch of single quotes
Nested replacements (5 and 6), save me even more bytes (thanks, @t-clausen.dk)

If only I could REPLACE all the REPLACEs with something shorter. Hmm....

If you REPLACE space 11,12,15 using your own method, you can save 1 byte

Perl 5, 215 bytes
$m='merrily,';$s=' 'x11;$l='-'x35;
@t=@s=("Row, row, row your boat,$s","Gently down the stream. $s",
       "\u$m $m $m $m","Life is but a dream.    $s",$l,$l,$l);
map{$i--;map$t[$_].="|".$s[$i++%7],0..6}1..3;print"$_\n"for@t

Try it online!

Swift, 416 406 405 380 372 307 bytes
var f=String.init(repeating:count:);_={[[0,4,4,4],[1,0,4,4],[2,1,0,4],[3,2,1,0],[4,3,2,1],[4,4,3,2],[4,4,4,3]].forEach{print($0.map{["Row, row, row your boat,"+f(" ",11),"Gently down the stream."+f(" ",12),"Merrily,"+f(" merrily,",3),"Life is but a dream."+f(" ",15),f("-",35)][$0]}.joined(separator:"|"))}}

You can try it here.
Thanks to @Mr. Xcoder for saving me 65 bytes!

Great to see a swift answer!

You can make it shorter by replacing the declaration of f to the following: var f=String.init(repeating:count:), which saves a ton of bytes: 30

Also, in the sandbox you shouldn't print(o()), you should just call o() because you have a print statement inside it, which gives a () at the end of the output

Also, remove the unnecessary whitespace. It will save lots of bytes. I'll comment an improved version.

Here is an improved version, 309 bytes. This is 63 bytes shorter and can be golfed, I believe

Python 2, 225 Bytes
w=[["-"*35]*7for _ in[0]*4]
for i in [0]*4:w[i][i:i+4]=[a.ljust(35)for a in["Row, row, row your boat,","Gently down the stream.","Merrily,"+" merrily,"*3,"Life is but a dream."]]
print "\n".join(["|".join(i)for i in zip(*w)])

Try it online!

Retina, 153 150 bytes

<-|>Life is but a dream.15|M!< m!>|Gently down the stream.12|Row, row, row your boat,11<|->
<(.*?)>
$1$1$1
!
errily,
-
35$*-
\d+
$*
r!&`.{71}\|.{71}

Try it online!
I tried arbitrary run-length encoding but $1$*$2 doesn't do what I want and repeating strings proved too tricky. Edit: Saved 2 bytes by encoding errily, and 1 byte by removing an unnecessary ^.

MATLAB, 280 bytes
a='errily,';
z={'Row, row, row your boat,';'Gently down the stream.';['M',a,' m',a,' m',a,' m',a];'Life is but a dream.'};
z{5}(1:35)='-';
y=5*ones(7,4);
for j=1:4;z{j}(end+1:35)=' ';y(j:j+3,j)=(1:4)';end
x=z(y);
for j=1:7;fprintf('%s|%s|%s|%s\n',x{j,1},x{j,2},x{j,3},x{j,4});end

The cell array indexing is pretty costly, that seems like the easiest place to discard some bytes (if possible).

Welcome to the site!

Japt -R, 99 95 94 92 90 89 87 bytes
R³i`Life  ¿t a Ým.
M{34î`Îk, m`}
Gt§ Üµ e Ðpam.
Row, w, w yr ¾,`ú)·ú-
£éY Å¤q|

Try it
R³i`L...{34î`...`}...,`ú)·ú-
R                                :Newline
 ³                               :Repeat 3 times
  i                              :Prepend
   `                             :  Decompress
    L...                         :    "Life is but a dream.\nM"
        {                        :    Interpolate
         34î                     :      Repeat & slice to length 34
            `...`                :        The compressed string "errily, m"
                 }               :    End interpolation
                  ...,           :    "\nGently down the stream.\nRow, row, row your boat,"
                      `          :  End decompression
                       ú         :  Right pad each line with spaces to the length of the longest
                        )        :End prepend
                         ·       :Split on newlines
                          ú-     :Right pad each element with "-" to the length of the longest
£éY Å¤q|                         :Assign the above to U
£                                :Map each element at 0-based index Y
 éY                              :  Rotate U right Y times
    Å                            :  Slice off the first element
     ¤                           :  Slice off the first two elements
      q|                         :  Join with "|"
                                 :Implicit output, joined with newlines

Java, 295 bytes / 272 259 bytes
with newlines every 4 columns (295b)
void r(){String m=" merrily,",t="-------",s="     ",e=t+t+t+t+t;String[]v={"Gently down the stream.  "+s+s, "Merrily,"+m+m+m, "Life is but a dream."+s+s+s, e, e, e, "Row, row, row your boat, "+s+s};for(int i=0;i<7;i++){for(int j=6+i;j>2+i;j--)System.out.print(v[j%7]+'|');System.out.println();}}

Try it Online
no newline version (259b):
void r(){String m=" merrily,",t="-------",s="     ",e=t+t+t+t+t;String[]v={"Gently down the stream.  "+s+s, "Merrily,"+m+m+m, "Life is but a dream."+s+s+s, e, e, e, "Row, row, row your boat, "+s+s};for(int i=0;i<28;i++)System.out.print(v[(6-i%4+i/4)%7]+'|');}

Condensed 2 for loops into 1

Try it Online

Japt, 158 157 bytes
='|L=`Row, žw, žw yŒr ¾…,`+Sp11 +UV=`Gt§ Üµ e Ðpam.`+S³²²+UW=`M€Îk,`+` ´rÎk,`³+UJ=W+VX=`Life ‰ ¿t a Ý„m.`+Sp15 +UZ='-p35 +U[LZ³RVLZ²RJLZRXJLRZXJRZ²XWRZ³X]q

Try it online!

Ruby, 162 bytes
7.times{|i|puts (~i..~i+3).map{|j|[*[?-*35]*3,"Life is but a dream.",?M+['errily,']*4*" m","Gently down the stream.","Row, row, row your boat,"][j].ljust(35)}*?|}

Stax, 63 bytes
∞╖]ÇàI╨‼Çö¼fi╩╨╛Aóß╟uƒ←37qÄô.Z╛Θ6►Mûj╚#Å[░]Oá0"y╧o╙)5;V╞♥╬F¼♫t~

Run and debug it

Perl 5, 163 bytes
say join'|',(('-'x26)x3,"Life is but a dream".$"x7,ucfirst(join$",("merrily,")x3),"Gently down the stream    ",ucfirst "row, "x3 ."your boat  ")[-$_..3-$_]for 1..7

Try it online!

Runic Enchantments, 292 bytes
B͍"-"'#*"|"3s
"Row, row, row your boat,"b" "S*q"|"3sB͍>01B10B3*1-akr@>12B01B10B2*1-akr@>13B12B01B10B1-akr@>14B13B12B01B1-akr@>10B3*14B1-r0[10B2*14B13B1-akr0[10B14B13B12B1-akr]]@
B͍"Gently down the stream."c" "S*q"|"3s
B͍"Merrily,"3" merrily,"S*q"|"3s
B͍"Life is but a dream."f" "S*q"|"3s

Try it online!
I don't generally do kolmogorov-complexity challenges, but the layout was one I could work with without too much trouble. Runic does not have good ways to compress arbitrary strings, so all we have to work with are the repetitious parts.
Explanation:
Uncompressing slightly:
B͍"-"'#*"|"3s
B͍"Row, row, row your boat,"b" "S*q"|"3s
B͍"Gently down the stream."c" "S*q"|"3s
B͍"Merrily,"3" merrily,"S*q"|"3s
B͍"Life is but a dream."f" "S*q"|"3s
>11B10B3*1-akr@
>12B11B10B2*1-akr@
>13B12B11B10B1-akr@
>14B13B12B11B1-akr@
>10B3*14B1-r0[10B2*14B13B1-akr0[10B14B13B12B1-akr]]@

First 5 lines act as functions to build each portion of the song (where the first line generates the 35 - for the spacer using the decimal value of # to save 2 bytes over 3X5+). The return instruction is at the beginning of the line to insure that all IPs that enter a function will also leave the function after the same number of cycles to avoid IPs merging (resulting in missing lines of output), as programs are rectangular and empty cells are implicit.
The next four lines are responsible for printing the first four lines of the output
The fifth line then prints the last 3 lines of output. Due to all three lines needing to start with at least one stanza-spacer it is not feasible to use 3 separate IPs (as they would need delays in order to avoid merging).  >, y, @, and a newline cost more bytes (4) than 0[...] (3 bytes) where ... is arbitrary instructions (ie. another line of output).
Conversely replacing > and @ to use a single IP requires more bytes.
Finally, merging all five entry-point lines onto the 2nd line saves 5 bytes worth of newlines. We just have to insure that the B͍ranch-return instruction moves to the end of its line first, preserving the function's functionality.


text:
Transpile these ES6 arrow functions!
The ECMAScript 6 standard added many new features to the JavaScript language, including a new arrow function notation.
Your task is to write a basic ES6-to-ES5 transpiler. Given only an ES6 arrow function as input, output its ES5-compatible counterpart.
It's code-golf! May the shortest program in bytes win!

The Basics
An arrow function looks like this:
(a, b, c) => { return a + b - c }

And its equivalent ES5 function expression looks like this:
function(a, b, c) { return a + b - c }

In general, you can copy the body of the function (everything between the curly braces) verbatim.

Implicit Return Statement
Instead of a body with curly braces, a single expression can be used; the result of this expression is then returned.
(a, b, c) => a + b - c

function(a, b, c) { return a + b - c }

Another example:
(a, b, c) => (a + 1, b - 2 * c / 3)

function(a, b, c) { return (a + 1, b - 2 * c / 3) }

Again, you may simply copy the expression verbatim - BUT take care that you do not output a line break between it and the return keyword to avoid automatic semicolon insertion!

One Argument
Parentheses are optional if one argument is provided.
foo => { return foo + 'bar' }

function(foo) { return foo + 'bar' }

Whitespace
Finally, you must be able to account for any number of whitespace characters (space, tab, newline) before or after parentheses, variables, commas, curly braces, and the arrow*.
 ( o   ,  O
     , _    )=>{

    return                                     "Please don't write code like this."
}

Whether or not you choose to preserve whitespace in the output is up to you. Keep 'em, remove 'em, or add your own - just make sure it's valid code!
*It's technically illegal for an arrow to come immediately after a line break, but I doubt this fact would help you. :)

A quick way to validate your output:
Enter var foo = <your output>; foo() into your browser console. If it doesn't complain, you're probably on the right track.

More rules for the wizards:

Input is a syntactically valid ES6 arrow function.
Assume the body of the function is ES5-compatible (and doesn't reference this, super, arguments, etc). This also means that the function will never contain another arrow function (but you may not assume that "=>" will never occur within the body).
Variable names will only consist of basic Latin letters, $ and _.
You need not transpile ES6 features that aren't listed above (default parameters, rest operator, destructuring, etc).
The space after a return statement is optional if followed by (, [, or {.
It isn't strictly necessary to match my test cases exactly - you can modify the code as much as you need if it'll help lower your byte count. Really, as long as you produce a syntactically valid, functionally equivalent ES5 function expression, you're golden!

May we assume the input is a syntactically valid arrow function and nothing else?

An edge case would be a =>\na, where function(a){ return\na } would actually return undefined no matter what the value of a is. Do we need to handle this?

@ETHproductions Don't you just love those automagic semicolons!

Will we get nested ES6 functions?

Can we assume that the input will only contain a single =>?

@Riker It is done.

@ETHproductions: Yes, and yes.

@KritixiLithos: No.

@mathjunkie: No.

JavaScript (ES6), 123 110 100 97 bytes
Saved 3 bytes thanks to @Neil
s=>s.replace(/\(?(.*?)\)?\s*=>\s*([^]*)/,(_,a,b)=>`function(${a})${b[0]=='{'?b:`{return ${b}}`}`)

Assumes the input is a syntactically valid arrow function and nothing else. Correctly handles the case a =>\na, though not handling is not any shorter as far as I can tell.
Output when the code is run through itself:
function(s){return s.replace(/\(?(.*?)\)?\s*=>\s*([^]*)/,(_,a,b)=>`function(${a})${b[0]=='{'?b:`{return ${b}}`}`)}

I can save 9 bytes with a possibly invalid format:
s=>s.replace(/\(?(.*?)\)?\s*=>\s*({?)([^]*?)}?$/,(_,a,z,b)=>Function(a,z?b:'return '+b))

Output for itself:
function anonymous(s) {
return s.replace(/\(?([^=)]*)\)?\s*=>\s*({?)([^]*?)}?$/,(_,a,z,b)=>Function(a,z?b:'return '+b))
}

(Specifically, the function anonymous is what I'm worried about.)

Shame that your function itself contains a further arrow function so that when run through itself it's not actually fully transpiled.

I think \(?(.*?)\)?\s*=> might save you 3 bytes.

Retina, 86 80 79 bytes

^([^(]*?)=
($1)=
s(`\s*$

>\s*(.*[^}])$
>{return $1}
)`(.*?)=>(.*)
function$1$2

Try it Online!
 Saved a byte thanks to Neil
 Saved 6 bytes with help from ETHproductions
Edit: Fixed for possibility of newlines in function body.
75 byte solution assuming the input won't contain §: Try it Online!

You can use a pilcrow instead of \n to save a byte.

This seems to remove line breaks within the function body, which may alter the functionality.

I think \s includes ¶, so line three can be \s*$ to save 4 bytes.

@ETHproductions It seems \s only matches ¶ when the s configuration option is added. Nevertheless, it saved me some bytes

PHP, 112 bytes
preg_match("#\(??(.*)\)?=>(\{?)(.*$)#U",$argn,$m);echo"function($m[1])",trim($b=$m[3])[0]=="{"?$b:"{return $b}";

takes input from STDIN; run with -R