Skip to main content
Commonmark migration
Source Link

#APL(NARS), 9 chars, 18 bytes

APL(NARS), 9 chars, 18 bytes

{⍵≡⍦,⍨∪⍵}

test:

  f←{⍵≡⍦,⍨∪⍵}
  f 7,13,9,2,10,2,4,10,7,13,4,9
1
  f 77,31,5,31,80,77,5,8,8
0
  f 2,4,6,4,4,4
0

#APL(NARS), 9 chars, 18 bytes

{⍵≡⍦,⍨∪⍵}

test:

  f←{⍵≡⍦,⍨∪⍵}
  f 7,13,9,2,10,2,4,10,7,13,4,9
1
  f 77,31,5,31,80,77,5,8,8
0
  f 2,4,6,4,4,4
0

APL(NARS), 9 chars, 18 bytes

{⍵≡⍦,⍨∪⍵}

test:

  f←{⍵≡⍦,⍨∪⍵}
  f 7,13,9,2,10,2,4,10,7,13,4,9
1
  f 77,31,5,31,80,77,5,8,8
0
  f 2,4,6,4,4,4
0
deleted 28 characters in body
Source Link
user58988
user58988

#APL(NARS), 209 chars, 4018 bytes

{(⍵≡⍦,2)≡∪+/¨{⍵=w}¨w←⍵⍨∪⍵}

Testtest:

  f←{(⍵≡⍦,2)≡∪+/¨{⍵=w}¨w←⍵⍨∪⍵}
  f 7,13,9,2,10,2,4,10,7,13,4,9
1
  f 77,31,5,31,80,77,5,8,8
0
  f 2,4,6,4,4,4
0

#APL(NARS), 20 chars, 40 bytes

{(,2)≡∪+/¨{⍵=w}¨w←⍵}

Test:

  f←{(,2)≡∪+/¨{⍵=w}¨w←⍵}
  f 7,13,9,2,10,2,4,10,7,13,4,9
1
  f 77,31,5,31,80,77,5,8,8
0
  f 2,4,6,4,4,4
0

#APL(NARS), 9 chars, 18 bytes

{⍵≡⍦,⍨∪⍵}

test:

  f←{⍵≡⍦,⍨∪⍵}
  f 7,13,9,2,10,2,4,10,7,13,4,9
1
  f 77,31,5,31,80,77,5,8,8
0
  f 2,4,6,4,4,4
0
Source Link
user58988
user58988

#APL(NARS), 20 chars, 40 bytes

{(,2)≡∪+/¨{⍵=w}¨w←⍵}

Test:

  f←{(,2)≡∪+/¨{⍵=w}¨w←⍵}
  f 7,13,9,2,10,2,4,10,7,13,4,9
1
  f 77,31,5,31,80,77,5,8,8
0
  f 2,4,6,4,4,4
0