Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 443 characters in body
Source Link
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697

Haskell (1 indexed), 29 bytes

Courtesy of AZTECCO

g l=all(`elem`l)[1..length l]

Try it online!

Haskell (0 indexed), (削除) 42 (削除ここまで) (削除) 32 (削除ここまで) 31 bytes

Lynn saved one byte with the pointfree solution.

all.(.fst).flip elem<*>zip[0..]

Try it online!

I tried a bunch of creative stuff with scans, folds and zips, but the boring solution ended up being the shortest.

ChecksBoth of these check that every integer fromin the available range is in the list. The first is 01 to 1 less than the length of the list, the second is an element0 to 1 less than the length of the list.

Haskell, (削除) 42 (削除ここまで) (削除) 32 (削除ここまで) 31 bytes

Lynn saved one byte with the pointfree solution.

all.(.fst).flip elem<*>zip[0..]

Try it online!

I tried a bunch of creative stuff with scans, folds and zips, but the boring solution ended up being the shortest.

Checks that every integer from 0 to 1 less than the length of the list is an element of the list.

Haskell (1 indexed), 29 bytes

Courtesy of AZTECCO

g l=all(`elem`l)[1..length l]

Try it online!

Haskell (0 indexed), (削除) 42 (削除ここまで) (削除) 32 (削除ここまで) 31 bytes

Lynn saved one byte with the pointfree solution.

all.(.fst).flip elem<*>zip[0..]

Try it online!

I tried a bunch of creative stuff with scans, folds and zips, but the boring solution ended up being the shortest.

Both of these check that every integer in the available range is in the list. The first is 1 to the length of the list, the second is 0 to 1 less than the length of the list.

deleted 3 characters in body
Source Link
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697

Haskell, (削除) 42 (削除ここまで) (削除) 32 (削除ここまで) 31 bytes

Lynn saved one byte with the pointfree.io solution.

all.(.fst).flip elem<*>zip[0..]

Try it online!

I tried a bunch of creative stuff with scans, folds and zips, but the boring solution ended up being the shortest.

Checks that every integer from 0 to 1 less than the length of the list is an element of the list.

Haskell, (削除) 42 (削除ここまで) (削除) 32 (削除ここまで) 31 bytes

Lynn saved one byte with the pointfree.io solution.

all.(.fst).flip elem<*>zip[0..]

Try it online!

I tried a bunch of creative stuff with scans, folds and zips, but the boring solution ended up being the shortest.

Checks that every integer from 0 to 1 less than the length of the list is an element of the list.

Haskell, (削除) 42 (削除ここまで) (削除) 32 (削除ここまで) 31 bytes

Lynn saved one byte with the pointfree solution.

all.(.fst).flip elem<*>zip[0..]

Try it online!

I tried a bunch of creative stuff with scans, folds and zips, but the boring solution ended up being the shortest.

Checks that every integer from 0 to 1 less than the length of the list is an element of the list.

added 67 characters in body
Source Link
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697

Haskell, (削除) 42 (削除ここまで) 32(削除) 32 (削除ここまで) 31 bytes

Lynn saved one byte with the pointfree.io solution.

f x=all(all.(`elem`x).fst)$zip[0.flip elem<*>zip[0.]x.]

Try it online! Try it online!

I tried a bunch of creative stuff with scans, folds and zips, but the boring solution ended up being the shortest.

Checks that every integer from 0 to 1 less than the length of the list is an element of the list.

Haskell, (削除) 42 (削除ここまで) 32 bytes

f x=all((`elem`x).fst)$zip[0..]x

Try it online!

I tried a bunch of creative stuff with scans, folds and zips, but the boring solution ended up being the shortest.

Checks that every integer from 0 to 1 less than the length of the list is an element of the list.

Haskell, (削除) 42 (削除ここまで) (削除) 32 (削除ここまで) 31 bytes

Lynn saved one byte with the pointfree.io solution.

all.(.fst).flip elem<*>zip[0..]

Try it online!

I tried a bunch of creative stuff with scans, folds and zips, but the boring solution ended up being the shortest.

Checks that every integer from 0 to 1 less than the length of the list is an element of the list.

deleted 23 characters in body
Source Link
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697
Loading
Source Link
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697
Loading

AltStyle によって変換されたページ (->オリジナル) /