Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

December Prog Challenge

Name: Anonymous 2022-12-12 0:19

Given a list L of arbitrary items, remove the items which are duplicate of previously occurring items, without changing the order.

An example in Symta
L: a 3 b 3 a 5
L{T~.?+>0!=} //produces list (a 3 b 5)

L{...} - maps over the elements of the list L
{P=} - maps elements matching P to empty space (erases them)
`!` specifies that we are matching elements against a lambda call returning a boolean value
? - turns entire expression into a lambda function with ? being formal parameter
T~ - introduces an auto-closure variable, of a hash table type, around the lambda
T~.? - accesses a value of a hash table T~ at key ?
X+ - increments a value


Challenge: write a more "readable" version of this code, with all your `public static void main` literary programming stuff.

Name: Anonymous 2022-12-12 2:04

DUHHH NIKITA SADKOV NOOGIE TIME

*NOOGIES YOUR BALD HEAD*

#include <stdio.h>

int uniq(int *p, int n)
{
int i, j, k;

for (i = 0; i < n; i++)
for (j = i + 1; j < n; j++)
if (p[i] == p[j]) {
p[j] = p[j + 1];
n--;
}
return n;
}

main()
{
int a[] = { 1, 3, 2, 3, 1, 5 };
int i, n;

n = uniq(a, sizeof a / sizeof *a);
for (i = 0; i < n; i++)
printf(" %d", a[i]);
printf("\n");
}


C DAWGS ROX DA ROOST C DAWGS ROX DA ROOST!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List