I gotta have my orange juice.

Jesu, Juva

Holy Trinity

leave a comment »

holy-trinityLetham, Robert. The Holy Trinity: In Scripture, History, Theology and Worship. Phillipsburg, NJ: P & R Publishing, 2005.

This is an outstanding book. Letham begins with an overview of the Biblical doctrine of the trinity. He then describes the historical development of the doctrine of the trinity from the early church to the present, covering both the orthodox and heterodox. The book closes with an excellent overview of how the trinity ought to inform our life and worship.

While the entire book is very good, this closing section is the best part. Christianity is inescapably trinitarian: God’s nature is fundamentally triune, and His relation to man, through creation, revelation, salvation and glorification, is an unavoidable expression of His triunity. Yet so often our life and worship is practically unitarian. Letham wants to see the church recover an essential trinitarian life and worship, and this God-glorifying focus is very refreshing. Letham develops how this appropriate focus on the trinity will have vital practical outworking in our salvation, sanctification, worship, prayer, evangelism, and sacrificial love for fellow believers with whom we are united to Jesus.

Letham encourages us to see the trinity as expressed through all of reality, and to enjoy unity in diversity and diversity in unity. This contrasts on the one hand with postmodernism’s diversity without unity, and on the other hand Islam’s unity without diversity. Only Trinitarianism can understand a reality that is both united and diverse. (This echoes Van Til’s apologetic emphasis on the problem of the one and the many, to which only Trinitarian Christianity has an answer.)

It seems to me that an appropriate focus on the gospel must result in an appropriate understanding and focus on the trinity. Even more clearly than in creation, the gospel showcases both the unified and diverse act of God in saving us. Each person of the trinity plays a distinct role in our salvation, but the unity of God’s purpose and action in saving us is also clear.

Following are several quotes that struck me while reading this book:

Quoting Gregory Nazianzen, Oration on Holy Baptism:

This I give you to share, and to defend all your life, the one Godhead and power, found in the three in unity, and comprising the three separately; not unequal, in substances or natures, neither increased nor diminished by superiorities or inferiorities; in every respect equal, in every respect the same; just as the beauty and the greatness of the heavens is one; the infinite conjunction of three infinite ones, each God when considered in himself; as the Father, so the Son; as the Son, so the Holy Spirit; the three one God when contemplated together; each God because consubstantial; one God because of the monarchia. No sooner do I conceive of the one than I am illumined by the splendour of the three; no sooner do I distinguish them than I am carried back to the one. When I think of any one of the three I think of him as the whole, and my eyes are filled, and the greater part of what I am thinking escapes me. I cannot grasp the greatness of that one so as to attribute a greater greatness to the rest. When I contemplate the three together, I see but one torch, and cannot divide or measure out the undivided light.

On the filioque and Jesus’ eternal submission (but not subordination) to the Father (p. 401), reminding us that God is who He has objectively revealed Himself to be:

The economic Trinity is a reliable gauge of the immanent trinity, owing to the faithfulness of God [emphasis mine]. [Quoting Jurgen Moltmann], “One cannot say, therefore, that something holds true in God’s revelation, but not in God’s being.”

Quoting Sergius Bulgakov, The Orthodox Church:

The dogma of the Holy Trinity is not only a doctrinal form, but a loving Christian experience which is constantly developing; it is a fact of the Christian life. For life in Christ unites with the Holy Trinity, gives a knowledge of the Father’s love and the gifts of the Holy Spirit. There is no truly Christian life, apart from knowledge of the Trinity; this is abundantly witnessed in Christian literature.

Written by Scott Moonen

April 11, 2005 at 4:39 pm

Gödel, Escher, Bach: an Eternal Golden Braid

with 2 comments

Hofstadter, Douglas. Gödel, Escher, Bach: an Eternal Golden Braid. New York: Basic Books, 1999.

This book is an excellent and fun, if lengthy, romp through art (visual, literary, and musical), mathematics, logic, provability and computability, linguistics, cognitive science and artificial intelligence, and more. Hofstadter cleverly explores a myriad of amazing connections between all these fields. And while he ends up drawing no substantive conclusions about his final hypothesis of emergent intelligence, the journey is no less exciting.

I disagree with Hofstadter’s opinion of the nature of intelligence. But I thoroughly enjoyed this book for a number of reasons. First, despite its imposing size, it is accessible; Hofstadter presents mathematical proofs in an easily understood way, using examples, analogies, and much explanatory prose. Second, despite its imposing size, it is delightfully fun; this book is brimming with humor, wit, cleverness, and exciting coincidences. Lastly, it is an excellent introduction to a broad variety of topics.

I first read this book in eighth grade and deeply enjoyed it. In part this book served as my introduction to the exciting fields of logic, mathematics, and computer science.

Written by Scott Moonen

March 25, 2005 at 11:01 am

Biblical Theology

with 2 comments

biblical-theologyVos, Geerhardus. Biblical Theology. Carlisle, PA: Banner of Truth, 1996.

In this book Vos presents an expansive summary of Biblical theology. In this case, Biblical theology is a technical term that means the study of the history of theological development in Scripture. Biblical theology as a discipline seeks to understand what Israel understood about God throughout Biblical history, and what God was intending to teach Israel as He progressively revealed himself to them.

Vos is reformed, and he presents a compelling view not simply of a sovereign and glorious Creator and Redeemer, but of a Creator who has had one plan for all of history. Vos demonstrates the continuity of God’s revelation and covenants, showing how each progressive stage fits into God’s revealed eternal plan. I had never seen this demonstrated so powerfully before; this was very encouraging for me to read.

In particular, I was struck by Vos’s presentation of God’s law. Vos reminds us that God has always intended to save by grace alone, and that even in the Old Testament it was not obedience to the law that brought salvation, but rather obedience filled with faith in a God of grace. In Romans Paul discusses his pre-conversion understanding of God’s law. Forgetting Paul’s reminder that Abraham was saved by faith, not works, I sometimes think that Paul’s legalistic pre-conversion understanding of the law was right! But Vos reminds us that law and grace are not at odds; that the law is good and gracious; and that as much as we are now freed from bondage to the law, God never intended to save by anything other than grace.

I understand that Vos had not fully completed this book by the time of his death, and so his treatment of the New Testament is somewhat less extensive than his treatment of the Old Testament. But this book is still a tremendously valuable survey of God’s self-revelation and dealings with man throughout scripture.

Written by Scott Moonen

March 24, 2005 at 1:44 pm

Love of God

with 4 comments

love-of-godCarson, D. A. The Difficult Doctrine of the Love of God. Wheaton, IL: Crossway Books, 2000.

Carson presents a brief and beautiful affirmation both of God’s transcendent sovereignty, but also the genuineness of God’s love as an affection, both to the elect in particular but also to mankind in general.

Often we tend to force God into convenient little boxes and categories, forgetting that He is far above and beyond our understanding. We know that the doctrines of grace guard against universalism; Carson shows that we must also have a full understanding of God’s love, guarding against the hypercalvinist tendency to see the world exclusively through the lens of God’s decrees.

I recommend this book very highly.

Quotes

For my own purposes I’ve kept an outline and some quotes of this book:

Chapter 1, On Distorting the Love of God

Why the doctrine of the love of God must be judged difficult:

  1. Love is the least doubted of God’s attributes, but often understood in an un-Biblical light. Christians must understand and present it rightly.
  2. So many other attributes (justice, holiness, …) of God are disbelieved today. Christians must understand and rightly present how God’s love relates to his other attributes.
  3. Postmodernism emphasizes a sentimental, syncretistic God. This presents a particular challenge to those representing a Biblical understanding of God’s love.
  4. Within confessional Christianity, how do we understand God’s love relating to evil in the world? How do we understand God’s love relating to his justice?
  5. Christians tend to over-simplify God’s love compared to the Bible’s portrayal.

Five distinguishable ways the Bible speaks of the love of God (not exclusive):

  1. The peculiar love of the Father for the Son, and of the Son for the Father (p. 16).
  2. God’s providential love over all that he has made (p. 16).
  3. God’s salvific stance toward his fallen world (p. 17). Comments on sense of “world” in John 3:16.
  4. God’s particular, effective, selecting love toward his elect (p. 18).
  5. Finally, God’s love is sometimes said to be directed toward his own people in a provisional or conditional way — conditioned, that is, on obedience (p. 19). Comments on “remaining in God’s love”, and on texts expressing conditional aspects of God’s love.

Three preliminary observations

  1. If we absolutize any one of these ways of understanding God’s love, we will lose sight of vital aspects of God’s character (p. 21). “In short, we need all of what Scripture says on this subject, or the doctrinal and pastoral ramifications will prove disastrous.” (23)
    1. Intra-Trinitarian love -> lose redemption
    2. Providential love -> lose God’s personality
    3. Common grace love -> lose force and power of saving grace
    4. Salvific love -> lose common grace love
    5. Conditional love -> fall into merit legalism
  2. God’s love is unified, not compartmentalized. All of God’s attributes stand in relation to one another.
  3. Many evangelical cliches about God’s love are true in some sense, but not generally true. “It is pastorally important to know what passages and themes to apply to which people at any given time.” (24)

“Christian faithfulness entails our responsibility to grow in our grasp of what it means to confess that God is love.” (24)

Chapter 2, God is Love

Carson argues against the consideration of agape as a mere willed altruism.

He is concerned that we not argue from God’s impassibility to his lacking emotion. Quoting Charles Hodge:

Love of necessity involves feeling, and if there be no feeling in God, there can be no love. . . . We must adhere to the truth in its Scriptural form, or we lose it altogether. We must believe that God is love in the sense in which that word comes home to every human heart. The Scriptures do not mock us when they say, “Like as a father pitieth his children, so the Lord pitieth them that fear Him (Ps. 103:13).” (29)

Carson is concerned that we not pursue “methodologically flawed word studies”, but rather pay attention to context, and broad themese of redemptive history.

Chapter 3, God’s Love and God’s Sovereignty

  1. God’s love has an affective element.
    • 1 Cor 13 — it is possible to have incredible altruism and be without love. agape is not merely “willed commitment to the other’s good”.
    • Hosea 11 speaks in very emotionally intense terms about God’s love and devotion for Israel.
    • God is not relenting per se; the judgment+exile will still come. But it will end.
    • Emotional expressions common in prophets. God is jealous, abounding in lovingkindness.
    • God grieves, rejoices, has intense wrath, pities, and loves with an everlasting love.
    • Our love to be modeled after God’s (1 John 4:7-11).
    • God is in some sense impassable, “without … passions” (WCF). But this does not mean that God is without emotion. Rather, God is unchangeable, not given to mood swings, nor dependent on his creatures.
  2. God is sovereign and transcendent.
    1. God is utterly sovereign (omnipotent and omniscient, over people and things) and transcendent.
    2. God’s sovereignty extends to election — of the nation of Israel, of God’s people, and individuals.
      • Acts speaks unashamedly of those “appointed to eternal life”.
      • Election extends even to angels (1 Tim 5:21), so is not limited to salvation.
      • God’s electing love is immutable; he will lose none of those he has saved.
    3. Christians are not fatalists.
      • We do not sacrifice either God’s sovereignty or our responsibility — compatibilism.
      • Both are affirmed, so fatalism is denied. We do not understand how they reconcile.
      • Though man intends evil, God is always at work through men’s actions for his good purpose.
      • Compatibilism is necessary, otherwise 1) the cross is an accident, or 2) there is no responsibility for sin, and no need for atonement.
    4. God is immutable, unchangeable. Ps 102:27, Mal 3:6, Isa 46:8-11, Ps 33:11
      • “God’s immutability . . . engenders stability and elicits worship.” (54)
      • God “is unchanging in his being, purposes, and perfections. But this does not mean he cannot interact with his image-bearers in their time. . . . Even the most superficial reading of Scripture discloses God to be a personal Being who interacts with us. None of this is meant to be ruled out by immutability.” (55)
    5. God’s sovereignty is under attack both by process theologians and open theists.
      • What of God’s repenting and relenting? “God relents over a step he has already taken . . . what he has said he would do or even started doing, sometimes in response to the prayer of an intercessor.”
      • The key is not an internal change in God, but an external change in what God is doing.
      • Still a mystery here how our responsibility and actions relate to God’s sovereignty.
      • We can somewhat imagine God’s sovereignty by extrapolating authority and power, and by thinking of transcendence apophatically.
      • God’s being personal is hard to understand because he never grows in his knowledge of us.
      • But it is clearly taught in scripture, and most clearly revealed in the person of Jesus.
      • Neither God’s personhood nor his sovereign transcendence must be elevated to the exclusion of the other (open theism vs. hypercalvinism).
  3. God’s impassibility is a personal, loving, emotional impassibility.
    • What space is left for emotions in a sovereign, transcendent, all-knowing God?
    • God “knows the end from the beginning, cannot be surprised, and remains in charge of the whole thing anyway.”
    • Cannot deny God’s emotions. Much biblical evidence to the contrary, and this leaves us “[resting] in God’s sovereignty, but . . . no longer [rejoicing] in his love.” His love is not an anthropopathism. “Give me a break. Paul did not pray that his readers might be able to grasp the height and depth and length and breadth of an anthropopathism and know this anthropopathism that surpasses knowledge (Eph. 3:14-21).” (59)
    • Must not insist on impassable immanent Trinity but economic Trinity that is able to suffer.
    • Must not divorce God as he is in himself from God as he interacts with creation.
    • But impassibility is “trying to ward off the kind of sentimentalizing view of the love of God and of other emotions (‘passions’) in God that ultimately make him a souped-up human being but no more” (60). Not deny God’s sovereignty, power, authority, aseity, infinitude.
    • God’s love is real but exists in relation to his knowledge, power, will, justice, holiness.
    • So his emotion does not make him vulnerable to external contingency. But at the same time his will and power are never exercised independent of his love.
    • “God’s ‘passions’, unlike ours, do not flare up out of control. . ., are displayed in conjunction with the fullness of all his other perfections.” (60)
    • So God’s love is different from ours, but no less a real emotion.
    • Guards various truths. God doesn’t ‘fall in love’ with us, but sets his affections on us. He doesn’t predestine us capriciously, but in love.
    • God’s love is always exercised in concert with all his attributes; and it is dependent on his loving character, not our loveliness. This, then, is a model for Christian love.

Chapter 4, God’s Love and God’s Wrath

With a sentimental view of God’s love, people assume that God is bound to forgive sin.

  1. God’s love and wrath
    1. God is often represented in violent, judicious, angry, wrathful ways. Like love, wrath includes an emotional aspect, and this cannot be denied even for the sake of impassibility.
      • Wrath is a product of holiness and sin, not a first-class attribute of God.
      • To depersonalize God’s wrath is to diminish his holiness.
      • To distinguish economic-trinity wrath from immanent-trinity wrath is to limit God’s holiness to dealings with man.
    2. Reconciling God’s love and wrath
      • God hates the sin. It is true hate is not his only posture to the sinner, but God’s hatred and wrath do rest on both sin (Rom 1:18ff) and sinner (John 3:36).
      • Human experience separates love and wrath.
      • But “God’s wrath is not an implacable, blind rage. However emotional it may be, it is an entirely reasonable and willed response to offenses against his holiness. But his love . . . wells up amidst his perfections and is not generated by the loveliness of the loved. Thus there is nothing intrinsically impossible about wrath and love being directed toward the same individual or people at the same time. God in his perfections must be wrathful against his rebel image-bearers, for they have offended him; God in his perfections must be loving toward his rebel image-bearers, for he is that kind of God” (69).
    3. Misconceptions
      1. OT more about God’s wrath, NT more about his love. Perhaps main reason for this is that manifestation of God’s wrath in OT is more temporal, in NT more eternal. OT manifests both love and wrath in “experience and types”, and both become “clearer” and “ratcheted up” in NT. Both God’s love and wrath are perfectly manifested in the cross. “Do you wish to see God’s love? Look at the cross. Do you wish to see God’s wrath? Look at the cross” (70-71).
      2. Father full of wrath, Jesus mollifies him. Some truth to this; Hebrews’ picture of Jesus as constantly interceding high priest. 1 John 2:2 — Jesus as advocate.
      3. Yet God loved the world (Jn 3:16). “Here it is not that God is reluctant while his Son wins him over; rather, it is God himself who sends his son. Thus (to return to Hebrews), even if our great high priest intercedes for us and pleads his own blood on our behalf, we must never think of this as an independent action that the Father somehow did not know about or reluctantly approved” (72). Picture is complex. Father and son both full of wrath, and both loving us so much that they sent/came.
      4. Revelation speaks of the “wrath of the Lamb”; full Godhead “is both the subject and the object of propitiation” (72)
  2. The Love of God and the Intent of the Atonement
    • Limited atonement -> definite atonement. God’s intent for the cross was different for the elect than for the non-elect. Much scripture speaks of the specificity of Jesus’s saving work for his people. But Arminians cite texts indicating God’s love for the world, and it is stilted in many places to read “the world” in a limited fashion. This hearkens back to ch. 1 — neither of these understandings of God’s love (towards elect, non-elect) should be absolutized.
    • “Surely it is best not to introduce disjunctions where God himself has not introduced them. If one holds that the Atonement is sufficient for all and effective for the elect, then both sets of texts are accommodated” (76).
    • Has observed a gradual shift in categories of debate from Calvin forward that moves from conjunction to disjunction.
    • “God is a person. Surely it is unsurprising if the love that characterizes him as a person is manifest in a variety of ways toward other persons. But it is always love, for all that.” (77)
    • Unlimited effectiveness allows us to preach the gospel to all, extend invitation to all, assure all of God’s love.
    • Particular extent gives us pastoral assurance, since the ground of our salvation and our perseverance is not in ourselves.
  3. God loves the world in a compassionate way; we are to have this sort of love for the world. We are not to love the things of the world, nor desire to be like the world (1 John 2:15-17).
  4. Concluding thoughts
    1. God loves us as a parent, disciplines us as a parent. This means that we are responsible in some sense to “love him and keep his commandments”. While his saving love and ultimate disposition to us are unconditional, there is some conditional sense in his face toward us.
    2. “The love of God is not merely to be analyzed, understood, and adopted into holistic categories of integrated theological thought. It is to be received, to be absorbed, to be felt” (80-81). Eph 3:14-21
    3. God’s love is sufficiently powerful to save and transform anyone. Our love toward others should be full of hope in the power of grace.

Back to original 5 categories:

  1. God’s intra-Trinitarian love “ensures the plan of redemption” (82).
  2. God’s providential love cares for us and preserves us even when wrath would destroy us.
  3. God’s inviting love “compels us, because we are convinced that one died for all, and therefore all died. And he died for all, that those who live should no longer live for themselves but for him who died for them and was raised again” (2 Cor 5:14-15)
  4. God’s elective love gently draws us to him, opens our eyes, and secures our salvation.
  5. God’s fatherly love sanctifies us and preserves us, helping us to grow in obedience and holiness.

Our response is to love God with all our being!

Written by Scott Moonen

February 1, 2005 at 5:23 am

Purpose-driven life

leave a comment »

Warren, Rick. The Purpose-Driven Life. Grand Rapids, MI: Zondervan, 2002.

I am delighted to see a popular book that exhorts Christians to consider God first, and to remember that we are God’s and not our own. One of the overwhelming concerns of this book is countering self-centeredness and directing believers to God, and there are many helpful exhortations to this end. This is excellent.

However, there are some aspects of the book that I am concerned about:

  • Scripture. The book seems to play fast and loose with Scripture. Most scripture quotations are given entirely out of context, and many are used to argue points they were not intended to make, or at least were not intended to make conclusively or universally.
  • Holiness. God’s holiness is largely absent, while His love is heavily emphasized; this tends to give an inaccurate picture of God’s love. It’s not that the book doesn’t touch on sin and forgiveness; but it doesn’t convey the gravity of man’s sinful estate before a holy God. I would say that the true gospel seems almost absent.
  • The gospel. Beyond that, the book declares hope to unbelievers before it has portrayed their helplessness and need for mercy. The hope that is thus declared is a very false and shallow hope. And when the book finally does answer “what must I do” (pp. 58-59), there is only very oblique mention of our need for forgiveness, mercy, redemption, etc. How sad that this crucial aspect of the cross should be so neglected! The salvation thus proclaimed cannot be genuine salvation.
  • Sanctification. There is some imbalance between exhortation to obedience and faith, and a reminder that obedience and faith are empowered by the Spirit and grounded in the cross. Both are present, though the latter isn’t attested to nearly as much; this frequently lends the impression that obedience is to be in our own strength.
  • Suffering. There is little mention of genuine suffering in this book. The apostle Peter goes so far as to say that “you were called for this purpose” — namely, to patiently and joyfully endure suffering for God’s glory. Without an acknowledgment that we are called to be united with Christ in suffering, receiving his strength and reflecting his glory, this book is missing a significant aspect of God’s purpose in our lives for displaying his glory and refining and proving our faith. This leaves Christians ill prepared to endure suffering in faith.

I fear that this book will serve to leave unbelievers empty-handed, looking to Jesus as a source of tranquility, happiness, satisfaction, and purpose — but not as a mediator, redeemer, or savior. I also fear that, by leaving the gospel and the cross behind the scenes, it may serve to subtly distract the church from that which is most important.

As an alternative to The Purpose-Driven Life, I highly recommend C. J. Mahaney’s The Cross-Centered Life.

You may also be interested in 9 Marks Ministries‘ very helpful reviews of The Purpose-Driven Life, The Purpose-Driven Church, and 40 Days of Purpose.

Rick Warren also has his own website related to the book.

Written by Scott Moonen

January 13, 2005 at 10:24 am

Posted in Books

Tagged with , , ,

Comfort and Joy

leave a comment »

Discussion questions on chapters 7-8 of Christ Our Mediator, by C. J. Mahaney.

Summary

Chapter 7, What God Understands. Because of Jesus’s suffering, there is comfort to be found at the cross for the suffering Christian. The cross puts the degree of our suffering in perspective; our suffering, though very real, is light and momentary by comparison, for Jesus has suffered God’s full wrath for our sin. And as a result of His own suffering, Jesus understands our suffering intimately. But more than that, because He suffered for our sake, He brings real comfort to us in our own suffering: He intercedes for us before the Father, and He gives us the Holy Spirit.

Chapter 8, Assurance and Joy. Because of what Jesus has accomplished for us, there is joy to be found at the cross in the midst of our suffering as Christians. He suffered God’s wrath for our sake, to rescue us from that wrath and bring us mercy. All of our suffering is eclipsed by the staggering greatness of this gift, even moreso because we are entirely undeserving of God’s kindness. The cross assures us of God’s unfailing and personal love for us. The cross should be for us an unending source of “joy inexpressible and full of glory”.

Questions

  1. CJ quoted Spurgeon as writing that “we little know what we owe to our Savior’s prayers,” that not until heaven will we see the the full and amazing extent of Jesus’s intercession for us before the Father. Yet looking back even now, can you identify some specific ways in which it is clear that God has shown mercy and compassion to you in the midst of suffering? The goal here is both to build faith and also encourage thankfulness and praise.
  2. CJ describes a doctor dying of AIDS and writes that “Jesus was with [him and his wife]. That was all either of them needed to know. Because that is always enough. . . . He is always present. . . and that is sufficient.” What does it mean to say that Jesus is sufficient? ”We do not need anything other than Him, and we do not need anything more than Him.” How have you found this to be true in your life? How is Jesus present and sufficient for you here and now?
  3. Often we allow ourselves to be ruled by subjective feelings and appearances; we might feel that God has abandoned us, that He does not care or understand, or that a situation is insurmountable. When we are overwhelmed by feelings or appearances, the only counsel that the world has to offer is to convince ourselves we’re okay on the one hand, or on the other to grimly bear pain in our own strength. But for the Christian there are objective realities that bring genuine comfort and even joy in the midst of suffering. When we are tempted by subjective appearances to despair, what objective truths must we flee to as our anchor and hope? The gospel, the cross, the amazing and undeserved mercy God has shown us in our sin, God’s declaration of His eternal love, God’s faithfulness. . . When we are captivated by subjective appearances, why is it not only good, but right, to flee to the cross? By giving ourselves to subjectivity we are not merely misguided or short-sighted, but are living in unbelief.
  4. Read Habakkuk 3:17-19. In the midst of his trials, where was Habakkuk’s focus? In the God of his salvation. Why was this the right attitude for Habakkuk — and us — to have? God has proven His love (we can see this even more clearly than Habakkuk, since we look back on the cross); God’s kindness and salvation far outweigh our suffering; and we do not know better than God in His sovereignty, wisdom, and love. Does this attitude come naturally for Habakkuk, or us? Habakkuk struggled for three chapters, complaining to God, and only in the end came to realize what was most important. Likewise, in our suffering, we must exercise faith to have this outlook.
  5. CJ quotes Thomas Watson as writing that “your sufferings are not so great as your sins: put these two in the balance, and see which weighs heaviest.” When we consider the full weight of our sin, how does that put our suffering in perspective? First, we deserve far worse suffering. Second, God has been amazingly merciful to us. How should this provoke us to respond to suffering? With humility, gratefulness for mercy, joy.
  6. Read Galatians 2:20. CJ counsels us to flee to the cross as our only hope and the source of true joy. What encouragement can we draw from this verse in particular? Jesus is the source of our life; Jesus loves us personally; Jesus gave Himself for us personally. Why is Jesus’ personal love and sacrifice for us so amazing? First, God’s particular and personal love gives us great comfort and assurance: we haven’t stumbled upon His grace accidentally, but rather He set His love on us, individually. Second, the fact that He loved us beforehand, even knowing our sins, is humbling and amazing.
  7. God actually commands us to serve Him with joy (Ps. 100:2; Deut. 28:47-48). Obviously joy is not the fruit of a wooden obedience; CJ reminds us that our joy is found by seeing our savior and the cross with eyes of faith, exhorting us to “let the cross always be the treasure of your heart, your best and highest thought. . . and your passionate preoccupation.” What are some practical ways you have found helpful to keep the cross your “passionate preoccupation”? Study the gospels and epistles; study books on the cross; make the cross a regular subject of meditation, prayer, and song; . . .
  8. What are some of the many ways that considering the cross produces real joy? Name some specific ways the cross has brought comfort and joy to you in the past, or how it can bring comfort and joy to a present situation you are experiencing. This would be a good bridge to a time of spontaneous thanksgiving and praise in closing.
  9. Possible ways to close the meeting:
    • End with a time of prayer or praise to allow for spontaneous expressions of gratitude and joy in the cross.
    • Pray for those who are experiencing suffering, hardship, or trials.
    • Pray for those who desire greater assurance. While a lack of assurance is usually a sign of looking for it in the wrong place (emotions or self-righteousness rather than Christ), God does give us assurance in His word and by His Holy Spirit.

Written by Scott Moonen

November 24, 2004 at 11:11 am

Python odd word problem

leave a comment »

I crafted this compact solution to Dijkstra’s OddWordProblem:

from sys import stdin, stdout
def even(char) : stdout.write(char); return select(even, 0, "");
def odd(char)  : q = select(odd, 0, ""); stdout.write(char); return q
def select(fn, skipspace, prefix) :
  char = stdin.read(1)
  if char.isspace() and skipspace : return select(fn, 1, prefix)
  elif char.isspace()             : return 0
  elif char.isalpha()             : stdout.write(prefix); return fn(char)
  elif char == "."                : return 1
  else                            : raise "Invalid input"

if not select(even, 1, "") :
while not select(odd, 1, " ") and not select(even, 1, " ") : pass
stdout.write(".")

Written by Scott Moonen

November 10, 2004 at 5:36 am

Posted in Python

Tagged with ,

Python list partition

leave a comment »

I came up with these simple solutions to RonJeffries‘ CodingProblem. The first uses Python 2.2’s generators, the second uses the functional idiom, and the third uses list comprehensions. The third is my favorite:

def split1(list, num) :
  for index in range(num) :
    yield list[index * len(list) / num:(index + 1) * len(list) / num]

def split2(list, num) :
  return map(lambda x: list[x * len(list) / num:(x+1) * len(list) / num], range(num))

def split3(list, num) :
  return [list[x*len(list)/num : (x+1)*len(list)/num] for x in range(num)]

Written by Scott Moonen

November 9, 2004 at 2:10 pm

Posted in Python

Tagged with ,

Python Timestamp Increment

leave a comment »

I composed this concise solution to ncm‘s “coding challenge” in November 2004. I’m not entirely satisfied with its elegance, but I’m pleased with its brevity.

def dateinc(s) :
  def carry(list, modulus) :
    if len(list) == 1 : return [list[0] // modulus[0], list[0] % modulus[0]]
    else              : q = carry(list[1:], modulus[1:]); return [(list[0] + q[0]) // modulus[0], (list[0] + q[0]) % modulus[0]] + q[1:]
  s = reduce(lambda x,y:x+y, map(lambda x : (x >= '0' and x <= '9') * x, s))
  result = map(lambda x,y:x+y, map(int,(s[0:4],s[4:6],s[6:8],s[8:10],s[10:12],s[12:14])),(0,-1,-1,0,0,1))
  modulus = [10000,12,[31,28,31,30,31,30,31,31,30,31,30,31][result[1]],24,60,60]
  if result[0] % 4 == 0 and (result[0] % 100 != 0 or result[0] % 400 == 0) :
    modulus[2] += 1                               # Account for leap day.
  result = carry(result, modulus)[1:]             # Carry the extra second.
  result[1:3] = map(lambda x:x+1, result[1:3])    # Readjust to 1-base.
  return reduce(lambda x,y:x+y, map(lambda x : (x < 10) * '0' + str(x), result))

I further reduced this as follows, turning the carry function into a one-liner that computes the carry in-place (and also using builtins wherever possible). I’m much more satisfied with this solution.

def dateinc(s) :
  s = reduce(lambda x,y:x.isdigit()*x+y.isdigit()*y, s)
  ans = map(int.__add__, map(int,(s[0:4],s[4:6],s[6:8],s[8:10],s[10:12],s[12:14])),(0,-1,-1,0,0,1))
  mod = [10000,12,[31,28,31,30,31,30,31,31,30,31,30,31][ans[1]],24,60,60]
  if ans[0] % 4 == 0 and (ans[0] % 100 != 0 or ans[0] % 400 == 0) : mod[2] += 1
  ans = map(lambda x:(ans[x] + reduce(int.__mul__, map(lambda y:ans[y]>=mod[y]-1,range(x+1,len(ans))),x!=len(ans)-1)) % mod[x], range(len(ans)))
  ans[1:3] = map(int.__add__,ans[1:3],[1,1])      # Readjust to 1-base.
  return reduce(str.__add__, map(lambda x : (x < 10) * '0' + str(x), ans))

Written by Scott Moonen

November 9, 2004 at 12:52 pm

Posted in Python

Tagged with

Introduction to Pointers in C++

leave a comment »

Originally written in February 1998. At least one person seems to have found it useful. It’s a little incomplete, because it doesn’t deal with malloc and free, nor with C++ references. If you find this useful, feel free to copy and pass along, with attribution. Thanks!

Basics

All data and code are stored in memory. The location in memory where they are stored is known as the address of that data or code. Usually they are accessed through variable names that represent them, such as counter, printf, etc. We can, however, also access data using its address, rather than a formal name. This is done using pointers, special variables which store the address of data. Following are several annotated examples of simple pointers at work.

int*   x;                             // Declare x, a pointer to an integer.
int    y;                             // Declare y, an integer.
float* r;                             // Declare r, a pointer to a float.
float  s;                             // Declare s, a float.

x = &y;                               // x gets y's address -- it points to y.
r = &s;                               // r gets s's address -- it points to s.

The next few are a tad trickier. We use the “*” to dereference the pointer. Basically, this means to access whatever it is the pointer is pointing to. You can think of it as counteracting the “*” used in the declaration of the pointer; they neutralize each other, making the result a regular variable.

*x = 15;                              // Set value pointed to by x -- y -- to 15.
cout << *r;                           // Print value pointed to by r: s.

Complications

If it were that simple, of course, then nobody would have trouble with pointers. The fact of the matter is, however, that there are a number of complications — extensions to the idea of pointer — that can be hard to keep track of.

Pointers as Lists

The first is the idea of pointers being equivalent to lists. This is a crucial idea in C and C++. Essentially, instead of thinking of a pointer as pointing to a single variable, you can think of it as pointing to the first variable in a list of variables. Likewise, a list can be accessed without any subscripts to find the pointer to the first element in the list. It works like this:

int* x;
int  y[15];
 
x = new int[8];                       // Allocate array of 8 integers.

*y   = 8;                             // Set first element of y-list to 8.
x[3] = 7;                             // Set fourth element of x-list to 7.

Note how pointer notation can be used for the list y, and how list notation can be used for the pointer x.

This brings up a similar topic: pointer arithmetic. Since a pointer is a memory address, you might think that adding 1 to a pointer would simply make it point to the next byte of memory. The C compiler, however, is smarter than that; it realizes that you’re adding something to a pointer, you probably want to make it point to the next element of whatever you’re pointing at. So instead of adding whatever you specified to the pointer, it adds that times the size of the object the pointer points to. For example:

int* x = new int[8];

x++;                                  // Add four to x pointer, to
                                      //   point at next integer.
x[0] = 5;                             // This was originally the second
                                      //   element in the array.
x--;                                  // Subtract 4 again from pointer.
*(x + 2) = 6;                         // Set third element (second after the
                                      //   first) to 6.

cout << x[1];                         // Will now print "5".
cout << x[2];                         // Prints "6".

Pointers to Pointers (aka “The Middleman”)

Another pointer curiosity that C throws our way is pointers that point to other pointers. This may seem like a needless feature, but it comes in very handy when you have multidimensional data whose size you don’t know before-hand. You can then use these pointers to pointers to set up an arbitrary-sized multidimensional array.

It works like this: you can think of a pointer to a pointer as being essentially a list of lists. It’s kind of like the words in the dictionary: the first pointer tells you where to find each of the lists for the letters of the alphabet. Each letter is then itself a pointer that forms a list (by pointing to the first element) of all of the words beginning with that letter. If you add another dimension (and make a pointer to a pointer to a pointer), you can have each word also be a list, pointing to the first out of several different meanings for the word.

Here’s how it works in C++. The following program reads in a table of numbers and finds the average for each row and column. The first two numbers it reads in tell how many rows and columns there are. The rest of the numbers are the ones in the table.

#include <iostream.h>

void main(void)
{
  int** table;                        // *Two*-dimensional pointer.
  int   rows, cols, i, j, sum;        // Dimensions of table.

  cin >> rows >> cols;                // Find out the number of rows & cols.

// What we'd really like to do here is say:
//   table = new int[rows][cols];
// Unfortunately, this doesn't work in C++, since it instead tries to set up
// a one-dimensional array like this:
//   table = new int[rows * cols];
// And a one-dimensional array (a pointer to integers) is absolutely
// incompatible with a two-dimensional array (a pointer to a pointer to
// integers), so our program will crash.  Note that the syntax above will
// work, however, in Java.

  table = new (int*)[rows];           // Allocate the rows.
  for(i = 0; i < rows; i++)
    table[i] = new int[cols];         // Allocate each row's columns.

  for(i = 0; i < rows; i++)           // Find row sums.
  {
    sum = 0;
    for(j = 0; j < cols; j++)
      sum += table[i][j];
    cout << "Row sum for row " << i << ": " << sum << endl;
  }

  for(j = 0; j < cols; j++)           // Find column sums.
  {
    sum = 0;
    for(i = 0; i < rows; i++)
      sum += table[i][j];
    cout << "Col sum for col " << j << ": " << sum << endl;
  }
}

Notice how we had to explicitly allocate both dimensions of the array, starting with the first dimension, the rows; and then for each row we allocated its columns. You may be wondering why the outer dimension is allocated using “new (int*)[n]”, while the inner dimension is allocated using “new int[n]”. This is because each dimension but the last is a pointer to the next dimension. The final array dimension is obviously simply a list of integers, so in the inner loop we merely allocate a list of integers. The next dimension up, however, is not a list of integers; it’s a list of lists of integers. As such, each entry in this list will itself be a pointer to a list of integers — the final dimension. Therefore, the code allocating the outside dimension must allocate a list of pointers to integers.

If we had additional dimensions, for each column in each row we would then have to allocate the list of cells, and so forth. Here’s how a three-dimensional array allocation might look like. Assume that x, y, and z are the size of each array dimension. Notice how the outer dimension is now a list of (int**)’s — a list of lists of lists — and the second dimension is now the one that is (int*) — a list of lists — while the final dimension is still a list of integers.

int    i, j;
int*** array3d;
 
array3d = new (int**)[x];
for(i = 0; i < x; i++)
{
  array3d[i] = new(int*)[y];
  for(j < 0; j < y; j++)
    array3d[i][j] = new int[z];
}

Written by Scott Moonen

October 2, 2004 at 12:44 pm

Posted in C/C++

Tagged with , , , ,