text:
Two lasers between two mirrors
What if we have a corridor comprised of two parallel mirrors?
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |

Now, we shine a laser down it...
|  \       |
|   \      |
|    \     |
|     \    |
|      \   |
|       \  |
|        \ |
|         \|
|         /|
|        / |

Oh, look. It bounced, towards the end, there.
What if we draw two lasers BUT going in the opposite direction?
|  \    /  |
|   \  /   |
|    \/    |
|    /\    |
|   /  \   |
|  /    \  |
| /      \ |
|/        \|
|\        /|
| \      / |

Hmm, they didn't seem to meet, there. That's convenient. What happens if both lasers take up the same space?
|  \     / |
|   \   /  |
|    \ /   |
|     X    |
|    / \   |
|   /   \  |
|  /     \ |
| /       \|
|/        /|
|\       / |

I guess that was pretty obvious, huh?

Drawing these diagrams by hand is pretty laborious (trust me on this). Perhaps some code could do it for us?

Write some code to output two parallel mirrors, with two bouncing, intersecting lasers.
Input (all integers):

The width of the corridor
The length of the corridor
Starting position of the right-going laser (zero-indexed, must be less than width)
Starting position of the left-going laser (zero-indexed, must be less than width)

Process

If a laser is right going, it will be drawn one space to the right on the following line.
If a laser is left going, it will be drawn one space to the left on the following line.
If a laser can not take it's sideways step, it will change it's direction, but not it's position.
If both laser are at the same index, print an upper-case X at that index.

Output

A string with multiple lines
Each line starts and ends with a pipe character (|)
Right-going laser are denoted by a back slash (\)
Left-going laser are denoted by a forward slash (/)
The intersection of two lasers is denoted by an upper-case X.

Any language
I'd like to see TIO links
Attempt to fix it in the smallest number of bytes

Test cases
width: 6
length: 10
right-going: 1
left-going: 4
| \  / |
|  \/  |
|  /\  |
| /  \ |
|/    \|
|\    /|
| \  / |
|  \/  |
|  /\  |
| /  \ |

width: 6
length: 10
right-going: 0
left-going: 1
|\/    |
|/\    |
|\ \   |
| \ \  |
|  \ \ |
|   \ \|
|    \/|
|    /\|
|   / /|
|  / / |

width: 4
length: 10
right-going: 2
left-going: 0
|/ \ |
|\  \|
| \ /|
|  X |
| / \|
|/  /|
|\ / |
| X  |
|/ \ |
|\  \|

width: 20
length: 5
right-going: 5
left-going: 15
|     \         /    |
|      \       /     |
|       \     /      |
|        \   /       |
|         \ /        |

width: 5
length: 6
right-going: 2
left-going: 2
|  X  |
| / \ |
|/   \|
|\   /|
| \ / |
|  X  |

width: 1
length: 2
right-going: 0
left-going: 0
|X|
|X|

Suggested edge case: width: 1, length: whatever, right: 0, left: 0

@Arnauld |X| ;)

Stax, 40 bytes
àù@○⌡┼PY¼îαφu^·A☺°É⌠■╟¡Åt^◘v(µ╩Ñ♣t{╓○xß╦

Run and debug it
Try it online!
Pretty sure this can be further golfed.
Input is given in the form of width [right-going left-going] length(per comment by @EngineerToast).
ASCII equivalent:
xHXdmzx);hi+x%Y92&;Hi-x%cy=41*47+&2ME:R\{|+m'||S

Might want to note the input format as width [right-going left-going] length

JavaScript (ES6), 149 bytes
Takes input in currying syntax (w)(h)([a,b]).
w=>h=>g=(p,d=[1,-1],s=Array(w).fill` `)=>h--?`|${p=p.map((x,i)=>~(k=d[i],s[x]='/X\\'[x-p[i^1]?k+1:1],x+=k)&&x<w?x:x+(d[i]=-k)),s.join``}|
`+g(p,d):''

Try it online!
Commented
w => h =>                  // w = width, h = height
  g = (                    // g = recursive function taking:
    p,                     //   p[] = array holding the point coordinates
    d = [1, -1],           //   d[] = directions
    s = Array(w).fill` `   //   s = array of w spaces (we can't use a string because it's
  ) =>                     //       immutable in JS)
    h-- ?                  // if we haven't reached the last row yet:
      `|${                 //   append the left pipe
      p = p.map((x, i) =>  //   for each x at position i in p[]:
        ~(k = d[i],        //     k = direction for this point
          s[x] = '/X\\'[   //     insert either '/', 'X' or '\' at position x in s
            x - p[i ^ 1] ? //     if p[0] != p[1]:
              k + 1        //       use the direction
            :              //     else:
              1            //       force 'X'
          ], x += k        //     add k to x
        ) &&               //     if the result is not equal to -1
        x < w ?            //     and is less than w:
          x                //       use the current value of x
        :                  //     else:
          x + (d[i] = -k)  //       change the direction and restore the initial value of x
      ),                   //   end of map()
      s.join``}|\n` +      //   join and append s; append the right bar and a linefeed
      g(p, d)              //   followed by the result of a recursive call
    :                      // else:
      ''                   //   stop recursion

Python 2, 119 bytes
w,l,a,b=input()
exec"print'|%s|'%''.join(' \/X'[sum(i==k%(2*w)for k in[a,~b]+[~a,b]*2)]for i in range(w));a+=1;b-=1;"*l

Try it online!

Can you not golf \\/ to \/? Even though the backslash is interpreted twice, it will still not escape the slash.

@JonathanFrech You're right, I thought being in a string-in-string would fail, but it indeed doesn't escape either time.

Oh jeez, my solution got painfully close to this idea -- working modulo 2w makes a lot of sense in retrospect. Very clever!

Python 2, 187 181 179 177 174 172 171 bytes
def f(w,l,a,b,A=1,B=-1):
 while l:l-=1;print'|%s|'%''.join(' \X/'[[0,A,B,2][(i==a)+2*(i==b)]]for i in range(w));a,A=[a,a+A,-A,A][-1<a+A<w::2];b,B=[b,b+B,-B,B][-1<b+B<w::2]

Try it online!

Recursive:
Python 2, 172 bytes
def f(w,l,a,b,A=1,B=-1):
 if not-1<a<w:A=-A;a+=A
 if not-1<b<w:B=-B;b+=B
 if l:print'|%s|'%''.join(' \X/'[[0,A,B,2][(i==a)+2*(i==b)]]for i in range(w));f(w,l-1,a+A,b+B,A,B)

Try it online!

Recursive, alternative print:
Python 2, 172 bytes
def f(w,l,a,b,A=1,B=-1):
 if not-1<a<w:A=-A;a+=A
 if not-1<b<w:B=-B;b+=B
 if l:L=[' ']*w;L[a]=' \/'[A];L[b]=[' \/'[B],'X'][a==b];print'|%s|'%''.join(L);f(w,l-1,a+A,b+B,A,B)

Try it online!

I am once again amazed by the speed of first answers on code golf challenges. Nice one! :)

Python 2, 168 bytes
w,n,r,l=input()
R=L=1
exec"""
d=[~r*R,-~l*L].count
print'|%s|'%''.join(' /\X'[2*d(~x)|d(x+1)]for x in range(w))
if-1<r+R<w:r+=R
else:R=-R
if-1<l-L<w:l-=L
else:L=-L"""*n

Try it online!

What a weird and unfortunate error, just as if it didn't take precious bytes to define d!

C (clang), 240 236 208 bytes
#define g(a,b) b?a++,a==x&&(a=x-1,b=0):a--,a==-1&&(a=0,b=1)
i,m,n,o,p,t[]={47,92};f(x,y,r,l){for(m=1,n=0;y--;puts("|"),g(r,m),g(l,n))for(printf("|"),i=0;i<x;o=i==r,p=i++==l,putchar(o*p?88:o?t[m]:p?t[n]:32));}

Try it online!
f() takes parameters as follows:
x = width,
y = length,
r = Initially right-going line starting position
l = Initially left-going-line starting position
-4 Bytes. credits  Kevin Cruijssen. Thanks

You can golf 3 bytes by changing the while to a for to remove the {} and one of the semi-colons. And 1 more byte by changing c&&d to c&d. Try it online 236 bytes.

Looks like you are taking two extra inputs, that is not allowed afaik.

@O.O.Balance Taking two extra inputs allows me to handle input conditions that original question didn't accounted for, i.e. lines starting in same direction. But if you can point me to a general-consensus vote that says this is disallowed, I'll be happy to remove variables from parameter and add to globals.

You're not supposed to solve a generalisation of the challenge, but the challenge as specified. Regarding extra inputs, I dug around meta a bit and found this: https://codegolf.meta.stackexchange.com/a/12696/79343 I'm thinking it must be written up somewhere else, too, but i can't find it atm. It is however the norm.

@O.O.Balance I didn't think that was the norm, but I understand objection to passing special values as parameters. I could've initiaized those params in my function with 6 bytes penalty, but I improved the answer instead. Thanks for your inputs :)

In your g macro, you can golf 2 bytes by changing a==-1 to a<0.

Actually got more in the macro, a++,a and a--,a can golf 2 bytes each to ++a and --a

I checked; works on GCC too.

187 bytes

Canvas, 66 40 bytes
｛²Ｘø⁶╵［⁷／²２％［↔｝∔｝；ｘ╷？⁷∔⁷＋╷｝［ｊ｝｝ｎ⁶［|ＰＪｐ|ｐ

Try it here!

Charcoal, 56 50 bytes
↷ＰＩθＭ⊕η→ＩθＦ²«Ｊ⊕⎇ιεζ⁰ＦＩθ«✳§⟦↘↙⟧ι∨⁼ＫＫψX¿⁼ＫＫ|«¿ι→←≦¬ι

Try it online! Link is to verbose version of code. Edit: Saved 6 bytes by reducing reliance on pivoting. Explanation:
↷ＰＩθＭ⊕η→Ｉθ

Print the sides.
Ｆ²«

Loop over the two lasers.
Ｊ⊕⎇ιεζ⁰

Move to the start of the laser.
ＦＩθ«

Loop over the height.
✳§⟦↘↙⟧ι∨⁼ＫＫψX

Draw a \ or / in the appropriate direction, unless the square is not empty, in which case draw an X.
¿⁼ＫＫ|«

Have we hit a side?
¿ι→←≦¬ι

If so then take one step sideways and invert the direction of travel.

This goes out of bounds when the input is "10 2 4 2"

@MartijnVissers Well yes, if your width is 2, then your positions can only be 0 or 1...

Java (JDK 10), 186 bytes
(w,h,r,l)->{var x="";for(int i=0,j,R=1,L=-1;i++<h;l+=L,l+=l<0|l>=w?L=-L:0,r+=R,r+=r<0|r>=w?R=-R:0,x+="|\n")for(j=0,x+="|";j<w;j++)x+="/X\\ ".charAt(j==r?j==l?1:R+1:j==l?L+1:3);return x;}

Try it online!

PHP, 177 169 166 bytes
[,$w,$h,$a,$b]=$argv;for($e=-$d=1;$h--;$s[$a+=$d]^L?:$a+=$d=-$d,$s[$b+=$e]^L?:$b+=$e=-$e){$s=str_pad("",$w)."|";$s[$b]="X\/"[$e];$s[$a]="X\/"[$a-$b?$d:0];echo"|$s
";}

requires PHP 7.1 for negative string indexes, PHP 5.5 or later for indexing string literals.
for PHP <7.1, remove ^L, replace "X\/" with "/X\\", :0 with +1:1, [$e] with [$e+1], remove ."|" and insert | before the newline. (+3 bytes)
for PHP < 5.5, replace "/X\\" with $p and insert $p="/X\\"; at the beginning. (+2 bytes)
takes input from command line arguments. Run with -nr or try them online.

It's unfortunate that onlinephpfunctions.com does not save the correct PHP version in the sharing link...

Python 3, 162 bytes
from numpy import*
def f(w,h,u,v):
 v=w+w-v-1;T=eye(w);M=vstack([T,2*T[::-1]]*2*h)
 for r in M[u:u+h,:]+M[v:v+h,:]:print('|%s|'%''.join(' \/X'[int(i)]for i in r))

Try it online!

I like the formatting in your test suite, reliably showing the inputs against the output... Nice one ;)

Ruby, 117 bytes
->w,h,a{a[1]-=w;(1..h).map{s=' '*w;a.map!{|x|d=x<0?-1:1;s[x]='X\\/'[s[x][/ /]?d:0];x+=d;x==w ?-1:x<-w ?0:x};?|+s+?|}}

Try it online!
Anonymous lambda taking input as width w, height h and an array of starting points a.

You kind of made my day by making it an expandable array, not just 2 starting points.

PowerShell, 243 233 222 205 bytes
param($w,$h,$a,$b)$l,$r,$s=1,-1,' \/'
1..$h|%{$p,$p[$b],$p[$a]=[char[]](' '*$w),$s[$r],($s[$l],"x")[!($a-$b)]
if($a+$l-in($z=0..($w-1))){$a+=$l}else{$l*=-1}if($b+$r-in$z){$b+=$r}else{$r*=-1}"|$(-join$p)|"}

Try it online!
Oooof. those logic blocks are big and dirty and mostly duplicated. The next step would be rewriting them so they don't need the else statement.

Python 2, 165 164 bytes
w,h,x,y=input()
a,b,s=1,-1,' \/'
exec"""l=[' ']*w
l[x],l[y]=s[a],s[b]if x-y else'X'
if-1<x+a<w:x+=a
else:a=-a
if-1<y+b<w:y+=b
else:b=-b
print'|%s|'%''.join(l)
"""*h

Saved a byte thanks to Jonathan Frech.
Try it online!

\\/ is equivalent to \/.

K (ngn/k), 58 bytes
{" \\/X|"4,'(+/3!1 2*(x#'e+2*|e:=2*x)(2*x)!z+(!y;-!y)),'4}

Try it online!
anonymous function that accepts three arguments: x the width, y the length, z a pair of starting positions for the lasers

C (gcc), 169 bytes
A,B,c;f(w,l,a,b){for(A=1,B=-1;l--;a+=A,a<0|a==w?A=-A,a+=A:0,b+=B,b<0|b==w?B=-B,b+=B:0,puts("|"))for(c=-1;c<w;c++)putchar(c<0?'|':a^c?b^c?32:B>0?92:47:b^c?A>0?92:47:88);}

Try it online!

163 bytes

Kotlin, 322 311 302 bytes
Changed how I put laser direction in string for 11 bytes.
Moved assignment out of when for 9 bytes.
{w:Int,h:Int,r:Int,l:Int->{var a=""
var f=r
var d=1>0
var s=l
var t=!d
for(o in 1..h){a+="|"
for(c in 0..w-1)a+=when{c==f&&c==s->"X"
c==f&&d||c==s&&t->"\\"
c==f||c==s->"/"
else->" "}
a+="|\n"
if(d){if(++f==w){--f
d=!d}}else if(--f<0){f=0
d=!d}
if(t){if(++s==w){--s
t=!t}}else if(--s<0){s=0
t=!t}}
a}()}

Try it online!


text:
Get the number of images on a webpage
Recreational languages win at code golf too much. This challenge is simple, when using higher level functions.
The task is as follows:
Given any valid url, which is guaranteed to result in a valid HTML document (for example https://en.wikipedia.org/wiki/Ruby_on_Rails, which has 9 images), count the number of images displayed from the resultant webpage.
Only images visible in the HTML code are counted, marked by the HTML  tag.
Websites that can continually load images (Google Images) are not valid tests.

Comments are not for extended discussion; this conversation has been moved to chat.

This is [tag:code-golf], right? The shortest code wins, right? Then why does a 61 byte answer beat an 10 byte answer? If my answer is invalid in some way, just comment on my post.

JavaScript, 61 bytes
As per this consensus, the code needs to run under the same domain as the page being requested, to avoid CORS issues. Returns a Promise conatining the count.
u=>fetch(u).then(r=>r.text()).then(t=>t.split`<img`.length-1)

Thanks to tsh for pointing out some code I forgot to update before posting, saving 3 bytes.

Try it

(f=
u=>fetch(`https://crossorigin.me/`+u).then(r=>r.text()).then(t=>t.split`<img`.length-1)
)(i.value=`https://codegolf.stackexchange.com/questions/161669/`).then(x=>o.innerText=x);b.addEventListener(`click`,_=>f(i.value).then(x=>o.innerText=x),0)
<input id=i><button id=b>Count</button>

Why not .match? or .split"<img"?

.match works out longer in order to handle the case of their being no images. You're right on the second count, though; forgot to change it before posting. Thanks.

*there! Dunno how I did that!

CJam, 10 bytes
lg"<img"e=

Does not work online.
Description:
l          # read line
 g         # open url and get html
  "<img"   # this string
        e= # count arg2 in arg1

@downvoters what did I do wrong?

No idea. / Anyone who hates golfing languages is likely to know none of them. (otherwise they would know how hard it is to golf in those languages) Bash is not even a golfing language...

Can you add a TIO and/or an explanation? I don't know CJam and can't figure out how this is reading in the HTML.

Python 3 + Selenium + Firefox, 124 bytes
from selenium.webdriver import*
d=Firefox()
d.get(input())
c=len(d.find_elements_by_xpath('//img'))
d.quit()
print(c)

Notice that https://en.wikipedia.org/wiki/Ruby_on_Rails report 8 instead of 9. This is due to one of the  tag is contained by , which is regarded as comment by a browser who enabled script.
Changing webdriver.Firefox to webdriver.Ie may save 5 bytes... But I just dislike IE.
How to run:

First install Python 3, and Firefox
install Selenium by pip install selenium
Download gecko driver and put it to your path
Run this script
A Firefox will be started, ignore it and input the url to stdin
The result will be shown on stdout

A manual count confirms that there are 9 img tags on that page.

@Shaggy One of them is in  tag which will not be rendered if browser support javascript; 3 of them are invisible to user. So there are 5 image displayed.

"Only images visible in the HTML code are counted, marked by the HTML  tag."

Yes, and also "count the number of images displayed from the resultant webpage". I read this as "only displayed  tags are count.

You're right, there's a contradiction there. I suggest asking for clarification.

@tsh @0liveradam8 So we just need to count  tags? – NoOneIsHere 19 hours ago    @NoOneIsHere Yes! But you have to download the HTML code from a given URL first

For some reason my laptop will not let me install silenium so can't test but can't you just do import silenium as S and then S.webdriver.Firefox() to save 7?

@Shaggy @NoOneIsHere Just updated to fit OP's comment (ignored is_displayed test).

@ElPedro it seems that from selenium.webdriver import* works, updated.

Python 2 + BeautifulSoup, 103 bytes
import bs4 as B
import urllib as U
print len(B.BeautifulSoup(U.urlopen(input()).read()).findAll('img'))

Can't do a TIO as BeautifulSoup is not available there. This reports 9 for  https://en.wikipedia.org/wiki/Ruby_on_Rails.
Note: A warning is displayed before the number as a parser is not specified and lxmlis taken as the default. Adding the lxml parser explicitly suppresses the warning but costs another 7 bytes.
import bs4 as B
import urllib as U
print len(B.BeautifulSoup(U.urlopen(input()).read(),'lxml').findAll('img'))

Bash, grep, and wc, 45 28 bytes
curl $1|grep -o "<img"|wc -l

-17 bytes thanks to tsh
Explanation:
curl $1                      # download html from first parametre
       |grep -o "<img"       # find all <img strings
                      |wc -l # count lines

What if there are multiple  tags on a line?

@downvoters what did I do wrong?

grep -o '<img' should works if you just want <img substring.

@nimi - if that's the case then the person who made the web site should be a code golfer and not a web developer :-)

@ElPedro No need of code golfer, just a minify tool should be enough.

source: Stack Exchange

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

sort: votes


text:
Sort spelled-out serial numbers
Given a list of two or more spelled-out serial numbers of equal length greater than two, e.g.
[[ "three" , "one"  , "four"  ],
 [ "one"   , "five" , "nine"  ],
 [ "two"   , "six"  , "five"  ],
 [ "three" , "five" , "eight" ]]

sort the list by the numbers that the words represent:
[[ "one"   , "five" , "nine"  ],
 [ "two"   , "six"  , "five"  ],
 [ "three" , "one"  , "four"  ],
 [ "three" , "five" , "eight" ]]

You may require the numbers to be spelled in lower or upper, but not mixed, case.
Test cases
[["three","one","four"],["one","five","nine"],["two","six","five"],["three","five","eight"]]gives[["one","five","nine"],["two","six","five"],["three","one","four"],["three","five","eight"]]
[["two","seven"],["one","eight"],["two","eight"],["one","eight"],["two","eight"],["four","five"]]gives[["one","eight"],["one","eight"],["two","seven"],["two","eight"],["two","eight"],["four","five"]]
[["one","four","one","four","two"],["one","three","five","six","two"],["three","seven","three","zero","nine"]]gives[["one","three","five","six","two"],["one","four","one","four","two"],["three","seven","three","zero","nine"]]
[["zero","six","one"],["eight","zero","three"],["three","nine","eight"],["eight","seven","four"],["nine","eight","nine"],["four","eight","four"]]gives[["zero","six","one"],["three","nine","eight"],["four","eight","four"],["eight","zero","three"],["eight","seven","four"],["nine","eight","nine"]]

Not sure if I got this correctly, does ["three","one","four"] === 314?

@Nit Yes, that's right.

@Nit By the numbers they spell out. E.g. [314,159,265,358] → [159,265,314,358].

Can we assume a certain arbitrary capitalization of the numbers?

@dylnan You may require the numbers to be spelled in lower or upper, but not mixed, case.

I really need to learn to read...

No APL friendly test cases format? ;)

@Uriel Just use ↑⍣≡⎕JSON.

Husk, 9 8 bytes
Ö†€¨tfṡn

Try it online!
Algorithm "inspired" by recursive's Stax answer (I've just changed the lookup string a bit), go upvote him!
The trick is mapping each letter to its position in the string tfsen (compressed at the end of this program). Husks lists are 1-based, and missing items return 0, so we get this mapping:
"one"        [0,5,4]
"two"        [1,0,0]
"three"      [1,0,0,4,4]
"four"       [2,0,0,0]
"five"       [2,0,0,4]
"six"        [3,0,0]
"seven"      [3,4,0,4,5]
"eight"      [4,0,0,0,1]
"nine"       [5,0,5,4]

As you can see, the lists are perfectly ordered.

In order to be clear, here's how list comparison works in Husk (and in many other languages):

If one of the two lists is empty, that's the smaller one.
If the first elements of the two lists are different, the one with the smaller first element is the smaller list.
Otherwise, discard the first element from both lists and go back to point 1.

If I'm not mistaken, the "w" can be dropped also, since it's only useful comparing "two" to "three", but you already have "h".  Not sure if that helps you.  I haven't figured out how to integrate this fact into a stax program that's actually smaller yet.

...if it were just the letters it could be tfrsen but I'm guessing having words like with and sen in there helps compression.

Thank you guys, you inspired me to find an even shorter string :D

So, it's like replacing the commas with a decimal point after the first comma?

@Strawberry Not really, [1,0,0] is considered smaller than [1,0,0,0] (but for this program it wouldn't make a difference)

Stax, 24 22 17 16 14 bytes
▄Ωφ▐╧Kìg▄↕ñ▼!█

Run and debug it
This program takes arrays of lowercase spelled digits for input. The output is newline-separated like so.
one five nine
two six five
three one four
three five eight

This program sorts the inputs using the ordering obtained under a specific transformation.  Each character in each word is replaced by its index in the string "wo thif sen".  The original arrays are sorted by this ordering.  Then the results are printed after joining with a space.
The spaces serve no purpose, but actually allow greater compression in the string literal.

What encoding does Stax use? This is 32 bytes in UTF-8.

Modified CP437, like the "bytes" hyperlink explains.

Is there some standard algorithm/method of coming up with such a string? Does the concept have a name?

@Itai:  It seems like it would, but I'm not aware what it is.

Python, 62 bytes
lambda m:sorted(m,key=lambda r:[int(s,36)%6779%531for s in r])

Try it online! ...or see the test-suite
Note:
lambda m:sorted(m,key=lambda r:[map("trfsen".find,s)for s in r])

which works in Python 2 (but not 3) is longer by two bytes.

How did you discover the magic numbers?

Just a nested loop checking for strict increasing over the results. Although I  possibly restriced the digit length of the inner given the outer.

Jelly, 12 bytes
OḌ%⁽Ð¢%147µÞ

A monadic link.
Try it online!  ...or see the test-suite
How?
Converting the digits to ordinals and then from base 10 then taking modulos by 4752 then 147 gives an ascending order:
 zero            , one         , two         , three               , four
[122,101,114,111],[111,110,101],[116,119,111],[116,104,114,101,101],[102,111,117,114]
 133351          , 12301       , 12901       , 1276511             , 114384
 295             , 2797        , 3397        , 2975                , 336
 1               , 4           , 16          , 35                  , 42

 five            , six         , seven               , eight               , nine
[102,105,118,101],[115,105,120],[115,101,118,101,110],[101,105,103,104,116],[110,105,110,101]
 113781          , 12670       , 1263920             , 1126456             , 121701
 4485            , 3166        , 4640                , 232                 , 2901
 75              , 79          , 83                  , 85                  , 108

This can then be used as a key function by which to sort:
OḌ%⁽Ð¢%147µÞ - Link: list of lists of lists of characters
          µÞ - sort (Þ) by the mondadic chain to the left (µ):
O            -   ordinals of the characters
 Ḍ           -   convert from base 10
   ⁽Ð¢       -   literal 4752
  %          -   modulo
      %147   -   modulo by 147

That's some wonderful modulos you have found right there, I assume that was painstaking.

Not all that painstaking - I did look at binary first though.

Like, you brute-forced the modulos, no?

Yeah, but it was quick.

APL (Dyalog Classic), 12 bytes
'nesft'∘⍒⌷¨⊂

Try it online!
This is how I found a suitable left argument for dyadic ⍒ (I tried ⍋ and length 6 first):
A←⊖a←↑'zero' 'one' 'two' 'three' 'four' 'five' 'six' 'seven' 'eight' 'nine'
{(a≡a[⍵⍒a;])∧A≡a[⍵⍒A;]:⎕←⍵}¨,⊃∘.,/5⍴⊂∪∊a

Ruby, 48 bytes
->x{x.sort_by{|y|y.map{|s|s.to_i(35)**2%47394}}}

Abuses the fact that "zero".to_i(35) is 0 (since 'z' isn't a valid digit in base 35), so it's that much easier to brute-force a formula for the other nine digits.

Ruby, 47 bytes
->x{x.sort_by{|y|y.map{|s|s.to_i(32)%774%538}}}

Try it online!
Utilises the fact that using a base less than the maximum digit yields a result of zero (as pointed out by histocrat in their answer)

K (ngn/k), 14 18 bytes
{x@<"tfsen"?/:/:x}

Try it online!

Python 2, 85 81 80 bytes
Simply uses the first two letters of each word to determine the number, then sorts each list using that indexing function as the key.
lambda _:sorted(_,key=lambda L:['zeontwthfofisiseeini'.find(s[:2])/2for s in L])

Try it online!
Saved 4 bytes, thanks to Jonathan Allan

A for loop list comprehension in the key function is 4 bytes shorter.

Perl 6, 37 bytes
*.sort:{('digit 'X~$_)».parse-names}

Try it
Expanded:
*\     # WhateverCode lambda (this is the parameter)
.sort:
{  # block with implicit parameter ｢$_｣
  (
    'digit ' X~ $_  # concatenate 'digit ' to each named digit
  )».parse-names    # call .parse-names on each
}

The code block will take a value of the form ("three","one","four") and translate it to ("3","1","4") which is a value that .sort can easily use.

APL (Dyalog), 38 bytes
{⍵[⍋(531∘⊥⍤1)(531|6779|36⊥9+⎕A⍳⊢)¨↑⍵]}

Try it online!
Based of Jonathan Allan's awesome solution.

@JonathanAllan I edited a credit during the initial changetime.. I have no idea why it was unchanged. fixed now

31: ⊂⌷¨⍨∘⍋(531⊥531|6779|36⊥9+⎕A⍳⊢)¨, but you can do this much simpler in less than half of your current byte count.

@Adám so, you tolerate input and output in different formats (mixed vs unmixed)?

@ngn Sure. But the solution I have in mind has fully mixed I/O.

JavaScript (Node.js), 70 bytes
a=>a.sort((a,b)=>(g=a=>a.map(c=>99+parseInt(2+c,34)%607%292))(a)>g(b))

Try it online!

Ruby, 49 bytes
->x{x.sort_by{|y|y.map{|s|s.to_i(36)**4%463595}}}

Try it online!

Haskell, 133 122 109 107 106 bytes
import Data.List
sortOn$abs.read.(>>=show.head.(`elemIndices`words"ze on tw th fo fi si se ei ni").take 2)

Ungolfed:
import Data.List

nums = ["ze","on","tw","th","fo","fi","si","se","ei","ni"]

lookup' :: Eq a => a -> [a] -> Int
lookup' v = head . elemIndices v

wordToInt :: String -> Int
wordToInt (x:y:_) = lookup' [x,y] nums

wordsToInt :: [String] -> Int
wordsToInt = read . concatMap (show . wordToInt)

sortN :: [[String]] -> [[String]]
sortN = sortOn wordsToInt

05AB1E, 27 bytes
Σ“¡×€µ‚•„í†ìˆÈŒšï¿Ÿ¯¥Š“#skJ

Try it online!

Σ                           # Sort input by...
 “¡×€µ‚•„í†ìˆÈŒšï¿Ÿ¯¥Š“     # "zero one two three four five size seven eight nine"
                       #    # Split on spaces.
                        sk  # Find index of each input...
                          J # Join up.

25 bytes

@Kaldo ah... encoding the starting 2 letters of each? I feel like that should be its own answer.

Python 2, 59 bytes
lambda m:sorted(m,key=lambda r:[hash(s)%2249518for s in r])

Try it online!
Riffing on Jonathan Allan's Python 3 solution...

Java (JDK 10), 132 bytes
l->{l.sort((a,b)->s(a)-s(b));}
int s(String[]a){int v=0;for(var s:a)v=v*99+"zeontwthfofisiseini".indexOf(s.substring(0,2));return v;}

Try it online!

Jelly, 30 28 27 bytes
w@€“¡¦ẇṆb~ṇjṚØ%ĖġṘḥḞṾṇJḌ»µÞ

Try it online!
-1 thanks to Jonathan Allan.
Finds the index of each digit in the string ‘onetwo...nine’ then sorts using this as a key function with Þ. Don't need to include 'zero' at the beginning because the search for the first two characters of 'zero' will fail and 0 will be returned instead of an index, making 'zero' lexicographically "early".

Using a compression of 'one two ...nine' is one byte less

@JonathanAllan Ah, thanks. I hadn't thought to check that. Compressing 'zeontw...ni' ended up being longer.

...no longer "...the first two letters".

Perl 5, 103 bytes
sub c{pop=~s%(..)\w+\s*%zeontwthfofisiseeini=~/$1/;$`=~y///c/2%ger}say s/\R//gr for sort{c($a)<=>c$b}<>

Try it online!

Retina 0.8.2, 38 bytes
T`z\o\wit\hfsen`d
O`
T`d`z\o\wit\hfsen

Try it online! Link includes test suite. Works by temporarily replacing the letters zowithfsen with their position in that string, which allows the numbers to be sorted lexically.

Python 3, 141 bytes
print(sorted(eval(input()),key=lambda l:int(''.join([str("zero one two three four five six seven eight nine".split().index(i))for i in l]))))

Try it online!

131 bytes

C (clang), 229 bytes
y,j,k,t[9];char *s="zeontwthfofisiseeini";r(char **x){for(j=y=k=0;k+1<strlen(*x);k+=j,y=y*10+(strstr(s,t)-s)/2)sscanf(*x+k,"%2[^,]%*[^,]%*[,]%n",t,&j);return y;}c(*x,*y){return r(x)-r(y);}f(*x[],l){qsort(&x[0],l,sizeof(x[0]),c);}

Try it online!
There is no straightforward way of sending array of array of strings to C functions, so in spirit of code-golf, I have taken a minor liberty in input format.
f() accepts an array of pointers to strings, where each string is a number, represented by comma separated spelled-out-digits in lower-case. Additionally, it needs number of strings in array in second parameter.
I hope this is acceptable.
f() replaces the pointers in place in sorted order using qsort().
r() reads input number from comma-separated number string. It only compares first two characters to identify number.
c() is comparison function

207 bytes

@ceilingcat Can you please explain strstr("i"-19,t)-"zeontwthfofisiseeini"? Is it compiler-specific or standard?

That relies on there being no other patterns in .rodata that look like 0x69 0x00 and the compiler placing the address of "i" at the end of "zeo..."

thought so.. is there a way to ensure compiler does that? I know rules here would allow this but, could I depend on this in real wold?

My instinct is to avoid this in the "real world" but this will probably work well if your string fragments are sufficiently unique. There may actually be some legitimate use case perhaps related to stack canaries but I also might just be hallucinating.

Ruby, 64 bytes
->a{a.sort_by{|b|b.map{|n|"zeontwthfofisiseeini".index n[0,2]}}}

Try it online!
A lambda accepting a 2D array of strings and returning a 2D array of strings.
Piggybacking off of mbomb007's Python 2 answer for -26 bytes off of what I was about to post.

Vyxal, 10 bytes
µ→λf∆ċ←⁼;Ṅ

Try it Online!
Can be a little bit slow for serial numbers that represent larger decimal numbers, as the explanation will show. Who needs lookup strings anyway?
Explained
µ→λf∆ċ←⁼;Ṅ
µ          # Sort the input by:
 →         #  putting the item into a temporary variable (needed for scoping purposes)
  λ     ;Ṅ #  and getting the first non-negative integer where:
   f∆ċ     #    converting each of the digits in the number to words
      ←⁼   #    equals the list being considered.

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

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


text:
Intron Adder Quine

In the context of quines, an intron (or payload) is a part of a quine that serves no purpose in producing output, but is still included in the data section. For example:
function quine() {
    const data = "function quine() {\n    const data=\"@\";\n    // Arr! This be an intron!\n    return data.replace(\"@\", JSON.stringify(data));\n}";
    // Arr! This be an intron!
    return data.replace("@", JSON.stringify(data));
}

My challenge is to write a quine that will normally run as a standard quine, but if an argument is passed in, then it returns a new quine with the argument placed somewhere in it. If that new quine is called with an argument, it should do the same. For example:
function quine(intron="") {
    const data = "function quine(intron=\"\0\") {\n    const data = \"%%%\";\n    //\0\n    return data.replace(/\u0000/g, intron).replace(\"%%%\", JSON.stringify(data));\n}";
    //
    return data.replace(/\u0000/g, intron).replace("%%%", JSON.stringify(data));
}

A few statements:

If you have no input, then the output should be identical to the source code. If you have input, then the output only needs to:

Be in the same language
Contain the input
Be a solution to this challenge in its own right

Quines only need to contain the latest intron. Introns from the program that generated it are optional.
If your program already contains the input, then the same program is fine. For example, if it's called with the same input twice.
The input can be assumed to be printable ASCII only.
The shortest program in bytes wins.

So with no argument, the program should be a quine, and with an argument the output should be a quine with the argument as a contiguous sublist somewhere in the text?

@dylnan You can put it anywhere: comments, literals, variable names, as long as you handle any printable ASCII.

I thought the usual term was payload

@JoKing I got the term "intron" from this article on quines.

Related.

"My challenge is to write a quine that will normally run as a standard quine" and "The returned program need only be similar in any way to the original if it's called without arguments" condradict each other.

V, 11 bytes
ñéÑvu"qpx:"

Try it online!
Hexdump:
00000000: f1e9 d176 7522 7170 783a 22              ...vu"qpx:"

This is a simple modification of the standard V quine. Given the input:
Hello

this program will output:
ñéÑvu"qpx:"Hello

Which outputs:
ñéÑvu"qpx:"Hello

This works because the input is automatically appended to the end of ñéÑvu"qpx, and :" is a comment (essentially)

Wouldn't a " in the input break it?

@joking Surprisingly, no. " is a line comment.

Python 2, 70 bytes
def f(x=''):s='def f(x=%r):s=%r;print s%%(x,s,x)#%s';print s%(x,s,x)#

Try it online!
A weird extension of the usual python quine s="s=%r;print s%%s";print s%s. This adds an extra %s after a comment, to output the data, and a %r in the default string to push the original string as default instead of an empty string.

I don't believe this supports input containing both ' and ".

@ØrjanJohansen Should be fixed

I don't quite understand the purpose of the %r in the default, or of changing x in the function. Although it might be related to the question I just asked on the OP (in which case I don't think it actually works if you explicitly pass in the same string again.)

Python 3, 77 bytes
t='';s='t=input()or t;print(f"t={repr(t)};s={repr(s)};exec(s)#{t}")';exec(s)#

Try it online!
Full programs. Input must be terminated with a newline, and output a trailing newline.
Equivalent Python 2 would be 76 bytes (I think).


text:
How many arguments were passed?
Using your language of choice, write a function that takes a variable number of arguments and returns the number of arguments it was called with.
Specifics:

Your language needs to support variadic argument functions: something callable that takes an arbitrary number of arguments and returns a value.
Parameters must be able to be passed individually. This means that passing an array would only count for one parameter. You can use an "all passed arguments" array if your language supports it; the restriction is on how the function is called.
Code that calls this function must not be required to pass the number of arguments in its source. If a compiler inserts the number of arguments as part of a calling convention, that is allowed.
The arguments can be of any type you want. You can support only a single type (e.g. only supporting int is still valid), arbitrary types (any type of argument is allowed), or any combination of argument types (e.g. first arg is int, rest are strings).
Your function may have a maximum number of arguments (especially since resources are finite), but must support at least 2 arguments.

Samples:

f() returns 0
f(1) or f("a") returns 1
f([1, 2, 3]) returns 1 as it is passed an array, not 3 arguments
f(1, 10) or f(1, "a") returns 2

As this is code-golf, the winning solution is the one that uses the fewest number of bytes.

What if the language doesn't allow functions...

It's not entirely clear (objectively) what is a "function", "return value" or "variadic arguments". For example, would Dodos function be considered as monadic or variadic?

(I downvoted because the challenge requires unobservable requirements)

@user202729 If your language doesn't support functions, use another language. It's not a requirement that all languages can compete, part of code golfing is finding the right tool for the job.

I've already deleted my C and assembly answers, but I figured I'd ask anyway: do answers have to work for any number of arguments, or is it OK if there's an upper limit (in this case: 8).

"the arguments can be of any type; you do not need to support all types or arbitrary types of arguments" -- does that mean we can support a single type of our choosing?

@Sanchises Some language-specific restrictions are acceptable (being able to read /dev/urandom or time or access argv). I don't like this restriction which make use of the definition of "function" and "variadic" in a language.

@user202729 I have no problems with the occasional challenge aimed at traditional/high-level languages, just as we have the occasional challenge that is only possible in unusual languages.

@Sanchises But this requirement is not objective. ...

Does the number have to be printed, or can it be from stderr?

Solutions that (I think) under dispute: Haskell (that's not variadic argument, that's multiple curried), Dodos (count argv, while "technically" according to the language spec each function take a vector of numbers), Batch (also count argv), Brain-Flak (Brain-Flak doesn't have the concept of "function"), Japt (right in the answer there is "take all of the inputs as an array"), CJam (technically CJam doesn't have "input to function", just a global stack, the calling convention must be made up, according to the answer), APL (see Dennis' comment below the answer), maybe more but I don't know.

Either the challenge is unclear (in defining what's a function and what's variadic) or too many people misunderstand the specification.

Is "something callable that takes an arbitrary number of arguments and returns a value" specific enough? If a language does not have the concept of a function, then it cannot support variadic functions.

The problem isn't that it's not specific, the problem is that whether a calling convention counts as taking several arguments individually or not, is for many languages a property of a description of the language, or of internal details of how it is implemented, not of the visible behavior of the language itself.

@user202729 The fact that the Haskell function uses currying shouldn't be an issue.

@GlennSmith I suggest asking about this question in meta. This question is not doomed to be closed and people there might say what they think would make the question more clear.

@user9549915 ... ØrjanJohansen is correct. | Functions can take multiple arguments as an array of arguments too (yes, why not?)...

didn't know we had to solve the halting problem for language characteristics to have a clear challenge....

Elaborated on calling conventions (as long as you don't have to pass the length in source it's valid) and maximum number of arguments (>= 2)

How is "passing an array" different from "passing multiple arguments"? What if our language doesn't have a calling convention (Assembly, CJam) and you have to make up one? You need extra clarification about that.

If your language doesn't have the concept of arguments / calling convention then it doesn't fit the criteria of supporting arbitrary numbers of arguments.

Amstrad CPC Z80 binary call from BASIC, 1 byte, hex encoded
C9          : RET

(Also 2 and 5 byte versions, see below)
Upon entry to the call, the number of parameters passed will be in the A register. The code simply returns immediately. There is no concept of return values in the Z80, just entry and exit states. The value is just "there" accessible in the register since the code changes no input conditions, except for PC (the program counter) and SP (the stack pointer). However, the value in A is not accessible to BASIC and gets overwritten almost immediately.
Examples:
CALL &8000, "Hello", "World"

A = 2
CALL &8000, 42

A = 1
CALL &8000

A = 0

By request, here is some code that makes the value accessible in BASIC. I was very surprised to find it could be done in only 5 bytes!:
The machine code:
12          : LD   (DE), A
13          : INC  DE
AF          : XOR  A
12          : LD   (DE), A
C9          : RET

On entry:

AF - the accumulator and flags registers (treated as two 8-bit registers)

A contains the number of parameters passed, up to the maximum of 32 parameters
I'm not sure what's in F. It appears to have all flags RESET to 0, except the two undefined flags which are both 1. The Z flag (zero) is SET to 1 if there were no parameters passed in

BC

B - 32 minus the number of parameters (A + B = 32)
C - &FF

DE - The address of the last parameter, or the calling address if no parameters were passed in
HL - The address of the first byte after the tokenised BASIC command currently being executed (either as a program or in immediate command mode)
IX - The stack address of the pointer to the last parameter
IY - &0000

The code

LoaDs the address pointed to by DE with the value in A
INCrements DE
XORs A (with A), giving &00
LoaDs the value in A to the address pointed to by DE
RETurns

On exit:

A is destroyed (it's always &00)
DE is destroyed (it's always one higher than on entry)
All other registers are preserved

The BASIC
Amstrad basic has only three data types, plus simple arrays. By default, all BASIC variables are REAL (signed, 32 bit mantissa, 8 bit exponent), which can be made explicit with !. For an INTEGER (signed, 16 bit) use % and for a STRING (1 byte string length, up to 255 bytes character data, binary safe) use $:

x - REAL (implicit)
x! - REAL (explicit)
x% - INTEGER
x$ - STRING

You can also use DEFINT, DEFREAL and DEFSTR with a single letter, or a range of two single letters to specify the default type for all variables starting with that letter, similar to FORTRAN.

DEFSTR a
DEFINT x-z

Now:

a - STRING (implicit)
i - REAL (implicit)
x - INTEGER (implicit)
x$ - STRING (explicit)

The easiest type to work with is the integer. The machine code expects the last parameter to passed by address, not value, which is why @ is prefixed to the variable. The return variable is counted as one of the CALLs parameters.
The machine code is called as follows from BASIC (assuming it's loaded at into memory at address &8000):
CALL &8000, "Hello", "World", 42, @n%

n% = 4
This will always give the correct result, regardless of the initial value of n%.
For a 2-byte version that preserves all input registers:
CALL &8003, "Hello", "World", 42, @n%

n% = 4
This skips the first three bytes, and only gives the correct result if the initial value of n% is 0-255. This works because the Z80 is little-endian.
The return parameter must be initialised before being passed, otherwise BASIC will throw an Improper argument error. In the below image, I am printing (with the shortcut ? since I've golfed the demonstration too!) the return values immediately before and after the call to show the value changing. I'm using the value &FFFF because that is the binary representation of -1 for a signed integer. This demonstrates that the 5-byte program correctly writes both bytes, whereas the 2-byte program only writes the low byte and assumes that the high byte is already &00.

So how does the calling convention you're using return values?  If it doesn't return them in the accumulator, or at all, then your answer is basically inventing a custom calling convention that solves the problem for you (by adding a return register, instead of passing a pointer where you can store A, if that's how you might actually do it from BASIC).  Not that there's anything wrong with that, but it might be a more interesting answer to follow an existing calliing convention.

@PeterCordes Neither Amstrad BASIC nor the Z80 have the concept of scopes. All values are global and are immediately accessible until destroyed. The value of A is the same immediately after the RET instruction. The lifespan of a value in A is very short since it's the accumulator. There's no such thing as x = CALL &8000, 42. It would have to be CALL &8000, x, 42, and extra Z80 code, but then x would be 2, not 1.

I think it's fine if you include the output arg in the count, otherwise there's a 1-byte decrement instruction isn't there?  I'd be interested to see a version that was actually usable from BASIC instead of being trivial.

@PeterCordes Done! Oh, by the way, I forgot to mention not to call it with no parameters as it will overwrite its own first two instructions with &00s - NOP no-ops. Another byte can be added to make it safer, but of course without a return parameter it can't set anything.

Java (JDK 10), 11 bytes
a->a.length

Try it online!

Java beating Javscript is rare enouth to be noticed

@Therandomguy this requires something like interface x{void f(Object...a);} to be defined, and this lambda must be either stored in a variable of that interface type, or be passed to a method expecting that interface type, so I'm not really sure it counts for this challenge (even though usually java lambdas are allowed in codegolf challenges)

@SamYonnou There is no difference with other lambdas, and as you mentioned, lambdas are fine.

@OlivierGrégoire I know that lambdas are allowed, my point was that compared to JavaScript for example, you need a lot more extra code to set it up, even if you are using something like REPL and avoid the need for a main class/method (the need for the interface to be defined is what distinguishes it from JavaScript)

@OlivierGrégoire: I know some Java but haven't kept up with it at all.  I was interested to see Sam's comment on what boilerplate is getting swept under the rug in a Java answer that lets it actually be really short.  I agree it should be allowed (even though it does give you something that you don't normally get with Java functions, right, so it's not just boilerplate reduction it's giving you arg-counting built-in).  Besides that, it's still interesting as a reply to "Java beating JS".

@PeterCordes That's why the "Try it online" link in my answer exists ;-)

JavaScript, 15 bytes
[].push.bind(0)

The Array.prototype.push function takes any number of arguments, adds them to its array, and returns the size of the array. Therefore, the push function used on an empty array returns the number of arguments supplied to push.
f = [].push.bind(0)

f(10,2,65,7)
> 4

f()
> 0

The .bind(0) simply gives the push function a fixed this value so that it can be stored in a variable. In fact, the 7-byte identifier [].push can be used literally (but not assigned) without bind:
[].push(10,2,65,7)
> 4

[].push()
> 0

JavaScript (ES6), 16 bytes
(...a)=>a.length

f=
(...a)=>a.length

console.log(f())
console.log(f(1))
console.log(f(1,2))
console.log(f(1,2,3))
console.log(f(1,2,3,4))

Haskell, 108 107 95 94 bytes
class T r where z::Int->r
instance T Int where z=id
instance T r=>T(a->r)where z n _=z$n+1
z 0

Try it online!
This was surprisingly hard to get working, but I had fun trying to find out how to implement something that's trivial in imperative languages.

Damn, you beat me to it. f is optional if you say z 0 is the function without the binding, so main = print $ ((z 0) pi 0 () [] :: Int) works.

And by that I mean that the types work when used as an anonymous function so you can indeed remove everything from the last two rows except z 0

Nice, thanks! Turns out I was doing something wrong when I was testing the anonymous function. Tried your example and it worked just fine.

I guess the ::Int should be counted in the byte count, since the type of the answer has to be declared sooner or later, like in main = print $ ((z 0 :: Double -> Integer -> () -> [a] -> (Int->Int->Int) -> IO () -> Int) pi 0 () [] (+) main). I also think that this works only during compile time so something like foldl(\a b->a b) (z 0) $ [1..5])::Int can't work. Either way, this is great stuff.

Very nice! Btw. you can remove a superfluous space between T(a->r) and where.

s/imperative/non-curry/

@Angs I've been going back and forth on the signature byte count. I feel like it should be included too, but on the other hand, it's +5 bytes per call rather than a constant amount, so assuming it's only used once seems arbitrary. It seemed more consistent to take the signature as a requirement for calling the function and exclude it from the byte count.

The version in your tio link has an extra space in the second instance, that is not in your answer nor necessary.

Python 3, 15 bytes
lambda*a:len(a)

Try it online!

Also, Python 2 :)

It's not at all surprising that this was the first answer. ;)

Zsh, 7 5 bytes
<<<$#

Try it online!

Though it should probably be wrapped: f(){ echo $#; }

@muru That looks fine as a full program to me.

Although, I see now that the OP only wants a function...

@Neil shell scripts act exactly like functions. OP doesn't clear on what a function is, I claim my submission is just a function saved to the disk.

Brain-Flak, 6 bytes
My first Brain-Flak solution worthy posting, I guess it's the right tool for this job:
([]<>)

Try it online!
Explanation
When executing a Brain-Flak program, initially the left stack contains all arguments. From there it's simply a matter of:
(      -- push the following..
 []    --   height of the stack (ie. # of arguments)
   <>  -- ..to the other stack  (toggles to the other stack)
)      --
       -- the right stack now contains the # of arguments which
       -- gets printed implicitly

Wolfram Language (Mathematica), 11 bytes
Tr[1^{##}]&

Try it online!
Suggested by JungHwan Min. Some restrictions (input must be rectangular) but we are not required to handle arbitrary input.
11 bytes
Length@!##&

Try it online!
Another 11 byte solution suggested by Martin Ender. This seems to error when there isn't one input but it still returns the correct value in all cases.
12 bytes
Length@{##}&

Try it online!
My original solution.
In Mathematica ## stands for a variadic number of arguments in a function. { and } wraps them in a list and Length@ takes the length of this list. & at the end turns this into an actual function.

C++14 (gcc), 34 bytes
As generic variadic lambda function (C++14 required):
[](auto...p){return sizeof...(p);}

Try it online!
Previous (incorrect) answer: 32 bytes
It was missing the template<class...T> and (p)
int f(T...p){return sizeof...p;}

C++14, C++11 has no generic lambdas.

You could add the permissive flag to be able to remove the parenthesis around p (and -w to turn off the warning).

@nwp: wouldn't -fpermissive cost you the 12 bytes for that option, though?  If it's not standard ISO C++ or GNU C++.

@PeterCordes It probably does and is intended to avoid having a trivial 0-byte solution for everything by passing the program via command line. I just didn't think about that here because it seems to not be abusive.

@Quentin fixed -> C++14

R, 30 bytes
function(...)length(list(...))

Try it online!

function(...)nargs() is 20 bytes, but using length(...) was my initial approach until I googled a nargs-like function.

@Giuseppe hmm, I tried converting the list(...) to a logical so sum() could be used, but that's tricky :/

sum(!!c(...)) also fails on the empty test case

and sum(1|c(...)) doesn't cope well with characters

I've commented to see if taking a single data type is allowed, to try and get sum(1|c(...)) to work.

@Giuseppe I doubt it tbh, it'd kinda be against the spirit of the challenge

But this counts the total number of elements of arrays passed in, not the number of arrays. I don't know if it's possible using combine in place of list here.

@RoryT hmmmm, you're right. I'm reverting it to list

Also, I think c stands for concatenate :)

Haha, don't try and bait me into that argument ;)

@RoryT oh actually, R docs say combine. Nevermind :D

...length() does the same thing as length(list(...))

@Giuseppe just curious to know why no one ever answered with nargs as you suggest? Seems like the natural answer.

@JayCe eh, JAD has really only been semi-active on PPCG for the last few months, so I am not particularly surprised. You're more than welcome to post it yourself.

@Giuseppe ty just did that.

Bash, 12 bytes (thanks to paxdiablo for saving 4)
n()(echo $#)

Copy and paste at a bash prompt. Then run the n function from the prompt:
$ n
0
$ n 46 gr 3443 dad
4
$ n 4fwj23 wrw jdwj 00998 34 eyt q3 vg wq j qw
11

Welcome to PPCG!

can you just say it is a script "./n" and not a function? then it is just:  echo $#, 7 bytes. (will be then any shell you use to launch the "./n" script with.  ie, you run bash? then when you:  ./n arg1 ... argn it will be interpreted by bash.)

@Olivier Dulac The challenge clearly says a function.

Octave, 9 bytes
@()nargin

Try it online!
Anonymous function taking any number of arguments (and silently discarding the lot), and outputs the number of arguments through the built-in nargin. This does not work in MATLAB, where you would need varargin to allow for arbitrary many arguments.

Ruby, 12 bytes
->*a{a.size}

Try it online!
*a is a splat of the arguments, making a consume all arguments passed to the Proc. a.size obtains its size.

Perl 6, 5 bytes
Thanks @Joshua for -5 bytes
{+@_}

Try it online!

You could just do {+@_}

@Joshua >_> true, thanks

You can remove the sub in Perl 6 (not in Perl 5, though).

@nwellnhof Oh, TIL. Perl 6 is so different from Perl 5 >_>

Perl 5, 9 bytes
sub{~~@_}

Try it online!

A quick sitewide search of answers seems to indicate that you can leave out the sub

Protip: TIO let's you copy in PPCG post format (ESC, S, G)

@ASCII-only Oh nice, thanks! :) As for leaving out the sub, I don't think so. It's not a function without it.

@ASCII-only I'd consider answers without sub invalid since the result isn't something you can call or assign to a variable

Dodos, 32 31 bytes
f
	dot i f dab
i

	dip dot dab

Try it online!
Uses Dennis' increment function.
Explanation
f                     # definition of f - target function
        dot i f dab   # sum of j(f(all args but first)). recurses until it has 0 args
i                     # definition of i - returns (arg, 1) given 1 arg
                      # arg
        dip dot dab   # 1 (dot dab on list of length 1 returns 0, dip returns |0 - 1|)

Alternatively, 32 bytes without recursion in target function (thanks @Leo)
	dot i
i
	dip dot dab dot
	i dab
Try it online!
Explanation
        dot i             # anonymous function: sum of i(args)
                          # here this becomes implicit main
i                         # definition of i - returns a list with all arguments replaced with 1
        dip dot dab dot   # 1 (dab dot returns empty list, dot returns 0, dip returns |0 - 1|
        i dab             # list concatenated with i(all args but first)

Here's another same-length solution Try it online!
I can't seem to understand why yours works though, could you add an explanation please?

Hey, you added an explanation to my solution! I wanted one for yours, I know how mine works xD

@Leo sorry for late reply, idek what I'm doing, just copied Dennis' function, will try to understand asap. I had no idea how dodos works so I figured out what yours did first

No worries, it was just a funny situation :)

@Leo ok so does my explanation make sense? (note: I'm on mobile so feel free to edit it to make it better lol)

Yes it does, thank you!

Is it a typo that i defines j?

@NoOneIsHere Oops, fixed, thanks

C++, 72 bytes
int f(){return 0;}template<class...P>int f(int,P...p){return f(p...)+1;}

Saves bytes by only working with ints.

You can use sizeof....

PHP, 34 bytes
function(...$a){return count($a);}

Nice one! The alternative, for PHP 5.6 and older, is function(){return func_num_args();} (35 bytes, posted below).

@IsmaelMiguel This one also works in PHP 5.6.

You should mention this works only in PHP 5.6 and newer.

@axiac You're right, my bad. Was thinking about PHP5.5

C# .NET, 11 bytes
a=>a.Length

Try it online.
Explanation:
In C# .NET object is used for multi-type arguments, allowing one to pass integers, strings, characters, etc. as possible inputs. For example:
// Can be called like: `F(2)`, `F("test")`, `F('a')`, etc.
void F(object arg){ ... }

C# .NET can also have a fixed size of optional arguments. For example:
// Can be called like: `F()`, `F(2)`, `F("test")`, `F('a')`, etc.
void F(object arg = null){ ... }

And there are also varargs, which is an undefined amount of optional arguments (which is what I've used in this answer). For example:
// Can be called like: `F()`, `F(2)`, `F(2, "test", 'a')`, etc.
void F(params object[] args){ ... }

Usually lambdas are created like this:
System.Func<object[], int> F f = a=>a.Length;
// A call like `f(new object[]{2, "test", 'a'))` will return 3 (size of the input array)

But unfortunately System.Func doesn't support params varargs, so I'll have to create a delegate instead:
delegate int F(params object[] args);
F f = a=>a.Length;
// A call like `f()` will return 0, and `f(2, "test", 'a')` will return 3

Which is my answer for this challenge, and can be found in the linked TIO test code.

The only limitation is that inputting an actual object[] like f(new object[]{1,2,3}) will result in 3 instead of 1. f(new int[]{1,2,3}) will still result in 1, because it interprets the int[] as a single object. To have the object[] parameter be interpret as a single object as well it can be casted to an object like this: f((object)new object[]{1,2,3}).

I have to say, if there were ever an answer that made me support including lambda-related boilerplate in C# answers it would be this one... but it is definitely a valid solution.

@KamilDrakari Maybe it indeed wasn't very clear what I did without opening the TIO-link, so I've added an explanation.

Fails when passed a single array as argument.  Ie. f(new object[]{1, 2, 3})

@Taemyr I tried finding a solution, but unfortunately there is none for C# .NET, except for casting any object[] parameters to object, like this: f((object)new object[]{1,2,3});. There is no way to differentiate between f(new object[]{1,2,3}); and f(1,2,3); as far as I could find.

this handles array parameters correctly for a huge penalty of bytes. There might be a more concise structure that can handle it, but it works in my testing.

@KamilDrakari Hmm, but it fails for f(1, new object[]{1,2,3}) again though. Not sure if a solution for this behavior can be found.

Well... I don't know if this was missed or has simply been changed, but reading the Challenge again it appears that both "Supporting only up to a maximum number of inputs" and "Supporting only specific data types" are allowed, so the solution is valid as-is with the simple note "supports data types other than object[]", though some other use of those allowances could save characters.

There may be some benefits to using the dynamic type over object =>  delegate int F(params dynamic[] a);. This saves you from having to type cast the args.

Rust, 57 bytes
macro_rules!f{()=>{0};($($x:expr),+)=>{[$($x),+].len()};}

Explanation:
macro_rules! f {         // define a macro called f
    () => {0};           // when called without arguments, expand to 0
    ($($x:expr),+) => {  // when called with 1 or more comma seperated arguments
        [                // rust uses [a, b, c] to make an array
            $($x),+      // expand to the arguments seperated with a comma
        ]
        .len()           // take the length of that.
    };
}

Test:
fn main() {
    println!("{:?}", f!());                // prints 0
    println!("{:?}", f!(4));               // prints 1
    println!("{:?}", f!(5, 2));            // prints 2
    // works with anything, as long as you dont mix things
    println!("{}", f!("", "a", "hello"));  // prints 3
}

R, 20 bytes
function(...)nargs()

Try it online!
R has a function just for that.

PHP, 35 bytes
function(){return func_num_args();}

manual entry

Common Lisp, 28 bytes
(defun f(&rest a)(length a))

Try it online!

Add++, 3 bytes
L,L

Try it online!

Batch, 50 49 bytes
set n=0
for %%a in (%*)do set/an+=1
exit/b%n%

No builtin in Batch, so we have to go old-school. Saved 1 byte thanks to @IsmaelMiguel. Outputs via exit code, or save 3 bytes if output via global variable is valid. Example of use in a full program:
@echo off
call:c %*
echo %ERRORLEVEL%
exit/b
:c
set n=0
for %%a in (%*)do set/an+=1
exit/b%n%

I believe that this answer is answer goes (somewhat) against the rules. Batch has something somewhat close to functions. You can do something similar to :a|set r=0&for %%a in (%*)do set/ar+=1 (| = windows-style newline). This solution is 38 bytes. To execute it, do call :a <args> with a goto :eof before the function, being the value available inside the variable r. If you want to keep your solution, remove the /a on the first set, and remove those @.

@IsmaelMiguel Like this? (Note: I didn't include the function name in the byte count, but I did include the function return, which seems reasonable, as there needs to be one somewhere.)

Yes, that's exactly it. Nice catch with the exit code! I was surprised to see that exitcodes can be larger than 255. An example is the list provided by Symantec: https://www.symantec.com/connect/articles/windows-system-error-codes-exit-codes-description

PHP, 11 bytes
<?=$argc-1;

Try it online: 1 input | 3 inputs

I'm not so sure about this one (and it's validity) since it is the count of arguments passed to call PHP.

@IsmaelMiguel, see this consensus.

The question explicitly requires a function that returns the number, does not display it: "...write a function that takes a variable number of arguments and returns the number of arguments."

Re-quoting the question: "Using your language of choice, write a function that takes a variable number of arguments and returns the number of arguments it was called with.". Your code doesn't contain functions.

@IsmaelMiguel, if that were indeed the case then many other solutions would also be invalidated. The norm is to allow solutions to be programmes or functions.

I believe that all (or, at least, most of) the programming languages that do that do not have a very specific concept of a function. Batch, for example, has something that looks and (somewhat) works like a function. But is just a label pointing to some code. And in that case, I've already left my comment there.

Go, 44 30 28 bytes
-2 bytes thanks to  BMO
My first code golf attempt.
func(a...int){print(len(a))}

Try it online (outputs to Debug-window instead of STDOUT).

Welcome to the site! I've edited your post to match the general answer format we use here. Is it possible for you to edit in a link to somewhere where others can test your code, such as Try It Online!

added a link to a modified workign example, sadly go only runs main packages

Welcome to PPCG! I noticed you had your TIO-link in your header. So I've put it below it, and fixed the header-link. Enjoy your stay!

PowerShell 3, 25 bytes
function a(){$args.Count}

Usage:
a 1 2 ...

Console output for "a 1 2 3"
PS: C:\> a 1 2 3
3

Pretty self explanatory. Powershell stores all unspecified args in the $args list, so we just grab a count of it. Since the language implicitly writes values to the console, the act of finding the count will print to the console without needing a Write-Host or Write-Output.
Edit: Mistyped; should have been 25 bytes (typed 35).

You can use filter instead of function. Or just raw scriptblock:  .{$args.Count} 1 2 3 4 5

Good idea. I chose "function" to fulfill the challenge text:
Using your language of choice, write a function that takes a variable number of arguments...
I guess it depends on how loose the definition of "function" is in this case.

x86 32-bit (i386) machine code function, 13 bytes
Calling convention: i386 System V (stack args), with a NULL pointer as a sentinel / terminator for the end-of-arg-list.  (Clobbers EDI, otherwise complies with SysV).
C (and asm) don't pass type info to variadic functions, so the OP's description of passing integers or arrays with no explicit type info could only be implemented in a convention that passed some kind of struct / class object (or pointers to such), not bare integers on the stack.  So I decided to assume that all the args were non-NULL pointers, and the caller passes a NULL terminator.
A NULL-terminated pointer list of args is actually used in C for functions like POSIX execl(3):   int execl(const char *path, const char *arg, ... /* (char  *) NULL */);
C doesn't allow int foo(...); prototypes with no fixed arg, but int foo(); means the same thing: args unspecified.  (Unlike in C++ where it means int foo(void)).  In any case, this is an asm answer.  Coaxing a C compiler to call this function directly is interesting but not required.
nasm -felf32 -l/dev/stdout arg-count.asm with some comment lines removed.
24                       global argcount_pointer_loop
25                       argcount_pointer_loop:
26                               .entry:
28 00000000 31C0             xor   eax, eax  ; search pattern = NULL
29 00000002 99               cdq             ; counter = 0
30 00000003 89E7             mov   edi, esp
31                       ;    scasd           ; edi+=4; skip retaddr
32                       .scan_args:
33 00000005 42               inc   edx
34 00000006 AF               scasd            ; cmp eax,[edi] / edi+=4
35 00000007 75FC             jne  .scan_args
36                       ;    dec   edx       ; correct for overshoot: don't count terminator
37                       ;    xchg  eax,edx
38 00000009 8D42FE           lea   eax, [edx-2]    ; terminator + ret addr
40 0000000C C3               ret

size = 0D               db $ - .entry

The question shows that the function must be able to return 0, and I decided to follow that requirement by not including the terminating NULL pointer in the arg count.  This does cost 1 byte, though.  (For the 12-byte version, remove the LEA and uncomment the scasd outside the loop and the xchg, but not the dec edx.  I used LEA because it costs the same as those other three instructions put together, but is more efficient, so the function is fewer uops.)
C caller for testing:
Built with:
nasm -felf32 -l /dev/stdout arg-count.asm | cut -b -28,$((28+12))- &&
 gcc -Wall -O3 -g -std=gnu11 -m32 -fcall-used-edi arg-count.c arg-count.o -o ac &&
 ./ac

-fcall-used-edi is required even at -O0 to tell gcc to assume that functions clobber edi without saving/restoring it, because I used so many calls in one C statement (the printf call) that even -O0 was using EDI.  It appears to be safe for gcc's main to clobber EDI from its own caller (in CRT code), on Linux with glibc, but otherwise it's totally bogus to mix/match code compiled with different -fcall-used-reg.  There's no __attribute__ version of it to let us declare the asm functions with custom calling conventions different from the usual.
#include <stdio.h>

int argcount_rep_scas();       // not (...): ISO C requires at least one fixed arg
int argcount_pointer_loop();   // if you declare args at all
int argcount_loopne();

#define TEST(...) printf("count=%d = %d = %d   (scasd/jne) | (rep scas) | (scas/loopne)\n", \
        argcount_pointer_loop(__VA_ARGS__), argcount_rep_scas(__VA_ARGS__), \
        argcount_loopne(__VA_ARGS__))

int main(void) {
    TEST("abc", 0);
    TEST(1, 1, 1, 1, 1, 1, 1, 0);
    TEST(0);
}

Two other versions also came in at 13 bytes: this one based on loopne returns a value that's too high by 1.
45                       global argcount_loopne
46                       argcount_loopne:
47                           .entry:
49 00000010 31C0             xor   eax, eax  ; search pattern = NULL
50 00000012 31C9             xor   ecx, ecx  ; counter = 0
51 00000014 89E7             mov   edi, esp
52 00000016 AF               scasd           ; edi+=4; skip retaddr
53                       .scan_args:
54 00000017 AF               scasd
55 00000018 E0FD             loopne  .scan_args
56 0000001A 29C8             sub   eax, ecx
58 0000001C C3               ret

size = 0D = 13 bytes               db $ - .entry

This version uses rep scasd instead of a loop, but takes the arg count modulo 256.  (Or capped at 256 if the upper bytes of ecx are 0 on entry!)
63                       ; return int8_t maybe?
64                       global argcount_rep_scas
65                       argcount_rep_scas:
66                               .entry:
67 00000020 31C0             xor   eax, eax
68                           ;    lea   ecx, [eax-1]
69 00000022 B1FF             mov   cl, -1
70 00000024 89E7             mov   edi, esp
71                       ;    scasd              ; skip retaddr
72 00000026 F2AF             repne scasd        ; ecx = -len - 2 (including retaddr)
73 00000028 B0FD             mov   al, -3
74 0000002A 28C8             sub   al, cl       ; eax = -3 +len + 2
75                       ;    dec   eax
76                       ;    dec   eax
77 0000002C C3               ret

size =  0D = 13 bytes         db $ - .entry

Amusingly, yet another version based on inc eax / pop edx / test edx,edx / jnz came in at 13 bytes.  It's a callee-pops convention, which is never used by C implementations for variadic functions.  (I popped the ret addr into ecx, and jmp ecx instead of ret.  (Or push/ret to not break the return-address predictor stack).

JavaScript, 35 bytes

f=
function(){return arguments.length}

console.log(f(2,5,4))

Cauliflower, 16 bytes
(\((@a))(len@a))

Try it online!

Pyth, 10 bytes
D[$*b$)Rlb

Try it online!
Pyth doesn't really support defining variadic functions, but it does allow embedding Python code directly into the source, and Python allows variadic functions. We can get away with just using two bytes of Python code: *b, which makes b a variadic argument, containing the list of arguments passed in. We redefine the function [, which the Pyth parser understands to be a variadic function, and then we simply return the length of b.
Note that this can be run on TIO but not the standard Pyth executor at http://pyth.herokuapp.com/, due to sandboxing limitations.

AutoHotkey, 33 bytes
f(p*){
n+=p.MaxIndex()
return n
}

The asterisk * defines the parameter p as a variadic parameter.
MaxIndex() returns the highest numeric index which, in this case, is the parameter count.
By starting with nothing and adding the MaxIndex, you get a 0 for empty calls.
Here's an example of it in a full program:
MsgBox % f()
MsgBox % f(1)
MsgBox % f([1, 2, 3])
MsgBox % f(1, 10)
MsgBox % f(1, "a")

Exit

f(p*){
n+=p.MaxIndex()
return n
}

The returns as shown in the message box are (in order) 0,1,1,2,2.

AutoHotkey, 8 bytes
If it is allowable to write an entire program that returns the number of parameters passed to it, the result is much shorter:
Send %0%

I don't know this language, but won't something like return p.MaxIndex() work?

@ØrjanJohansen Unfortunately, that would return an empty value when no parameters are passed instead of the desired value 0.

Hm. What about return 0+p.MaxIndex()?

@ØrjanJohansen Also an empty value. AHK is pretty finnicky about doing math (or any other functions) inside of another function. It's not a very good golfing language.

Röda, 15 bytes
main a...{[#a]}

Try it online!
a... indicates that the program takes in a variable number of arguments
[  ] prints the following

#a the length of variable a

x86-64 machine code, 5 bytes (program for Linux, exit status = ret value)
ia32 (i386) machine code, 4 bytes
This program does sys_exit(argc).
It works for the x86-64 System V ABI, where the stack on process entry has argc followed by argv[0], argv[1], ... NULL, envp[0], ..., NULL.  (Or the i386 SysV ABI, where the stack layout is the same, but in 4-byte elements).
nasm -felf64 -l /dev/stdout arg-count.asm listing output:
 1                                  global _start
 2                                  _start:
 3 00000000 5F                          pop rdi
 4 00000001 B03C                        mov al, 60     ; __NR_exit
 5 00000003 0F05                        syscall

Most registers (including rax) are zeroed by the kernel on entry to user-space.  To we can set rax=60 with just a mov al in a static executable where no dynamic linker code ran first.
Assemble + link into a static executable with
yasm -felf64 arg-count.asm && ld -o arg-count arg-count.o

   32-bit version: nasm -felf32 -l /dev/stdout arg-count.asm
 1                                  global _start
 2                                  _start:
 3 00000000 5B                          pop ebx
 4 00000001 40                          inc eax       ; __NR_exit = 1
 5 00000002 CD80                        int 0x80

yasm -felf32 arg-count32.asm &&
ld -melf_i386 -o arg-count32 arg-count32.o

32-bit __NR_exit is 1, so the constant only takes a 1-byte inc (the kernel still zeros registers).

Note that argc includes the first arg passed by the shell which by convention is the name of the executable, but doesn't have to be.  execve doesn't care if you exec a process with argv[0] being something other than the executable filename.  It's a real arg, and some programs actually use it to figure out how they were invoked (useful for multiple hardlinks to one executable with different behaviours, like busybox can be ls or mv depending on argv[0])
$ ./arg-count ; echo $?     # by convention, program name is passed as a first arg
1
$ ./arg-count a b c d; echo $?
5
$ ./arg-count {a..z} ; echo $?
27
$ ./arg-count $(seq 100); echo $?
101
$ ./empty-args ./arg-count ; echo $?     # runs with argc=0 / argv[0]=NULL
0

(empty-args is a wrapper program that calls execve(argv[1], {NULL}, {NULL}).  It is possible to "call" the program with an empty argument list, just not from bash directly.)
Note that the echo $? is just how you can see the exit status printed to the screen.  It's always returned to the shell by this program, whether you print it or not.  The submission is the program's machine code, not the way I run it from the shell.

Actually, 2 bytes
`

Try it online!
Note: this is a grave and a space

Japt, 2 bytes
Nl

I suspect the answer will be similar in many golfing languages, take all of the inputs as an array and return its length.
Try it online!

Beat me to it. If I haven't done so already: Welcome to Japt! :)

Kotlin, 26 bytes
Defines function a with a vararg parameter x: Any. Thus, the arguments passed can be anything but null.
fun a(vararg x:Any)=x.size

Try It Online!

Clojure, 11 bytes
#(count %&)

Try it online!

Lua, 11 bytes
print(#arg)

Try it online: 1 input | 3 inputs

Note that as of Lua 5.1, arg only refers to the parameters passed when evaluating the script and does not work when defining a function.

Julia 0.6, 16 bytes
f(x...)=endof(x)

Try it online!

Stax, 4 bytes
{L%}

Run and debug it at staxlang.xyz!
Simple. Listifies the entire stack and all input, and returns the resulting length. No thought went into this answer.
Works without the closing brace, but I think that that makes it an incomplete "function" (block).

I don't think I realized that it would be a legal program without the closing brace.  Interesting!

@recursive I was as surprised as you. Though interesting, this sadly seems useless at this point (as far as I can tell).

Yes, it doesn't seem useful for general golfing, which is probably why I didn't make it do anything in particular.  An unterminated block is necessarily at the end of the program, so there's nothing to do but execute it.  You could achieve the same result by "inlining" the contents of the block.  Maybe some day I could make it do something else.  Hm...

Vim, 10 bytes
:ec argc()

Where "an argument" is a filename for Vim to edit. Hopefully this counts.

Avail, 32 characters.
Method"f(«_‡,»)"is[t:tuple||t|];

Avail's a little different.  Any particular function has fixed arity, so the nearest approximation is a multi-method taking a polyadic argument (shown with spaces)...
Method "f(«_‡,»)" is [t : tuple | |t|];
Assert f(10,20,30) = 3;

The guillemets say expect multiple arguments (the underscore), separated by commas (the comma after the double-dagger).  The "f", "(", and ")" (and ",") are actual keywords of this method.  The guillemet mechanism is supported by the compiler, which assembles instructions at call sites (like the Assert statement on the second line) to assemble arguments into a tuple, mostly similar to Java.  However, Avail also supports multiple repeated arguments, nested repetitions, strong heterogeneously typed arguments, and a ton more.
In the general spirit of code golf,
Method "g(«x‡,»#)" is [w : whole number | w];
Assert g(x,x,x) = 3;

The # after the close-guillemet arranges to pass the number of repetitions of the preceding group, rather than the actual tuple.  However, it's pointless to throw away actual arguments, so they're forbidden in such a group.  Only constant tokens are allowed, namely "x" in this case, as reflected in the example assertion.

Welcome to PPCG! Since this is code golf, could you include the byte count of the code that is necessary to define f (ideally with unnecessary whitespace removed, if any of it is unnecessary). A link to an implementation and/or specification of Avail would be great too. :)

Updated.  Thanks for the tip!

There's a summary of the message pattern language (including the «p1‡,p2» format) in the quick start, and the |_| size method is documented in the stacks here.

05AB1E, 2 bytes
|g

Try it online.
Explanation:
|     # Take all new-line separated inputs as a single list
 g    # Take the length of this list

Pyth, 9 bytes
D[$*N$)lN

Try it online!
Variadic functions cannot be defined in pure Pyth, but using the raw Python override $$, it's easy. This translates to the Python program:
def list(*N):
    print(len(N))

Where [ is the function defined.

Spice, 23 bytes
;a;return@LEN a return;

Un-golfed explanantion
Spice has no concept of functions - the closest would be a module which are called with the format:
LOD .\module.spice (^)input result
Where the result is set to the final value of the variable return in the module. The optional ^ character passes the input as the given value rather than flattening the array across all variables in the module. So in this case we can require ^ and:
;a;return@     - declare vars
LEN a return;  - Get length of our input, a, and store in result

Flurry, 2 bytes
[]

Run example
$ ./flurry -nin -c "[]" 4 7 2 5 3
5

The arguments are pushed to the stack before running the code, and [] nilad returns the stack height. Flurry can output via return value (ignoring the stack), so we don't need to do anything about the stack.

Vyxal, 7 bytes
@f:*|!;

Try it Online!
Note the last number before the input called is the no. of arguments.
shoutout to @lyxal for helping me!

Julia 1.0, 17 bytes
f(x...)=length(x)

Try it online!

Ruby, 12 bytes
Nothing exciting here. The splat operator (*) gathers all of the arguments into an array.
->*a{a.size}

Attempt This Online!

Go, 31 bytes
func(a...any)int{return len(a)}

Attempt This Online!
Same length as this Go answer and 2 bytes longer than this Go answer.
Returns a value instead of printing.

tinylisp, 27 bytes
(load library
(q(A(length A

Try it online!
Explanation
(q (A (expr))) creates a variadic anonymous function that binds its arglist to A and evaluates (expr). Then we just use the length function from the library to return the length of A.

Non-library solution, 33 bytes:
(d F(q(A(i A(a(v(c(q F)(t A)))1)0

Try it online!
(d F                                )  ; Define F as
    (q(A                          ))   ; a variadic function:
        (i A                     )     ; If the arglist is not empty:
                       (t A)           ;  Tail of arglist
                (c(q F)     )          ;  Cons the symbol F to the front
              (v             )         ;  Evaluate (calling the function again)
            (a                1)       ;  Add 1 to the result
                                0      ; Otherwise, return 0

This approach evaluates some of the arguments multiple times and may generate lots of warning messages; however, I believe it always ultimately returns the correct answer.

Attache, 5 bytes
{#__}

Try it online!
This is an anonymous lambda. __ simply represents the arguments passed to it, and # calculates the length.

Scheme, 16 bytes
(λ a(length a))

Or defining a named function (25 bytes):
(define(f . a)(length a))

Yabasic, 17 bytes
An anonymous yabasic function that takes input as discrete arguments and outputs to the console.
?peek("argument")

Try it online!

Brainfuck, 27
>>,[>,]<[[-]<[<]<+>>[>]<].

Try it online!
"arguments" are single characters. output is in ASCII (eg 32 args outputs a space). In order to see output normally, add this thing that I stole from esolang wiki (204 bytes)
>>++++++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->++++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<[-<+>]<

Explanation
>> padding
,[>,] input all
<[ for each
  [-] delete
  <[<]< go back to beginning
  + add one
  >>[>] go to the end
<] go back
<. print

Lua, 30 bytes
function f(...)return#{...}end

Try it online!
Explanation: ... is used to pass variadic arguments, {...} creates a new table and expands the argument list into that table, and # is the length operator (for arrays, returns number of elements).

C macro (gcc), 61

3 bytes saved thanks to @ceilingcat.

I think the only way to do this in c is with a preprocessor macro:
#define f(a...) ({char*s=#a,i=!!*s;for(;*s;)*s++-44||i++;i;})

Any symbols and literal integers may be passed.  But passing literal strings containing commas will certainly mess this up.
This can probably be golfed more, but for now its a proof-of-concept.
The arg counter is declared as a char, and is thusly size-limited.
Try it online!

You can remove the space between f(a...) and ({char*s

Funky, 10 bytes
(...a)=>#a

Funky does this pretty well. I first tried @#arguments, however, arguments is never actually used by @ functions, and even if, that turned out larger...
Try it online!

Clojure, 11 bytes
#(count %&)

Try it online!

CJam, 4 bytes
{],}

This defines a code block (CJam's analogous construct to a function) that takes all the stack contents as inputs.
Try it online!
Explanation
{  }    e# Define block
 ]      e# Concatenate all stack into a list
  ,     e# Length

Go, 31 bytes
func a(b ...int){print(len(b))}

Only works with integers to save space.
Try it here

Tcl, 27 bytes
proc F args {llength $args}

Try it online!

SimpleTemplate, 23 bytes
In this language, all functions have some special variables.
Luckly, one of them is argc, which contains the number of arguments passed to the program or function.
{@fna}{@returnargc}{@/}

This could be written as {@fna}{@returnargc} if it was the last thing in the file.
Alternativelly, running {@returnargc} by itself gives you back the number of arguments passed to the program itself.

Ungolfed:
{@fn a}
    {@return argc}
{@/}

All whitespace present here is optional.

Example: count the arguments passed to the function
{@fna}{@returnargc}{@/}

{@call a into b 1, 2, 3, 4, 5, 6}

{@echo b}

How to run:

Get the code from https://github.com/ismael-miguel/SimpleTemplate
Run the following code:
<?php
    include 'SimpleTemplate.php';

    $template = new SimpleTemplate('<code>');

    $template->render();

Done!

(Shamelessly lifted from Print a word clock and adapted for this challenge)

Jstx, 3 bytes
s£O

Try it online!

Swift, 37 bytes
func r(s:Any...)->Int{return s.count}

Try it online!

As of Swift 5.1, you can remove the word return for -7.

Visual Basic .NET (.NET Core), 54 49 bytes
Unfortunately, lambda expressions do not allow ParamArray in VB.net.
Function F(ParamArray a())
F=a.Count:End Function

Try it online!

49?

@ASCII-only Oh, I forgot that's how values used to be returned in old VB syntax. That should work.

C#, 32 bytes
int X(params int[] y)=>y.Length;

Expression-bodied method with the params keyword.

Python 2,22 21 15 bytes
lambda*a:len(a)

EDIT: -1 byte by removing space between "lambda" and "*a"
Edit 2: -6 thanks to @ppperry

I believe you can save a few bytes by removing the "print"

REXX, 12 bytes
return arg()

arg without arguments returns the number of arguments.

Wolfram Language (Mathematica), 9 bytes
Length@*f

Try it online!
Composition of the Length function, which returns the number of arguments of an expression, and the undefined function f.

W, 1 byte
If I'm understanding it correctly:
k

Why does this work?
Assume that the program is a function (the program is technically a function). In this case, you pass arguments into the function in a list like this:
[[item1,item2,item3]]

Because the main list only supports at most 4 items, we put the arguments in a sub-list of that list (just an optimization, no effect for the source code).
Also, the program technically reads that list of arguments:
ak

Then it finds the length of a list of its arguments.

K (ngn/k), 2 bytes
#:

Try it online!
This is a lame answer, honestly.

Fig, \$3\log_{256}(96)\approx\$ 2.469 bytes
L#X

Try it online!
L#X
L   # Length
 #X # Of the argument list

J-uby, 7 bytes
:>>&:+@

Attempt This Online!
The :>> operator gathers all of the arguments into an array; :+@ returns its length.

Pip, 2 bytes
#G

Attempt This Online!
Note that Pip's function-call syntax does not support calling a function with zero arguments, so instead I'm using the V operator (call function with given argument list) with an empty list for that test case.
Explanation
All functions in Pip are variadic. The list of arguments can be accessed through the local variable g.
 G  ; Variable preset to {g}, a function that returns its argument list
#   ; Length
    ; The result is a function that returns the length of its arglist

TypeScript's type system, 57 bytes
interface F{o:this extends{i:{}[]}?this["i"]["length"]:0}

Try it at the TS playground!
I'm not entirely sure if this is valid, because it's not exactly a "function" in the traditional sense, but it is very similar.
Normal TypeScript type submissions are defined with the type keyword, and take input via generic type parameters:
type Greet<T extends string> = `Hello, ${T}!`
type Something = Greet<"World">
//   ^? "Hello, World!"

These work as functions in most cases, but there are two main cases in which they don't suffice:

Higher order functions - you can't pass a generic type as an argument to another generic type.
Variadic arguments - usually this is handled by taking a list as the argument.

There is actually another way to define "functions" in TypeScript, though- one which solves both of these problems, albeit in an extremely hacky way:
interface Greet {
  o: this extends { i: [infer S extends string] } ? `Hello, ${S}!` : never
}

type Something = (Greet & { i: ["World"] })["o"]
//   ^? "Hello, World!"

Within the interface, it checks if its own type has a property i, and if it does, does something with that value, otherwise returning nothing.
What's very hacky about this is that when you take the intersection type of Greet and a record type which has a property i, Greet takes its own type to have that property.
I couldn't tell you why the TypeScript team decided to make this be the behavior, but it comes in very handy in cases like this.
Since this behavior is rarely used and almost certainly unintentional, there isn't a very common calling convention for these, but the most common one I've seen is taking either a tuple of ordered arguments from a property, or taking a record of named arguments from that property. I've opted to use the former for this submission, as it makes the problem very convenient and short.

RProgN 2, 2 bytes
)L

Same concept as many stack based answers; collects everything on the stack into a stack, and gets its length.
Try it online!

Submission has to be a function, this looks to be a program taking arguments on the command line?

@noodleman Full programs haven't been forbidden elsewhere. Either way, prepending ² to this (giving ²)L) makes a function with the exact same functionality.

I think other submissions to this challenge which aren't functions are invalid, per the spec "Using your language of choice, write a function that takes a variable number of arguments and returns the number of arguments it was called with."

@noodleman To argue against this solution is to invalidate numerous others (And disqualify languages without functions). The only way to confirm it, would be to invoke the challenge author directly. I think it's safe to assume this is a valid submission for now

Python, 3 bytes
len

Attempt This Online!
Using the new community default that multiple arguments to a function can be taken as a list instead.
Named function which accepts a list of variable length and returns its size.

IMHO default IO methods don't apply when the challenge explicitly specifies a IO method


text:
Craptastic Program Search
A certain well-known cable company has a somewhat clumsy 'Search for Program' feature that works through the remote. It takes muchly much button pushing; so, being an admirer of economy of motion, I thought I'd seek out a programmer's help to minimize the number of finger movements I have to make.
The Craptastic Search Feature features a layout of selectable cells, 1 row of 3 cells followed by 6 rows of 6 cells, that looks like this:
del spa sav
A B C D E F
G H I J K L
M N O P Q R
S T U V W X
Y Z 0 1 2 3
4 5 6 7 8 9

There are cells for each of the letters A-Z, and spa which is used to add a space to the search string. del is supposed to be used to delete a character; and sav is meant to be used to save the search string. We'll ignore these actual functions for this challenge; but the cells are otherwise still selectable for our purposes.
We start with an empty search string and the A cell selected; and we use left, right, up and down arrow buttons to change the selected cell. When the central 'OK' key is pushed, the character in the selected cell is added to the search string. For convenience, we'll use <,>,^,v and _ for left,right,up,down and OK, respectively.
For the letters and numbers, the action of the directional buttons is straightforward. There is no 'wrap-around'; for example, if the current cell is G, then < has no effect.
So to enter the search string BIG, we could use the sequence
>_>v_<<_
(the initial > is required to move us from the default starting cell A to the cell B). Alternatively, we could of course instead use >_v>_<<_; but note there is no shorter sequence than 8 keys that can do the job.
Now since the top row has only three cells, the action there is slightly different and complicates things a little:
First, if the selected cell is in the top letter row A-F, the ^ key moves the selected cell directly above; so A,B go to del, C,D go to spa and E,F go to sav.
One the other hand, if the selected cell is 'del', the v key moves the selected cell to A, and the > key makes the selected cell spa. Similarly v key moves the selected cell from spa to C, and sav to E.
This means that for example, if you are currently at the B cell, the sequence ^v does not return you to the B cell; instead it takes you to the A cell.
And starting at the A cell, the sequence v>>^moves us to the C cell; while the sequence ^>>v moves us to the the E cell.
The Challenge
Given a TV show or movie title s, consisting solely of characters in A-Z, 0-9 and space, your program/function should output one of the sequences of keypresses of minimal length to enter s as the search string from the starting state in Craptastic fashion.
Your output should be a string or a list of distinct values representing a sequence of up, down, right, left, and OK; so you are not restricted to the charset <>^v_ (e.g., udrl* or a list with integer elements 0,1,2,3,4 would be acceptable alternatives, so long as you articulate what your schema is).
This is code-golf; the usual loophole taboos apply. May the odds be ever in your favor for each language.
Test Cases
Below are inputs and an example acceptable answer (other different sequences will be correct as well, but must be of at most the length of the examples provided).
(I re-post the keypad here so one can more easily play along visually, if that is one's wont...)
del spa sav
A B C D E F
G H I J K L
M N O P Q R
S T U V W X
Y Z 0 1 2 3
4 5 6 7 8 9

BIG         >_>v_<<_
THE OFFICE  >vvv_^^_>>>^_^<_vvv_>>>^^__<<<v_^_>>_
FARGO       ^>>v>_^<<v_^>>v>vv_<<<<<^_>>v_
BUFFY       >_>vvv_>>>^^^__^<<vvvvv_
DALLAS      >>>_<<<_^>>v>v__^^<<v_vvv_
THX1138     >vvv_^^_>>>>vv_<<v__>>_<v_
ON DEMAND   >>vv_<_^^^>_v>_>_<<<<vv_^^_>vv_>>^^_
NEWS RADIO  >vv_>>>^^_vvv_<<<<_^^^^>_>vvv>_^^^<<v_>>>_<v_v_
ROOM 909    ^>>v>vv_<<<__<<_^^^>_>vvvvvv>_<<<^_>>>v_

Only FA doesn't go straight but up and down

Is del and sav useless here?

Closely related.

@l4m2: del and sav have no function if 'OK' is used when they are selected; but that would waste a keypress.

@l4m2 LA, RA, XA, 3A, 9A do the same

JavaScript (ES6), 196 bytes
Golfing this code below 200 bytes was basically a nightmare (but it was fun). I'm really looking forward a simpler and shorter implementation.
f=(s,p=(i=0,6),x=(p-=p&(p<6))%6,X=(P=(parseInt(c=s[i],36)+26)%36+6||2)%6)=>c?'^<>v_'[(d=p-P?p<6?x<(X&6)?40:X-1&&x^X&6?20:60:P<6+(x>4)|p==11&!X?0:x<X?39:x>X?21:p<P&&60:++i&&70)>>4]+f(s,p+d%16-6):''

Try it online!
How?
Variables

s is the input string
i is a pointer in s, initialized to 0
c is the next target character (aka s[ i ])
p is the current position on the keypad according to the following mapping and initialized to 6 (the "A" key)
del spa sav      00 -- 02 -- 04 --
A B C D E F      06 07 08 09 10 11
G H I J K L      12 13 14 15 16 17
M N O P Q R  ->  18 19 20 21 22 23
S T U V W X      24 25 26 27 28 29
Y Z 0 1 2 3      30 31 32 33 34 35
4 5 6 7 8 9      36 37 38 39 40 41

P is the position of the target character c
x is the column of the current character (p % 6)
X is the column of the target character (P % 6)

Move encoding
There are 7 possible moves. We encode each of them as a 7-bit integer. The 4 least significant bits hold the displacement value V + 6 and the 3 most significant bits hold the symbol ID S.
move                       | symbol | S |  V | V + 6 | S << 4 | (V + 6)
---------------------------+--------+---+----+-------+-----------------
one position to the left   |   <    | 1 | -1 |   5   |       21
two positions to the left  |   <    | 1 | -2 |   4   |       20
one position to the right  |   >    | 2 |  1 |   7   |       39
two positions to the right |   >    | 2 |  2 |   8   |       40
upwards                    |   ^    | 0 | -6 |   0   |        0
downwards                  |   v    | 3 |  6 |  12   |       60
don't move (press the key) |   _    | 4 |  0 |   6   |       70

Alignment with function keys
At the beginning of each iteration, we execute the following code to make sure that p is aligned with the current function key if we're located in the first row:
p -= p & (p < 6)

Move logic
The move is chosen with a (too) long chain of ternary operators which is detailed below.
p - P ?               // if we're not yet located over the target character:
  p < 6 ?             //   if we're currently located in the first row:
    x < (X & 6) ?     //     if x is less than the column of the function key holding the target character:
      40              //       move 2 positions to the right
    :                 //     else:
      X - 1 &&        //       if the target character is not located in the 2nd column
      x ^ X & 6 ?     //       and x is not equal to the column of the function key holding the target character:
        20            //         move two positions to the left
      :               //       else:
        60            //         move downwards
  :                   //   else:
    P < 6             //     if the target key is space (P is either greater than 5 or equal to 2)
          + (x > 4) | //     or the target key is A and we're currently in the rightmost column
    p == 11 & !X ?    //     or we're currently over F and the target key is in the leftmost column:
      0               //       move upwards
    :                 //     else, this is a standard move:
      x < X ?         //       if x is less than X:
        39            //         move one position to the right
      :               //       else:
        x > X ?       //         if x is greater than X:
          21          //           move one position to the left
        :             //         else:
          p < P && 60 //           move either upwards or downwards
:                     // else:
  ++i && 70           //   don't move and advance the pointer in s

Python 2, 294 293 289 bytes
r='';l=[(ord(c)-59)%43-14*(c<'0')for c in input()]
for a,b in zip([6]+l,l):x,y,X,Y=a%6,a/6,b%6,b/6;A=(a<6)*(X!=1);x=[x,X/2*2][A];r+='< >'[X/2]*A+('^'*y+['<<'+'v'*Y,'> <'[x/2]][b<6]if(b,x)in[(6,5),(2,x)]or(a,X)==(11,0)else('^v'[Y>y]*abs(y-Y)+'<>'[X>x]*abs(x-X)))+'_'
print r.replace(' ','')

Try it online!

JavaScript, 311 bytes

f=n=>(parseInt(n,36)+26)%36+1||'S'
g=n=>(t=+n)?[t-(t%6!=1),t%6?t+1:t,t>30?t:t+6,t<7?' DDSSVV'[t]:t-6]:{D:'DS1',S:'DV3',V:'SV5'}[n]||[]
h=(p,q,t={[p]:''})=>([...g(p)].map((n,i)=>n in t&&t[n].length<t[p].length+1||h(n,q,t,t[n]=t[p]+'<>v^'[i])),t[q])
F=s=>[...s].map(f).map((c,i,a)=>h(a[i-1]||1,c)+'_').join``
<input id=i oninput=o.value=F(i.value)><br><output id=o>

Not sure how to golf this...

f: convert 'A-Z0-9' to 1-36, space to "S"
g: get 4 sibling of given key
h: find shortest path from p to q
F: the answer