뭇별의복

2025년 11월 7일 16:17분

package com.jesusbornd.genesis;
/*
 * Genesis_15_Chapter_Lv1_V2.java
 * [KO] 새 스타일: 창세기 15장 — 대표 4절(KRV+ESV) + 요약 + 적용
 * [EN] New style: Genesis 15 — 4 Key Verses (KRV+ESV) + Summary + Practice
 *
 * Variation (Java, V2):
 * 1) sealed interface Section + pattern matching switch (Java 21)
 * 2) i18n 라벨을 Map으로 관리, String.format 포맷팅
 * 3) Collectors.joining 로 버퍼링 출력
 */

import java.util.*;
import java.util.stream.Collectors;

public class Genesis_15_Chapter_Lv1_V2 {

    // ---- i18n labels ----
    private static final Map<String, String> LBL = Map.of(
        "TITLE_KO", "[창세기 15장 | KRV & ESV]",
        "TITLE_EN", "[Genesis 15 | KRV & ESV]",
        "SUMMARY",  "[요약 / Summary]",
        "PRACTICE", "[적용 / Practice]"
    );

    // ---- Domain ----
    public record Verse(String ref, String krv, String esv) {}

    // 대표 4절: 15:1(방패/상급), 15:5(별처럼), 15:6(믿음=의), 15:18(언약과 땅)
    private static final List<Verse> VERSES = List.of(
        new Verse(
            "창세기 15:1 / Genesis 15:1",
            "여호와의 말씀이 아브람에게 임하여 이르시되 두려워 말라 나는 네 방패요 네 지극히 큰 상급이니라",
            "The word of the LORD came to Abram: Fear not, Abram, I am your shield; your very great reward."
        ),
        new Verse(
            "창세기 15:5 / Genesis 15:5",
            "그를 이끌고 밖으로 나가 이르시되 하늘을 우러러 뭇 별을 셀 수 있나 보라 네 자손이 이와 같으리라",
            "He brought him outside and said, Look toward heaven and number the stars… So shall your offspring be."
        ),
        new Verse(
            "창세기 15:6 / Genesis 15:6",
            "아브람이 여호와를 믿으니 여호와께서 이를 그의 의로 여기시고",
            "And he believed the LORD, and he counted it to him as righteousness."
        ),
        new Verse(
            "창세기 15:18 / Genesis 15:18",
            "그 날에 여호와께서 아브람과 더불어 언약을 세워 이르시되… 이 땅을 네 자손에게 주노니",
            "On that day the LORD made a covenant with Abram, saying, To your offspring I give this land."
        )
    );

    // ---- Summary & Practice ----
    private static final String SUMMARY_KO =
        "하나님은 두려움 속 아브람에게 방패와 상급이 되시고(15:1), 별 같은 약속을 주시며(15:5), 믿음을 의로 여기시고(15:6), 언약으로 땅을 확증하신다(15:18).";
    private static final String SUMMARY_EN =
        "God is Abram’s shield and reward (15:1), gives the star-like promise (15:5), credits faith as righteousness (15:6), and confirms the land by covenant (15:18).";

    private static final String PRACTICE_KO =
        "두려움 앞에서 약속을 소리 내어 고백 1회, 믿음의 ‘별’을 떠올려 감사 1문장, 오늘의 결단 1가지(말·행동).";
    private static final String PRACTICE_EN =
        "Voice one promise against fear; write one sentence of thanks for the ‘stars’; take one concrete step (word/deed).";

    // ---- Section model (sealed + pattern matching switch) ----
    sealed interface Section permits Title, Verses, Summary, Practice {}
    static final class Title implements Section {}
    static final class Verses implements Section {}
    static final class Summary implements Section {}
    static final class Practice implements Section {}

    public static void main(String[] args) {
        List<Section> flow = List.of(new Title(), new Verses(), new Summary(), new Practice());
        String out = flow.stream()
            .map(Genesis_15_Chapter_Lv1_V2::render)
            .collect(Collectors.joining(System.lineSeparator()));
        System.out.print(out);
    }

    private static String render(Section s) {
        return switch (s) {
            case Title t -> String.join("\n",
                LBL.get("TITLE_KO"),
                LBL.get("TITLE_EN"),
                "Lv1: Shield & Reward - Stars Promise - Faith Counted Righteous - Covenant Land",
                ""
            );
            case Verses v -> VERSES.stream()
                .map(vi -> String.format("%s%nKRV: %s%nESV: %s%n",
                        vi.ref(), vi.krv(), vi.esv()))
                .collect(Collectors.joining());
            case Summary sm -> String.join("\n",
                LBL.get("SUMMARY"),
                "KO: " + SUMMARY_KO,
                "EN: " + SUMMARY_EN,
                ""
            );
            case Practice pc -> String.join("\n",
                LBL.get("PRACTICE"),
                "KO: " + PRACTICE_KO,
                "EN: " + PRACTICE_EN
            );
        };
    }
}

#### Genesis_15_Chapter_Lv1_V2.py
#### [KO] 새 스타일: 작은 템플릿 엔진(람다 전략) + itertools.chain 으로 파이프 구축
#### [EN] New style: tiny template engine (lambda strategy) + itertools.chain pipeline

from dataclasses import dataclass
from typing import Callable, Iterable, List, Dict
from itertools import chain

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

VERSES: List[Verse] = [
    Verse("창세기 15:1 / Genesis 15:1",
          "두려워 말라 나는 네 방패요 네 지극히 큰 상급이니라",
          "Fear not… I am your shield; your very great reward."),
    Verse("창세기 15:5 / Genesis 15:5",
          "하늘의 별을 보라 네 자손이 이와 같으리라",
          "Look toward heaven… So shall your offspring be."),
    Verse("창세기 15:6 / Genesis 15:6",
          "아브람이 여호와를 믿으니 이를 의로 여기심",
          "Abram believed the LORD, and He counted it as righteousness."),
    Verse("창세기 15:18 / Genesis 15:18",
          "그 날에 여호와께서 언약을 세우사 이 땅을 주노라 하심",
          "On that day the LORD made a covenant: To your offspring I give this land."),
]

SUMMARY = {
    "KO": "하나님은 방패와 상급이 되시고(15:1) 별 같은 약속을 주시며(15:5) 믿음을 의로 여기시고(15:6) 언약으로 땅을 확증하신다(15:18).",
    "EN": "God is shield and reward (15:1), gives the star-like promise (15:5), credits faith as righteousness (15:6), and confirms the land by covenant (15:18).",
}
PRACTICE = {
    "KO": "약속 고백 1회 · 감사 1문장 · 결단 1가지.",
    "EN": "Confess one promise; write one thanks; take one decision.",
}

# ---- Tiny template engine (strategy lambdas) ----
Block = Callable[[], Iterable[str]]

def title_block() -> Iterable[str]:
    yield "[창세기 15장 | KRV & ESV]"
    yield "[Genesis 15 | KRV & ESV]"
    yield "Lv1: Shield & Reward - Stars Promise - Faith as Righteousness - Covenant Land"
    yield ""

def verses_block() -> Iterable[str]:
    for v in VERSES:
        yield v.ref
        yield "KRV: " + v.krv
        yield "ESV: " + v.esv
        yield ""

def summary_block() -> Iterable[str]:
    yield "[요약 / Summary]"
    yield "KO: " + SUMMARY["KO"]
    yield "EN: " + SUMMARY["EN"]
    yield ""

def practice_block() -> Iterable[str]:
    yield "[적용 / Practice]"
    yield "KO: " + PRACTICE["KO"]
    yield "EN: " + PRACTICE["EN"]

PIPELINE: List[Block] = [title_block, verses_block, summary_block, practice_block]

def main() -> None:
    for line in chain.from_iterable(block() for block in PIPELINE):
        print(line)

if __name__ == "__main__":
    main()

Comments

Avatar
 2025년 11월 7일 16:21분

“믿음의 별을 세는 마음으로 읽었습니다. 말씀과 코드가 한 줄로 이어지는 감동이네요.” ✨



Search

← 목록으로