[Question]
  [
Given a list of `(key, value)` pairs, determine whether it represents a function, meaning that each key maps to a consistent value. In other words, whenever two entries have equal keys, they must also have equal values. Repeated entries are OK.
For example:
```
# Not a function: 3 maps to both 1 and 6
[(3,1), (2,5), (3,6)]
# Function: It's OK that (3,5) is listed twice, and that both 6 and 4 both map to 4
[(3,5), (3,5), (6,4), (4,4)]
```
**Input:** An ordered sequence of `(key, value)` pairs using digits 1 to 9. You may not require a particular ordering. You may alternatively take the key list and value list as separate inputs.
**Output:** A consistent value for functions, and a different consistent value for non-functions.
**Test cases:** The first 5 inputs are functions, the last 5 are not.
```
[(3, 5), (3, 5), (6, 4), (4, 4)]
[(9, 4), (1, 4), (2, 4)]
[]
[(1, 1)]
[(1, 2), (2, 1)]
[(3, 1), (2, 5), (3, 6)]
[(1, 2), (2, 1), (5, 2), (1, 2), (2, 5)]
[(8, 8), (8, 8), (8, 9), (8, 9)]
[(1, 2), (1, 3), (1, 4)]
[(1, 2), (1, 3), (2, 3), (2, 4)]
```
Here they are as two lists of inputs:
```
[[(3, 5), (3, 5), (6, 4), (4, 4)], [(9, 4), (1, 4), (2, 4)], [], [(1, 1)], [(1, 2), (2, 1)]]
[[(3, 1), (2, 5), (3, 6)], [(1, 2), (2, 1), (5, 2), (1, 2), (2, 5)], [(8, 8), (8, 8), (8, 9), (8, 9)], [(1, 2), (1, 3), (1, 4)], [(1, 2), (1, 3), (2, 3), (2, 4)]]
```
---
**Leaderboard:**
```
var QUESTION_ID=118960,OVERRIDE_USER=20260;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/118960/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
```
```
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
```
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>
```
  
[Answer]
# [Python 2](https://docs.python.org/2/), 34 bytes
```
lambda x:len(dict(x))==len(set(x))
```
[Try it online!](https://tio.run/nexus/python2#bZDNCoMwEITvPsXeTCAe/ImokGufoDcrxdYEBLVFU/DtbVbjT6mnLzOTyS5R4jY1ZfuoShizRnakqp@ajJQKgWqQs5j0XctBizwnIQNOGWyMGUTICFkwyElqHd8yWJM5Na5P11Ngc@MUjjrO8G2yzopPOobc6oPPl5sJgwSdA9ONP28Zhtu@p0mwM8JNnXdfdxpcD679R4LnOurVA24PdQfLX2XLHUVQ0L1xKZvhr6JOKtMX "Python 2 – TIO Nexus")
Creates a Dictionary and a Set from the input and compare their lengths.  
Dictionaries can't have duplicated keys, so all the illegal (and repeated) values are removed.
[Answer]
## Haskell, 36 bytes
```
f x=and[v==n|(k,v)<-x,(m,n)<-x,k==m]
```
[Try it online!](https://tio.run/nexus/haskell#dY/NCoMwEITvfYo5eIiwPfgTUTB9keBBEEHEtJQiHvruNombYKHN5dvMzGY3@4hN9WbQq1LmLWZa0/a6kVjI@GJWaun2pZ8MFIb7BfY8npN5IcGINrkBWouCIFNCZEUoHUvHjqBFw0rGzIPjXatmaahy9q3S/Z@XcSrMrX70W0q@n3R5JGtC7ZQTm8ivtyyLuLt3JGcbnh9@J4@t9w8 "Haskell – TIO Nexus")
Outer (->`(k,v)`) and inner (-> `(m,n)`) loop over the pairs and whenever `k==m`, collect the truth value of `v==n`. Check if all are true. 
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~5~~ 4 bytes
```
dhᵐ≠
```
[Try it online!](https://tio.run/nexus/brachylog2#@5@S8XDrhEedC/7/j4421jGN1YGSZjomQNIESMYCAA "Brachylog – TIO Nexus")
Full program. As far as I can tell, the reason that this is beating most other golfing languages is that `≠` is a builtin in Brachylog, whereas most of the other golfing languages need to synthesize it.
## Explanation
```
dhᵐ≠
d     On the list of all unique elements of {the input},
 h    take the first element
  ᵐ     of each of those elements
   ≠  and assert that all those elements are different
```
As a full program, we get `true` if the assertion succeeds, or `false` if it fails.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 5 bytes
I'm pretty happy with this one.
```
{IhM{
       implicit input
    {  removes duplicate pairs
  hM   first element of each pair
{I     checks invariance over deduplication (i.e. checks if no duplicates)
```
[Try it online!](http://pyth.herokuapp.com/?code=%7BIhM%7B&input=%5B%283%2C%205%29%2C%20%283%2C%205%29%2C%20%286%2C%204%29%2C%20%284%2C%204%29%5D%0A%5B%289%2C%204%29%2C%20%281%2C%204%29%2C%20%282%2C%204%29%5D%0A%5B%5D%0A%5B%281%2C%201%29%5D%0A%5B%281%2C%202%29%2C%20%282%2C%201%29%5D%0A%0A%5B%283%2C%201%29%2C%20%282%2C%205%29%2C%20%283%2C%206%29%5D%0A%5B%281%2C%202%29%2C%20%282%2C%201%29%2C%20%285%2C%202%29%2C%20%281%2C%202%29%2C%20%282%2C%205%29%5D%0A%5B%288%2C%208%29%2C%20%288%2C%208%29%2C%20%288%2C%209%29%2C%20%288%2C%209%29%5D%0A%5B%281%2C%202%29%2C%20%281%2C%203%29%2C%20%281%2C%204%29%5D%0A%5B%281%2C%202%29%2C%20%281%2C%203%29%2C%20%282%2C%203%29%2C%20%282%2C%204%29%5D&test_suite=1&test_suite_input=%5B%283%2C%205%29%2C%20%283%2C%205%29%2C%20%286%2C%204%29%2C%20%284%2C%204%29%5D%0A%5B%289%2C%204%29%2C%20%281%2C%204%29%2C%20%282%2C%204%29%5D%0A%5B%5D%0A%5B%281%2C%201%29%5D%0A%5B%281%2C%202%29%2C%20%282%2C%201%29%5D%0A%5B%283%2C%201%29%2C%20%282%2C%205%29%2C%20%283%2C%206%29%5D%0A%5B%281%2C%202%29%2C%20%282%2C%201%29%2C%20%285%2C%202%29%2C%20%281%2C%202%29%2C%20%282%2C%205%29%5D%0A%5B%288%2C%208%29%2C%20%288%2C%208%29%2C%20%288%2C%209%29%2C%20%288%2C%209%29%5D%0A%5B%281%2C%202%29%2C%20%281%2C%203%29%2C%20%281%2C%204%29%5D%0A%5B%281%2C%202%29%2C%20%281%2C%203%29%2C%20%282%2C%203%29%2C%20%282%2C%204%29%5D&debug=0)
[Answer]
## [Retina](https://github.com/m-ender/retina), 25 bytes
```
1`({\d+,)(\d+}).*\1(?!\2)
```
[Try it online!](https://tio.run/nexus/retina#VY49DoAgDIV3buFgAtqYlB8jk6OXYHDwFoSzY1sg0eXL63v9m/V1V7x1Ts8KRhOL2ZaE@pySNbVmB6FA5w6e6IkqR9EotOwoKrAwrVisHZF1W7H/UshB9HACpQccpAdj55hCcP2kollOo2xur4TP9dZpO315AQ "Retina – TIO Nexus")
Input format is `{k,v},{k,v},...`. Prints `0` for functions and `1` for non-functions. I could save two bytes by using linefeeds instead of the commas in the input format, but that's messed up.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 13 bytes
```
¬{⊇Ċhᵐ=∧Ċtᵐ≠}
```
[Try it online!](https://tio.run/nexus/brachylog2#@39oTfWjrvYjXRkPt06wfdSx/EhXCZD1qHNB7f//0dHGOqaxOlDSTMcESJoAydj/AA "Brachylog – TIO Nexus")
### Explanation
```
¬{          }      It is impossible...
  ⊇Ċ               ...to find a subset of length 2 of the input...
   Ċhᵐ=            ...for which both elements have the same head...
       ∧           ...and...
        Ċtᵐ≠       ...have different tails.
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), 8 bytes
```
1Z?gs2<A
```
Inputs are: an array with the `value`s, followed by an array with the `key`s.
Output is `1` for function, `0` otherswise.
[Try it online!](https://tio.run/nexus/matl#@28YZ9ebGTj@P9/tKmCqYKJgkksV7SxgrGCGZAFAA). Or [verify all test cases](https://tio.run/nexus/matl#RU1BCsAwCLvvFfmC2pYWBmOwJ@y0UthtD9j/6USFoWI0id6Tru15ed3ncc6ekZGQxtIFgmIoxaaBwNo9KYphyBhSdzEvQ5xTxMiuUNZ1FRUNLZCGacW@kGoo5n@jV8YH).
### Explanation
`1Z?`
Builds a sparse matrix. Initially all entries contain `0`; and `1` is added to each entry `(i, j)` where `j` and `i` are the input `key`, `value` pairs.
`g`
The matrix is converted to logical; that is, entries exceeding `1` (corresponding to duplicate `key`, `value` pairs) are set to `1`.
`s`
The sum of each column is computed. This is the number of different `value`s for each `key`.
`2<A`
A function will have all such sums less than `2`.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~11~~ ~~9~~ 7 bytes
Saved 2 bytes thanks to *kalsowerus*.
```
Ùø¬DÙQ,
```
[Try it online!](https://tio.run/nexus/05ab1e#@3945uEdh9a4HJ4ZqPP/f3S0sY6CaayOApw201EwAdEmIDoWAA "05AB1E – TIO Nexus")
**Explanation**
```
Ù           # remove duplicates
 ø          # zip
  ¬         # get the first element of the list (keys)
   D        # duplicate list of keys
    Ù       # remove duplicates in the copy
     Q      # compare for equality
      ,     # explicitly print result
```
[Answer]
# R, 33 bytes
This is my version for R. This takes advantage of the `ave` function. I have allowed for empty input by setting defaults on the key and value parameters. `ave` is producing a mean of the values for each of the keys. Fortunately this returns the means in the same order as the input values, so a comparison to the input will indicate if there is different values. Returns `TRUE` if it is a function.
```
function(k=0,v=0)all(ave(v,k)==v)
```
[Try it online!](https://tio.run/nexus/r#TY5LDoMwDET3nMSWZkE@oGaRw6CokSoQ3bS5furgAJU3njfjkXOs@bunz@u90xpHlDjysm20lCcVrBxj4ZopkYPDDM9INGGCl5WHZgQY2Ib9HzQNmEN0oBmLBgcttHBHTOpmvmKi7rBIAd18oE8zdQ0I16WMXrn7DW04sRr1Bw "R – TIO Nexus")
[Answer]
## JavaScript (ES6), ~~45~~ 38 bytes
*Saved 6 bytes thanks to @Neil*
```
a=>a.some(([k,v])=>m[k]-(m[k]=v),m={})
```
Returns `false` or `true` for functions and non-functions, respectively.
This works by constantly subtracting the old value of each function (`m[k]`) and the new one (`m[k]=v`, which also stores the new value). Each time, there are three cases:
* If there was no old value, `m[k]` returns `undefined`. Subtracting anything from `undefined` results in `NaN`, which is falsy.
* If the old value is the same as the new one, `m[k]-v` results in `0`, which is falsy.
* If the old value is different from the new one, `m[k]-v` results in a non-zero integer, which is truthy.
Therefore, we just have to make sure that `m[k]-(m[k]=v)` is never truthy.
[Answer]
## Mathematica, 24 bytes
```
UnsameQ@@(#&@@@Union@#)&
```
Explanation: `Union` deletes duplicated pairs, then `#&@@@` gets the first element from each pair (like `First/@` but with fewer bytes). If there is any repetition in these first elements, the pairs don't make a function, which we check with `UnsameQ`.
(This might have the highest density of `@` characters in any program I've written…)
[Answer]
# [J-uby](http://github.com/cyoce/J-uby), ~~48~~ ~~33~~ ~~25~~ 21 bytes
-3 bytes thanks to Jordan!
```
:size*:==%[:to_h,~:|]
```
### Explanation
```
:size*:==%[:to_h,~:|]
# "readable"
(:size * :==) % [:to_h, ~:|]
# transform :% to explicit lambda
->(x){ (:size * :==).(:to_h ^ x, ~:| ^ x)
# apply explicit x to functions
->(x){ (:size * :==).(x.to_h, x|x) }
# expand :* (map over arguments)
->(x){ :==.(:size.(x.to_h), :size.(x|x) }
# simplify symbol calls to method calls
->(x){ x.to_h.size == (x|x).size }
# :| is set union for arrays; x|x just removes duplicates, like :uniq but shorter
->(x){ x.to_h.size == x.uniq.size }
```
# First Approach, 33 bytes
```
-[:[]&Hash,:uniq]|:*&:size|:/&:==
```
This one is longer than the equivalent Ruby solution, but it was fun to make. 
Attempt of explanation by transforming to Ruby:
```
-[:[]&Hash,:uniq]|:*&:size|:/&:==
# "readable"
-[:[] & Hash, :uniq] | (:* & :size) | (:/ & :==)                  
# turn into explicit lambda
->(x){ (:/ & :==) ^ ((:* & :size) ^ (-[:[] & Hash, :uniq] ^ x)) } 
# simplify expressions now that we have an explicit x
->(x){ :== / (:size * [Hash[x], x.uniq]) }                          
# translate to equivalent Ruby code
->(x) { [Hash[x], x.uniq].map(&:size).reduce(:==) }               
# simplify reduce over explicit array
->(x) { Hash[x].size == x.uniq.size }                             
```
I could save 2 bytes with a newer version by replacing `:uniq` with `~:|`
[Answer]
# Bash + coreutils, 17
```
sort -u|uniq -dw1
```
Input is given via STDIN. `key` and `value` are `Tab` separated and each pair is newline-delimited.
`sort` removes the duplicate key-value pairs. `uniq -d` only outputs duplicates, and so outputs the empty string in the case of a function, and a non-empty string otherwise - when there are duplicate keys that map to different values.
[Try it online](https://tio.run/nexus/bash#XZBNDoMgEIXXcIpZdOsC/6Kt6a7d9gwKWGkaSRXTjXe3IxVFSV6YvO8xDPDSwBVKKAq4Pe40IolVSmIao2aPcpupXCZHn6HCPeeOe55wHiPM9@Xmh9hnx@ptFoZsnif1@fN4NsH9Xyd@rnG5jGSLcisvo/xejET2XR5/HXlotWRq3YGRvanVW4Jq8Rcr/AWBr6txyga7vy4gNAVckjd6DZ/h5EoL58tWB8ap152BYBiHVn0gEF82Cd3K6Qc).
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes
Code:
```
ãü-ʒ¬_}}Ë
```
Explanation:
```
ã            # Cartesian product with itself
 ü-          # Pairwise subtraction
   ʒ  }}     # Filter out elements where the following is not true:
    ¬_       #   Check whether the first digit is 0
        Ë    # Check if all equal
```
Uses the **05AB1E** encoding. [Try it online!](https://tio.run/nexus/05ab1e#@3948eE9uqcmHVoTX1t7uPv//@hoYx0F01gdBThtpqNgAqJNQHQsAA "05AB1E – TIO Nexus")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
nþ`ḄCȦ
```
[Try it online!](https://tio.run/nexus/jelly#@593eF/Cwx0tzieW/T/c/qhpDRC5//8frRAdrWGso2CqqaMAp810FExAtAmIjtVRiNawhIoYQmkjmAxYFihqqAljGUHlgSKxOlxQ4w2hgjBrzLAoB9KmUD6SuClEpYWOggVIBIm2hNMoZgFpY7hTscoYIWigiliuWAA "Jelly – TIO Nexus")
### How it works
```
nþ`ḄCȦ  Main link. Argument: M (n×2 matrix)
nþ`     Construct the table of (a != b, c != d) with (a, b) and (c, d) in M.
   Ḅ    Unbinary; map (0, 0), (0, 1), (1, 0), (1, 1) to 0, 1, 2, 3 (resp.).
    C   Complement; map each resulting integer x to 1 - x.
     Ȧ  All; test if all resulting integers are non-zero.
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
QḢ€µQ⁼
```
[Try it online!](https://tio.run/nexus/jelly#@x/4cMeiR01rHu5c5Plw14L///9HRxvrmMbqQEkzMGmqYxIbCwA "Jelly – TIO Nexus")
**Explanation**
```
QḢ€µQ⁼
Q      - Remove duplicate pairs
 Ḣ€    - Retrieve the first element of each pair
   µ   - On the output of what came before..
     ⁼ - Are the following two equal (bit returned)?
    Q  - The output with duplicates removed
       - (implicit) the output.
```
Here is an alternate method, also 6 bytes:
```
QḢ€ṢIẠ
```
[Try it online!](https://tio.run/nexus/jelly#@x/4cMeiR01rDm0NfNS45////9HRhjoKRrE6CtFGOgqGINoUzjcFUWDpWAA "Jelly – TIO Nexus")
Instead of testing with removing duplicate keys, this sorts (`Ṣ`) and checks if the difference between terms (`I`) is all truthy (`Ạ`)
[Answer]
# [Actually](https://github.com/Mego/Seriously), 4 bytes
```
╔♂F═
```
[Try it online!](https://tio.run/nexus/actually#@/9o6pRHM5vcHk2d8P9/tIaxjoKhpo6ChpGOgimIBvLNNGMB "Actually – TIO Nexus")
Explanation:
```
╔♂F═
╔     uniquify (remove duplicate pairs)
 ♂F   take first items in each pair (keys)
   ═  are all of the keys unique?
```
[Answer]
# R, ~~36~~ 33 bytes
```
function(k,v)any(v[match(k,k)]-v)
```
[Try it online!](https://tio.run/##HYtBDoMgFET3nOIn3fyfjAtFu@pNGhcEIW2otKlIwulR3L2ZefOvnh4dVb9Hm97fyAFZTCycn6tJ9nXmIHOXpXq2rKFxxyiwPGHCeKKoNrRGhG7k1l8qFFzZyMSFsvnsbruUHj0GDM1soK@vUvUA "R – Try It Online")
anonymous function; returns `FALSE` for functions and `TRUE` for not.
This ~~is being beaten by~~ is finally tied with [MickyT's answer!](https://codegolf.stackexchange.com/a/119045/67312)!
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 11 bytes
```
{r~?r:*'?x}
```
[Try it online!](https://ngn.codeberg.page/k#eJxLs6ouqrMvstJSt6+o5eJKc9AwVjC1BmEzBRNrEwUTTYiYobURWNwMzDdUMALyDTUB4EoNpw==)
Port of chunes' factor answer.
## Explanation
```
{r~?r:*'?x}
{         }     /function
        ?x      /distinct values
      *'        /first value of each
    r:          /store in r
 r~?            /is distinct?
```
[Answer]
# [V](https://github.com/DJMcMayhem/V), 30 bytes
```
Úç^¨.*©î±$/d
ÎwD
ç/HdG
Íî
Ò1lD
```
[Try it online!](https://tio.run/nexus/v#@3941uHlcYdW6GkdWnl43aGNKvopXIf7yl24Di/X90hx5zrce3gd1@FJhjku//8bK5hygbCZggkQm3KZKJgAAA "V – TIO Nexus")
Outputs `1` for functions and nothing for non-functions.
[Answer]
# Mathematica, 35 bytes
```
(l=Length)@Union@#==l@<|Rule@@@#|>&
```
Pure function taking a list of ordered pairs as input and returning `True` or `False`. Exploits the fact that `Union@#` deletes repeated ordered pairs, but `<|Rule@@@#|>` (an association) deletes all but one ordered pair with a particular first element. So we can just compare the `Length`s of the two outputs to check whether the input list is a function.
[Answer]
# [CJam](https://sourceforge.net/p/cjam), ~~19~~ 17 bytes
Saved 2 bytes thanks to Martin Ender
```
0l~$2ew{:.=~!&|}/
```
Outputs `0` for functions and `1` for non-functions.
[Try it online!](https://tio.run/nexus/cjam#q/5vkFOnYpRaXm2lZ1unqFZTq/@/oNbQQOt/dLSxgmmsApQ0UzABkiZAMpYrOtoSzDMEk0YQMZCwoYJhLIQ2AktAeMZAGsSDGGaGpkIh2hTMhomYguUtFCyAPBhpCSUROg0VjKEOQBczgpJAGQA "CJam – TIO Nexus")
**Explanation**
```
0                     e# Push a 0. We need it for later.
 l~                   e# Read and eval a line of input.
   $                  e# Sort it by the keys.
    2ew               e# Get all consecutive pairs of the sorted list.
       {              e# For each pair of pairs:
        :.=           e#  Check if the keys are equal and if the values are equal.
           ~!&        e#  Determine if the keys are equal AND the values are not equal.
              |       e#  OR with 0. If any pair indicates that the input is not a function,
                      e#  this will become 1 (and remain 1), otherwise it will be 0.
               }/     e# (end block)
```
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), ~~16~~ ~~12~~ ~~11~~ 9 bytes
```
(∪≡⊢)⊃¨∘∪
```
[Try it online!](https://tio.run/nexus/apl-dyalog#@@/4qG2CxqOOVY86Fz7qWqT5qKv50IpHHTOAIv//OypoPOpqMtZRMNXUQWea6SiYQJkmICYXRLElQtgQwTSCqnjUuwaqDihpqIlgGyEUAoUtDB71blHXVeeCO8AQIY/kFjNcJkCYpghRVAWmMH0WOgoWUGFUpiUyE9MSINMY2Zd4VRihME00AQ "APL (Dyalog Unicode) – TIO Nexus")
### Explanation
```
∪             Unique, remove duplicates; (3 5) (3 5) => (3 5)
¨∘            For each element
⊃             Pick the first sub element (3 5) (2 3) => 3 
 ≡            Check whether the arguments (listed below) are the same
  ⊢           The right argument
∪             And the right argument with duplicates removed
```
Prints `0` for false and `1` for true
[Answer]
# [R](https://www.r-project.org/), ~~95~~ 66 bytes
```
function(k,v)any(sapply(k,function(x){length(unique(v[k==x]))-1}))
```
*Saved 29 bytes thanks to Jarko Dubbeldam.*
Anonymous function. Outputs `FALSE` if a function and `TRUE` if not (sorry). Takes as arguments a list of keys and a list of values, like so. 
```
> f(c(1,2,5,1,2),c(2,1,2,2,5))
[1] TRUE # not a function
```
Loops through all keys and grabs the length of the set of unique values for that key. If `any` of them are > 1, return `TRUE`.
This is being beaten by [MickyT](https://codegolf.stackexchange.com/questions/118960/is-this-a-function/119045#119045)'s answer, and also [Giuseppe](https://codegolf.stackexchange.com/a/119006/62105)'s. upvote one of those.
[Answer]
# [brainfuck](https://github.com/TryItOnline/tio-transpilers), 71 bytes
```
,[[-[->>+<<]+>>],>[[->+<<->]<[<<]>]>[-<+>]<<[->+<]+[-<<]>>,]-[--->+<]>.
```
[Try it online!](https://tio.run/nexus/brainfuck#HcvBDQAxCAPBgoBIIfdEbgS5/zKIL88dy@Pd0QFYFQ2gQ/BXgNVCEB1lqnoDTSmGU8d4hDWzc588@V0 "brainfuck – TIO Nexus")
Input is taken as a flat string: for instance, the first test case would be `35356444`. To get the representation shown in the original question, simply add a total of six commas to the program at the right points.
Output is `U` for functions and `V` for non-functions.
### Explanation
For any ASCII code point n, f(n) is stored at cell 2n+1. Cells 2n and 2n+2 are working space, and 0, 2, 4, 6, ... 2n-2 are a trail of breadcrumbs to lead back to cell 0. When the input is proven not to be a function, f(0) is set to 1 (among various side effects).
```
,                  input first key
[                  start main loop
 [-[->>+<<]+>>]    move to cell 2n, leaving a trail of breadcrumbs
 ,                 input value corresponding to current key
 >[                if key already has a value:
   [->+<<->]<      copy existing value, and compare to new value
   [<<]            if values are different, go to cell -2
   >               go back to cell 2n+1 (or -1 if mismatch)
 ]
 >[-<+>]           move existing value back to cell 2n+1 (NOP if no existing value, move the 1 from cell 0 to cell -1 if mismatch)
 <<[->+<]          copy new value to cell 2n+1 (NOP if there was already a value)
 +[-<<]>>          follow breadcrumbs back to cell 0 (NOP if mismatch)
 ,                 input next key
]                  (if mismatch, cell -2 becomes the next "cell 0", and the next key is also effectively changed by the breadcrumbs left lying around)
-[--->+<]>.        add 85 to cell 1 and output the result
```
[Answer]
# [Desmos](https://desmos.com/calculator), 46 bytes
```
U=L.unique
f(L)=0^{U.length-U.x.unique.length}
```
Function returning 1 for functions and 0 for non-functions.
Equivalent, but slightly longer:
```
f(L)=0^{L.unique.length-L.unique.x.unique.length}
```
[Try it on Desmos!](https://www.desmos.com/calculator/zqk5ac1hwp)
[Answer]
# [Factor](https://factorcode.org/), 28 bytes
```
[ members keys all-unique? ]
```
[Try it online!](https://tio.run/##fZC/DsIgEMb3PsW9gCZgbawOjsbFxTgZBySYNLV/5OjQNDw7XlpsaYzyDT@4@447eAhpKu0u5@PpsAWBWEmEWitj2lpnpQFUr0aVUiHtDMIuiroIaHWkFazBBkwg7hn3tKMv9XHmyWf5ycdIdnbm3j/Eg8bMJz4DJH8KO3JxPwAP6ib/hmRnTAN@38uo4/Sg33k@cvDZyF2hUMVdaYRctQji@Vw0ZUZ/vIebK0QNaITMl@4N "Factor – Try It Online")
* `members` Get the unique elements
* `keys` Get the keys of an associative array as a sequence
* `all-unique?` Are they all unique?
```
             ! { { 1 2 } { 2 1 } { 5 2 } { 1 2 } { 2 5 } }
members      ! { { 1 2 } { 2 1 } { 5 2 } { 2 5 } }
keys         ! { 1 2 5 2 }
all-unique?  ! f
```
[Answer]
# [Julia](https://julialang.org), 14 bytes
```
!x=x⊆Dict(x)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=bY8xDoIwFIZ3TvHcXpNqIgiBASZXT2AcipZYQ6pBNB2cHbyCCwur93H1Cl7A1lYk0S5f-_1_XttruzmUgjVNe6iLYXwbqFQ9LuepWNaoiJX3dbGtQICQUHG2KoXkeyQe6KUgBX5kJc54zUY7Vu05CvLNFIxOGSAymhNKYJgBS7P8He8qIetSoq5lMFDE43Jl72vuzzkGFEJCoWNEYWI4MVx4c0ycGDv6LjCZdmPiNr4LrQjMxorP-Oi3qRm6c8-H72JMITaix6Rjf5Jm0D3wX-B_qQv27y8)
[Answer]
# [Perl 6](https://perl6.org), 38 bytes
```
!*.unique(:as(~*)).repeated(:as(*[0]))
```
[Try it](https://tio.run/nexus/perl6#jVFBbsIwELz7FcsF2cFEJCQRNCri1BdwoxwiMJIlcEJsV6pQ@/XUsYyTAJU4jXdmdtZra8ngKwv3OTp/w5jL6VGLveKlgPdmFIRa8Itm@K2Q@DcgJKxZxQrFDpYJtrMdIY1tXQ9aASOALZ5TSAkFjxmFpMWkxR21nqXjIodxpzmHUSLSnWPnshzxw0Wpnl4gcvbbRbKnUQZTV/f49OZdUFi0XA@XHu/yDM79Qv9ocYeJW0Obj9gwqXJUnQoxfM/Jw4Y5Opb10DRdwScXlVZwNTO5hJ6IrWAmbmrNKNgK/fiMwdu9lPNRnGQX1PwB "Perl 6 – TIO Nexus")
[Answer]
# Pyth - ~~9~~ 8 bytes
```
ql.d{Ql{
```
[Try it](http://pyth.herokuapp.com/?code=ql.d%7BQl%7B&input=%5B%283%2C+5%29%2C+%283%2C+5%29%2C+%286%2C+4%29%2C+%284%2C+4%29%5D%0A%5B%289%2C+4%29%2C+%281%2C+4%29%2C+%282%2C+4%29%5D%0A%5B%5D%0A%5B%281%2C+1%29%5D%0A%5B%281%2C+2%29%2C+%282%2C+1%29%5D%0A%5B%283%2C+1%29%2C+%282%2C+5%29%2C+%283%2C+6%29%5D%0A%5B%281%2C+2%29%2C+%282%2C+1%29%2C+%285%2C+2%29%2C+%281%2C+2%29%2C+%282%2C+5%29%5D%0A%5B%288%2C+8%29%2C+%288%2C+8%29%2C+%288%2C+9%29%2C+%288%2C+9%29%5D%0A%5B%281%2C+2%29%2C+%281%2C+3%29%2C+%281%2C+4%29%5D%0A%5B%281%2C+2%29%2C+%281%2C+3%29%2C+%282%2C+3%29%2C+%282%2C+4%29%5D&test_suite=1&test_suite_input=%5B%283%2C+5%29%2C+%283%2C+5%29%2C+%286%2C+4%29%2C+%284%2C+4%29%5D%0A%5B%289%2C+4%29%2C+%281%2C+4%29%2C+%282%2C+4%29%5D%0A%5B%5D%0A%5B%281%2C+1%29%5D%0A%5B%281%2C+2%29%2C+%282%2C+1%29%5D%0A%5B%283%2C+1%29%2C+%282%2C+5%29%2C+%283%2C+6%29%5D%0A%5B%281%2C+2%29%2C+%282%2C+1%29%2C+%285%2C+2%29%2C+%281%2C+2%29%2C+%282%2C+5%29%5D%0A%5B%288%2C+8%29%2C+%288%2C+8%29%2C+%288%2C+9%29%2C+%288%2C+9%29%5D%0A%5B%281%2C+2%29%2C+%281%2C+3%29%2C+%281%2C+4%29%5D%0A%5B%281%2C+2%29%2C+%281%2C+3%29%2C+%282%2C+3%29%2C+%282%2C+4%29%5D&debug=0)
It works by removing any repeated pairs first ({Q); then it compares the length of the list to the length of a dictionary created from the list (if the same x value occurs more than once, the dictionary constructor uses only the last one, resulting in the dictionary being shorter than the list)
]