Skip to main content
added 112 characters in body
Source Link
Leaky Nun
  • 50.6k
  • 6
  • 115
  • 291

Brachylog, 3737 29 bytes

Credits to Fatalize for his assistance throughout.

4 bytes thanks to Fatalize, and inspiration for another 4 bytes.

@A:1fb:2&~@nw ~c[A:B],A1&e:1"a"yr:2yt.1&cw@Nw\ :Lc.r.! 

Try it online!Try it online!

Predicate 0 (Main predicate)

@A:1fb1&e:2&~@nw"a"yr:1&cw@Nw\ @A:1f1& Find all solutions of  Apply predicate 1 withto @A, aswhich inputis @A is  basically "abcdefghijklmnopqrstuvwxyz" be Remove the first  Choose one (it'selement from the emptyresult string(choice point) :2&"a"yr Call predicate 2 with the above as input generate substring from element to "a" ~@n :1& Join by newlines apply predicate 1   c  concatenate w Print  write to STDOUT 

Predicate 1 (Auxiliary predicate 1)

~c[A:B],A:1:2yt. ~C[A:B] input is in the form of@Nw [A:B] write "\n" to STDOUT (pattern matching\ hax)  Backtrack to last choice point to ,choose  and  A:1:2yt. output isanother theelement firstuntil outputthere is no more from predicate 2 with Achoice asleft, inputthen halt. 

Predicate 21 (Auxiliary predicate 2)

This basically builds a palindrome from the given string/array.

:Lc.r.! :Lc. output is [input:L] .r. output reversed is still output ! stop searching after the first output 

Brachylog, 37 bytes

Credits to Fatalize for his assistance throughout.

@A:1fb:2&~@nw ~c[A:B],A:1:2yt. :Lc.r. 

Try it online!

Predicate 0 (Main predicate)

@A:1fb:2&~@nw @A:1f Find all solutions of predicate 1 with @A as input @A is basically "abcdefghijklmnopqrstuvwxyz" b Remove the first one (it's the empty string) :2& Call predicate 2 with the above as input ~@n Join by newlines w Print to STDOUT 

Predicate 1 (Auxiliary predicate 1)

~c[A:B],A:1:2yt. ~C[A:B] input is in the form of [A:B] (pattern matching hax)  , and  A:1:2yt. output is the first output from predicate 2 with A as input 

Predicate 2 (Auxiliary predicate 2)

This basically builds a palindrome from the given string/array.

:Lc.r. :Lc. output is [input:L] .r. output reversed is still output 

Brachylog, 37 29 bytes

Credits to Fatalize for his assistance throughout.

4 bytes thanks to Fatalize, and inspiration for another 4 bytes.

@A:1&e:"a"yr:1&cw@Nw\ :Lc.r.! 

Try it online!

Predicate 0 (Main predicate)

@A:1&e:"a"yr:1&cw@Nw\ @A:1&   Apply predicate 1 to @A, which is   basically "abcdefghijklmnopqrstuvwxyz" e   Choose one element from the result (choice point) :"a"yr  generate substring from element to "a" :1&  apply predicate 1   c  concatenate w   write to STDOUT @Nw  write "\n" to STDOUT \ Backtrack to last choice point to choose  another element until there is no more choice left, then halt. 

Predicate 1 (Auxiliary predicate)

This basically builds a palindrome from the given string.

:Lc.r.! :Lc. output is [input:L] .r. output reversed is still output ! stop searching after the first output 
added 906 characters in body
Source Link
Leaky Nun
  • 50.6k
  • 6
  • 115
  • 291

Brachylog, 37 bytes

Credits to Fatalize for his assistance throughout.

@A:1fb:2&~@nw ~c[A:B],A:1:2yt. :Lc.r. 

Try it online!

Predicate 0 (Main predicate)

@A:1fb:2&~@nw @A:1f Find all solutions of predicate 1 with @A as input @A is basically "abcdefghijklmnopqrstuvwxyz" b Remove the first one (it's the empty string) :2& Call predicate 2 with the above as input ~@n Join by newlines w Print to STDOUT 

Predicate 1 (Auxiliary predicate 1)

~c[A:B],A:1:2yt. ~C[A:B] input is in the form of [A:B] (pattern matching hax) , and A:1:2yt. output is the first output from predicate 2 with A as input 

Predicate 2 (Auxiliary predicate 2)

This basically builds a palindrome from the given string/array.

:Lc.r. :Lc. output is [input:L] .r. output reversed is still output 

Brachylog, 37 bytes

Credits to Fatalize for his assistance throughout.

@A:1fb:2&~@nw ~c[A:B],A:1:2yt. :Lc.r. 

Try it online!

Brachylog, 37 bytes

Credits to Fatalize for his assistance throughout.

@A:1fb:2&~@nw ~c[A:B],A:1:2yt. :Lc.r. 

Try it online!

Predicate 0 (Main predicate)

@A:1fb:2&~@nw @A:1f Find all solutions of predicate 1 with @A as input @A is basically "abcdefghijklmnopqrstuvwxyz" b Remove the first one (it's the empty string) :2& Call predicate 2 with the above as input ~@n Join by newlines w Print to STDOUT 

Predicate 1 (Auxiliary predicate 1)

~c[A:B],A:1:2yt. ~C[A:B] input is in the form of [A:B] (pattern matching hax) , and A:1:2yt. output is the first output from predicate 2 with A as input 

Predicate 2 (Auxiliary predicate 2)

This basically builds a palindrome from the given string/array.

:Lc.r. :Lc. output is [input:L] .r. output reversed is still output 
Source Link
Leaky Nun
  • 50.6k
  • 6
  • 115
  • 291

Brachylog, 37 bytes

Credits to Fatalize for his assistance throughout.

@A:1fb:2&~@nw ~c[A:B],A:1:2yt. :Lc.r. 

Try it online!