3 Cut it down to 47 characters
source | link

><> (5347)

Not particularly optimized, just testing the water with my first golf.

r:1:nr2&>ao$:@=?vr~&:&v|   
&1+&l3)?^;      >r    >:nr

Assumes that the input is prepopulated in the stack, such that the first element of the input is the first to be popped off.

Testing:

fish.py ranks.fish -v 1 2 3 4 5 6 7 8 9 9 10 10

outputs

1
1
3
3
5
6
7
8
9
10
11
12

><> (53)

Not particularly optimized, just testing the water with my first golf.

r:1:nr2&>ao$:@=?vr~&:&v   
&1+&l3)?^;      >r    >:nr

Assumes that the input is prepopulated in the stack, such that the first element of the input is the first to be popped off.

Testing:

fish.py ranks.fish -v 1 2 3 4 5 6 7 8 9 9 10 10

outputs

1
1
3
3
5
6
7
8
9
10
11
12

><> (47)

Not particularly optimized, just testing the water with my first golf.

r:1:nr2&>ao$:@=?vr~&:|   
&1+&l3)?^;      >r:nr

Assumes that the input is prepopulated in the stack, such that the first element of the input is the first to be popped off.

Testing:

fish.py ranks.fish -v 1 2 3 4 5 6 7 8 9 9 10 10

outputs

1
1
3
3
5
6
7
8
9
10
11
12
2 Removed redundancy
source | link

><> (53)

Not particularly optimized, just testing the water with my first golf.

r:1:nr2&ao>$nr2&>ao$:@=?vr~&::n&rv&v   
&1+&l3)ao?^;      >r:nr    >:nr

Assumes that the input is prepopulated in the stack, such that the first element of the input is the first to be popped off.

Testing:

fish.py ranks.fish -v 1 2 3 4 5 6 7 8 9 9 10 10

outputs

1
1
3
3
5
6
7
8
9
10
11
12

><> (53)

Not particularly optimized, just testing the water with my first golf.

r:1:nr2&ao>$:@=?vr~&::n&rv
&1+&l3)ao?^;    >r:nr    >

Assumes that the input is prepopulated in the stack, such that the first element of the input is the first to be popped off.

Testing:

fish.py ranks.fish -v 1 2 3 4 5 6 7 8 9 9 10 10

outputs

1
1
3
3
5
6
7
8
9
10
11
12

><> (53)

Not particularly optimized, just testing the water with my first golf.

r:1:nr2&>ao$:@=?vr~&:&v   
&1+&l3)?^;      >r    >:nr

Assumes that the input is prepopulated in the stack, such that the first element of the input is the first to be popped off.

Testing:

fish.py ranks.fish -v 1 2 3 4 5 6 7 8 9 9 10 10

outputs

1
1
3
3
5
6
7
8
9
10
11
12
1
source | link

><> (53)

Not particularly optimized, just testing the water with my first golf.

r:1:nr2&ao>$:@=?vr~&::n&rv
&1+&l3)ao?^;    >r:nr    >

Assumes that the input is prepopulated in the stack, such that the first element of the input is the first to be popped off.

Testing:

fish.py ranks.fish -v 1 2 3 4 5 6 7 8 9 9 10 10

outputs

1
1
3
3
5
6
7
8
9
10
11
12