Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TAKE 2: code refactored for beginners, with extensive comments and docstrings #5

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

gw666
Copy link

@gw666 gw666 commented Mar 25, 2015

Now I've cut out everything that you didn't have in your version of escher.clj. I also added support for clj-tuple. Feel free to use as much/as little as you wish.

Cheers,

Gregg

gw666 and others added 15 commits January 17, 2015 22:09
also added comments to help orient new users
shapes: box, x, diamond, george

segment-lists allow compound shapes to be drawn using
concat; see diamond-x

fcns: flip-horiz, flip-vert; rotate, rotate180, rotate270; below
Abstracted split-up, split-right into higher-level split function.
Source code refactored, with comments and docstrings added, to make it
easy for beginners to get up to speed quickly.

Does not implement image-painter.

To give yourself a chance to complete the exercise as ‘thattommyhall’
intended, delete the bodies of the following functions:

  add-vec
  sub-vec
  scale-vec
  flip-horiz
  rotate
  below
  path
  right-split (uncomment by removing “#_”)
  up-split (uncomment by removing “#_”)
  split

Just evaluate this file to see the “goal” function, square-limit, draw
itself. This version uses the “higher-level” versions of right-split
and up-split.

If you decide to write the code for up-split and derive the
higher-level function ‘split’, you will need to comment out or remove
the versions of right-split and up-split that follow split in the
source code and un-comment the versions that precede split in the
source code.

Enjoy, and please give me feedback if you find my version helpful!
This reverts commit f8dc53523901f84b162294b3ba8f2bd7a6a3ac6f.

Conflicts:
	src/escher/core.clj
This reverts commit f8dc53523901f84b162294b3ba8f2bd7a6a3ac6f.

Conflicts:
	src/escher/core.clj
This file is functionally equivalent to the version in the
SICPDistilled/master repository. The following has been done to make
the file more useful to Clojure programmers who are starting from
scratch:

* reordered code to group related code together
* added useful info in comments
* added docstrings to major functions
* added formatting to increase readability
@thattommyhall
Copy link
Member

This is excellent @gw666, I have copied it into a branch so I can fix up a few things but most of it will land.

The important change I just made is a14df09
Remember the point of the data abstraction, only make-vec should care about the clj-tuple namespace, you were bypassing it calling t/vector

@gw666
Copy link
Author

gw666 commented Mar 25, 2015

see below

On Mar 25, 2015, at 7:18 AM, thattommyhall [email protected] wrote:

This is excellent @gw666, I have copied it into a branch so I can fix up a few things but most of it will land.

Wow! Many thanks! I think this will really help (some) people out!
The important change I just made is a14df09
Remember the point of the data abstraction, only make-vec should care about the clj-tuple namespace, you were bypassing it calling t/vector

Duh--what, was I thinking?

Reply to this email directly or view it on GitHub.

Best wishes,

Gregg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants