Lets start here: HTDP/2e Prolog

90 views
Skip to first unread message

Grant Rettke

unread,
Aug 24, 2008, 12:19:14 AM8/24/08
to Study-HTDP
Hi folks,

With our official start date only a week away, per a master's advice I
wanted go over something pretty quickly that would provide an impetus
for installing DrScheme, doing a tiny bit of reading, and hopefully
asking questions.

Please read and perform the steps in the Prolog of HTDP/2e (we aren't
reading this, it isn't ready yet!):

http://www.ccs.neu.edu/home/matthias/HtDP/Prologue/book-Z-H-3.html

After you do the work, please have a look at some of my comments and
notes regarding the material:

1. The 'Language Menu' is located in the lower-left hand corner of
DrScheme. Click it, and select 'Choose Language'. Then expand the list
under 'How To Design Programs'. This is where you choose the language.

2. In the top part when you enter (+ 1 1), try hitting alt+shift+( at
the same time, this will give you balanced parentheses.

3. When you need to run the program, you can click 'Run' or hit F5
instead.

4. When you push ctrl+F6 at the same time, you will move focus between
the top and bottom parts of the screen.

5. Maybe you should save this in a RCS. Be sure to add keyword
expansion. Also install this plugin to keep your files in sync:

http://planet.plt-scheme.org/display.ss?package=drsync.plt&owner=grettke

6. We don't need to discuss Beginning Student Language notation right
now.

7. Now that you know the difference between the definitions and
interactions window, you should feel free to toggle the former by
pressing ctrl+d and the latter by pressing ctrl+e.

8. You'll notice a message in the interactions window about testing,
more on this later

Best wishes,

Grant Rettke

Michael

unread,
Aug 26, 2008, 9:31:10 PM8/26/08
to Study-HTDP
As I read through it I was struck how the analogy of teaching a child
is just so... imperative.

I assume that the authors may be somewhat predisposed to encourage
people to consider functional programming. To me this underscores
that at some primitive level imperative and functional programming may
be intertwined.

That and that it may be hard to talk about computing without some
starting assumptions, and the ones that lead to an imperative
computing model come to mind pretty easily.

Michael

Grant Rettke

unread,
Aug 26, 2008, 11:32:18 PM8/26/08
to Study-HTDP
Hi Michael,

On Tue, Aug 26, 2008 at 8:31 PM, Michael <mdkr...@gmail.com> wrote:
> As I read through it I was struck how the analogy of teaching a child
> is just so... imperative.

Was some particular material that made you notice this?

> I assume that the authors may be somewhat predisposed to encourage
> people to consider functional programming. To me this underscores
> that at some primitive level imperative and functional programming may
> be intertwined.

Please elaborate.

Do you mean this?
http://www.wisdomandwonder.com/article/527/sequencing-in-scheme

> That and that it may be hard to talk about computing without some
> starting assumptions, and the ones that lead to an imperative
> computing model come to mind pretty easily.

Sequencing is how we understand the world, we are bound to time. As I
write this, I wonder how I would define "imperative programming". Now,
I couldn't.

I could only say the difference is whether or not the language has
side-effects, that is the gotcha.

Best wishes,

Grant

Michael

unread,
Aug 27, 2008, 11:30:25 PM8/27/08
to Study-HTDP
On Aug 26, 10:32 pm, Grant Rettke <gret...@gmail.com> wrote:
> Hi Michael,
>
> On Tue, Aug 26, 2008 at 8:31 PM, Michael <mdkraj...@gmail.com> wrote:
> > As I read through it I was struck how the analogy of teaching a child
> > is just so... imperative.
>
> Was some particular material that made you notice this?

Its just the imagery of how one might instruct a child.

> > I assume that the authors may be somewhat predisposed to encourage
> > people to consider functional programming.  To me this underscores
> > that at some primitive level imperative and functional programming may
> > be intertwined.
>
> Please elaborate.
>
> Do you mean this?http://www.wisdomandwonder.com/article/527/sequencing-in-scheme

Hmmm, now that you point it out that is one way of highlighting the
same dualism.

To me imperative simply means an explicitly ordered sequence of
operations.
Functional programming defines functions and evaluation rules which
implicitly define the sequence of operations.

So they both yield sequences of operations, but how that sequence is
arrived at may differ.

> > That and that it may be hard to talk about computing without some
> > starting assumptions, and the ones that lead to an imperative
> > computing model come to mind pretty easily.
>
> Sequencing is how we understand the world, we are bound to time. As I
> write this, I wonder how I would define "imperative programming". Now,
> I couldn't.
>
> I could only say the difference is whether or not the language has
> side-effects, that is the gotcha.

I think side effects is a different issue. You can be side-effect
free and still imperative (by my definition).

And if you want to get even more philosophical, are we bound in time
or flowing with it? If time is a river are we on the shore or in a
boat?

I guess its all relative, the invariants remain the invariants. But
your choice of reference frame can have profound effects on how you
model the world. In classical mechanics there are two very different
approaches to setting up the mathematics of moving objects, one is
Hamiltonian - fixed to the point of reference of the object that is
moving - the other is Laplacian - fixed in space and describing the
flow of matter past a point in space. Hamiltonian is the prefered way
of doing kinematics, Laplacian is more useful for fluid flows (even
including magnetic effects - thats how magneto-hydrodynamics is
derived). But both start with conservation of mass/energy.

Systems that are Hamiltonian are better described by programming
systems that have side effects. Particle quantities such as momenteum
are treated as variables which are updated (side effects) where as the
stream-of-values approach that emerge from Laplacian descriptions are
how side effect free systems model change over time.

Mike

Grant Rettke

unread,
Aug 28, 2008, 3:14:27 PM8/28/08
to study...@googlegroups.com
Hi Michael,

On Wed, Aug 27, 2008 at 10:30 PM, Michael <mdkr...@gmail.com> wrote:

> To me imperative simply means an explicitly ordered sequence of
> operations.

We should throw out the term "imperative programming". Everything is
imperative, it can't all happen at once. It has to happen in order.
So, what does it mean? In Haskell, you can define
B=A+1 before you define A.

> Functional programming defines functions and evaluation rules which
> implicitly define the sequence of operations.

No it doesn't matter the order in which they are evaluated as long as
their evaluation order is enforced :).

> So they both yield sequences of operations, but how that sequence is
> arrived at may differ.

Yes.

> I think side effects is a different issue. You can be side-effect
> free and still imperative (by my definition).

Yes.

> And if you want to get even more philosophical, are we bound in time
> or flowing with it? If time is a river are we on the shore or in a
> boat?

That is pretty interesting; I'm just working on learning how to
program well for now, though! (Thanks for your discussion on
Hamiltonian and Laplacian , that is interesting!)

Reply all
Reply to author
Forward
0 new messages