# Tell my friends to which "comma club" they belong

Inspired by Silicon Valley's "three-comma club" scenes, like this one, in this challenge you'll be telling ten people the "comma club" to which they each belong.

If you're unfamiliar with the term "comma club," let me explain: you're in the one-comma club if the money you have is in the inclusive range $1,000.00 to$999,999.99; you're in the two-comma club if it's in the range $1,000,000.00 to$999,999,999.99; these "clubs" repeat through the three-comma club, since no individual on Earth (AFAIK) owns more than one trillion U.S. dollars (Japanese Yen would be a different story very quickly). So, the number of commas your bank account has, according to the notation standards most common in the United States and Great Britain, denotes the comma club to which you belong. The same "comma" rules apply for negative numbers (although you wouldn't want to be in the negative comma club): negative amounts in the inclusive range [-0.01, -999.99] belong to the zero-comma club, amounts in the range [-1000.00, -999999.99] belong to the one-comma club, etc.

# The test cases

Friend    Amount
John      100000
Jamie     0.05
Kylie     1549001.10
Laura     999999999.99
Russ      986000000
Karla     1
Reid      99.99
Mark      999.99
Manson    1000.01
Lonnie    999999999999.00
Nelly     -123.45


John is in the 1-comma club.
Jamie is in the 0-comma club.
Kylie is in the 2-comma club.
Laura is in the 2-comma club.
Russ is in the 2-comma club.
Karla is in the 0-comma club.
Reid is in the 0-comma club.
Mark is in the 0-comma club.
Manson is in the 1-comma club.
Lonnie is in the 3-comma club.
Nelly is in the 0-comma club.


Whatever array setup you need to get a friends array and amounts array does not count towards your score. So for Python, the following code doesn't count:

f = ['John', 'Jamie', 'Kylie', 'Laura', 'Russ', 'Karla', 'Reid', 'Mark', 'Manson', 'Lonnie']
a = ['100000', '0.05', '1549001.10', '999999999.99', '986000000', '1', '99.99', '999.99', '1000.01', '999999999999.00']


### Edit: Please see the revised test cases

I removed the actual string commas from the test cases to make things a bit more difficult, as opposed to just counting commas.

• I don't think you've made the output format very clear. Is something like "Name number,Name number,..." acceptable? Mar 1, 2017 at 0:24
• Are the entries in f guaranteed to be positive, or would -$1,234.56 also be in the 1-comma club? Mar 1, 2017 at 0:25 • @not_a_robot Could you address Fry's comment? Is it sufficient to output pairs of name and number in any format? Mar 1, 2017 at 12:47 • @FryAmTheEggman No, the output needs to be in the format "<name> is in the <number of commas>-club." Mar 1, 2017 at 13:57 • Test cases are not spec. And even if they were, there's no test case covering the issue of large negatives raised by Jonathan Allan above. Mar 6, 2017 at 17:23 ## 28 Answers ## JavaScript (ES6), 80 bytes a=>a.map(([s,n])=>s+ is in the${n.toFixed(n<0?3:4).length/3-2|0}-comma club.)


Takes an array of [friend, amount] arrays and returns an array of "friend is in the n-comma club." strings. Works by adding extra trailing zeros so that the length is 6-8 for the 0-comma club, 9-11 for the 1-comma club, 12-15 for the 2-comma club etc.

https://jsfiddle.net/cau40vmk/1/

• I don't think this works for negative numbers. For instance, it would put Nelly (-123.45) in the 1-comma club. I'd suggest the shorter Math.log10(n*n)/6|0. Mar 1, 2017 at 5:41
• @Arnauld Ah yes, I'd forgotten |0 truncates to zero, so it gives the right answer for Jamie.
– Neil
Mar 1, 2017 at 9:56

# PostgreSQL, 61 bytes

SELECT f||' is in the '||div(log(@a),3)||'-comma club.'FROM p


@x is the absolute value of x, log(x) is base-10 logarithm and div(y, x) computes the integer quotient of y/x.

Setup:

CREATE TEMP TABLE p AS
SELECT * FROM (VALUES
('John', 100000),
('Jamie', 0.05),
('Kylie', 1549001.10),
('Laura', 999999999.99),
('Russ', 986000000),
('Karla', 1),
('Reid', 99.99),
('Mark', 999.99),
('Manson', 1000.01),
('Lonnie', 999999999999.00),
('Nelly', -123.45)
) AS p (f, a)


Output:

            ?column?
--------------------------------
John is in the 1-comma club.
Jamie is in the 0-comma club.
Kylie is in the 2-comma club.
Laura is in the 2-comma club.
Russ is in the 2-comma club.
Karla is in the 0-comma club.
Reid is in the 0-comma club.
Mark is in the 0-comma club.
Manson is in the 1-comma club.
Lonnie is in the 3-comma club.
Nelly is in the 0-comma club.
(11 rows)

• It's nice to see a competitive SQL answer - well done! Mar 1, 2017 at 17:55

# Jelly, 34 32  31 bytes

AḞbȷL’⁶;“£ṙƬs⁾¬ụṂ“¢<ỴȦ8£l»j)⁹żY


A dyadic link (function) which takes a list of bank balances as numbers (decimals / integers) and a list of names as strings and returns a list of strings.

Try it online! - the footer çYsimply calls the function and joins the resulting list with line feeds so it has nice output when run as a full program.

### How?

AḞbȷL’⁶;“£ṙƬs⁾¬ụṂ“¢<ỴȦ8£l»j)⁹ż - Main link: bankBalances, names
)   - for each bankBalance:
A                               -   absolute value (treat negatives and positives the same)
Ḟ                              -   floor (get rid of any pennies)
bȷ                            -   convert to base 1000
L                           -   length (number of digits in base 1000)
’                          -   decrement by one
⁶;                        -   concatenate a space with that   ...because -------.
“         “       »     -   compressed list of strings:                       ↓
£ṙƬs⁾¬ụṂ              -     " is in the"  ← cannot compress a trailing space :(
¢<ỴȦ8£l      -     "-comma club."
j    -   join that list of strings with the "number plus space"
⁹  - right argument (names)
ż - zip with L


# PHP, 76 74 bytes

// data as associative array
$d=[Poorman=>-1234,John=>100000,Jamie=>0.05,Kylie=>1549001.10,Laura=>999999999.99,Russ=>1000000000,Karla=>1,Reid=>99.99,Mark=>999.99,Manson=>1000.01,Lonnie=>999999999999.00]; // code foreach($d as$n=>$a)printf("$n is in the %d-comma club. ",log($a*$a,1e6));  Fortunately I don´t have to cast to int (as I would have to in C); PHP does that implicitly for %d. • Gee! Am I the first here to calculate instead of counting characters? Mar 1, 2017 at 1:52 # Mathematica (86 bytes) The set-up (with names as strings, money as numbers): n = {"John", "Jamie", "Kylie", "Laura", "Russ", "Karla", "Reid", "Mark", "Manson", "Lonnie", "Nelly"}; m = {100000, 0.05, 1549001.10, 999999999.99, 1000000000, 1, 99.99, 999.99, 1000.01, 999999999999.00, -123.45}  The attempt: MapThread[#~~" is in the "~~ToString@Max[Floor@Log[10^3,#2],0]~~"-comma club."&,{n,m}]  All of Mathematica's string functions include "String" in the name, so I think logs are shorter. The Max[...,0] is to deal with the pesky negative numbers or negative infinity for people who own between -1 and 1 dollars. The log of a negative number includes imaginary stuff, but Mathematica helpfully ignores that when taking a Floor! # Japt, 36 bytes This takes in the amount as the first input, name as the second. V+ e {w0 x4 l /3-2|0}-¬mµ club  ### Explanation V+ e {w0 x4 l /3-2|0}-¬mµ club V+ // Second input +  // compressed string: e // " is in the " { } // Insert here: w0 // The larger of 0 and the first input x4 // Rounded to the 4th decimal l // Length -¬mµ club // "-comma club" // A closing backtick is auto-inserted at the end of the program  Japt uses the shoco library for string compression. Inspired by @Neil's solution. Saved 7 bytes thanks to @ETHproductions Try it online! • I think you can just do Vw0 x4 l /3-2|0 in the middle section, saving 6 bytes :-) Mar 1, 2017 at 14:51 • I think you can save a byte by taking input in the opposite order: V+...{w0... Mar 1, 2017 at 15:01 # 05AB1E, 32 bytes Äï€g3/î<“-comma†Ú“«“€ˆ€†€€ “ì‚ø»  Try it online! Explanation Ä # absolute value of input ï # convert to int €g # length of each 3/ # divided by 3 î # round up < # decrement “-comma†Ú“« # append string "-comma club" to each number “€ˆ€†€€ “ì # prepend string "is in the " to each number ‚ # pair with second input ø # zip » # join by spaces and newlines  # R, 68 bytes The setup: f <- c('John', 'Jamie', 'Kylie', 'Laura', 'Russ', 'Karla', 'Reid', 'Mark', 'Manson', 'Lonnie', 'Nelly') a <- c(100000, 0.05, 1549001.10, 999999999.99, 986000000, 1, 99.99, 999.99, 1000.01, 999999999999.00, -123.45)  The solution: cat(paste0(f, " is in the ",floor(log10(abs(a))/3)),"-comma club.\n"))  Take the base 10 log of the absolute value of the account, round down then print with the names. I'm not sure if it could be smaller if a would be a character vector... • What about the case of Nelly, who has -123.45 dollars? That log10 call will produce NaNs for negatives. Looks like log10(abs(a)) would work. Mar 1, 2017 at 15:19 • Oops, you're right, the sample above didn't include Nelly. And I misread the specification... I understood negative value should be 0 comma club. – Joe Mar 1, 2017 at 15:36 • Instead of abs(x), use pmax(a,1) - this will take anything less than 1 and make it 1, giving good results for negative numbers. And, instead of floor(log10(...)/3) you can use log10(...)%/%3. I think that gets it down to 66 bytes (and correct for negatives). Mar 2, 2017 at 0:18 • Also worth noting that a full 7 bytes of that are the cat() and \n... printing the vector with the strings in it to the console might be considered good enough (*ahem* like the Python answers). Mar 2, 2017 at 0:26 • This has an extra parenthesis after 3. It also outputs the -1 club for Jamie. Using pmax(a,1) fixes that. – BLT Mar 2, 2017 at 4:53 ## JavaScript, 59 bytes Saved 3 bytes thanks to @ETHproductions Saved 2 bytes thanks to @Cyoce n=>m=>n+ is in the${m>1?Math.log10(m)/3|0:0}-comma club.


### Demo

f=n=>m=>n+ is in the ${m>1?Math.log10(m)/3|0:0}-comma club. console.log((f("John")(100000))) console.log((f("Jamie")(0.05))) console.log((f("Kylie")(1549001.10))) console.log((f("Laura")(999999999.99))) console.log((f("Russ")(986000000))) console.log((f("Karla")(1))) console.log((f("Reid")(99.99))) console.log((f("Mark")(999.99))) console.log((f("Manson")(1000.01))) console.log((f("Lonnie")(999999999999.00))) console.log((f("Nelly")(-123.45))) • Save a byte with ${} and you can curry the function to n=>m=>... instead of (n,m)=>... Mar 1, 2017 at 19:38

# MATL, 5048 43 bytes

j' is in the 'i|kVn3/XkqV'-comma club'&hDT


Try it at MATL Online

Explanation

                   % Do...While loop
j                 % Explicitly grab the next input as a string
' is in the the ' % Push this string literal to the stack
i                 % Grab the next input as a number
|                 % Compute the absolute value
k                 % Round towards zero
V                 % Convert to a string
n3/Xk             % Divide the length of the string by 3 and round up
q                 % Subtract one
V                 % Convert to a string
'-comma club'     % Push this string literal to the stack
&h                % Horizontally concatenate the entire stack
D                 % Display the resulting string
T                 % Push TRUE to the stack, causing an infinite loop which automatically
% terminates when we run out of inputs
% Implicit end of do...while loop


# Vim, 72 bytes

:%s;\v +\-=(\d+).*;\=' is in the '.(len(submatch(1))-1)/3.' comma club'


Somehow I should show that there's a trailing return, but unsure how. This is just a basic regex answer, that I'm sure could be beaten by any regex language. I would have used V, but I think that the substitute commands in V use / as a separator by default, and I couldn't figure out how to make it not complain about the divide.

Takes input as OP's table, and returns values as the table, but with the financial information replaced by " is in the X comma club"

Try it online!

• I don't think the \-= adds anything. Also, if you remove the extra spaces in your input, and change the regex too \v (\d*).*; you could save 4 bytes Mar 1, 2017 at 5:34

# Python 3 (207 159 110 95 86 bytes, thanks to @iwaseatenbyagrue)

A little bit of setup:

f = ['John', 'Jamie', 'Kylie', 'Laura', 'Russ', 'Karla', 'Reid', 'Mark', 'Manson', 'Lonnie', 'Nelly']
a = [100000, 0.05, 1549001.10, 999999999.99, 986000000, 1, 99.99, 999.99, 1000.01, 999999999999.00, -123.45]


My attempt:

['%s is in the %d-comma club.'%(p,-(-len(str(int(abs(v))))//3)-1) for p,v in zip(f,a)]


Results:

['John is in the 1-comma club.', 'Jamie is in the 0-comma club.', 'Kylie is in the 2-comma club.', 'Laura is in the 2-comma club.', 'Russ is in the 2-comma club.', 'Karla is in the 0-comma club.', 'Reid is in the 0-comma club.', 'Mark is in the 0-comma club.', 'Manson is in the 1-comma club.', 'Lonnie is in the 3-comma club.', 'Nelly is in the 0-comma club.']


Edit: converting everything to absolute values saved me 15 bytes.

• Most importantly, this is a code snippet, Typically we only allow functions or full programs. As for golfing, You can remove many spaces. Try: ["%s is in the %d-comma club."%(p,v.count(','))for p,v in zip(f,a)] Also, you must include a byte count. Mar 1, 2017 at 0:24
• You can do print'\n'.join([your array]) and actually print output. Mar 1, 2017 at 0:25
• Welcome to the site! Negatives (e.g. -123.45) are off by one (since you count the -). But why not take a list of numbers and save (have I misinterpreted?). You'd need to add import statements, and as it stands this is a snippet not a program or function (as the defaults are, and changing from them is discouraged unless there is good reason). Mar 1, 2017 at 1:13
• Thanks, @JonathanAllan. I'm currently trying to improve this so I don't have to count the imports. I realize that Python's math.ceil function likely adds quite a bit of overhead to my score. Mar 1, 2017 at 1:18
• You can save 9 bytes by replacing (-len(str(abs(v)).split('.')[0]) with len(str(int(float(v)))). In your test set, there are no negative numbers (in the examples, there is one). If you wanted to be completist, spend 5 bytes to do len(str(abs(int(float(v))))) - which then only saves you 4 bytes. Mar 1, 2017 at 14:11

# Python 2, 69 bytes

Setup our arrays:

n = ['John', 'Jamie', 'Kylie', 'Laura', 'Russ', 'Karla', 'Reid', 'Mark', 'Manson', 'Lonnie']
a = [100000, 0.05, 1549001.10, 999999999.99, 1000000000, 1, 99.99, 999.99, 1000.01, 999999999999.00]


And our function can then be:

f=lambda n,a:'%s is in %s comma club'%(n,min(3,(len(str(int(a)))/3)))


Giving us:

>>> [f(x,y) for x,y in zip(n,a)]
['John is in 2 comma club', 'Jamie is in 0 comma club', 'Kylie is in 2 comma club', 'Laura is in 3 comma club', 'Russ is in 3 comma club', 'Karla is in 0 comma club', 'Reid is in 0 comma club', 'Mark is in 1 comma club', 'Manson is in 1 comma club', 'Lonnie is in 3 comma club']


If the array needs to be identical to that provided in the question, then the solution costs 76 bytes:

f=lambda n,a:'%s is in %s comma club'%(n,min(3,(len(str(int(float(a))))/3)))

• This does not take the arrays, but rather a single pair. Also, I don't think it caters for the negative number inputs as specified. Apr 11, 2022 at 17:36

$args[0]|%{$_[0]+" is in the "+(('{0:N}'-f$_[1]-split',').Count-1)+"-comma club."}  Assuming a 2D-array input of cc.ps1 @(@("John",100000),@("Jamie",0.05),@("Kylie",1549001.10),@("Laura",999999999.99),@("Russ",986000000),@("Karla",1),@("Reid",99.99),@("Mark",999.99),@("Manson",1000.01),@("Lonnie",999999999999.00),@("Nelly",-123.45)) The output is  John is in the 1-comma club. Jamie is in the 0-comma club. Kylie is in the 2-comma club. Laura is in the 2-comma club. Russ is in the 2-comma club. Karla is in the 0-comma club. Reid is in the 0-comma club. Mark is in the 0-comma club. Manson is in the 1-comma club. Lonnie is in the 3-comma club. Nelly is in the 0-comma club.  ## Haskell, 71 bytes n#a=n++" is in the "++(show.truncate.logBase 1e3.abs$a)++"-comma club."


Defines an operator '#' that provides the correct answer. E.g.:

*Main> "John"#100000
"John is in the 1-comma club."


Unfortunately, Haskell doesn't have a compact log10 function like many other languages, but it does have a useful logBase function, which means we don't need to divide our answer by 3. Unfortunately, logBase 1000 0.05 is a negative number, so we need to use the longer truncate rather than floor to round it.

Full program including test cases:

(#) :: (RealFrac n, Floating n) => [Char] -> n -> [Char]
n#a=n++" is in the "++(show.truncate.logBase 1e3.abs$a)++"-comma club." testCases = [ ("John", 100000), ("Jamie", 0.05), ("Kylie", 1549001.10), ("Laura", 999999999.99), ("Russ", 986000000), ("Karla", 1), ("Reid", 99.99), ("Mark", 999.99), ("Manson", 1000.01), ("Lonnie", 999999999999.00), ("Nelly", -123.45)] main = putStrLn$ unlines $map (uncurry (#)) testCases  Gives the following results: John is in the 1-comma club. Jamie is in the 0-comma club. Kylie is in the 2-comma club. Laura is in the 2-comma club. Russ is in the 2-comma club. Karla is in the 0-comma club. Reid is in the 0-comma club. Mark is in the 0-comma club. Manson is in the 1-comma club. Lonnie is in the 3-comma club. Nelly is in the 0-comma club.  # Python 2.7, 89 86 84 76 bytes for g,b in input():print g,'is in the',~-len('%d'%abs(b))/3+'-comma club.'  Try it online! Full program that takes a list of pairs of names and bank balances - and prints the resulting strings. (Note the question states "friends array and amounts array, but this is the format used by the accepted answer, so I guess it's allowed!) ## K, 66 bytes  /n is names and a is amounts n ("John";"Jamie";"Kylie";"Laura";"Russ";"Karla";"Reid";"Mark";"Manson";"Lonnie") a ("100000";"0.05";"1549001.10";"999999999.99";"1000000000";,"1";"99.99";"999.99";"1000.01";"999999999999.00") /the function {x," is in the ",($(#.q.cut[3;*"."\:y])-1)," comma club"}./:+(n;a)
/output
("John is in the 1 comma club";"Jamie is in the 0 comma club";"Kylie is in the 2 comma club";"Laura is in the 2 comma club";"Russ is in the 3 comma club";"Karla is in the 0 comma club";"Reid is in the 0 comma club";"Mark is in the 0 comma club";"Manson is in the 1 comma club";"Lonnie is in the 3 comma club")


# C#, 125 bytes

(p,n)=>{for(int x=0;x<p.Length;x++)Console.Write(p[x]+" is in the "+(n[x]<1e3?0:n[x]<1e6?1:n[x]<1e9?2:3)+"-comma club.\n");};


Anonymous function which prints the result in the the OP's format.

Full program with test cases:

using System;

class CommaClub
{
static void Main()
{
Action<string[], double[]> f =
(p,n)=>{for(int x=0;x<p.Length;x++)Console.Write(p[x]+" is in the "+(n[x]<1e3?0:n[x]<1e6?1:n[x]<1e9?2:3)+"-comma club.\n");};

// test cases:
string[] personArr = new[] {"John", "Jamie", "Kylie", "Laura", "Russ", "Karla", "Reid", "Mark", "Manson", "Lonnie", "Nelly"};
double[] amountArr = new[] {100000, 0.05, 1549001.10, 999999999.99, 1000000000, 1, 99.99, 999.99, 1000.01, 999999999999.00, -123.45};
f(personArr, amountArr);
}
}


# Perl 6, 107 95 bytes

for @f {printf "%s is in the %d-comma club.\n",@f[$++],(abs(@a[$++].split(".")[0]).chars-1)/3;}


Not my proudest work, give me a heads up if ive forgotten any golfing techniques. EDIT: -12 bytes thanks to @Ven

• why parens around ^@f.elems? btw you don't need that .elems, for ^@f works. You don't need to name your $x, use $_ instead. And don't use printf, use "{"interpolation"}".
– Ven
Mar 1, 2017 at 15:42
• I don't even understand why you need that. Why not go for for @f? You can use $++ as an index to go along with it (and index into @a). – Ven Mar 1, 2017 at 15:44 • ill edit as soon as im on the pc :) Mar 1, 2017 at 16:08 • @Ven thanks for the heads up about the$++. Saves me alot of trouble in my "real" programs. Just picked up Perl 6. Mar 1, 2017 at 17:37
• Are you sure interpolations don't save bytes?
– Ven
Mar 1, 2017 at 18:32

## Python 2, 87 bytes

for n,a in input():print n+' is in the %dd-comma club.'%'{:20,.2f}'.format(a).count(',')


Slightly older (90 bytes):

for n,a in input():print n+' is in the '+'{:20,.2f}'.format(a).count(',')+'-comma club.'


Takes input as a list of tuples (name, amount).

I'm doing this on my phone at school so I'll test it later.

## dc, 56 54 bytes

[P[ is in the ]Pd*vdZrX-1-3/n[-comma club.]pstz0<g]sglgx


This takes input from the stack, which should be pre-loaded with the first name at top of stack, the first number, the second name, second number, etc.

Here is an example of loading the stack and running the macro, g:

#!/usr/bin/dc
_123.45         [Nelly]
999999999999.00 [Lonnie]
1000.01         [Manson]
999.99          [Mark]
99.99           [Reid]
1               [Karla]
986000000       [Russ]
999999999.99    [Laura]
1549001.10      [Kylie]
0.05            [Jamie]
100000          [John]
[P[ is in the ]Pd*v1/Z1-3/n[-comma club.]pstz0<g]sglgx


which produces the usual output,

John is in the 1-comma club.
Jamie is in the 0-comma club.
Kylie is in the 2-comma club.
Laura is in the 2-comma club.
Russ is in the 2-comma club.
Karla is in the 0-comma club.
Reid is in the 0-comma club.
Mark is in the 0-comma club.
Manson is in the 1-comma club.
Lonnie is in the 3-comma club.
Nelly is in the 0-comma club.


Here's an exegesis of the code:

[P[ is in the ]Pd*v1/Z-1-3/n[-comma club.]pstz0<g]sglgx

[                    # begin macro string
P                    # print and pop person name
[ is in the ]P       # print and pop ' is in the '
# Get absolute value of number by squaring and square root
d*v                  # d=dup, *=multiply, v=root
1/                   # 1/ truncates to integer since scale is 0
Z                    # Z=number length
1-3/n                # n=print and pop (#digits - 1)//3
[-comma club.]p      # print '-comma club.' and newline
st                   # pop '-comma club.' off stack into register t
z0<g                 # Do macro g if 0 is less than z=stack height
]                    # end macro string
sg                   # Save macro g
lgx                  # Load g and do its initial execution


Note, in edit 1 I replaced dZrX- (d=dup, Z=number length, r=swap, X=fraction, -=subtract) with 1/Z (divide number by 1, which with default scale of zero truncates to integer; then Z=number length), saving two bytes.

# Swift, 166158 145 bytes

var c="comma club",i=0
f.map{k,v in var a=abs(v);print(k,(1000..<1000000~=a ?1:1000000..<1000000000~=a ?2:1000000000..<1000000000000~=a ?3:0),c)}


And here is the dictionary:

var f = [
"John": 100000, "Jamie": 0.05, "Kylie" : 1549001.10,
"Laura": 999999999.99,"Russ":1000000000,"Karla": 1,
"Reid": 99.99,"Mark": 999.99, "Manson": 1000.01,
"Lonnie": 999999999999.00, "Nelly": -123.45
]


Try it here!

# JavaScript (V8), 55 bytes

n=>m=>n+ is in the ${Math.log10(m*m)/6|0}-comma club.  Try it online! # Vyxal, 29 bytes ¹ð«E⟨b?6Ḃ«⁰²∆τ6ḭS‹ḊṄa ⟇¦.Wṅ  Try it Online! ## Explained ¹ð«E⟨b?6Ḃ«⁰²∆τ6ḭS‹ḊṄa ⟇¦.Wṅ ¹ð # Get first input and push space «E⟨b?6Ḃ« # Push compressed string "is in the " ⁰² # Get second input and square it ∆τ # Log10 it 6ḭ # Floor divide by 6 S # Stringify ‹ # Push a hyphen ḊṄa ⟇¦. # Push string "comma club" Wṅ # Join stack  ## Clojure, 108 bytes (def f ["John", "Jamie", "Kylie", "Laura", "Russ", "Karla", "Reid", "Mark", "Manson", "Lonnie", "Nelly"]) (def a ["100000", "0.05", "1549001.10", "999999999.99", "986000000", "1", "99.99", "999.99", "1000.01", "999999999999.00", "-123.45"]) (map #(str %" is in the "(quot(-(count(nth(partition-by #{\.}(drop-while #{\-}%2))0))1)3)"-comma club.")f a)  Not sure if operating on floats would be shorted than on sequences of characters. Not sure if non-function answer is fine which returns a sequence of answers. # Rebol, 118 bytes d: charset"0123456789"forskip s 2[c: 0 parse s/2[opt"-"any[3 d and d(++ c)]]print[s/1"is in the"join c"-comma club."]]  Ungolfed with array declaration: s: [ {John} {100000} {Jamie} {0.05} {Kylie} {1549001.10} {Laura} {999999999.99} {Russ} {986000000} {Karla} {1} {Reid} {99.99} {Mark} {999.99} {Manson} {1000.01} {Lonnie} {999999999999.00} {Nelly} {-123.45} {Baz} {1.12345678} ;; added extra Baz test case ] d: charset "0123456789" forskip s 2 [ c: 0 parse s/2 [ opt "-" any [3 d and d (++ c)] ] print [s/1 "is in the" join c "-comma club."] ]  Output: John is in the 1-comma club. Jamie is in the 0-comma club. Kylie is in the 2-comma club. Laura is in the 2-comma club. Russ is in the 2-comma club. Karla is in the 0-comma club. Reid is in the 0-comma club. Mark is in the 0-comma club. Manson is in the 1-comma club. Lonnie is in the 3-comma club. Nelly is in the 0-comma club. Baz is in the 0-comma club.  # Java 8 154 141 bytes m.keySet().stream().map(k->k+" is in the "+(((""+Math.abs(m.get(k).longValue()))).length()-1)/3+"-comma club.").forEach(System.out::println);  ## Ungolfed public static void main(String[] args) { Map<String, Number> m = new LinkedHashMap<String, Number>(){{ put("John", 100000); put("Jamie", 0.05); put("Kylie", 1549001.10); put("Laura", 999999999.99); put("Russ", 1000000000); put("Karla", 1); put("Reid", 99.99); put("Mark", 999.99); put("Manson", 1000.01); put("Lonnie", 999999999999.00); put("Nelly", -123.45); }}; m.keySet().stream().map(k->k+" is in the "+(((""+Math.abs(m.get(k).longValue()))).length()-1)/3+"-comma club.").forEach(System.out::println); }  • You can remove the String.valueOf and use (((""+Math.abs(m.get(k).longValue())).length()-1)/3) instead. Mar 1, 2017 at 13:15 • And you can also remove the parenthesis around k->. Sep 4, 2017 at 11:36 # Factor, 52 bytes [ sq log10 6 /i [I${} is in the \${}-comma club.I] ]


Attempt This Online!

Port of @MatthewJensen's JavaScript answer.

• doesn't work for me... could you get a working ATO/TIO link? Apr 12, 2022 at 4:26
• @Steffan I had no idea about ATO. It uses a later build than TIO so [I works. The problem is that mnapply` is bugged in that build. Try this. Apr 12, 2022 at 5:02