Skip to main content
edited body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 17
  • 43

A pair of links that is called as a daysdyad and that takes the pg10.txt file as its right argument and the required biblical reference as its left argument. TIO fails with the full document (presumably because the POST exceeds the maximum size), and the links to TIO on CGCC are even more limited because of length. However, it should work with the full text if run locally.

A pair of links that is called as a days and that takes the pg10.txt file as its right argument and the required biblical reference as its left argument. TIO fails with the full document (presumably because the POST exceeds the maximum size), and the links to TIO on CGCC are even more limited because of length. However, it should work with the full text if run locally.

A pair of links that is called as a dyad and that takes the pg10.txt file as its right argument and the required biblical reference as its left argument. TIO fails with the full document (presumably because the POST exceeds the maximum size), and the links to TIO on CGCC are even more limited because of length. However, it should work with the full text if run locally.

deleted 98 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 17
  • 43

Jelly, 80 70# Jelly, 66 bytes

ḢfØDV+2ị=”JƲo1
Ḳ-ị⁹œṣ”¶x5¤¤Ỵ€¤Ḣw¥Ƈị@Çị⁹œṣ⁷x5¤¤ỴḢwɗƇị@Ç{KœṣḲṪ¹⁾1ỴKḲ<”AȦ$€œṗ$Ḣ⁼¥ƇḲṪ¹⁾1:;$f?”:ʋ2ịwⱮØD;€”:¤œPƊḢḊʋḢK

Try it online!Try it online!

Pleasingly now code length in bytes == number of books in bible.

Explanation (outdated)

Jelly, 80 70 bytes

ḢfØDV+2ị=”JƲo1
Ḳ-ị⁹œṣ”¶x5¤¤Ỵ€¤Ḣw¥Ƈị@Ç{KœṣḲṪ¹⁾1:;$f?”:ʋ2ịwⱮØD;€”:¤œPƊḢḊ

Try it online!

Explanation

Jelly, 80 # Jelly, 66 bytes

ḢfØDV+2ị=”JƲo1
Ḳ-ị⁹œṣ⁷x5¤¤ỴḢwɗƇị@Ç{ỴKḲ<”AȦ$€œṗ$Ḣ⁼¥ƇḲṪ¹⁾1:;$f?”:ʋḢK

Try it online!

Pleasingly now code length in bytes == number of books in bible.

Explanation (outdated)

added 109 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 17
  • 43

Jelly, 80 70 bytes

Explanation (outdated)

ḢfØDV+2ị=”JƲo1                                          # ‎⁡HelperHelper link 1: Takes a bible reference and returns which number book should be used that matches the textual part of the reference; half the code is to handle the John letters
Ḣ                                            # ‎⁢Head
 fØD         # Head
 fØD                              # ‎⁣Keep only digits
    V               # Keep only digits
    V                  # ‎⁤Evaluate (will be 0 if no digits)
      2ị=”JƲ}¡                    # Evaluate (will be 0 if no digits)
    # ‎⁢⁡If+ the second remaining character isƲ a J:
                                          # Add #the ‎⁢⁢-result Incrementof bythe 1
following, applied to the helper link's original argument
      2ị=”J o1                             # ‎⁢⁣Or 1 (replaces 0s with ones)
‎⁢⁤
ɠ⁻⁶x8¤$пYœṣ”¶x5¤Ỵ€         # - 1 if the second remaining character is a J, otherwise 0
     # ‎⁣⁡Helper link 2: Called niladically, reads theo1 bible from STDIN and splits up into books
ɠ     $п                             # Or 1 (replaces 0s with ones)

Ḳ-ị⁹œṣ”¶x5¤¤Ỵ€¤Ḣw¥Ƈị@Ç{KœṣḲṪ¹⁾1:;$f?”:ʋ2ịwⱮØD;€”:¤œPƊḢḊ # ‎⁣⁢ReadMain lineslink: fromtakes STDINa untilbible thereference followingas isits false:
argument ⁻⁶x8¤and returns the verse
Ḳ                                    # ‎⁣⁣- The read line is not equal to eight spaces
         Y# Split at spaces
 -ị                               # ‎⁣⁤Join with newlines
          œṣ”¶x5¤         # Penultimate part (will be the last word of the book title)
        # ‎⁤⁡Split at five consecutive newlines
¤                 Ỵ€                        # Using #the ‎⁤⁢Splitfollowing eachapplied bookto atthe newlines
‎⁤⁣
Ḳ-ị¢Ḣw¥Ƈị@ÑKœṣḲṪ¹⁾1:;$f?”:Ʋ2ịwⱮØD;€”right argument:¤œPƊḢḊ 
  # ‎⁤⁤Main link:œṣ”¶x5¤¤ takes a bible reference as its argument and returns the verse
Ḳ                                 # - Split at five consecutive newlines
      # ‎⁢⁡⁡Split at spaces
 -ị  Ỵ€                                          # ‎⁢⁡⁢Penultimate- partSplit (willeach beat thenewlines
 last word of the book title)
   ¢Ḣw¥Ƈ      Ḣw¥Ƈ                               # ‎⁢⁡⁣Keep those books (from helper link# 2)Keep those where the first line containsincludes thisthe asbook atitle sublistword from earlier
        ị@Ñ           ị@Ç{                                 # ‎⁢⁡⁤IndexIndex into this using the result of calling the helper link 1 on the original reference (so returning a single book)
           K            K                                # ‎⁢⁢⁡JoinJoin atwith spaces
                        œṣ            Ʋ                  # ‎⁢⁢⁢SplitSplit at the substring determined by calling following on the original reference:
                                             # ‎⁢⁢⁣- Split at spaces
                                                  # ‎⁢⁢⁤- Tail (i.e. the verse or chapter:verse)
                                  f?”:                   # ‎⁢⁣⁡- If contains a colon:
                ¹            ¹                           # ‎⁢⁣⁢  - Leave as is
                             ⁾1:;$                       # ‎⁢⁣⁣  - Else: prepend "1:"
                           2ị            2ị               # ‎⁢⁣⁤TakeTake the second part (i.e. the bit immediately after the chapter:verse reference)
                                        Ɗ            Ɗ   # ‎⁢⁤⁡FollowingFollowing as a monad:
                                         wⱮØD;€”:¤       # - ‎⁢⁤⁡FindFind the position of every sublist that comprises of a digit followed by a colon
                                      œP            œP    # ‎⁢⁤⁡- And split at these
                                         ḢḊ            ḢḊ # ‎⁢⁤⁢TakeTake the first remaining part, and then remove the first character (which will be the space left just after the original chapter:verse marker)
💎

Jelly, 70 bytes

Explanation (outdated)

ḢfØDV+2ị=”JƲo1                             # ‎⁡Helper link 1: Takes a bible reference and returns which number book should be used that matches the textual part of the reference; half the code is to handle the John letters
Ḣ                                            # ‎⁢Head
 fØD                                         # ‎⁣Keep only digits
    V                                        # ‎⁤Evaluate (will be 0 if no digits)
      2ị=”JƲ}¡                               # ‎⁢⁡If the second remaining character is a J:
                                            # ‎⁢⁢- Increment by 1
              o1                             # ‎⁢⁣Or 1 (replaces 0s with ones)
‎⁢⁤
ɠ⁻⁶x8¤$пYœṣ”¶x5¤Ỵ€                          # ‎⁣⁡Helper link 2: Called niladically, reads the bible from STDIN and splits up into books
ɠ     $п                                    # ‎⁣⁢Read lines from STDIN until the following is false:
 ⁻⁶x8¤                                       # ‎⁣⁣- The read line is not equal to eight spaces
         Y                                   # ‎⁣⁤Join with newlines
          œṣ”¶x5¤                            # ‎⁤⁡Split at five consecutive newlines
                 Ỵ€                          # ‎⁤⁢Split each book at newlines
‎⁤⁣
Ḳ-ị¢Ḣw¥Ƈị@ÑKœṣḲṪ¹⁾1:;$f?”:Ʋ2ịwⱮØD;€”:¤œPƊḢḊ  # ‎⁤⁤Main link: takes a bible reference as its argument and returns the verse
Ḳ                                            # ‎⁢⁡⁡Split at spaces
 -ị                                          # ‎⁢⁡⁢Penultimate part (will be the last word of the book title)
   ¢Ḣw¥Ƈ                                     # ‎⁢⁡⁣Keep those books (from helper link 2) where the first line contains this as a sublist
        ị@Ñ                                  # ‎⁢⁡⁤Index into this using the result of calling helper link 1 on the original reference (so returning a single book)
           K                                 # ‎⁢⁢⁡Join at spaces
            œṣ            Ʋ                  # ‎⁢⁢⁢Split at the substring determined by calling following on the original reference:
                                            # ‎⁢⁢⁣- Split at spaces
                                            # ‎⁢⁢⁤- Tail (i.e. the verse or chapter:verse)
                      f?”:                   # ‎⁢⁣⁡- If contains a colon:
                ¹                            # ‎⁢⁣⁢  - Leave as is
                 ⁾1:;$                       # ‎⁢⁣⁣  - Else: prepend "1:"
                           2ị                # ‎⁢⁣⁤Take the second part (i.e. the bit immediately after the chapter:verse reference)
                                        Ɗ    # ‎⁢⁤⁡Following as a monad:
                             wⱮØD;€”:¤       # - ‎⁢⁤⁡Find the position of every sublist that comprises of a digit followed by a colon
                                      œP     # ‎⁢⁤⁡- And split at these
                                         ḢḊ  # ‎⁢⁤⁢Take the first remaining part, and then remove the first character (which will be the space left just after the original chapter:verse marker)
💎

Jelly, 80 70 bytes

Explanation

ḢfØDV+2ị=”JƲo1                                          # Helper link: Takes a bible reference and returns which number book should be used that matches the textual part of the reference; half the code is to handle the John letters
Ḣ                                                       # Head
 fØD                                                    # Keep only digits
    V                                                   # Evaluate (will be 0 if no digits)
     +     Ʋ                                            # Add the result of the following, applied to the helper link's original argument
      2ị=”J                                             # - 1 if the second remaining character is a J, otherwise 0
            o1                                          # Or 1 (replaces 0s with ones)

Ḳ-ị⁹œṣ”¶x5¤¤Ỵ€¤Ḣw¥Ƈị@Ç{KœṣḲṪ¹⁾1:;$f?”:ʋ2ịwⱮØD;€”:¤œPƊḢḊ # Main link: takes a bible reference as its argument and returns the verse
Ḳ                                                       # Split at spaces
 -ị                                                     # Penultimate part (will be the last word of the book title)
             ¤                                         # Using the following applied to the right argument: 
    œṣ”¶x5¤¤                                            # - Split at five consecutive newlines
            Ỵ€                                          # - Split each at newlines
               Ḣw¥Ƈ                                     # Keep those where the first line includes the book title word from earlier
                   ị@Ç{                                 # Index into this using the result of calling the helper link on the original reference (so returning a single book)
                       K                                # Join with spaces
                        œṣ            Ʋ                 # Split at the substring determined by calling following on the original reference:
                                             # - Split at spaces
                                                  # - Tail (i.e. the verse or chapter:verse)
                                  f?”:                  # - If contains a colon:
                            ¹                           #   - Leave as is
                             ⁾1:;$                      #   - Else: prepend "1:"
                                       2ị               # Take the second part (i.e. the bit immediately after the chapter:verse reference)
                                                    Ɗ   # Following as a monad:
                                         wⱮØD;€”:¤      # - Find the position of every sublist that comprises of a digit followed by a colon
                                                  œP    # - And split at these
                                                     ḢḊ # Take the first remaining part, and then remove the first character (which will be the space left just after the original chapter:verse marker)
💎
added 109 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 17
  • 43
Loading
deleted 2144 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 17
  • 43
Loading
deleted 2144 characters in body
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 17
  • 43
Loading
Source Link
Nick Kennedy
  • 21.2k
  • 3
  • 17
  • 43
Loading