text:
From Programming Puzzles to Code Golf
Your task is to write a program that outputs the exact string Programming Puzzles (trailing newline optional), but when all spaces, tabs, and newlines are removed it outputs Code Golf (trailing newline optional.)
Your byte count is the count of the first program, with spaces still there.
Notes

The spaces in Code Golf and Programming Puzzles will be removed as part of the removal, so plan accordingly.
In encodings where 0x09, 0x0A and 0x20 aren't tabs, newlines or spaces respectively, those chars will be removed.
If your code is
42  $@ rw$
@42

then that must output Programming Puzzles. Also, in the same language,
42$@rw$@42

must output Code Golf.

This is code-golf, so the shortest code in bytes wins! Good luck!

will the space in Code Golf also be removed, what about the one in Programming Puzzles.

@ConnorLSW I assume so, see Mego's answer

In encodings where 0x09, 0x0A and 0x20 aren't tabs, newlines or spaces respectively, should the bytes or the chars be removed?

@EriktheOutgolfer the chars, not the bytes.

This will be impossible in at least Whirl
and Whitespace.

What are the close votes for?

@OldBunny2800 good question. I keep asking that but the comment gets removed...

The close votes are for the lack of inputs and outputs and restriction on the formatting of inputs and outputs. 100% if you had a section labeled "rules" with a bullet-pointed list of things you think were obvious about the challenge you'd have 0 close votes. It's all about presentation with CompSci folks, if we can think of a seemingly idiotic question to ask that may save us a byte or to, we will, try to counter that idiocy and you will be a great question writer.

I think this challenge resembles the quality of polyglot challenges. Though not entirely, of course. Awesome idea! +1

What about non-breaking space? In MathGolf, non-breaking space is the operator "discard everything but top-of-stack", which is quite useful in this challenge.

From Code Golf to Coding Challenges

I'd add a solution in Poetic, but such a solution would be at least 3111613151435231622325141268427653175133731762761752743751317 bytes long. (No kidding.)

Python 2, 50 bytes
print["Code\40Golf","Programming Puzzles"][" ">""]

Try it online!
With all spaces removed:
print["Code\40Golf","ProgrammingPuzzles"]["">""]

Try that online!
Thanks to Stephen S for 3 bytes, and Erik the Outgolfer for 1

Darn, ninja'd! I was just about to click Post Answer! +1

I think you just broke my friend's brain. How does this even work?

@StevenVascellaro It's really simple. In the first case, " ">"" returns True, since, lexicographically, a space is greater than the empty string. In the second case, "">"" returns False, since nothing can be greater than itself. True and False are actually just 1 and 0 respectively, just in the bool datatype instead of int or long. In the first case, the spaces are preserved, so, the item at index 1, "Programming Puzzles", is returned verbatim. In the second case, the spaces are gone, hence the \x20 in the item at index 0 "Code\x20Golf" to preserve a space.

@Mego I don't really know Python, but if it is like JavaScript, can't [" ">""] simply be [" "]? Because empty string is false and non-empty string is true.

@StephenS Nope, because unlike JavaScript, Python doesn't have an obsession with implicit casting.

If find Python's lack of obsession disturbing.

@JanDvorak If it's any consolation, Python 2 has an obsession with comparisons. []>""

Note that bool is a subclass of int. So True and False are actually equal to 1 and 0, just of type bool instead of int.

@Mego Your comment made me laugh out loud. Have a nice day sir. :)

Python 2, 48 47 bytes
-1 byte thanks to Erik the Outgolfer

print' 'and'Programming Puzzles'or'Code\40Golf'

Try it online!
print''and'ProgrammingPuzzles'or'Code\40Golf'

Try it online!

Aww, I was just about to improve my answer to this...

Jelly, 17 bytes
“Ñ1ɦ+£)G“½ċṭ6 Ỵ»Ṃ

Try it online!
How it works
As in the other Jelly answer, Ñ1ɦ+£)G and ½ċṭ6Ỵ encode the strings Programming Puzzles and Code Golf. “ begins a string literal and separates one string form another, while » selects the kind of literal (dictionary-based compression), so this yields
["Programming Puzzles", "Code Golf"]

Ṃ then takes the minimum, yielding Code Golf.
However, by adding a space between ½ċṭ6 and Ỵ, we get a completely different second string, and the literal evaluates to
["Programming Puzzles", "caird coinheringaahing"]

Since caird coinheringaahing is lexicographically larger than Programming Puzzles, Ṃ selects the first string instead.

Just did the same with “½ċṭ6Ỵ“Ñ1ɦ +£)G»Ṁ

To my knowledge neither of those characters can be saved using one byte, assuming well known encodings. in UTF-8 I get 34 bytes... Am I wrong?

@steffen Jelly uses a custom code page that encodes each of the 256 characters it understands as a single byte.

@Dennis thank you for clarifying.

Where it all started.

C, 64 62 53 52 bytes
f(){puts(*" "?"Programming Puzzles":"Code\40Golf");}

Try it Online!
Uses the fact that C strings end with a null character

05AB1E, 15 bytes
”ƒËŠˆ”" "v”–±ÇÀ

Try it online!
Explanation
”ƒËŠˆ”           # push "Code Golf"
      " "v       # for each character in the string " " do
          ”–±ÇÀ  # push "Programming Puzzles"
                 # implicitly output top of stack

...I just don't get it. Does this use dictionary compression or something?

@LegionMammal978 I'm pretty sure it does.

@LegionMammal978: It does indeed use dictionary compression.

@Emigna Okay, because last I checked, neither of those strings could be fit into 4 bytes :p

To my knowledge some of those characters can be saved using one byte, assuming well known encodings. in UTF-8 I get 31 bytes... Am I wrong?

@steffen: 05AB1E uses a custom code page (previously CP-1252) where each character is 1 byte.

How, exactly does the compression work? I tried looking at the language's source code, but couldn't figure it out. Also, how does one generate the compressed strings when golfing?

@Draco18s: Kevin has written a nice tutorial over at the tips page you can use to get a better idea of how to use it.

Jelly, 18 bytes
“½ċṭ6Ỵ»ḷ
“Ñ1ɦ+£)G»

Try it online!
Explanation
In the program as written, the first line is a helper function that's never run. The second line (the last in the program) is the main program, and is the compressed representation of the string "Programming Puzzles" (which is then printed implicitly).
If you remove the newline, the whole thing becomes one large program. “½ċṭ6Ỵ» is the compressed representation of the string "Code Golf". ḷ evaluates but ignores its right hand argument, leaving the same value as before it ran; it can be used to evaluate functions for their side effects (something I've done before now), but it can also be used, as here, to effectively comment out code.
Interestingly, the actual logic here is shorter than the 05AB1E entry, but the code as a whole comes out longer because the string compressor is less good at compressing these particular strings.

This turns out to be valid.

To my knowledge some of those characters can be saved using one byte, assuming well known encodings. in UTF-8 I get 36 bytes... Am I wrong?

@steffen: Jelly uses its own character encoding, in which all of the 256 different characters it uses can be stored in a single byte. (The only reason it does this rather than using a pre-existing encoding is for readability (!); you could trivially write the program encoded in, say, codepage 437, and it would run in the Jelly interpreter, but it would typically be much harder to read.)

CJam, 38 bytes
" ""Programming Puzzles""Dpef!Hpmg":(?

Try it online! or with spaces removed
Explanation
" "                    e# Push this string.
"Programming Puzzles"  e# Push "Programming Puzzles".
"Dpef!Hpmg":(          e# Push "Dpef!Hpmg" and decrement each char, giving "Code Golf".
?                      e# If the first string is true (non-empty) return the second string,
                       e#   else return the third.

Whether spaces are in the program or not determines if the first string is truthy or falsy.

Your code is sad :(

If you're willing to use unprintables, "Bncd\x19Fnke":) is happy code instead (replace \x19).

Javascript, 46 43 42 Bytes
x=>" "?"Programming Puzzles":"Code\40Golf"

console.log((x=>" "?"Programming Puzzles":"Code\40Golf")())
console.log((x=>""?"ProgrammingPuzzles":"Code\40Golf")())

You can replace the \x20 in the first string with a space.

Beat me to it, nicely done.  Does this need a trailing ;?

@ricdesi no, it dosen't.

@ricdesi since this is codegolf, if the program runs, it works. ;s are sometimes not required in JavaScript.

You can replace \x20 with \40 to save a byte :-)

Haskell, 48 bytes
a _="Programming Puzzles";a4="Code\32Golf";f=a 4
a_="ProgrammingPuzzles";a4="Code\32Golf";f=a4

Defines function f which returns the corresponding string.
For reference, the old version is:
Haskell, 49/47 bytes
f""="Code\32Golf";f(_)="Programming Puzzles";f" "

with spaces removed
f""="Code\32Golf";f(_)="ProgrammingPuzzles";f""

Two simple pattern matches. (_) matches all patterns. You can improve the without-spaces version by one byte by defining the second pattern as f" "=/f""=, but this gives a "Pattern match is redundant" warning.
Alternative solution with the same byte count:
last$"Code\32Golf":["Programming Puzzles"|" ">""]
last$"Code\32Golf":["ProgrammingPuzzles"|"">""]

Wolfram language, 62 bytes
"Programming Puzzles"[ToExpression@"\"Code\\.20Golf\""][[0 1]]

The space in [[0 1]] is implicit multiplication, so this is equivalent to [[0]]. Without a space, 01 is just 1. The 0th and 1st parts of this expression are the strings we want.
Another solution of questionable validity (44 bytes, 2 saved by Kelly Lowder):
"Programming Puzzles"["Code\.20Golf"][[0 1]]

The \.20 gets replaced by a space immediately when typed into a Mathematica environment, so it's not clear if it gets removed along with the other spaces…

As soon as you paste (or type) this into Mathematica, (cloud based or not) the escape sequence, \:0020 turns into a space, and thus would be removed, so I'm not sure this qualifies.  Also \.20 is shorter.by two characters.  "Programming Puzzles"["Code"<>FromCharacterCode@32<>"Golf"][[01]] will work.

@KellyLowder, hmm, that's a good point. I've added another solution that should avoid that issue. (Thanks for the \.20 suggestion — how did you find that? I thought I'd scoured the whole documentation…)

I found the \.20 by making a typo. Seems to only work for two-digit character codes.  I don't think it's in the documentation.

Excel - 56 Bytes
=IF(""=" ","Code"&CHAR(32)&"Golf","Programming Puzzles")

Very similar to most of the other answers... nothing fancy here.

Ohm, 33 32 bytes
Uses CP437 encoding.
▀Bn¬i≈╣Ü╝Rb╡°╧S½uÇ▀
▀4>~H├MS░l╬δ

Try it online! or try without whitespace
Explanation
With whitespace:
▀Bn¬i≈╣Ü╝Rb╡°╧S½uÇ▀    Main wire

▀Bn¬i≈╣Ü╝Rb╡°╧S½uÇ▀    Push "Programming Puzzles" (compressed string)
                       Implicitly output the top stack element

▀4>~H├MS░l╬δ           Helper wire (never called)

Without whitespace:
▀Bn¬i≈╣Ü╝Rb╡°╧S½uÇ▀▀4>~H├MS░l╬δ    Main wire

▀Bn¬i≈╣Ü╝Rb╡°╧S½uÇ▀                Push "Programming Puzzles" (compressed string)
                   ▀4>~H├MS░l╬δ    Push "Code Golf" (compressed string)
                                   Implicitly output top stack element

I'm so glad I finally finished string compression!

@NickClifford The curious thing I noticed was that Code Golf got longer when compressed. I guess that's because of the capitals? Either way it's still shorter than writing it normally because I can't use a literal space here.

Yeah, Smaz is kind of weird like that.

FYI, feel free to ping me in chat if you have any questions or feature requests for Ohm.

Japt, 29 bytes
With spaces:
`Co¸{S}Golf`r `PžgŸmÚÁ Puzz¤s

Try it online!
Without spaces:
`Co¸{S}Golf`r`PžgŸmÚÁPuzz¤s

Try it online!

This takes advantage of the fact that in Japt, a space closes a method call. With spaces, the code is roughly equivalent to this JavaScript code:
("Code"+(S)+"Golf").r(),"Programming Puzzles"

This is evaluated as JavaScript, and the result is sent to STDOUT. Since the last expression is "Programming Puzzles", that string is printed.
Without spaces, the code is roughly equivalent to:
("Code"+(S)+"Golf").r("ProgrammingPuzzles")

(If you haven't figured it out by now, the S variable is a single space.) The .r() method on a string, if given one argument, removes all instances of that argument from the string. Since "Code Golf" does not contain "ProgrammingPuzzles", it returns "Code Golf" unchanged, which is then sent to STDOUT.

I didn't even think of using replace. Nice one!

To my knowledge some of those characters can be saved using one byte, assuming well known encodings. in UTF-8 I get 36 bytes... Am I wrong?

@steffen Japt uses the ISO-8859-1 encoding, in which each char represents one byte. But some of the chars would be unprintable in this program, so I used the Windows-1252 encoding here (actually, it was autogenerated by TIO)

Brachylog, 44 bytes
" "Ṣ∧"Programming Puzzles"w|"Code"wṢw"Golf"w

Try it online!
Explanation
" "Ṣ                                           If " " = Ṣ (which is itself " ")
    ∧"Programming Puzzles"w                    Write "Programming Puzzles"
                           |                   Else
                            "Code"w            Write "Code"
                                   Ṣw          Write " "
                                     "Golf"w   Write "Golf"

Crossed out 44 is still 44 :( Edit in   on either side to fix :)

@HyperNeutrino It's not crossed out, 44 is the length with spaces, and 42 without.

Oh. Whoops. Well, it's too similar so I couldn't tell without looking at the markdown by going into edit. Never mind :P

Alice, 44 bytes
/"floG!"t"edoC"#
 /"selzzuP gnimmargorP"d&o@

Try it online!
Without whitespace:
/"floG!"t"edoC"#/"selzzuPgnimmargorP"d&o@

Try it online!
Explanation
In the first program, the two mirrors / redirect the instruction pointer onto the second line. "selzzuP gnimmargorP" pushes the required code points in revere order, d pushes the stack depth and &o prints that many bytes. @ terminates the program.
Without the whitespace, the program is all on a single line. In that case, the instruction pointer can't move in Ordinal mode, so the / effectively become no-ops (technically, the IP simply doesn't move for one step, the same / gets executed again, and the IP reflects back to Cardinal mode). So if we drop those from the program, it looks like this:
"floG!"t"edoC"#"selzzuPgnimmargorP"d&o@

To include the space in Code Golf, we use an exclamation mark instead and decrement it with t. After we've got all the code points on the stack, # skips the next command, which is the entire second string. d&o then prints the stack again, and @ terminates the program.

You must golf this (crossed out 44 is 44)

PHP, 44 Bytes
ternary operator
<?=" "?"Programming Puzzles":"Code\x20Golf";

PHP, 51 Bytes
comment
<?=/** /"Code\x20Golf"/*/"Programming Puzzles"/**/;

PHP, 57 Bytes
array switch
<?=["Code\x20Golf","Programming Puzzles"][(ord("
")/10)];

Common Lisp (SBCL), 52 bytes
(format`,t"~[Programming Puzzles~;Code~@TGolf~]"0 1)

Prints Programming Puzzles
(format`,t"~[ProgrammingPuzzles~;Code~@TGolf~]"01)

Prints Code Golf
Ungolfed:
(format t "~[Programming Puzzles~;Code Golf~]" 0 1)

Explaination:
The trick basically comes from how #'format works in Common Lisp.
In CL, most whitespace can be omitted provided that there is no ambiguity about where tokens start or end. The first trick was separating the format and t symbols. I had to unambiguously end the format symbol without changing how t was interpreted. Luckily, ` in CL ends the preceding token before it gets processed, and , cancels the effect of ` (` is used to implement templating, where the next expression following it gets "quoted", but any sub-expression prefixed with a , is evaluated and the result included in the template, so `, is nearly a no-op).
The third argument to format is the template string. format is similar to printf in C, but has much more powerful formatting directives and use ~ to indicate them instead of %. ~[ and ~] allow you to select between multiple options for printing, with ~; separating them. An additional argument is supplied to format- the numeric index of which one you want printed. In order to ensure that the " " in Code Golf survives, I used the tabulation directive ~T, which is used to insert whitespace, generally to align text into columns. ~@T is a variation which just inserts a given number of spaces, defaulting to 1.
Finally, there are two arguments to format- 0 and 1. Before whitespace is removed, the 0 is used by ~[~;~] to select "Programming Puzzles" and the extra format argument (the 1) is dropped (I'm not sure how standard dropping extra format arguments is, but this works on Steel Bank Common Lisp). After whitespace is removed, there is only one argument (01) which selects "Code Golf" instead.

+1, just one thing: "but any sub-expression prefixed with a , is evaluated and spliced in" Isn't ,@ necessary for splicing?

"spliced" is a poor term for that, admittedly. Technically, , evals the next expression and includes the result in the template, while ,@ assumes the expression will eval to a list and includes that list's contents in the template directly. Traditionally in the lisp community, ,@ is called "splicing", but I'm not sure that's the most obvious choice. I'll try to reword it a bit.

Perl 5, 43 41 bytes
say" "?"Programming Puzzles":Code.$".Golf

Try it online!
Uses the fact that ' ' is true in perl and '' is false. The $" variable is set to a space by default.
Thanks to @NahuelFouilleul for removing two bytes.

maybe late but "Code$\"Golf" is shorter and Code.$".Golf too

@NahuelFouilleul Yeah, I was pretty new when I wrote this answer. Thanks though!

C# 88 81 70 63 bytes
Func<string>@a=()=>" "==""?"Code\x20Golf":"Programming Puzzles";

With whitespace stripped:
Func<string>@a=()=>""==""?"Code\x20Golf":"ProgrammingPuzzles";

Thanks to BrianJ for showing me how to have no space between a method return type and the method name, PeterTaylor for saving 7 18 bytes, and Patrick Huizinga for saving 7 bytes.
Same method as everyone else really, technically this could be considered invalid because the method doesn't specify a return type for the method, but there has to be whitespace between the return type and the method name.

you can prefix the function name with an @, so then you have void@a... and avoid the "no return type" compilation error (also adds bytes, though :( )

.Length<1 saves one byte; \u0020 saves six if I've counted correctly; and  you can make a valid answer (and save a few bytes at the same time) by submitting a lambda instead of a top level function. Func<string>a=()=>...

@BrianJ Hmm, didn't know that, wonder why that works from a compiler view-point. Anyway, it may lose bytes but it also technically makes this answer not non-competing, so it's worth it. Thanks!

@Mayube the @ is primarily used if you need to use a reserved word as a variable name (the equivalent is surrounding with [] in VB.NET (and MS SQL Server)).

@PeterTaylor wouldn't changing it to a func lambda require returning the string, which would need a space after return, thanks for the tip on Length and the space though

Yes, it requires returning the string; but if you use => instead of return you don't need any spaces. (And even if you use return, you can return(...)).

But Brian's tip combines with mine if you change the header to say "C# version 6": string@a()=>...

No, string@a()=>" ".Length<1?"Code\u0020Golf":"Programming Puzzles"; is a full-fledged method definition in C# from version 6.

@PeterTaylor Tried it in VS2015 with C#6 and it said it's only available in C#7, if you wanna post it as a separate answer for C#7 go ahead, my VS isn't setup for C#7

Huh. According to the documentation it's available from C# 6 in VS 2015. I'm not going to have access to a computer with any VS until Tuesday.

Can anyone explain to me why " ".Length<1 is used instead of " "==""?

Also, \u0020 can be replaced with \x20.

R, 50 bytes
I think this is the same as this Javascript answer, and basically the same idea as all the others.
`if`(' '=='','Code\x20Golf','Programming Puzzles')

49 bytes

Pyth, 37 bytes
?" ""Programming Puzzles""Code\40Golf

Try it here.
?"""ProgrammingPuzzles""Code\40Golf

Try it here.

><>, 47 45 bytes
! v"floG!"1-"edoC"!
o<>"selzzuP gnimmargorP">

Try it online!
Thanks to randomra for -2 (clever two !s so that I can use only one >o<.)
The code shouts "Flog! Flog! Flog!" and resembes a fish.

dc, 50
[pq]sm[Programming Puzzles]dZ19=m[Code]n32P[Golf]p

Try it online.
[ ] defines a string - Z measures its length.  If the length is 19 then it contains a space and the macro stored in the m register is called, which prints Programming Puzzles and quits.  Otherwise Code Golf is printed.

Could you link to the dc interpreter / docs / github?

@programmer5000 Just choose dc on TIO, then click the language name.

@Dennis thanks, I didn't even know that TIO does that!

><>, 42 bytes
With whitespace
\"floG"48*"edoC"
/>o<"Programming Puzzles"

Try it online!
Without whitespace
\"floG"48*"edoC"/>o<"ProgrammingPuzzles"

Try it online!

Java 8, 74 50 48 bytes
()=>" "==""?"Code\040Golf":"Programming Puzzles"

@NonlinearFruit you're right, I've changed that one to be non-competent

I don't think printing is a requirement, so you could just return the string. I haven't tested it but the == operator should also work, ()=>""==""?"Code\u00A0Golf":"Programming Puzzles"

\u00A0 -> \040 for a 2 byte savings.

Befunge, 47 bytes
# <"floG"84*"edoC">:#,_@#" Programming Puzzles"

Try it Online
Without spaces it skip the first < and prints Code Golf instead

APL (Dyalog Unicode), ₄₅ ₄₁ 39 bytesSBCS
Anonymous lambda. Takes dummy argument.
{'Programming Puzzles'
⊢4⌽9↑'GolfCode'}

Try it online!
This function is a so called "dfn" which terminates with and returns the first non-assignment, i.e. Programming Puzzles.
Removing all whitespace gives:
{'ProgrammingPuzzles'⊢4⌽9↑'GolfCode'}

Try it online!
This takes the last nine characters of GolfCode thus padding with a trailing space, then cyclically rotates that 4 steps to the left. ⊢ ignores the text on its left and returns the text on its right.

Python 3,  72 68 bytes
Had output backwards at first, thanks Draco18s, then saved 4 bytes, thanks Jo King
a=0;ab="Programming";a
b="Code";ad="Puzzles";a
d="Golf";print(ab,ad)

Try it online!

I think you have the outputs backwards.

Whoops lol, thanks. Fixed it

You can reuse the a to get 68 bytes

Japt, 32 bytes
" "?`PžgŸmÚÁ Puzz¤s`:`Co¸{S}Golf

Try it online!

Heh, I was just about to post the same thing :-)

Actually, there is a shorter way...

PowerShell, 56 bytes
('Programming Puzzles',('Code'+[char]32+'Golf'))[!(' ')]

Try it online!
Pretty basic I would say, but it gets the job done

PowerShell, 54 bytes
"$((('Programming','Puzzles'),('Code','Golf'))[!' '])"

Try it online!
Without spaces
"$((('Programming','Puzzles'),('Code','Golf'))[!''])"

Try it online!

T-SQL, 96 82 81 67 bytes
print+iif(len(' x')=2,'Programming Puzzles','Code'+char(32)+'Golf')

Try it online | Without spaces
Old version (96 bytes):
select(case'x'when(replace(' ',' ','x'))then'Programming Puzzles'else'Code'+nchar(32)+'Golf'end)

Nice work, you can get to 67 by losing the outer parens and changing the condition to iif(len(' x')=2

@BradC Close, but the outer paren prevents needing a space after print. I used a + instead and it worked.

Must've pasted and counted the wrong one. And I didn't know either, but the plus was the first character I tried and it worked.

MATL, 39 37 bytes
Thanks to @Sanchises for removing 2 bytes.
'Dpef!Hpmg'qc%
'Programming puzzles'&

Try it online!
Explanation
With spaces
'Dpef!Hpmg' pushes this string.
q substracts 1 from each code point, and c converts back to characters. This produces the string 'Code Golf'.
% is the comment symbol. The rest of the line (which is empty) is ignored.
'Programming puzzles' pushes this string.
& specifies that the display function, which is implicitly called at the end of the program, must only print the top of the stack (instead of the whole stack). So the second string is printed.
Without spaces
'Dpef!Hpmg' pushes this string.
q substracts 1 from each code point, and c converts back to characters. This produces the string 'Code Golf'.
% is the comment symbol. The rest of the line (that is, the rest of the code) is ignored.
At the end of the program the implicit display function is called, which prints the string.

Haskell, 42 bytes
Simple comment abuse. (Hm, seems to confuse the syntax coloring too.)
{-- }"Code\SPGolf"--}"Programming Puzzles"

With the spaces {-- }"Code\SPGolf"--} is a bracketed comment. Try it online!
Without the spaces {--} is a bracketed comment and --}"ProgrammingPuzzles" an end of line comment. Try it online!

Pushy, 47 bytes
`Dpef!Hpmg `KtkL9=?";
\
c`Programming Puzzles`"

Try it online!
In its initial form, the top line adds the string "Code Golf" to stack, but with each character incremented, and a trailing space. It then decrements each character and checks if the length is 9 - however, as there is a trailing space, the length is 10, so the conditional is not entered. Therefore the top line is essential a no-op. The third line then prints "Programming Puzzles".
After modification, the program looks like this:
`Dpef!Hpmg`KtkL9=?";\c`Programming Puzzles`"

The \ starts a comment therefore the only relevant code is the first half, which gets the string "Code Golf", checks its length (which is now correctly 9 as the space has been removed), and then prints it accordingly.

Kotlin, 62 bytes
Lambda returning a string.
{" ".ifEmpty{"Code\u0020Golf"}.ifBlank{"Programming Puzzles"}}

1.3 introduced ifEmpty and ifBlank which each take a lambda and return its result if the receiving string is empty or contains only whitespace. If the condition fails, the receiving string is passed on instead.
So, if the spaces are removed, then the ifEmpty check passes and the ifBlank check fails. The reverse is true if the spaces are left.
Try it online!

MathGolf, 34 bytes
╕│Çÿgolf]ûq¶$╦ÿming+û£q$╦α ?;;δ♥$u

Try it online!
Explanation
The code contains only one single space. With it, the stack contains [['code', 'golf'], ['programming', 'puzzles'], ' '] when the ? is reached, otherwise it just contains the two lists. The ?rotates the top three elements, and implicitly pushes a 0 to the stack when only two elements are on the stack. This means that the order of the elements is different after the ? depending on if the space is present. It could be shorter by using the non-breaking space character, which is the "discard everything but TOS" operator, but I don't know if that is allowed.
╕│Çÿgolf]                                   Push ['code', 'golf']
         ûq¶$╦ÿming+û£q$╦α                  Push ['programming', 'puzzles']
                           ?                Push a space and rotate top 3 stack elements
                            ;;              Discard top two elements
                              δ             Capitalize string
                               ♥$u          Join with spaces

SmileBASIC, 49 bytes
TABSTEP=5?"Code","Golf"'
CLS?"Programming Puzzles

At first I was afraid I'd need to use CHR$(32) to for the space in "Code Golf". Fortunately, I can save exactly 0 characters using commas and TABSTEP.

bash, 51 bytes
(echo Programming Puzzles||dd<<<$'Code\40Golf')2>&-

TIO

Befunge-98 (FBBI), 46 bytes
"floG edoCselzzuP gnimmargorP"f3+40# $j$k$8k,@

Try it online!
Explanation:
"floG edoCselzzuP gnimmargorP" ¤ Put "Code Golf" and "Programming Puzzles" into
                                 the stack, character by character,
                                 so that "Programming Puzzles" is on top of the stack.
f3+40                          ¤ Push 18, then 4, then 0 to the stack.
     # $                       ¤ With space: Jump over the whitespace and pop the 0.
        j$k$8                    Jump over the 4 next instructions.
             k,@                 Print the 18 top chars from the stack and exit.

     #$                        ¤ Without space: Jump over the `$` instruction,
       j                         Jump over the next 0 instructions.
        $                        Pop 4 from the stack.
         k$                      Pop the top 18 chars from the stack.
           8k,@                  Print out the 8 top chars from the stack and exit.

Wren, 62 bytes
System.write(" ".count>0?"Programming Puzzles":"Code\x20Golf")

Try it online!
Explanation
System.write(                                                ) // Output
             " ".count>0                                       // Whether the length of this string is larger than 0
                        ?"Programming Puzzles"                 // If true, output "Programming Puzzles"
                                              :"Code\x20Golf"  // Otherwise, output "Code Golf"

Wren, 71 bytes
System.write(Num.fromString("0 0")?"Code\x20Golf":"Programming Puzzles")

Try it online!
Explanation
System.write(                                                          ) // Output
             Num.fromString("0 0")                                       // Whether converting to a single number is successful
                                                                         // If this isn't successful, it outputs null, which is a false value.
                                  ?"Code\x20Golf"                        // If this is successful, output "Code Golf"
                                                 :"Programming Puzzles"  // Otherwise, output "Programming Puzzles"

c, 73 bytes
With whitespace:
main(){printf("%s\n",atoi("- 1")?"Code\x20Golf":"Programming Puzzles");}

Without whitespace:
main(){printf("%s\n",atoi("-1")?"Code\x20Golf":"Programming Puzzles");}

Zsh, 45 bytes
\ ;<<<Programming\ Puzzles||<<<Code$'\40'Golf

Try it online!
With spaces:

\ : execute the command  , (which doesn't exist so does nothing)
;: then
<<<Programming\ Puzzles: print Programming Puzzles
|| if that fails (which is never does, because printing is always successful):

<<<Code$'\40'Golf: print Code Golf (this doesn't get executed)

Without spaces:

\;: execute the command ; (which doesn't exist so does nothing with its input)
<<<Programming\Puzzles: and send ; the input ProgrammingPuzzles (which it discards, since it doesn't do anything)
|| if that fails (which it always does, since ; is not a defined command):

<<<Code$'\40'Golf: print Code Golf ($'\40' is a space, written with an octal escape)

Vyxal, 20 bytes
` `[`↔ḃ ₄∩`|`¬꘍»₆`½Ṅ

Try it Online!  and
TryitOnline!
How it works

` ` is a string with one space, a truthy value. When spaces are removed, it becomes the empty string ``, which is falsy.
[...|...] is an conditional statement. If the top of the stack is truthy, the first part is executed, otherwise the second part.

If true (spaces are not removed): `↔ḃ ₄∩`, the compressed string `Programming Puzzles`, is pushed and output
Otherwise: `¬꘍»₆`, the compressed string `CodeGolf`, is pushed. ½ splits it into the list ⟨`Code`|`Golf`⟩, which is then joined by spaces with Ṅ and implicitly printed.

Vyxal, 21 bytes, for the new site name
Additionally, here is a 21-byte solution for the new site name - Code Golf and Coding Challenges:
` `[`¬꘍ »₆`|`⟩₆,→ṗ`⌐Ṅ

Try it Online! and TryitOnline!
It works similarly, using ⌐Ṅ to replace the comma in compressed Coding,Challenges with a space.

GolfScript, 38 bytes
" ""Programming Puzzles""Code\sGolf"if

Try it online!

Befunge, 76 bytes
" "0`#v_"floG"84*"edoC",,,,,,,,,@
,,,,,@>"selzzuP gnimmargorP",,,,,,,,,,,,,,

Try it online!
Not the most compact solution, but then again writing Befunge code without whitespace is pretty difficult.
At the very beginning, it compares a space character with 0. If it's greater, it goes to the bottom row. If it isn't, which is what happens when you replace space with nothing, it stays on the first row.

What do the ,s do?

@programmer5000 Each prints one character.

A tip for printing a large number of characters up until you reach a 0 is to do >:#,_ which could save you a lot of bytes

Pyth, 36 bytes
J
"Programming Puzzles" "Code\40Golf

Try it online: with or without whitespace characters
That's a nice challenge for Pyth.
In the above code the newline prints Programming Puzzles and the space suppresses the output of Code Golf. J only assigns the first string to the variable J, but doesn't print anything.
After removing the newline and the spaces, the first string doesn't get printed (only assigned), but the second string gets printed implicitly.

Braingolf, 53 bytes [non-competing]
Holy crap I did it
48*# 1+-?"Programming Puzzles"@19%"Code"1#!-"Golf"@9|

So the issue with Braingolf is that the only conditional it has is an "is the last number on the stack greater than 0?" check, which makes this kinda challenge a little tricky, but I persevered and here it is!
Non-competing because the language was created after the date of the challenge
Explanation:
Whitespace version:
48*                                                    Push the int literals 4 and 8 to the stack, then multiply them together, consuming both and adding the result to the stack (32)
   #<space>                                            Add the charcode of the literal char <space> to the stack, which also happens to be 32
     1+                                                Push int literal 1 to the stack, then add together the last 2 elements of the stack (1 and 32)
       -                                               Subtract the last 2 elements of the stack from each other (33 - 32)
        ?                                              Check if the last element on the stack is greater than 0, 33-32 is 1, so it is (this also consumes the checked number from the stack)
         "Programming Puzzles"                         Add the charcodes for the string "Programming Puzzles" to the stack
                              @19                      Print the last 19 elements of the stack as chars
                                 %                     Else, nothing after this will run, as the ? returned true
                                  "Code"               Push the charcodes for the string "Code" to the stack
                                        1#!-           Push the literal int 1 and the charcode for the character '!' (33) to the stack, then subtract one from the other (33 - 1 = 32, the charcode for a space)
                                            "Golf"     Push the charcodes for the string "Golf" to the stack
                                                  @9   Print the last 9 elements of the stack as characters
                                                    |  End if-else, at this point Braingolf would normally output the last element of the stack, as there is no semicolon in the program, however the stack is empty, so it doesn't.

No whitespace version (only the important part):
48*        Same as last time, push 4 and 8 to the stack, then multiply them to make 32
   #1      This time add the charcode for the character '1' to the stack (which is 49)
     +     Add the last 2 elements of the stack together (32 + 49 = 81)
      -    Subtract the last 2 elements of the stack from each other, however there is only 1 element in the stack (81) so subtract it from itself, 0
       ?   Is the last (only) element in the stack greater than 0? (no, it is 0)
           At this point the code skips every character up until the % else, and then runs from there to the end.

Befunge-98, 51 bytes
]@,k9"Code"*84"Golf";
["selzzuP gnimmargorP">:#,_@;

Try it online!
The main idea here is to use the "turn right" operator (]) to check if there is a line below the first one. If there is, we print selzzuP gnimmargorP backwards. If the newline is removed, we turn right twice to go backwards on the top row. we use the ;s to skip the "Programming Puzzles" code and print Code Golf.
I have other ideas about how to golf this whole thing (having to do with the fact that ProgrammingPuzzles is exactly twice as long as Code Golf) but I thought I would post a simple version first, considering my other one is in progress.

Ruby, 46 bytes
puts' '[0]?'Programming Puzzles':"Code\40Golf"

Haskell, 67 65 bytes
Even if it's longer than the one by @nimi, here's another Haskell solution, that works by abusing the [] Monad:
λ putStr$[s|s<-[" ">>"Programming Puzzles","Code\32Golf"],s/=""]!!0

  Programming Puzzles

Try it online!
λ putStr$[s|s<-["">>"Programming Puzzles","Code\32Golf"],s/=""]!!0

  Code Golf

Try it online!
Thanks @Laikoni for golfing off 2 bytes!

Add++, 56 bytes
INy,x:" ",Ix,,O"Programming Puzzles",INx,,O"Code\40Golf"

Try it online!
Uses a very similar technique to a lot of answers, and has the pseudocode of
x = ' '
if x:
    print('Programming Puzzles')
else:
    print('Code Golf')

By removing all whitespace, we make x equal to the empty string, which is falsey in Add++. Therefore, we output Code Golf instead of Programming Puzzles. The space in Code Golf is simply the octal value \$40_8 = 32_{10}\$. The only unusual part is the preceding INy,. With this, we are able to put all our code on one line, as this is a compound statement. Without this, the programming, with whitespace, would look something like this:
x:" "
Ix,O"Programming Puzzles"
INx,O"Code\40Golf"

But, when you remove the whitespace from this, we cause syntax errors, as outside of compound statements, Add++ has no other line terminator than a newline.

Ahead, 44 bytes
j ~"floG"32"edoC"~"selzzuP gnimmargorP"j~WW@

The first space is what's actually important. j will "jump over" the next cell in the head's direction; if the space is there it will be jumped over and the head will land on the first ~, causing it to skip the section that pushes Code Golf. When the spaces are removed, the ~ will be jumped over and the first section will be entered instead.
Try it online!

Keg, 35 30 bytes
‘∂⬭⑥⑷‘¶C≬;Puzz0ɧ;¶\ #ø¶[*;Golf

Without spaces:
‘∂⬭⑥⑷‘¶C≬;Puzz0ɧ;¶\#ø¶[*;Golf

Explained
‘∂⬭⑥⑷‘¶C≬;Puzz0ɧ;¶\ #ø¶[*;Golf
‘∂⬭⑥⑷‘              #Push the string "Program"
       ¶C≬;Puzz0ɧ;¶     #Push the string "ing Puzzles"
                   \        #Escape the space and implicitly print

------------------------------------------------------------------------------

‘∂⬭⑥⑷‘¶C≬;Puzz0ɧ;¶\#ø¶[*;Golf
‘∂⬭⑥⑷‘¶C≬;Puzz0ɧ;¶\#        #Everything as before, but this time:
                     ø      #Empty the stack
                      ¶[*;Golf  #Push the string "Code Golf" and print

Try it online!
Answer History
35 bytes
`∂⬭;⑥⑷;`¶C≬;Puzz0ɧ;¶+\ #__¶[*;Golf¶

Real shifty string compression going on here!
Try it online!

Lua, 56 bytes
print((#' '>#'')and'Programming Puzzles'or'Code\32Golf')

Try it online!

Zsh, 49 bytes
<<<${${:-ProgrammingPuzzles}/*gP*/$'Code\40Golf'}

Try it online!
With spaces (in fact, only one added):
<<<${${:-Programming Puzzles}/*gP*/$'Code\40Golf'}

Uses ${    /match/replacement}, and executes it on any string containing gP.

yash, 50 bytes
This is POSIX-compatible.
echo Programming Puzzles||echo${IFS}Code${IFS}Golf

How it works
Like @NahuelFouilleul but using IFS variable instead.
Try it online!
Tryitonline!

Ruby, 56 bytes
puts"Code\x20Golf"if(" "=="")#
puts"Programming Puzzles"

The second string literal should contain a tab.

You can save a fair number of bytes if you change !(" ">"    ") to " "=="". That should bring it to 56 bytes, by my count.

Microscript II, 45 bytes
" "("Programming Puzzles"ph)"Code"p32Kp"Golf"

Or, which is one byte longer:
' s#("Programming Puzzles"ph)"Code"p32Kp"Golf"

Microscript, 48 bytes
' d32{"floG"z32s"edoC"ah}"selzzuP gnimmargorP"ah

Or, which is the same length:
" "#{o"selzzuP gnimmargorP"ah}"floG"z32s"edoC"ah

Or:
' s#{o"selzzuP gnimmargorP"ah}"floG"z32s"edoC"ah

Braingolf, 44 bytes
" "?"Programming Puzzles":"Code"48*"Golf"|&@

Try it online!
With whitespace removed:
""?"ProgrammingPuzzles":"Code"48*"Golf"|&@

Try it online!
Explanation
With whitespace:
" "                         push a space character
   ?                        if the last item on the stack > 0...
    "..."                   ...push the string "Programming Puzzles"
         :                  else...
          "..."             ...push the string "Code" and...
               48*          ...push 4 and 8 and multiply them and...
                  "..."     ...push the string "Golf"
                       |    end the conditional
                        &@  print all the characters on the stack

Without whitespace:
""                          push nothing
  ?                         if the last item on the stack > 0...
   "..."                    ...push the string "ProgrammingPuzzles"
        :                   else...
         "..."              ...push the string "Code" and...
              48*           ...push 4 and 8 and multiply them and...
                 "..."      ...push the string "Golf"
                      |     end the conditional
                       &@   print all the characters on the stack

Pip, 37 bytes
"Programming Puzzles"  "Code0Golf"R0s

Try it online!
Explanation
Comment abuse.
Anything following two spaces in Pip is a comment.* So with the spaces, this is just the string expression "Programming Puzzles", which is autoprinted. Without the spaces, the first expression doesn't do anything, and we instead autoprint "Code0Golf"R0s, which replaces the 0 in Code0Golf with a space.
My original idea, ' ?"Programming Puzzles""Code0Golf"R0s (fun with character literals), was 1 byte longer.
* Spaces at the beginning of a line don't count.

Petit Computer BASIC, 40 bytes
?"Code","Golf"'
CLS?"Programming Puzzles

The original program prints Code Golf and then clears the screen and prints Programming Puzzles.
When whitespace is removed it becomes ?"Code","Golf"'CLS?"Programming Puzzles (' starts a comment), so only Code Golf is printed.

Pxem, filename: 47 43 bytes.
  .zAaGolf.-Code.p.d.aProgramming Puzzles.p

What it does
Branches with first two spaces.
Try it online!
Tryitonline!

Note that it's Programming Puzzles, with an s at the end


text:
Write a mutating, replicating program
This is a variant on the self-replicating program, defined here as a program that outputs its source (or a quine). Below is an example of a self-replicating program in Python:
s = 's = %r\nprint(s%%s)'
print(s%s)

When run from a file, this script should output itself.
Instead of a self-replicating program, I want you to write a mutating, replicating program. This is a program that outputs something similar to its source, but with a mutation. The mutated source must also be able to replicate, but it should change the functionality of the program in some way. Here is an example:
s = 's = %r\ns = s.replace(s[-17],str(int(s[-17])+222))\nprint(s%%s)'
s = s.replace(s[-17],str(int(s[-17])+222))
print(s%s)

When this Python script is run, it outputs the following program:
s = 's = %r\ns = s.replace(s[-17],str(int(s[-17])+224224224))\nprint(s%%s)'
s = s.replace(s[-17],str(int(s[-17])+224224224))
print(s%s)

If you repeat a number of times, you will see that it continues to mutate but remain functional.
Incorporating a raw dynamic environment variable in your code, like a comment with a timestamp, is boring. Don't do that.
Edit: For that matter, let's follow the standard quine rule of no input.
This is code-golf so the shortest in bytes wins.
Clarifications: I've been asked to clarify, but without much information I'm not sure what needs clarifying. Here's my best shot:

Each iteration should have source code that is different from the last.
The iteration must still run.
The iteration must still replicate according to the same rules.
Comments or strings can't be the only thing that changes. In dzaima's answer the operations on the string are duplicated, not just the contents of the string--so that is valid.
Each iteration must be runnable in the same language you started in.

Not sure if I should actually tag the question with [tag:quine] or not, since the desired solutions are not technically quines.

Possible duplicate

@mathjunkie This is not a duplicate because that has the constraint that the program must cycle back to its original form. And also the restriction that there must be two programs at some point that share no characters in common.

That other challenge might actually be harder than this one, given those constraints.

@Draco18s It is in fact, but since it has no solution yet, it would probably be a good exercise to solve this easier problem first.

There is the oroboros Quine Relay but I have a feeling it's the only example. But point taken.

@called2voyage: if a challenge requires an infinite chain or closed loop of programs, each of which outputs the next, it's nearly always correctly tagged as [tag:quine]. The tagging's mostly about the sort of techniques you need to solve the problem, and even though the program isn't printing itself exactly, it still needs to generate something similar to its own source, or that of a near-quine, to keep the chain going.

Jelly, 4 bytes
⁾ṘȮṘ

Try it online!
(Equivalent to the 5-byte: “ṘȮ”Ṙ)
Exponentially spawns:
“ṘȮ”ṘȮ
“ṘȮ”ṘȮṘȮ
“ṘȮ”ṘȮ“ṘȮ”ṘȮṘȮ
“ṘȮ”ṘȮṘȮ“ṘȮ”ṘȮ“ṘȮ”ṘȮṘȮ
“ṘȮ”ṘȮ“ṘȮ”ṘȮṘȮ“ṘȮ”ṘȮṘȮ“ṘȮ”ṘȮ“ṘȮ”ṘȮṘȮ

Since Ṙ is a monadic atom which prints a Jelly representation of its input and then yields it's input, and Ȯ is a monadic atom which prints its input and yields it's input (neither printing any newlines), while “...” defines a list of characters. So each “ṘȮ”Ṙ prints “ṘȮ” and yields to the following Ȯ which prints ṘȮ and yields... a trailing Ȯ finally yields for the programs return value, which is implicitly printed, so the pattern will continue until resources no longer suffice.

SOGL, 9 bytes
:+q$o”q$o

Explanation:
:+q$o”     push that string
      q    output it in a new line without popping
       $   push "”"
        o  output that
           implicitly output the original string (in a new line)

The iterations go as (one per line)
:+q$o”¶:+q$o
:+q$o:+q$o”¶:+q$o:+q$o
:+q$o:+q$o:+q$o:+q$o”¶:+q$o:+q$o:+q$o:+q$o:+q$o:+q$o:+q$o:+q$o”¶:+q$o:+q$o:+q$o:+q$o:+q$o:+q$o:+q$o:+q$o

and the next one is 31424 characters long.
The first iteration is
:+q$o”        push that string
      ¶       no-op
       :+     add the string to itself
         q    output it in a newline without popping
          $o  append "”"

and the next:
:+q$o:+q$o”             push that string
           ¶            no-op
            :+          add the string to itself
              q         output it in a newline without popping
               $o       append "”"
                 :+q$o  the same

This should never break from what I can see (well except hitting javas string length limit or something), because only the last string is used and the rest of the code is just multiply, output.
note: newlines and ¶ are completely interchangeable in SOGL.

Looks good. Unless you know of a way to run online, I'll have to test when I get home.

No way of running SOGL online currently, sorry

Pyth, 11 bytes
jN*2]"jN*4[

Try it
Try it online
Gets exponentially longer. Based on this Pyth Quine.
first 4 iterations
jN*2]"jN*4[
jN*4["jN*4[
jN*4["jN*4["jN*4["jN*4[
jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4["jN*4[

Explanation
jN*4]"jN*4[
     "jN*4[                 # The String "jN*4["
    ]                       # Make it into a list with one element
  *4                        # Quadruple that list
jN                          # join on quote (N='"')

jN*4["jN*4["jN*4["jN*4[
                 "jN*4[     # The string "jN*4["
                [           # List with the string: ["jN*4["]
              *4            # Quadruple that list
            jN              # Join on quote
     "jN*4["                # The string "jN*4["
    [                       # Put both strings into a list
  *4                        # Quadruple that list
jN                          # join on quote (N='"')

(I could probably prove this rigoriosly using induction, but I'm not in the mood for that.)
This should (theoretically always work because) it's just even multiples of jN*4[". Every second occurence of that sequence of characters is interpreted as a string because of the " of the previous one. The [ of the previous one then puts that string into a list together with what the next one produces. Then that list is repeated four times and joined to string with ".

In your explanation you say *2 instead of *4.

@EriktheOutgolfer Fixed, thanks!

Python 2, 33 bytes
_='_=%r;print _%%_*2;';print _%_;

Ideone
Doubles in size. (This is technically only true from the third iteration onwards) Based on this Quine. Similar to my Pyth answer.
iterations
_='_=%r;print _%%_*2;';print _%_;

_='_=%r;print _%%_*2;';print _%_*2;

_='_=%r;print _%%_*2;';print _%_*2;_='_=%r;print _%%_*2;';print _%_*2;

_='_=%r;print _%%_*2;';print _%_*2;_='_=%r;print _%%_*2;';print _%_*2;
_='_=%r;print _%%_*2;';print _%_*2;_='_=%r;print _%%_*2;';print _%_*2;

_='_=%r;print _%%_*2;';print _%_*2;_='_=%r;print _%%_*2;';print _%_*2;
_='_=%r;print _%%_*2;';print _%_*2;_='_=%r;print _%%_*2;';print _%_*2;
_='_=%r;print _%%_*2;';print _%_*2;_='_=%r;print _%%_*2;';print _%_*2;
_='_=%r;print _%%_*2;';print _%_*2;_='_=%r;print _%%_*2;';print _%_*2;

source: Stack Exchange

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

sort: votes


text:
Keyboard layouts challenge
The keyboard layout people commonly use is the QWERTY layout as shown below.

But there are also other keyboard layouts:
DVORAK

COLEMAK

WORKMAN

Your task
Your code will take two inputs: the name of the keyboard layout and a string to transcribe.
Your goal is to convert your QWERTY input as if you were typing with the keyboard layout given as first parameter.
Rules
The input format is free, you can use strings, arrays, etc. Moreover, you can use any three distinct values to represent the layouts to reduce your byte count, but they each have to be representable in 10 bytes or less.
You need only to handle the keys with a white background. Specifically, you must transpose the printable ASCII characters from the QWERTY alphabet to one of the other alphabets:
 QWERTY: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
 DVORAK: !_#$%&-()*}w[vz0123456789SsW]VZ@AXJE>UIDCHTNMBRL"POYGK<QF:/\=^{`axje.uidchtnmbrl'poygk,qf;?|+~
COLEMAK: !"#$%&'()*+,-./0123456789Oo<=>?@ABCSFTDHUNEIMKY:QPRGLVWXJZ[\]^_`abcsftdhuneimky;qprglvwxjz{|}~
WORKMAN: !"#$%&'()*+,-./0123456789Ii<=>?@AVMHRTGYUNEOLKP:QWSBFCDXJZ[\]^_`avmhrtgyuneolkp;qwsbfcdxjz{|}~

(Note: this was transcribed by hand by @ETHproductions, so if you see any errors, please point them out!)
Example
DVORAK zZxX as input will give as output ;:qQ
This is code-golf so the shortest answer in bytes wins!

Also, some more test cases would be useful.

@ETHproductions I'll had some more test cases

When you say "you can use any three distinct values to represent the layouts", do you mean that we can assume the existence of constants containing those layouts?

@Tutleman Yes, you can take 0 1 2 for instance

Wait, can we take e.g. !_#$%&-()*}w[vz0123456789SsW]VZ@AXJE>UIDCHTNMBRL"POYGK<QF:/\=^{`axje.uidchtnmbrl'poygk,qf;?|+~ as the input for the Dvorak keyboard? That would trivialize the challenge... How about introducing a length restriction or something similar?

@ETHproductions Indeed I didn't think about that aspect, you can edit the question if you want to otherwise I'll do it later :)

There, I think it's better now.

To clarify: When you say we can take input as an array, do you mean we can use an array of the individual characters in the string? e.g., ["z","Z","x","X"]

@Shaggy Yes of course

Cool, that saves me few bytes :) For future reference, when people mention standard means of input in their questions, is a string destructures into an array usually included or is it something that has to be specifically allowed?

@ETHproductions "they each have to be representable in 10 bytes or less" I'd recommend removing this requirement.

@EriktheOutgolfer But then you could take e.g. !_#$%&-()*}w[vz0123456789SsW]VZ@AXJE>UIDCHTNMBRL"POYGK<QF:/\=^{`axje.uidchtnmbrl'poygk,qf;?|+~ as input

@ETHproductions Maybe add a rule then saying that the input must not be used to construct the layouts, but only to index them?

@EriktheOutgolfer I think that would be a little too blurry. Could I use E, S, and H (the keys on Qwerty-D) as my inputs? Why do you think the 10-byte requirement is not a good idea?

@ETHproductions Yes you could use those characters as inputs, although the layouts must not depend on them at all to be constructed. The only use for them would be to choose which layout to use. 10 bytes is a fixed limit (IMO too short), that's why I don't like it. And yes you say bytes not chars. I think this should've been sandboxed for more time.

@EriktheOutgolfer I actually quite like the challenge of trying to use those 10 bytes to do as much as possible!

Ruby, 258 247 238 bytes
->c,t{c.tr"#{$f='\'"+,-./<=>?[]{'}}:;B-Z_b-z",%W(-_}w[vzW]VZ/=?+SsXJE>UIDCHTNMBRL"POYGK<QF:{xje.uidchtnmbrl'poygk,qf;
#$f}OoBCSFTDHUNEIMKY:QPRGLVWXJZ_bcsftdhuneimky;qprglvwxjz
#$f}IiVMHRTGYUNEOLKP:QWSBFCDXJZ_vmhrtgyuneolkp;qwsbfcdxjz)[t]}

Try it online!
This is a function taking two arguments: the message to be swapped, and a value 0-2 representing the layout to be swapped to, where 0 corresponds to Dvorak, 1 to Colemak, and 2 to Workman.
Fundamentally, I don't think this is much different than the other answers. More readably, it looks like this:
def swap_layout(message, layout)
    keyboards = [DVORAK, COLEMAK, WORKMAN] # Omitted here for brevity
    return message.tr(QWERTY, keyboards[layout])
end

Ruby's string#tr function takes two arguments: a string containing characters to be replaced, and a string containing their replacements. Helpfully, it allows you to specify ranges of characters using a-z syntax. The other key space-saving realization is that it's not necessary to include characters that are the same in all four layouts, which allowed me to get rid of all digits, the letter "A" in both upper- and lowercase, and a handful of special characters.
One other weird bit of syntax is the use of %W(). This creates an array of strings containing everything inside the parentheses, separated by whitespace. All linebreaks in the submission actually function as element separators. %W() also permits string interpolation (which is done with the #{} operator) - %w() would've been the same thing, but without string interpolation.
I'd also like to take a moment to blame Dvorak for messing with my plans for optimization through its insistence on being totally different than everyone else, all the time; a Qwerty/Colemak/Workman solution could have been so beautifully short...

Does taking an integer as representation of the keyboard to map to meet the requirements? The test case seems to explicitly require the name of the keyboard but, then, the rules would seem to allow any input to represent the keyboard.

@Shaggy To quote one of the asker's comments on the post, "you can take 0 1 2 for instance", which is precisely what I've done.

JavaScript (ES7), 282 273 251 250 bytes
Takes a keyboard layout ID k and an array of characters a in currying syntax (k)(a). Returns an array of translated characters.
The layout IDs are:

DVORAK: \$-32\$
COLEMAK: \$64\$
WORKMAN: \$160\$

k=>a=>a.map(c=>1/(t=`1_3-2}w[vz8SsW]VZ1XJE>UIDCHTN0BRL"POYGK<QF:/0=0{1xje.uidchtn0brl'poygk,qf;?0+995Oo6SFTD0UNEI0KY:0PRGL2J8sftd0unei0ky;0prgl2j998Ii5VMHRT0YUNEOLKP:0W0BFCD0J6vmhrt0yuneolkp;0w0bfcd0j5`.replace(/\d/g,n=>15**n)[c.charCodeAt()+k])?c:t)

Try it online!
How it works
Compression
All three target layouts are stored in a single compressed string, where each character is either:

a translation character from QWERTY
a digit representing the number of consecutive characters that do not need to be translated

More specifically, a digit \$n\$ is interpreted as the length of the number \$15^n\$ in base \$10\$:
n | 15**n       | length
--+-------------+-------------
0 | 1           | 1
1 | 15          | 2
2 | 225         | 3
3 | 3375        | 4
4 | 50625       | 5 (not used)
5 | 759375      | 6
6 | 11390625    | 8
7 | 170859375   | 9 (not used)
8 | 2562890625  | 10
9 | 38443359375 | 11

For instance, #$%&-()* in DVORAK is stored as 3-2 because #$%& and ()* have identical mappings in QWERTY and only - is an actual translation.
In particular, 0123456789 is mapped the same way on all layouts and never has to be translated. Therefore, there's no possible ambiguity between a digit used for compression and a digit used for translation.
Decompression
To decompress the layout string, we replace each digit \$n\$ with \$15^n\$. For instance, 3-2 is decompressed as 3375-225.
Translation
For each character c in a, we extract the translation character t, using k as an offset in the uncompressed layout string, and test whether it's a digit with 1/t. If so, we output the original character c instead.

I had to run downstairs to put on a hat just so I could doff it to you! I knew someone would beat me but I'm happy to have been beaten in style. You shall have my upvote just as soon as I've finished digesting exactly how you pulled this masterpiece off.

Retina, 273 270 bytes
T`p` !_#-&\-()*}\w[vzdSsW]VZ@AXJ\E>UIDC\HTNMBR\L"P\OYGK<QF:/\\=^{\`axje.ui\dc\htnmbr\l'\p\oygk,qf;?|+~`^D.*
T`p` -9\O\o<-CSFTD\HUN\EIMKY:QPRG\LVWXJZ-csft\d\huneimky;q\prg\lv-xjz-~`^C.*
T`p` -9Ii<-AVM\HRTGYUN\E\O\LKP:QWSBFCDXJZ-avm\hrtgyune\o\lk\p;q\wsbfc\dxjz-~`^W.*
^.

Try it online! Prefix the message with a single letter D, C or W for the desired keyboard layout. Unfortunately Retina supports a bunch of magic letters (p being the obvious one, but I did manage to slip in a d) which all need to be quoted, except I was able to use v-x instead of v\wx. Edit: Saved 3 bytes thanks to @ETHproductions.

If the -s represent character ranges, I think you could save some by changing <-@ABC to <-C.

@ETHproductions Huh, I wonder why I overlooked it in the upper case version...

PHP, 364 Bytes
echo strtr($argv[2],($t=[[":;BCDEFHIJKLMNOPRTUVWYbcdefhijklmnoprtuvwy","IiVMHRTYUNEOLKP:WBFCDJvmhrtyuneolkp;wbfcdj"],[":;DEFGIJKLNOPRSTUYdefgijklnoprstuy","OoSFTDUNEIKY:PRGLJsftduneiky;prglj"],["\"'+,-./:;<=>?BCDEFGHIJKLNOPQRSTUVWXYZ[]_bcdefghijklnopqrstuvwxyz{}","_-}w[vzSsW]VZXJE>UIDCHTNBRL\"POYGK<QF:/={xje.uidchtnbrl'poygk,qf;?+"]][ord($argv[1])%3])[0],$t[1]);

Array contains 3 arrays where key stands for 0=W, 1=C, 2=D
Try it online!

Python 2, 422 bytes
Tried to combine layouts with some clever way, but it didn't help much.
Try it online
from string import*
Q=' '+printable
D=' '+digits
p,P=punctuation.split(':;')
w='avmhrtgyuneolkp;qwsbfcdxjz'
c='abcsftdhuneimky;qprglvwxjz'
d="uidchtnmbrl'poygk"
K={'C':D+c+c.upper().replace('Y;','Y:')+p+'Oo'+P,'W':D+w+w.upper().replace('P;','P:')+p+'Ii'+P,'D':D+'axje.'+d+',qf;AXJE>'+d.upper().replace("L'",'L"')+'<QF:!_#$%&-()*}w[vzSsW]VZ@/\=^{`?|+~'}
k,s=input().split()
print''.join(map(lambda x:K[k[0]][Q.index(x)],s))

Well played :) I'm not that good at python so I can't really help you golf this ^^

JavaScript (ES6), 461 409 404 395 385 bytes
I wrote the original version of the below up on my phone while sitting on a bus and then ran out of time to properly golf it so there's more crunching to follow. Thanks to @ETHproductions for the help so far.
The Keyboard strings were copied directly from the question so blame Antoine ETH for any errors!
This takes an integer representing the keyboard layout (0 for DVORAK, 94 for COLEMAK & 188 for WORKMAN) and an array of the string as arguments by currying - e.g., f(0)(["z","Z","x","X"]) outputs ;:qQ.
k=>s=>s.map(c=>`!_#$%&-()*}w[vz${a="0123456789"}SsW]VZ@AXJE>UIDCHTNMBRL"POYGK<QF:/\\=^{\`axje.uidchtnmbrl'poygk,qf;?|+~${b="!\"#$%&'()*+,-./"+a}Oo<=>?@ABCSFTDHUNEIMKY:QPRGLVWXJ${d="Z[\\]^_\`a"}bcsftdhuneimky;qprglvwxjz{|}~${b}Ii<=>?@AVMHRTGYUNEOLKP:QWSBFCDXJ${d}vmhrtgyuneolkp;qwsbfcdxjz{|}~`[`${b}:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY${d}bcdefghijklmnopqrstuvwxyz{|}~`.search(c)+k]).join``

Try It

f=
k=>s=>s.map(c=>`!_#$%&-()*}w[vz${a="0123456789"}SsW]VZ@AXJE>UIDCHTNMBRL"POYGK<QF:/\\=^{\`axje.uidchtnmbrl'poygk,qf;?|+~${b="!\"#$%&'()*+,-./"+a}Oo<=>?@ABCSFTDHUNEIMKY:QPRGLVWXJ${d="Z[\\]^_\`a"}bcsftdhuneimky;qprglvwxjz{|}~${b}Ii<=>?@AVMHRTGYUNEOLKP:QWSBFCDXJ${d}vmhrtgyuneolkp;qwsbfcdxjz{|}~`[`${b}:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY${d}bcdefghijklmnopqrstuvwxyz{|}~`.search(c)+k]).join``
o.innerText=f(j.value=0)([...i.value="zZxX"])
i.oninput=j.oninput=_=>o.innerText=f(+j.value)([...i.value].filter(c=>`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~`.includes(c)))
<select id=j><option value=0>DVORAK<option value=94>COLEMAK<option value=188>WORKMAN</select><input id=i><pre id=o>

Actually I compiled the strings :P

Let's see... you'll never get QWERTY as input, so I think you could save some bytes by not storing the Object in a variable. It'd look something like s=>[...s].map(c=>({D:"...",C:"...",W:"..."}[k[0]]["...".indexOf(c)]).join``

Aha, yes, I knew there was a way to work directly off the object, within the map() but I ran out of time - believe it or not, I wrote this up while sitting on the bus to the cinema. I'll update it with your suggestion and a few improvements I've spotted myself tomorrow.

C++, 528 bytes
#include <map>
#define M(a,b)a!='\0'?a:b
std::map<char,char>t[3];char*c[]={"\"'+,-./:;<=>?BCDEFGHIJKLMNOPQRSTUVWXYZ[]_bcdefghijklmnopqrstuvwxyz{}","_-}w[vzSsW]VZXJE>UIDCHTNMBRL\"POYGK<QF:/={xje.uidchtnmbrl'poygk,qf;?+","\"'+,-./Oo<=>?BCSFTDHUNEIMKY:QPRGLVWXJZ[]_bcsftdhuneimky;qprglvwxjz{}","\"'+,-./Ii<=>?VMHRTGYUNEOLKP:QWSBFCDXJZ[]_vmhrtgyuneolkp;qwsbfcdxjz{}"};int main(int d,char*v[]){for(int i=1;i<4;i++)for(int j=0;j<68;j++)t[i-1][c[0][j]]=c[i][j];for(int k=0;v[2][k];k++)printf("%c",M(t[v[1][0]-'0'][v[2][k]],v[2][k]));}

Run with ./multitrans <0-2> <string> where 0=Dvorak, 1=Colemak, and 2=Workman.
I added newlines in between to make the code slightly more readable below. This code generates a translation map from the strings where looking up the Qwerty character returns the translation (t[0]['s'] = 'o' for s into Dvorak), and then it uses the map to translate. The translation strings are shortened because some characters don't need to be changed ever. It could probably be reduced further, though.
#include <map>
#define M(a,b)a!='\0'?a:b
std::map<char,char>t[4];
char*c[4]={
"\"'+,-./:;<=>?BCDEFGHIJKLMNOPQRSTUVWXYZ[]_bcdefghijklmnopqrstuvwxyz{}",
"_-}w[vzSsW]VZXJE>UIDCHTNMBRL\"POYGK<QF:/={xje.uidchtnmbrl'poygk,qf;?+",
"\"'+,-./Oo<=>?BCSFTDHUNEIMKY:QPRGLVWXJZ[]_bcsftdhuneimky;qprglvwxjz{}",
"\"'+,-./Ii<=>?VMHRTGYUNEOLKP:QWSBFCDXJZ[]_vmhrtgyuneolkp;qwsbfcdxjz{}"};
int main(int d,char*v[]){
    for(int i=1;i<4;i++)
        for(int j=0;j<68;j++)
            t[i-1][c[0][j]]=c[i][j];
    for(int k=0;v[2][k];k++)
        printf("%c",M(t[v[1][0]-'0'][v[2][k]],v[2][k]));
}

Extra: Qwerty -> Dvorak Only (197 bytes)
I recently wrote this code that changes Qwerty into Dvorak, though capitals go untranslated.
#include<string>
char*d="\',.pyfgcrlaoeuidhtns;qjkxbmwvz ";std::string t="qwertyuiopasdfghjkl;zxcvbnm,./ ";int main(int c,char*v[]){for(int j=0;j<strlen(v[1]);j++)printf("%c",d[t.find(v[1][j])]);}

463 bytes

05AB1E, 199 192 187 bytes
žQDIiA¦'mKDuì“"'+,-./:;<=>?[]_{}“«.•4Zl˜η‡#ûwj˜ÐAδO•Duìð“>"<:.',;“S.;“_-}w[vzSsW]VZ/={?+“«ë¹<i.•2¸3'ÐQïK¤)•Duì„:;©ì.•C^ÿ¶₆*γŽ¨ï•Duì„Ooìë.•Brì·=ζW˜ΛlÝδ•Duì®ì.•]X)àƒ₆ä¤QúØM•Duì„Iiì}ð®S.;}‡‡

Uses IDs 1 for DVORAK; 2 for COLEMAK and 3 for WORKMAN.
Pushes the ID first, then the string we want to transliterate.
Try it online or verify full ASCII-range for all three.
Explanation:
žQ                    # Push printable ASCII builtin string:
                      #  “ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~“
  D                   # Duplicate it
   Ii                 # If the input-integer is 1:
     A                #  Push the lowercase alphabet
      ¦'mK           '#  Remove the first character (the 'a') and 'm'
          Duì         #  Prepend an uppercase copy
     “"'+,-./:;<=>?[]_{}“«
                     "#  And then append the string “"'+,-./:;<=>?[]_{}“
     .•4Zl˜η‡#ûwj˜ÐAδO•
                      #  Push compressed string "xje uidchtnbrl poygk qf "
        Duì           #  Prepend an uppercase copy
     ð                #  Push a space " "
      “>"<:.',;“S    "#  Push the characters [">",'"',"<",":",".","'",",",";"]
                 .;   #  Replace the first space with ">", second with '"', etc.
     “_-}w[vzSsW]VZ/={?+“«
                      #  And then append the string “_-}w[vzSsW]VZ/={?+“
   ë                  # Else:
    ¹<i               #  If the input-integer is 2 instead:
       .•2¸3'ÐQïK¤)• '#   Push compressed string "defgijklnoprstuy"
          Duì         #   Prepend an uppercase copy
       „:;            #   Push string ":;"
          ©           #   Store it in the register (without popping)
           ì          #   And then prepend this ":;" in front of the "DEF...def..."-string
       .•C^ÿ¶₆*γŽ¨ï•  #   Push compressed string "sftduneiky prglj"
          Duì         #   Prepend an uppercase copy
       „Ooì           #   And then prepend "Oo"
    ë                 #  Else (so the input-integer is 3):
     .•Brì·=ζW˜ΛlÝδ•  #   Push compressed string "bcdefhijklmnoprtuvwy"
        Duì           #   Prepend an uppercase copy
     ®ì               #   And then prepend ":;" (from the register)
     .•]X)àƒ₆ä¤QúØM•  #   Push compressed string "vmhrtyuneolkp wbfcdj"
        Duì           #   Prepend an uppercase copy
     „Iiì             #   And then prepend "Ii"
    }                 #  After the inner if-else:
     ð                #  Push a space " "
      ®S              #  Push the characters [":",";"] (from the register)
        .;            #  Replace the first space with ":" and the second space with ";"
   }                  # After the outer if-else:
    ‡                 # Transliterate the two strings we created,
                      #  in the duplicate printable ASCII string
     ‡                # And then transliterate the printable ASCII string with this string,
                      #  in the (implicit) string-input
                      # (after which the result is output implicitly)

See this 05AB1E tip of mine (section How to compress strings not part of the dictionary?) to understand how the compressed strings work.

C, 394 bytes
Try Online
char*K[3]={"!_#$%&-()*}w[vz0123456789SsW]VZ@AXJE>UIDCHTNMBRL\"POYGK<QF:/\\=^{`axje.uidchtnmbrl'poygk,qf;?|+~",
"!\"#$%&'()*+,-./0123456789Oo<=>?@ABCSFTDHUNEIMKY:QPRGLVWXJZ[\\]^_`abcsftdhuneimky;qprglvwxjz{|}~",
"!\"#$%&'()*+,-./0123456789Ii<=>?@AVMHRTGYUNEOLKP:QWSBFCDXJZ[\\]^_`avmhrtgyuneolkp;qwsbfcdxjz{|}~"};
main(int c,char**v){char*t=v[2];while(*t)putchar(*t>32?K[atoi(v[1])][*t-33]:*t),t++;}

388 bytes

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:
Take an input, a formula, and do f(x)
What I want:
Take an input, x
Take a formula. It has to be capable of reading something in the format:

ax^m + bx^n + cx^o ... where m, n, o and any terms after that can represent any value.
coefficients, again for any number. For example, 6x^2. (That means 6(x^2))
Doesn't necessarily have to put up with spaces
times, divide, plus and minus
brackets - up to stacking of 5
ANY negative numbers
fractions
To the power of x , these can be integeric (<-- is not a word, but that is the best word I can make up!)
If x = 5, you can put -x to get -5 and -x^2 is -(x^2). You could use (-x)^2

After it interprets the formula, it has to plug x into the function, then output the value.
The Challenge:

Do it in as less bytes as possible
The lowest number of bytes wins!

Note: I feel that I have included everything here, but if I haven't please comment below, and I will answer it within the next 30 minutes!
Example
Key:
bp = Background Process

Give me an input, (x)

4

Give me a formula:

2^x

(bp) So I have to do 2 to the power of x, which is 2^4, which is 16
Output: 16

Something in the form of ax means a*x

Does 6-x^2 mean 6 * -(x^2) or 6 * ((-x)^2)?

I'm really not sure as to what this challenge is asking, could you at least add some test-cases?

@StephenS , it says 6x^2. Where did you get the '-' from?

@Mayube I don't understand.

"ANY negative numbers" - can you not negate variables?

@simplest_mathematics test cases are inputs with expected outputs

@StephenS What does that mean? (The 1st comment)

This badly needs a specification of exactly what format the input can appear in. It starts off by implying that we're reading in a polynomial, but then why would we need brackets nested to depth 5? Also, is this meant to be a [tag:parsing] challenge? Or are you expecting answers based on eval?

@simplest_mathematics if I have variable x, can I say -x? If x is 5, -x is -5.

@StephenS , correct

@simplest_mathematics so if x = 5, what does -x^2 equal?

Very closely related, almost duplicate. I'm not sure that adapting the answers to include the use of x would make a significant change to the solutions.

@ais523 , SO does this count as a calculator?

@simplest_mathematics: Don't look at the name, look at the definition of the challenge. It's very similar to this one, and many answers from it might be adaptable to here.

@ais523 This one doesn't reqire spaces between characters, making it more feasible for more languages, though.

@ScottMilner: If I thought it was an exact duplicate I'd have thrown a close vote on. (And given that I got dupehammer rights yesterday, it'd close the challenge by itself.) I don't think it's quite close enough to do that, but it's certainly close enough to make people aware of the possibility.

TI BASIC, 6 bytes
This might change, since the rules are still not totally stable, but I wanted to post this while I could.
:Prompt X,F
:F

Asks for X, then parses whatever formula is put into F and displays it.
If I could assume that X was already stored in the memory, it would be
TI BASIC (maybe), 0 bytes

Is this ok?Guess not. :-(

How do I test this?

@simplest_mathematics If you have a TI-83/84 calculator, you can create a new program and plug it in. If not, you can find emulators online.

I still don't understand

A blank code block is

. However, I'm pretty sure the second answer won't work because it would need to take input with X= preceding it, which means you're taking input via a variable, something that's not allowed by default on PPCG.

TI BASIC is the programming language of TI 83/84 graphing calculators. You can create full programs in this language. You can find more information here


text:
Linear interpolation of the Fibonacci sequence
Your task is to find the nth Fibonacci number, but n is not necessarily an integer.
The Fibonacci sequence, 0-indexed, goes as follows:
0, 1, 2, 3, 4, 5,  6,  7, ...

1, 1, 2, 3, 5, 8, 13, 21, ...

However, what happens if we want the 2.4th number?
The 2.4th number is 0.4 times the difference between the 3rd and 2nd Fibonacci numbers plus the 2nd Fibonacci number. So, the 2.4th Fibonacci number is 2 + 0.4 * (3 – 2) = 2.4.
Similarly, the 6.35th Fibonacci number is 13 + 0.35 * (21 – 13) = 15.8.
Your task is to find the nth Fibonacci number, such that n is greater than or equal to 0.
You may do this zero- or one-indexed, just please say which one you are using.
This is code-golf, so shortest code in bytes wins!
Some more examples:
0        1
4.5    6.5
0.7      1
7       21

The operation you're doing here is called "linear interpolation". (Would you mind if I changed the title of the post to reflect that?) It does seem to have the Fibonacci property that f(n-2)+f(n-1)=f(n), so I guess this is a reasonable generalisation of the Fibonacci sequence. (I'm not sure if there's any standard generalisation.)

@ais523, if you think it would improve the question then yes, you may change the title of the post.

I think it'll make the question easier to find in future if someone asks something similar, and also makes it clearer what it's about in, say, the "Related" list. So it'll make the question better by helping get the answerers to the right place.

@ais523, those are all good things :)

@ais Looks like there's a generalisation of the Binet formula: http://mathworld.wolfram.com/FibonacciNumber.html

A few test cases in an easy-to-use format would be nice, especially for edge cases like integers and numbers between 0 and 1.

@ais523: I'm not sure if there's any standard generalization. —I guess this doesn't really qualify as a generalization since the exact Fibonacci numbers aren't included, but 1/sqrt(5) * (golden ratio)^n describes the the asymptotic growth. I don't believe there is any standard true generalization.

@JulianWolf Binet's formula is exact for integer arguments.

Although code golf doesn't have to justify the request (I guess), this seems like a weird operation; according to it, since F_0 = 0 and F_2 = 1, we should have F_1 = (1/2)(F_0 + F_2) = 1/2.

@orlp: huh, good to know. That's the sort of tidbit that I should probably know from some or other discrete maths course but have no memory whatsoever of. Thanks.

@LSpice That is true. However, that isn't how the linear interpolation works because it's like drawing a line segment between each point on a graph; the line segments don't form a straight line.

Jelly, 5 bytes
_Ḟ1+¡

This is an iterative solution without built-ins. It uses the same indexing as the challenge spec.
Try it online!
Background
Let f be the function defined in the challenge spec and F the Fibonacci function defined as usual (i.e., with F(0) = 0). For a non-negative integer n, we have f(n) = F(n + 1). When 0 ≤ x < 1, the challenge spec defines f(n + x) as f(n) + (f(n + 1) - f(n))x.
Clearly, this just affects the base cases, but not the recursive formula, i.e., f(n) = f(n - 1) + f(n - 2) holds as it would for F. This means we can simplify the definition for non-integer arguments to the easier f(n) = f(n) + f(n - 1)x.
As others have noted in their answers, the recursive relationship also holds for non-integer arguments. This is easily verifiable, as

Since f(0) = f(1) = 1, f in constant in the interval [0, 1] and f(0 + x) = 1 for all x. Furthermore, f(-1) = F(0) = 0, so f(-1 + x) = f(-1) + (f(0) - f(-1))x = 0 + 1x = x. These base cases cover in [-1, 1), so together with the recursive formula, they complete the definition of f.
How it works
As before, let n + x be the only argument of our monadic program.
¡ is a quick, meaning that it consumes some links to its left and turns them into a quicklink. ¡ in particular consumes either one or two links.

<F:monad|dyad><N:any> calls the link N, returning r, and executes F a total of r times.

<nilad|missing><F:monad|dyad> sets r to the last command-line argument (or an input from STDIN in their absence) and executes F a total of r times.

Since 1 is a nilad (a link without arguments), the second case applies, and +¡ will execute + n times (a non-integer argument is rounded down). After each call to +, the left argument of the quicklink is replaced with the return value, and the right argument with the previous value of the left argument.
As for the entire program, Ḟ floors the input, yielding n; then _ subtract the result from the input, yielding **x, which becomes the return value.
1+¡ then calls +¡ – as described before – with left argument 1 = f(0 + x) and right argument x = f(-1 + x), which computes the desired output.

Ahh, how useful +¡ is for Fibonacci challenges. Was it purposeful to have ¡ work like fibonacci with dyads?

Oooh - %1+¡: linear interpolation between n × F(n) at n and n × F(n-1) + F(n) at n-ε, and step up between n-ε and n.

@EriktheOutgolfer Well, more or less. Since Jelly doesn't have variables, you'd lose access to the previous sequence members otherwise, so it made sense to implement it like this.

@JonathanAllan I'm not sure I understand. What is %1+¡ supposed to do?

@Dennis erm, meant, well \o/ ...but that is what it appears to do with experimentation :D

Mathematica, 32 bytes
If[#<2,1~Max~#,#0[#-1]+#0[#-2]]&

Pure function taking a nonnegative real number as input and returning a real number. If 1~Max~# were replaced by 1, this would be the standard recursive definition of the 0-indexed Fibonacci numbers for integer arguments. But 1~Max~# is the correct piecewise linear function for real inputs between 0 and 2, and the recursion takes care of the rest. (Trivia fact: changing this to the 1-indexed Fibonacci numbers can be accomplished simply by changing the Max to a Min!)
The shortest I could get with the builtin is the 37-byte (b=Fibonacci)[i=Floor@#](#-i)+b[i+1]&.

JavaScript (ES6), 30 bytes

f=x=>x<1?1:x<2?x:f(x-1)+f(x-2)
<input type=number value=2.4 oninput="O.value=f(value)"> <input id=O value=2.4 disabled>

Trivial modification of the zero-indexed recursive Fibonacci sequence definition. May give slight rounding errors for some inputs.

This is clever. I thought it didn't work.

Python 2, 42 bytes
f=lambda n:n<3and max(1,n)or f(n-1)+f(n-2)

Try it online!

Jelly, 17 12 bytes
’Ñ+Ñ
’»0‘ÇỊ?

Try it online!
Non-builtin solution.
Explanation
Helper function 1Ŀ
’Ñ+Ñ
 Ñ    Call the main program on
’       {the input} - 1;
   Ñ  Call the main program on {the input};
  +   Add those results{and return the result}

Main program
’»0‘ÇỊ?
’        Subtract 1
 »0      but replace negative results with 0
     Ị?  If the result is less than or equal to 1
   ‘     Return the result plus 1
    Ç    else return the result

An input in the range 0 to 1 will therefore saturated-subtract to 0, thus we add 1 to get F(0)=F(1)=1. An input in the range 1 to 2 will return itself. Those base cases are sufficient to do a typical Fibonacci recursion and calculate the other values from there.

JavaScript (ES6), 67 64 bytes
Has a few issues with rounding
n=>(i=(g=(z,x=1,y=0)=>z?g(--z,x+y,x):y)(++n|0))+n%1*(g(++n|0)-i)

Try It

f=
n=>(i=(g=(z,x=1,y=0)=>z?g(--z,x+y,x):y)(++n|0))+n%1*(g(++n|0)-i)
console.log(f(2.4))
console.log(f(6.35))
console.log(f(42.42))

Excel, 137 124 119 113 102 97 Bytes
Non-recursive/iterative approach. (Directly calculate the nth terms)  This uses the one-indexed method.  Adding +1 to =TRUNC(B1) changes it to zero-indexed.
=A7+(A8-A7)*MOD(B1,1)
=5^.5
=(1+A2)/2
=TRUNC(B1)
=A4+1
=-1/A3
=(A3^A4-A6^A4)/A2
=(A3^A5-A6^A5)/A2

The code snippet is intended to be placed starting in cell A1.
The input cell is B1.  The output cell is A1.

Jelly, 13 9 bytes
,‘ḞÆḞḅ%1$

This uses the same indexing as the challenge spec.
Try it online!
Background
Per the spec, we have F(n + x) = F(n) + (F(n + 1) - F(n))x, for natural n and 0 ≤ x < 1. Since F(n + 1) = F(n) + F(n - 1), this can be rewritten as F(n + x) = F(n) + F(n - 1)x.
Furthermore, the indexing used in the challenge spec defines a function f(n) = F(n + 1) (where F is the usual Fibonacci function, i.e., F(0) = 0), so we get the formula f(n + x) = F(n + 1) + F(n)x.
How it works
,‘ḞÆḞḅ%1$  Main link. Argument: n + x

 ‘         Increment; yield n + 1 + x.
,          Pair; yield [n + x, n + 1 + x].
  Ḟ        Floor; yield [n, n + 1].
   ÆḞ      Fibonacci; yield [F(n), F(n + 1)].
      %1$  Modulus 1; yield (n + x) % 1 = x.
     ḅ     Unbase; yield F(n)x + F(n + 1).

PHP, 90 Bytes
for($f=[1,1];$i<$a=$argn;)$f[]=$f[+$i]+$f[++$i];echo$f[$b=$a^0]+($a-$b)*($f[$b+1]-$f[$b]);

Online Version

Perl 6,  48  38 bytes
48
{$/=(1,1,*+*...*)[$_,$_+1];$0+($_-.Int)*($1-$0)}

Try it
38
sub f(\n){3>n??max 1,n!!f(n-1)+f(n-2)}

Try it
Expanded:
48
{
  $/ =          # store here so we can use $0 and $1
  (
    1,1,*+*...* # Fibonacci sequence
  )[
    $_,         # get the value by using floor of the input
    $_ + 1      # and get the next value
  ];

    $0            # the first value from above
  +
    ( $_ - .Int ) # the fractional part of the input
  *
    ( $1 - $0 )   # the difference between the two values in the sequence
}

($0 and $1 is short for $/[0] and $/[1])
38
sub f (\n) {
    3 > n           # if n is below 3
  ??
    max 1, n        # return it if it is above 1, or return 1
                    # if it was below 1, the answer would be 1
                    # the result for numbers between 1 and 3
                    # would be the same as the input anyway
  !!
    f(n-1) + f(n-2) # the recursive way to get a fibonacci number
}

This was inspired by other Python, and Javascript solutions

Julia 0.5, 31 bytes
This is basically just Rod's answer translated.
f(n)=n<3?max(1,n):f(n-1)+f(n-2)

Try it online!


text:
Find the First Bracket Match

This was one of a series of challenges leading up to Brain-Flak's birthday. Find out more here.

Challenge
For this challenge your objective will be to find the very first pair of matching brackets in a fully matched string of ()[]{}<> brackets. To borrow DJMcMayhem's definition of a fully matched string:

For the purpose of this challenge, a "bracket" is any of these characters: ()[]{}<>.

A pair of brackets is considered "matched" if the opening and closing brackets are in the right order and have no characters inside of them, such as
()
[]{}

Or if every subelement inside of it is also matched.
[()()()()]
{<[]>}
(()())

Subelements can also be nested several layers deep.
[(){<><>[()]}<>()]
<[{((()))}]>

A string is considered "Fully matched" if and only if each pair of brackets has the correct opening and closing bracket in the right order.

Input
Input will consist of a single nonempty string or char array containing only the characters ()[]{}<>, and is guaranteed to be fully matched. You may take input in any reasonable manner that corresponds with our i/o defaults.
Output
The output of your program or function will be the index of the bracket which closes the first one. Output must be either 0 or 1 indexed. Again, output may be in any reasonable manner that corresponds with our i/o defaults.
Test Cases
Input       0-indexed   1-indexed
()          1           2
(<>)        3           4
<[]{<>}>    7           8
{}{}{}{}    1           2
[[]<>[]]    7           8

This is code-golf, fewest bytes wins!

Bonus points if you answer in Brain-Flak ofc :)

@EriktheOutgolfer Done

This technique is very helpful for writing inefficient implementations of BF.

V, 4 bytes
%Dø.

Try it online!
This, unlike most V answers, uses 0-indexing. I'm extremely proud of this answer, and how far my language has come. Explanation:
%       " Jump to the first bracket match
 D      " Delete everything under and after the cursor
  ø     " Count the number of times the following regex is matched:
   .    "   Any character

Isn't there boilerplate you need for matching <>?

@Pavel In vim, yes. But not in V.

Brain-Flak, 685, 155, 151, 137 bytes
(())({<{}({}()<(()()()())>)({}(<>))<>{(({})){({}[()])<>}{}}{}<>
([{}()]{})(({})){{}({}[()])(<()>)}{}(<>)<>{{}<>{}({}<>)}{}(<>[]<>)>()}<>)

Try it online!
136 bytes of code, plus one byte for -a. One indexed.
530 bytes golfed off! That's probably the largest golf I've ever done.
14 bytes saved thanks to Riley!
This abuses a formula of the opening/closing parenthesis: if you take the ASCII values, increment it by one, and take modulo of 4, the openers (({[<) will always get 0 or 1, whereas the closers ()}]>) will always get 2 or 3.
Explanation:
#Push 1
(())

#While true
({<

    #Pop stack height
    {}

    #Compute (TOS + 1) % 4
    ({}()<(()()()())>)({}(<>))<>{(({})){({}[()])<>}{}}{}<>([{}()]{})

    #Decrement if positive
    (({})){{}({}[()])(<()>)}{}

    #Push 0 onto alternate
    (<>)

    #Toggle back
    <>

    #Pop two zeros from alternate if closer
    {{}<>{}({}<>)}{}

    #Push height of alternate stack
    (<>[]<>)

#Make each time through evaluate to 1
>()

#Endwhile
}

#Push the number of loops onto the offstack
<>)

For the love of God, what on earth is this.

Basically everyone now is using n-1&2/n+1&2/-n&2 or n%7&2 to distinguish opening and closing brackets...

@ETHproductions I'm not sure if brain-flak can efficiently compute &2, but I'll look into it.

Oh, I thought you were. You must be doing something similar to distinguish between 0/1 and 2/3... though now that I look at it, you're just decrementing if positive. A cool trick as well :-)

136 bytes. My comments are marked with ---.

@Riley Aha! That seems so obvious now. Thanks!

Some minor golfs can be made

I think you just counted a newline.

@LeakyNun This is my challenge.

@EriktheOutgolfer The newline is not being counted right now.  There just is a newline in the code sample.

@WheatWizard Oh right. Then it still needs +2 bytes though, since (space) -a is 3 bytes on its own.

The (TOS+1)%4 can be shorter:Try it online!

@DJMcMayhem you should update your answer for Riley's golf which saves 12 bytes

05AB1E, 17 16 10 bytes
-1 thanks to carusocomputing
-6 thanks to Adnan for his amazing insight that "after incrementing, the second last bit is 0 for an opening bracket and 1 for an closing bracket"
Ç>2&<.pO0k

Try it online!
Ç          # Get input as ASCII values
 >         # Increment
  2&       # And with 2 (0 for open and 2 for close brackets)
    <      # decrement
     .p    # prefixes
       O   # Sum
        0k # Print the index of the first 0

žu seems usable here.

žu8ÝÈÏ so, no, not really lol. At best it will still be 5 bytes. I was thinking more of split into the pairs of braces, and remove braces until there's only one pair left, increment counter by 2 for each removed pair. I have no idea if that's less though. Trying it out atm.

For 10 bytes: Ç>2&<.pO0k.

Just messing around with the ASCII values. Note that after incrementing, the second last bit is 0 for an opening bracket and 1 for an closing bracket.

Vim, 23 bytes
:se mps+=<:>
%DVr<C-a>C1<esc>@"

Try it online!
I'm really sad about this answer. This solution is beautifully elegant and short, but, by default, vim does not consider < and > to be matched, so I need 13 bytes of boilerplate code. Otherwise, this would just be 10 bytes.
I would have posted a V answer, but that would only be one byte shorter, namely changing Vr to Ò, since Vr is a common vim-idiom.
This is 1-indexed but could be trivially modified to be 0-indexed by changing the 1 to a 0.
:se mps+=<:>        " Stupid boilerplate that tells vim to consider `<` and `>` matched
%                   " Jump to the bracket that matches the bracket under the cursor
 D                  " Delete everything from here to the end of the line
  V                 " Visually select this whole line
   r<C-a>           " Replace each character in this selection with `<C-a>`
                    " This conveniently places the cursor on the first char also
         C          " Delete this whole line into register '"', and enter insert mode
          1<esc>    " Enter a '1' and escape to normal mode
                @"  " Run the text in register '"' as if typed. Since the `<C-a>` command
                    " Will increment the number currently under the cursor

Post a V answer then :)

Jelly, 11 10 9 bytes
O’&2’+\i0

Try it online!
Explanation
The idea here was to find a "magic formula" that can distinguish opening from closing brackets. I originally used O%7&2 (i.e. "take the ASCII code, modulo 7, bitwise-and 2"), but @ETHproductions suggested O’&2 (which replaces the modulo 7 with a decrement); both return 0 for one sort of bracket and 2 for the other. Subtracting 1 (’) will make these results into -1 and 1.
The rest of the code is +\. +\ produces a cumulative sum. If a set of brackets is correctly matched, it will contain the same number of -1s and 1s, i.e. its cumulative sum will be 0. Then we just need to return the index of the first 0 in the resulting list; we can do that with i0.

Fascinating how we took a similar approach for detecting closing brackets. Unfortunately I only found an inferior version: b*2%7>3

Interesting approach! I developed a longer answer (for practicing) which I eventually golfed down to practically this, except interestingly enough, instead of the first decrement in your post, I had an increment instead. :)

Retina, 26 24 bytes
M!`^.(?<-1>([[({<])*.)*

Try it online!
Result is 1-based.
Explanation
A very different Retina solution that is essentially based on a single (and very readable...) regex. This uses a new technique I discovered yesterday for matching balanced strings using balancing groups.
M!`^.(?<-1>([[({<])*.)*

Find (M) and return (!) all matches of the regex ^.(?<-1>([[({<])*.)*. That regex skips the first character of the string and then uses balancing groups to keep track of the nesting depth. Any of [({< increase the depth (kept track of by group 1) and any other character decreases the depth (in principle, the . allows the depth to be decreased by opening brackets as well, but since the regex is matched greedily, the backtracker will never attempt that). The weird trick is that the (?<-1>...) encloses group 1 which works because the popping from a balancing group happens at the end of the group. This saves two bytes over the standard approach in the form ((open)|(?<-2>close))*. The match necessarily stops at the bracket that closes the first one, because we skipped it, so it isn't accounted for in the stack depth (and the stack depth can't go negative).
The length of this match is the 0-based index of the bracket we're looking for.

Simply count the number of empty matches in this string. The empty regex always matches once more than there are characters in the string, so this gives us the 1-based index of the bracket we're looking for.

That's brilliant!

Shorter approach: delete the second part of the string instead of matching the first part. I like how you measured the length of the string, btw!

@Leo That's really neat! You can post that as a separate answer :)

Ok, this new trick for balanced strings is wonderful :D

Retina, 24 bytes
.(([[({<])|(?<-2>.))*$

Try it online!
This is inspired by Martin Ender's solution.
Explanation
The first line is a regex that matches a character followed by a balanced string going all the way to the end of the main string (for a detailed explanation of how balancing groups are used in this regex see Martin's answer). Since regexes look for matches from left to right, this will find the longest balanced proper subfix, that is everything after the bracket that closes the first one, plus the bracket itself.
The following line is empty, so we replace the match with an empty string, meaning that we now only need to count the remaining characters to get the (0-indexed) desired result.
The last empty line counts the number of matches of the empty string in the string, which is one more than the number of characters in the string, equivalent to the 1-indexed result.

I found a new technique for matching balanced strings yesterday which saves two bytes on both of our answers: https://tio.run/##K0otycxL/K@q4Z7wX0/D3kbX0E4jOlqj2iZWU0tPU0uFi@v/fw1NLg0bO00um@jYahu7Wjuu6loI5IqOjrWxi46NBQA (and probably a dozen other ones I've written in the past...)

Perl 5, 28 bytes
Saved 6 bytes by using just . instead of [>})\]], from Martin Ender's Retina answer.
27 bytes of code + -p flag.
/([<{([](?0)*.)+?/;$_=$+[0]

Try it online!
Recursive regex, what a beautiful invention.
The regex looks for an opening bracket ([<{([]), followed by reccursive call (?0), followed by a closing bracket (.). All of this non-greedily (+?) so it matches as short as possible from the beginning. The index of the end of the match is the answer, and as it happens, it can be found in $+[0].

JavaScript (ES6), 55 53 52 bytes
Saved 1 byte thanks to @Adnan
f=([c,...s],i=1)=>(i-=-c.charCodeAt()&2)&&1+f(s,++i)

For every opening bracket, taking its char-code mod 4 gives us 0 or 3; for the closing brackets, it gives us 1 or 2. Therefore, we can distinguish between opening and closing brackets by negating the bracket's char-code (which flips the bits and subtracts 1) and taking the second least significant bit; that is, n&2.

I think that instead of n-1&2, -n&2 also works?

@Adnan Hmm, I think you're right. Thanks!

C, 75 72 56 55 54 45 bytes
a;f(char*s){return(a-=(-*s++&2)-1)?1+f(s):0;}

See it work online.
If you want the output to be 1-indexed instead of 0-indexed, replace the last 0 with 1.

Python 2.7 + Numpy, 85 79 bytes
My first attempt at code golf:
from numpy import*
lambda s:list(cumsum([(ord(x)+1&2)-1for x in s])).index(0)

Welcome to the site!

You don't have to name lambdas, you can remove the g=

Brain-Flak, 97 bytes (96 for code, 1 for flag)
{}<>(())({<(<()>)<>({<({}[()])><>([{}]())<>}{})<>(<{}>())<>{({}[()])<>([{}])<>}{}<>({}{})>()}{})

Run with the -a flag.
Try it online!
Explanation:
#Skip the first open bracket
{}

#Place a 1 on stack B, representing the nesting depth
<>(())

#Start a loop, until the depth is 0
({<

 #Divide the ASCII code by 2, rounding up
 (<()>)<>({<({}[()])><>([{}]())<>}{})<>

 #Replace TOS B with a 1
 (<{}>())

 #Swap back to stack A
 <>

 #Negate the 1 on stack B n times (n = ASCII value+1/2)
 {({}[()])<>([{}])<>}{}

 #Swap back to stack B
 <>

 #Add the 1/-1 (depending on Open/close bracket) to the nesting depth accumulator
 ({}{})

 #Count loop cycles
 >()

#end loop, print result implicitly by pushing to the stack
}{})

It just works, okay.

Retina, 34 bytes
^.
!
T`([{}])`<<<>
+T`p`!`<!*>
\G!

Try it online!
Result is 0-based.
Explanation
^.
!

Replace the first character with a !. This causes the bracket that we're looking for to be unmatched.
T`([{}])`<<<>

Convert parentheses, square brackets and braces to angle brackets. Since the string is guaranteed to be fully matched, we don't care about the actual types at all, and this saves some bytes in the next step.
+T`p`!`<!*>

Repeatedly (+) replace each character in all matches of <!*> with !s. That is, we match pairs of brackets which contain no further unprocessed brackets and turn them into further exclamation marks. This will turn the entire string except the unmatched closing bracket into exclamation marks.
\G!

Count the number of leading exclamation marks, which is equal to the 0-based position of the first non-exclamation-mark (i.e. the unmatched bracket). The \G anchors each match to the previous one, which is why this doesn't count the !s after said bracket.

I saw you had answered on the home page and knew it was going to use some sort of regex

@Christopher Eh, this one barely uses any regex at all (as opposed to the other Retina answer I just posted...).

Sheesh. Regex much?

Why isn't this working?

@LeakyNun Because (?!(2)) is just (?!2). You probably meant (?(2)(?!)) or (?2)!). You also forgot to escape a ] and the final + needs to be *.

Ruby, 35 34 bytes
p$_[/[<{(\[](\g<0>)*[>})\]]/].size

Based on Dada's Perl5 answer. Output is 1-indexed. Requires the Ruby interpreter be invoked with the -n option (implicit while gets loop).
Edit: This is also 35 34 bytes, but is another possible starting point to reduce this answer further.
p$_[/[<{(\[](\g<0>)*[>})\]]/]=~/$/

Edit2: Removed unnecessary spaces after p.
Edit3: A couple more 34-byte answers.
~/[<{(\[](\g<0>)*[>})\]]/;p$&.size
p~/[<{(\[](\g<0>)*[>})\]]/+$&.size

Welcome to PPCG!

Much appreciated! :)

PHP, 116 Bytes
for($l=["("=>")","["=>"]","{"=>"}","<"=>">"][$f=$argn[0]];;$d>0?$i++:die("$i"))$d+=$f!=($n=$argn[$i])?$n==$l?-1:0:1;

Online Version

Doesn't PHP need to start with <?php ?

@Phoenix: There's a standalone PHP interpreter that doesn't require the starting tag. That's what's normally used for golfing.

@ais523 In this case PHP runs from the command line with the -R option

Python, 76 bytes
f=lambda s,r=[],i=0:(i<1or sum(r))and f(s[1:],r+[(ord(s[0])+1&2)-1],i+1)or i

Recursive function that uses the ordinal 2nd LSB as a flag for open vs close trick used by many found by Adnan (and probably others). Tail hits when the cumulative sum of -1 for open and 1 for close reaches zero. The index is kept in a variable as it's byte-cheaper than using len(r), indexing is 1-based.
Try it online!

Python 3, 59 55 50 49 bytes
f=lambda s,n=1:n and-~f(s[1:],n+1-(-ord(s[1])&2))

Output is 0-indexed. The formula to determine the bracket direction was first discovered by @ETHProductions and improved by @Adnan.
Try it online!

Vyxal, 5 bytes
¦⁽øβǑ

Try it Online!
    Ǒ # First index
¦     # In prefixes of input
 ⁽--  # Where...
  øβ  # Brackets are balanced

Batch, 172 bytes
@set/ps=
@set/ai=d=0
:l
@set/ai+=1,d-=1
@set c="%s:~,1%"
@set "s=%s:~1%
@for %%a in ("<" "(" "[" "{")do @if %%a==%c% set/ad+=2&goto l
@if %d% gtr 0 goto l
@echo %i%

1-indexed. <>s are of course special characters in Batch so not only do I have to quote all over but I can't even do tricks such as making them goto labels.

R, 126 Bytes
s=readline();i=0;r=0;for(c in strsplit(s,"")[[1]]){if(grepl("[\\[\\(\\{<]",c))i=i+1 else i=i-1;if(i==0){print(r);break};r=r+1}

Julia, 42 bytes
!S=argmin(cumsum(2(s∈"([{<")-1 for s=S))
Attempt This Online!

C, 127 bytes
Try Online
c(x){x-40&x-60&x-91&x-123?-1:1;}
f(i,t)char*t;{return i?f(i+c(*t),t+1):t;}
s(char*t){return f(c(*t),t+1)-t;}

Output
2   ()
4   (<>)
8   <[]{<>}>
2   {}{}{}{}
8   [[]<>[]]

Any comment, downvoter.

I wasn't the downvoter, but I don't think it helps that there was already a much shorter C submission.

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