This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -0,0 +1,41 @@
100 DIM L$(15)
110 L$(0) = "NOW"
120 L$(1) = "IS"
130 L$(2) = "THE"
140 L$(3) = "TIME"
150 L$(4) = "FOR"
160 L$(5) = "ALL"
170 L$(6) = "GOOD"
180 L$(7) = "MEN"
190 L$(8) = "TO"
200 L$(9) = "COME"
210 L$(10) = "TO"
220 L$(11) = "THE"
230 L$(12) = "AID"
240 L$(13) = "OF"
250 L$(14) = "THE"
260 L$(15) = "PARTY."
300 N = 15
310 GOSUB 400
320 FOR I = 0 TO N
330 PRINT L$(I) " " ;
340 NEXT
350 PRINT
360 END
400 REMREMOVE DUPLICATES
410 FOR I = N TO 1 STEP -1
420 I$ = L$(I)
430 FOR J = 0 TO I - 1
440 EQ = I$ = L$(J)
450 IF NOT EQ THEN NEXT J
460 IF EQ THEN GOSUB 500
470 NEXT I
480 RETURN
500 REMREMOVE ELEMENT
510 L$(I) = L$(N)
520 L$(N) = ""
530 N = N - 1
540 RETURN

View file

@ -1,7 +1,8 @@
import std.stdio, std.algorithm;
void main() {
auto data = [1, 3, 2, 9, 1, 2, 3, 8, 8, 1, 0, 2];
data.sort();
writeln(uniq(data));
import std.stdio, std.algorithm;
[1, 3, 2, 9, 1, 2, 3, 8, 8, 1, 0, 2]
.sort()
.uniq
.writeln;
}

View file

@ -1,10 +1,10 @@
import std.stdio;
void main() {
auto data = [1, 3, 2, 9, 1, 2, 3, 8, 8, 1, 0, 2];
import std.stdio;
int[int] hash;
immutable data = [1, 3, 2, 9, 1, 2, 3, 8, 8, 1, 0, 2];
bool[int] hash;
foreach (el; data)
hash[el] = 0;
writeln(hash.keys);
hash[el] = true;
hash.byKey.writeln;
}

View file

@ -1,4 +1,4 @@
USING: sets ;
V{ 1 2 1 3 2 4 5 } pruned .
V{ 1 2 1 3 2 4 5 } members .
V{ 1 2 3 4 5 }

View file

@ -1,12 +1,11 @@
using System.Linq;
using System.Console;
module RemDups
{
Main() : void
{
def nums = [1, 4, 6, 3, 6, 2, 7, 2, 5, 2, 6, 8];
def unique = $[n | n in nums.Distinct()];
def nums = array[1, 4, 6, 3, 6, 2, 7, 2, 5, 2, 6, 8];
def unique = $[n | n in nums].RemoveDuplicates();
WriteLine(unique);
}
}