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

Commonmark migration
Source Link

#Pyth , 6 bytes

Pyth , 6 bytes

>1{I#C

Test suite.

The output is a singleton list, as allowed by default; the list [ ] (empty list, falsy) is returned in case the string cannot be enklactified.

Explanation

>1{I#C – Full program.
 C – Transpose the input, cropping absences.
 # – Filter by:
 {I – Invariant under deduplication.>1 – Slice to 1. list[:1] in Python.

Pyth, 5 bytes

This would've been valid if crashing would have counted as a falsy value.

h{I#C

Test suite.

#Pyth , 6 bytes

>1{I#C

Test suite.

The output is a singleton list, as allowed by default; the list [ ] (empty list, falsy) is returned in case the string cannot be enklactified.

Explanation

>1{I#C – Full program.
 C – Transpose the input, cropping absences.
 # – Filter by:
 {I – Invariant under deduplication.>1 – Slice to 1. list[:1] in Python.

Pyth, 5 bytes

This would've been valid if crashing would have counted as a falsy value.

h{I#C

Test suite.

Pyth , 6 bytes

>1{I#C

Test suite.

The output is a singleton list, as allowed by default; the list [ ] (empty list, falsy) is returned in case the string cannot be enklactified.

Explanation

>1{I#C – Full program.
 C – Transpose the input, cropping absences.
 # – Filter by:
 {I – Invariant under deduplication.>1 – Slice to 1. list[:1] in Python.

Pyth, 5 bytes

This would've been valid if crashing would have counted as a falsy value.

h{I#C

Test suite.

edited body
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221

#Pyth, 6 bytes

>1{I#C

Test suite.

The output is a singleton list, as allowed by default; the list [ ] (empty list, falsy) is returned in case the string cannot be enklactified.

Explanation

>1{I#C – Full program.
 C – Transpose the input, cropping absences.
 # – Filter by:
 {I – Invariant under deduplicatingdeduplication.>1 – Slice to 1. list[:1] in Python.

Pyth, 5 bytes

This would've been valid if crashing would have counted as a falsy value.

h{I#C

Test suite.

#Pyth, 6 bytes

>1{I#C

Test suite.

The output is a singleton list, as allowed by default; the list [ ] (empty list, falsy) is returned in case the string cannot be enklactified.

Explanation

>1{I#C – Full program.
 C – Transpose the input, cropping absences.
 # – Filter by:
 {I – Invariant under deduplicating.>1 – Slice to 1. list[:1] in Python.

Pyth, 5 bytes

This would've been valid if crashing would have counted as a falsy value.

h{I#C

Test suite.

#Pyth, 6 bytes

>1{I#C

Test suite.

The output is a singleton list, as allowed by default; the list [ ] (empty list, falsy) is returned in case the string cannot be enklactified.

Explanation

>1{I#C – Full program.
 C – Transpose the input, cropping absences.
 # – Filter by:
 {I – Invariant under deduplication.>1 – Slice to 1. list[:1] in Python.

Pyth, 5 bytes

This would've been valid if crashing would have counted as a falsy value.

h{I#C

Test suite.

deleted 416 characters in body
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221

#Pyth, 6 bytes

>1{I#C

Test suite.

The output is a singleton list, as allowed by default; the list [ ] (empty list, falsy) is returned in case the string cannot be enklactified.

Explanation

>1{I#C – Full program.
 C – Transpose the input, cropping absences.
 # – Filter by:
 {I – Invariant under deduplicating.>1 – Slice to 1. list[:1] in Python.

Pyth , 5 bytes (awaiting OP's response )

Pyth , 5 bytes

This would've been valid if crashing would have counted as a falsy value.

h{I#C

Test suite.

If throwing a consistent error is an acceptable falsy value (I honestly hope it will be), then this will become the main solution, crashing with:

Traceback (most recent call last):
 File "pyth.py", line 771, in <module>
 File "<string>", line 4, in <module>
 File "/app/macros.py", line 727, in head
IndexError: list index out of range

#Pyth, 6 bytes

>1{I#C

Test suite.

The output is a singleton list, as allowed by default; the list [ ] (empty list, falsy) is returned in case the string cannot be enklactified.

Explanation

>1{I#C – Full program.
 C – Transpose the input, cropping absences.
 # – Filter by:
 {I – Invariant under deduplicating.>1 – Slice to 1. list[:1] in Python.

Pyth , 5 bytes (awaiting OP's response )

h{I#C

Test suite.

If throwing a consistent error is an acceptable falsy value (I honestly hope it will be), then this will become the main solution, crashing with:

Traceback (most recent call last):
 File "pyth.py", line 771, in <module>
 File "<string>", line 4, in <module>
 File "/app/macros.py", line 727, in head
IndexError: list index out of range

#Pyth, 6 bytes

>1{I#C

Test suite.

The output is a singleton list, as allowed by default; the list [ ] (empty list, falsy) is returned in case the string cannot be enklactified.

Explanation

>1{I#C – Full program.
 C – Transpose the input, cropping absences.
 # – Filter by:
 {I – Invariant under deduplicating.>1 – Slice to 1. list[:1] in Python.

Pyth , 5 bytes

This would've been valid if crashing would have counted as a falsy value.

h{I#C

Test suite.

added 1 character in body
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221
Loading
added 1 character in body
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221
Loading
added 116 characters in body
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221
Loading
added 73 characters in body
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221
Loading
Source Link
Mr. Xcoder
  • 42.9k
  • 9
  • 87
  • 221
Loading

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