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 22 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

All upper or all lower.
Returns a flag list [D, F, S]:
DD: clockwise = 11 / anticlockwise = -1-1
FF: centrifugal = 11 / centripetal = -1-1
SS: spinning = 1 1/ not spinning = 00

  • if S = 0S is 0 the other flags are still evaluated even though they carry no useful information.

All upper or all lower.
Returns a flag list [D, F, S]:
D: clockwise = 1 / anticlockwise = -1
F: centrifugal = 1 / centripetal = -1
S: spinning = 1 / not spinning = 0

  • if S = 0 the other flags are still evaluated even though they carry no useful information.

All upper or all lower.
Returns a flag list [D, F, S]:
D: clockwise = 1 / anticlockwise = -1
F: centrifugal = 1 / centripetal = -1
S: spinning = 1/ not spinning = 0

  • if S is 0 the other flags are still evaluated even though they carry no useful information.
edited body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
OIḟ0μAI©Ṡḟ0ṂṭṠḢ$μ®ḟ0ṠEṭ - Main link: s
O - ordinals
 I - deltas (i.e. [a,b,c,...] -> [b-a,c-b,...])
 ḟ0 - filter out zeros
 - (call this Z)
 μ - start a new monadic chain (i.e. f(Z))
 A - absolute values
 I - deltas
 © - copy to register
 Ṡ - signs
 ḟ0 - filter out zeros
 Ṃ - minimum
 - (i.e. F = {centrifugal: 1; centripetal: -1})
 $ - last two links as a monad:
 Ḣ - head (XZ)
 Ṡ - sign
 - (i.e. D = {clockwise: 1; anticlockwise: -1})
 ṭ - tack
 μ - start a new monadic chain (i.e. f([D,F]))
 ® - recall from register
 ḟ0 - filter out zeros
 Ṡ - signs
 E - all equal?
 - (i.e. S = {spinning: 1; not spinning: 0})
 ṭ - tack
 - (i.e. [D,F,S])
OIḟ0μAI©Ṡḟ0ṂṭṠḢ$μ®ḟ0ṠEṭ - Main link: s
O - ordinals
 I - deltas (i.e. [a,b,c,...] -> [b-a,c-b,...])
 ḟ0 - filter out zeros
 - (call this Z)
 μ - start a new monadic chain (i.e. f(Z))
 A - absolute values
 I - deltas
 © - copy to register
 Ṡ - signs
 ḟ0 - filter out zeros
 Ṃ - minimum
 - (i.e. F = {centrifugal: 1; centripetal: -1})
 $ - last two links as a monad:
 Ḣ - head (X)
 Ṡ - sign
 - (i.e. D = {clockwise: 1; anticlockwise: -1})
 ṭ - tack
 μ - start a new monadic chain (i.e. f([D,F]))
 ® - recall from register
 ḟ0 - filter out zeros
 Ṡ - signs
 E - all equal?
 - (i.e. S = {spinning: 1; not spinning: 0})
 ṭ - tack
 - (i.e. [D,F,S])
OIḟ0μAI©Ṡḟ0ṂṭṠḢ$μ®ḟ0ṠEṭ - Main link: s
O - ordinals
 I - deltas (i.e. [a,b,c,...] -> [b-a,c-b,...])
 ḟ0 - filter out zeros
 - (call this Z)
 μ - start a new monadic chain (i.e. f(Z))
 A - absolute values
 I - deltas
 © - copy to register
 Ṡ - signs
 ḟ0 - filter out zeros
 Ṃ - minimum
 - (i.e. F = {centrifugal: 1; centripetal: -1})
 $ - last two links as a monad:
 Ḣ - head (Z)
 Ṡ - sign
 - (i.e. D = {clockwise: 1; anticlockwise: -1})
 ṭ - tack
 μ - start a new monadic chain (i.e. f([D,F]))
 ® - recall from register
 ḟ0 - filter out zeros
 Ṡ - signs
 E - all equal?
 - (i.e. S = {spinning: 1; not spinning: 0})
 ṭ - tack
 - (i.e. [D,F,S])
deleted 232 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, 30 (削除) 30 (削除ここまで) 23 bytes

3L·ḟ0ṠE
ÑṠḟ0Ṃ
ÑAI
OIḟ0
ÇṠḢ;2L·;ÑOIḟ0μAI©Ṡḟ0ṂṭḢṠ$μ®ḟ0ṠEṭ

TryItOnline Try it online!
Or Or see the test cases (with a slight change as the very last Ñ would point to the new main link)test cases

(My lack of chaining skill is probably costing a few bytes here)
All All upper or all lower.
Returns a flag list [D, F, S][D, F, S]:
SD: spinningclockwise = 1 / not spinninganticlockwise = 0-1
F: centrifugal = 1 (circular = 0)/ centripetal = -1
DS: clockwisespinning = 1 / anticlockwisenot spinning = -10

3L·ḟ0ṠEOIḟ0μAI©Ṡḟ0ṂṭṠḢ$μ®ḟ0ṠEṭ - Main link: s
O - Link 1, isSpinning: s
3L· - callordinals
 linkI 3 as a monad with s - deltas (i.e. [a,b,c,...] -> [b-a,c-b,...])
 ḟ0 - filter out zeros
  - sign
 E - all(call equal?
this Z)
ÑṠḟ0Ṃ μ  - Linkstart 2,a centrifugalnew monadic chain (-1),i.e. circularf(0Z)) or centripetal(1): s
Ñ A - call next link (3) as a monad with s- absolute values
  I  - signdeltas
 (+1 for positive changes, ©  -1 forcopy negativeto changes,register
 0 for no change) Ṡ - signs
 ḟ0 - filter out zeros (ignore these for cases like "IRIS")
 Ṃ - minimum (will be the only value for spinning words)
 - (circular- words(i.e. likeF "DAD",= now{centrifugal: excluded,1; yieldcentripetal: min([])=0-1})
ÑAI - Link 3, absolute change of moves$ over alphabet: s - last two links as a monad:
Ñ  - call next linkhead (4X) as a monad with s
 A  - absolute sign
 I - differences
OIḟ0 - Link 4, non-zero moves(i.e. overD alphabet= {clockwise: s1; anticlockwise: -1})
O  - ordinaltack
 cast μ - start a new monadic chain (i.e. f([D,F]))
 I ®  - differencesrecall from register
 ḟ0 ḟ0 - filter out zeros
ÇṠḢ;2L·;Ñ - Main link: s
Ç - callsigns
 last link (4) as a monad with s
  E - signall equal?
  - head - (clockwisei.e. /S anticlockwise= {spinning: 11; /not -1spinning: 0})
 ; ; - concatenate
 2L· - call link- (2)tack
 as a monad with s
 Ñ - call next link (1) as a monad with- s(i.e. [D,F,S])

Jelly, 30 bytes

3L·ḟ0ṠE
ÑṠḟ0Ṃ
ÑAI
OIḟ0
ÇṠḢ;2L·;Ñ

TryItOnline
Or see the test cases (with a slight change as the very last Ñ would point to the new main link)

(My lack of chaining skill is probably costing a few bytes here)
All upper or all lower.
Returns a flag list [D, F, S]:
S: spinning = 1 / not spinning = 0
F: centrifugal = 1 (circular = 0) centripetal = -1
D: clockwise = 1 / anticlockwise = -1

3L·ḟ0ṠE - Link 1, isSpinning: s
3L· - call link 3 as a monad with s
 ḟ0 - filter out zeros
  - sign
 E - all equal?

ÑṠḟ0Ṃ - Link 2, centrifugal(-1), circular(0) or centripetal(1): s
Ñ - call next link (3) as a monad with s
  - sign (+1 for positive changes, -1 for negative changes, 0 for no change)
 ḟ0 - filter out zeros (ignore these for cases like "IRIS")
 Ṃ - minimum (will be the only value for spinning words)
 - (circular words like "DAD", now excluded, yield min([])=0)
ÑAI - Link 3, absolute change of moves over alphabet: s
Ñ - call next link (4) as a monad with s
 A - absolute
 I - differences
OIḟ0 - Link 4, non-zero moves over alphabet: s
O - ordinal cast
 I - differences
 ḟ0 - filter out zeros
ÇṠḢ;2L·;Ñ - Main link: s
Ç - call last link (4) as a monad with s
  - sign
  - head (clockwise / anticlockwise: 1 / -1)
 ; ; - concatenate
 2L· - call link (2) as a monad with s
 Ñ - call next link (1) as a monad with s

Jelly, (削除) 30 (削除ここまで) 23 bytes

OIḟ0μAI©Ṡḟ0ṂṭḢṠ$μ®ḟ0ṠEṭ

Try it online! Or see the test cases

All upper or all lower.
Returns a flag list [D, F, S]:
D: clockwise = 1 / anticlockwise = -1
F: centrifugal = 1 / centripetal = -1
S: spinning = 1 / not spinning = 0

OIḟ0μAI©Ṡḟ0ṂṭṠḢ$μ®ḟ0ṠEṭ - Main link: s
O - ordinals
 I  - deltas (i.e. [a,b,c,...] -> [b-a,c-b,...])
 ḟ0 - filter out zeros
 - (call this Z)
 μ  - start a new monadic chain (i.e. f(Z)) A - absolute values
 I  - deltas
  ©  - copy to register
  Ṡ - signs
 ḟ0 - filter out zeros Ṃ - minimum - (i.e. F = {centrifugal: 1; centripetal: -1})
 $  - last two links as a monad:
  - head (X)  -  sign
 - (i.e. D = {clockwise: 1; anticlockwise: -1})
  - tack
  μ - start a new monadic chain (i.e. f([D,F]))
 ®  - recall from register
 ḟ0 - filter out zeros
 - signs
 E - all equal?
 - (i.e. S = {spinning: 1; not spinning: 0})
  - tack
 - (i.e. [D,F,S])
edited body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
Loading
deleted 210 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
Loading
added 1863 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
Loading
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
Loading

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