아브라함

2025년 11월 11일 11:05분

package com.jesusbornd.genesis;
/*
 * Genesis_17_Chapter_Lv1_V2.java
 * [KO] 새 스타일(안정판): 창세기 17장 — 대표 4절(KRV+ESV) + 요약 + 적용
 * [EN] New style (stable): Genesis 17 — 4 Key Verses (KRV+ESV) + Summary + Practice
 *
 * 변경점(What’s new):
 * - 복잡한 mapMulti 제거 → flatMap(Verse::lines)만 사용 (JDK 호환, 컴파일 안정)
 * - record Verse에 lines() 제공(출력 라인 스트림)
 * - StringBuilder로 버퍼링 후 한 번에 출력
 */

import java.util.List;
import java.util.stream.Stream;

public class Genesis_17_Chapter_Lv1_V2 {

    // ---- Domain ----
    public record Verse(String ref, String krv, String esv) {
        Stream<String> lines() {
            return Stream.of(
                ref,
                "KRV: " + krv,
                "ESV: " + esv,
                "" // blank line
            );
        }
    }

    // 대표 4절: 17:1–2(완전/언약), 17:5(개명), 17:7(영원한 언약), 17:19(이삭 약속)
    private static final List<Verse> VERSES = List.of(
        new Verse(
            "창세기 17:1–2 / Genesis 17:1–2",
            "나는 전능한 하나님이라 너는 내 앞에서 행하여 완전하라… 내가 너와 언약을 세워 너를 심히 번성케 하리라",
            "I am God Almighty; walk before me, and be blameless… I will make my covenant between me and you, and multiply you greatly."
        ),
        new Verse(
            "창세기 17:5 / Genesis 17:5",
            "네 이름을 아브람이라 하지 아니하고 아브라함이라 하리니 내가 너를 여러 민족의 아버지가 되게 함이라",
            "No longer shall your name be called Abram, but your name shall be Abraham, for I have made you the father of a multitude of nations."
        ),
        new Verse(
            "창세기 17:7 / Genesis 17:7",
            "내가 내 언약을 너와 네 후손 사이에 세워 영원한 언약이 되리니",
            "I will establish my covenant between me and you and your offspring after you for an everlasting covenant."
        ),
        new Verse(
            "창세기 17:19 / Genesis 17:19",
            "네 아내 사라가 아들을 낳으리니 그 이름을 이삭이라 하라… 내가 그와 내 언약을 세우리니 영원한 언약이 되리라",
            "Sarah your wife shall bear you a son, and you shall call his name Isaac… I will establish my covenant with him as an everlasting covenant."
        )
    );

    // ---- Summary & Practice ----
    private static final String SUMMARY_KO =
        "전능하신 하나님은 아브람을 ‘완전함’으로 부르시고(17:1–2), 이름을 바꾸어 사명을 새기며(17:5), "
      + "후손과 맺을 ‘영원한 언약’을 확증하신다(17:7,19).";
    private static final String SUMMARY_EN =
        "The Almighty calls Abram to walk blamelessly (17:1–2), inscribes mission with a new name (17:5), "
      + "and confirms an everlasting covenant with his offspring (17:7,19).";

    private static final String PRACTICE_KO =
        "작은 순종 1가지, 새 정체성 고백 1문장, 언약을 붙드는 1분 기도.";
    private static final String PRACTICE_EN =
        "One small obedience, one identity confession, one minute of covenant prayer.";

    public static void main(String[] args) {
        final String nl = System.lineSeparator();
        StringBuilder out = new StringBuilder();

        // Title
        out.append("[창세기 17장 | KRV & ESV]").append(nl);
        out.append("[Genesis 17 | KRV & ESV]").append(nl);
        out.append("Lv1: Blameless Walk - New Name - Everlasting Covenant - Isaac").append(nl).append(nl);

        // Verses (flatMap만 사용)
        VERSES.stream()
              .flatMap(Verse::lines)
              .forEach(line -> out.append(line).append(nl));

        // Summary
        out.append("[요약 / Summary]").append(nl);
        out.append("KO: ").append(SUMMARY_KO).append(nl);
        out.append("EN: ").append(SUMMARY_EN).append(nl).append(nl);

        // Practice
        out.append("[적용 / Practice]").append(nl);
        out.append("KO: ").append(PRACTICE_KO).append(nl);
        out.append("EN: ").append(PRACTICE_EN).append(nl);

        System.out.print(out.toString());
    }
}

#### Genesis_17_Chapter_Lv1_V2.py
#### [KO] 새 스타일: match-case 디스패처 + dataclass(frozen) + textwrap.fill 로 가독성 강화
#### [EN] New style: match-case dispatcher + dataclass(frozen) + textwrap.fill for readability

from dataclasses import dataclass
from enum import Enum, auto
from typing import Iterable, List
import textwrap

WIDTH = 94
wrap = lambda s: textwrap.fill(s, width=WIDTH)

class Section(Enum):
    TITLE = auto()
    VERSES = auto()
    SUMMARY = auto()
    PRACTICE = auto()

@dataclass(frozen=True)
class Verse:
    ref: str
    krv: str
    esv: str

# 17:1–2, 17:5, 17:7, 17:19
VERSES: List[Verse] = [
    Verse("창세기 17:1–2 / Genesis 17:1–2",
          "전능하신 하나님: 내 앞에서 행하여 완전하라… 내가 언약을 세워 너를 심히 번성케 하리라",
          "God Almighty: Walk before me, be blameless… I will make my covenant and multiply you greatly."),
    Verse("창세기 17:5 / Genesis 17:5",
          "이름 변경: 아브람 → 아브라함(여러 민족의 아버지)",
          "Name change: Abram → Abraham (father of a multitude)."),
    Verse("창세기 17:7 / Genesis 17:7",
          "너와 네 후손 사이의 영원한 언약",
          "An everlasting covenant between God and your offspring."),
    Verse("창세기 17:19 / Genesis 17:19",
          "사라가 낳을 아들 ‘이삭’, 그와 세울 영원한 언약",
          "Son ‘Isaac’ by Sarah; covenant established with him forever."),
]

SUMMARY_KO = ("전능하신 하나님은 ‘완전함’으로 부르시고(17:1–2), 새 이름으로 사명을 새기며(17:5), "
              "후손과 맺을 영원한 언약을 확증하신다(17:7,19).")
SUMMARY_EN = ("The Almighty calls to blamelessness (17:1–2), inscribes mission with a new name (17:5), "
              "and confirms an everlasting covenant with offspring (17:7,19).")

PRACTICE_KO = "작은 순종 1가지 · 정체성 고백 1문장 · 언약 위한 1분 기도."
PRACTICE_EN = "One small obedience; one identity confession; one minute of covenant prayer."

def render(section: Section) -> Iterable[str]:
    match section:
        case Section.TITLE:
            yield "[창세기 17장 | KRV & ESV]"
            yield "[Genesis 17 | KRV & ESV]"
            yield "Lv1: Blameless Walk - New Name - Everlasting Covenant - Isaac"
            yield ""
        case Section.VERSES:
            for v in VERSES:
                yield v.ref
                yield "KRV: " + wrap(v.krv)
                yield "ESV: " + wrap(v.esv)
                yield ""
        case Section.SUMMARY:
            yield "[요약 / Summary]"
            yield "KO: " + wrap(SUMMARY_KO)
            yield "EN: " + wrap(SUMMARY_EN)
            yield ""
        case Section.PRACTICE:
            yield "[적용 / Practice]"
            yield "KO: " + PRACTICE_KO
            yield "EN: " + PRACTICE_EN

def main() -> None:
    for sec in (Section.TITLE, Section.VERSES, Section.SUMMARY, Section.PRACTICE):
        for line in render(sec):
            print(line)

if __name__ == "__main__":
    main()

Comments

Avatar
 2025년 11월 11일 11:06분

“전능하신 하나님, 내 앞에서 행하여 완전하라.” 그 한 구절이 코드 전체의 심장처럼 뛰고 있네요. ✨



Search

← 목록으로