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

Pages: 1-

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 0:37

Why would I want to do that?

Name: Anonymous 2022-12-12 1:31

Dick eater sadkov

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!

Name: Anonymous 2022-12-12 2:08

>>4
leave it to da ENTERPRISE PROGRAMMERS to fix dis horse shit

Name: Anonymous 2022-12-12 16:04

ENTERPRISE RUBY

#!/usr/bin/env ruby
d={}
ARGV.each {|e|if !d.key?(e); puts d[e]=e end}


$ ./prog_challenge_dec_2022.rb prog sicp prog cudder sicp prog cudder cudder sicp prog lisp
prog
sicp
cudder
lisp

Name: Anonymous 2022-12-13 3:25

>>4

DUHHHHH NIKITA FUCKED AN ANTELOPE ON SAINT SWIVVEN'S DAY

#include <stdio.h>

static int unique(int *p, int n);

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

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

static int delete(int v, int *p, int n)
{
int to, from;

to = from = 0;
while (from < n) {
p[to] = p[from++];
if (p[to] != v)
to++;
}
return to;
}

int unique(int *p, int n)
{
int i, m;

for (i = 0; i < n; i++) {
m = delete(p[i], p + i + 1, n - i - 1);
n = i + 1 + m;
}
return n;
}

Name: Anonymous 2022-12-13 20:14

>>7
Now rewrite it to Java.
And don't forget to write good comments and documentation for you code, referencing the research papers you used.

Name: Anonymous 2022-12-13 20:16

>>7
Also,
static int delete(int v, int *p, int n)

Wont compile with C++ compiler

Name: Anonymous 2022-12-14 0:50

>>9
good

Name: Anonymous 2022-12-14 1:01

>>9
I shit on nikita sadkov and his stupid C++ compiler

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