Ozten Recent Activities - tagged with lisp http://www.ozten.com/sweetcron/feed en-us http://blogs.law.harvard.edu/tech/rss Sweetcron shout@ozten.com New in JavaScript 1.7 - MDC http://www.ozten.com/sweetcron/items/view/1206/new-in-javascript-17-mdc

The new features in JavaScript 1.7 are very SICPish adding the ability to create streams using generators. Very cool. Also iterators are exposed. Lastly list comprehension is added, which I haven't played with much.

]]>
Thu, 29 Jan 2009 09:16:00 -0800 http://www.ozten.com/sweetcron/items/view/1206/new-in-javascript-17-mdc
Dr. Dobb's | It's Time to Get Good at Functional Programming | December 3, 2008 http://www.ozten.com/sweetcron/items/view/704/dr-dobbs-its-time-to-get-good-at-functional-programming-december-3-2008 ]]> Fri, 05 Dec 2008 19:38:00 -0800 http://www.ozten.com/sweetcron/items/view/704/dr-dobbs-its-time-to-get-good-at-functional-programming-december-3-2008 Package systems a special case of first class functions http://www.ozten.com/sweetcron/items/view/2628/package-systems-a-special-case-of-first-class-functions

SICP Lecture 7B makes a great point during the second Q&A;session about solving modularity and abstraction problems by reorganizing a solution around PGEN which parametrizes a general algorithm for a specific input. Early in the book, the similarity of class based object systems and package management systems with Scheme style first class functions kept peaking my interest. Sussman points out that first-class functions can solve modularity issues in the general case with a very simple minimal mechanism. Without first class functions, one can solve specific known problems without special language features such as packages, modules, etc.One case the immediately comes to mind is the Java language feature of anonymous inner classes for getting around certain awkward pieces of code ( usually introduced by static typing requirements ).

]]>
Wed, 26 Dec 2007 21:07:00 -0800 http://www.ozten.com/sweetcron/items/view/2628/package-systems-a-special-case-of-first-class-functions
Behind on blog updates http://www.ozten.com/sweetcron/items/view/2630/behind-on-blog-updates

So I am still on pace with Reading SICP and doing exercises, but haven't really had time to update this blog with ruminations.I find the text a much deeper wading into Lisp and computational processes, which is what I needed after reading the Lisp Tutorial and the Little Schemer books.The study group has been going well with pretty consistent attendance. I hope my taking a break for one month to go to South Africa doesn't disturb the flow too much.

]]>
Tue, 09 Oct 2007 17:05:00 -0700 http://www.ozten.com/sweetcron/items/view/2630/behind-on-blog-updates
Sections 2.1 and 2.2 http://www.ozten.com/sweetcron/items/view/2632/sections-21-and-22

SICP Section 2.1The text introduces the topic of Data Abstraction. Coming into this discussion, I see this as a core feature of Object Oriented Programming and an element for enabling programming in the large.It is also another tool for adding abstraction to a system. Given selectors, constructors, and invariant rules or contracts, one can happily go about programming by “wishful thinking” caring only about this interface and not the actual data representation on the backend. This is important as one either builds layers of abstraction, or attempts to collaborate on a system with other programmers.The text runs though silly implementations of basic “primitives” of Lisp, to show that as long as selectors and constructors use the same silly implementation everything will work, albeit slowly.This has massive benefits for prototyping and agile system development. Once can sketch-out a component of the system, but not commit to it’s details or spend time on making it efficient, until it is something that is worth investing in. Also this supports David Parnas style information hiding and module de-composition. If one structures the abstract data types so that they use only the constructors and selectors of other abstract data types, then one can rework the implementation without recoding these parts.Section 2.2The text continues to blur the lines between data and code, when introducing the concept of hierarchical data and the closure property. This term “closure property” used in the text been superseded by a new concept of scoping rules and environment. I would call this feature composition or regularity. A cons is a pair of boxes that point to something. A cons pair may in-fact point to two other cons pairs. Thus the definition achieves “closure” and powerful abilities emerge out from this. I think about GUI programming where every widget is composable and recomposable. Example you can place a frame inside of a panel inside of a tabbed widget and so on. The ability to nest them brings power and the regularity brings simplicity.We can model sequences or hierarchical structures with the same simple glue. The section on “A Picture Language” is a very cool example. In this picture language the only primatives are painters. A painter given a rectangle, paints itself into that rectangle. The means of combination are functions, created with a rectable, that compose other painters. We are given two painters “Rogers” and an Escheresque “Wave” drawing where the line segments wrap around the image, for maximum trippiness factor.Very quickly the text begins creating composition combinators that do nothing more than compose other painters, but which create complexity from simple parts very quickly. Thus the “beside” combinator breaks the field in half and populates each half recursively with it’s two arguments.These painters are sort of data, in that they represent a photo, but at the same time they are a procedure that given a rectangle, render onto the screen.Again, similar to writing of Parnas, the text stress the importance of stratified design, such that each layer in a system builds on the abstraction below it only. This allows one to make a more robust system and to focus on less details at any one time.

]]>
Wed, 12 Sep 2007 22:11:00 -0700 http://www.ozten.com/sweetcron/items/view/2632/sections-21-and-22
SICP Exercises 1.1 - 1.7 http://www.ozten.com/sweetcron/items/view/2635/sicp-exercises-11-17

I have been slow in posting these, but here is exercises 1.1 - 1.7

Exercise 1.1 Exercise 1.2 Exercise 1.3 Exercise 1.4 Exercise 1.5 Exercise 1.6 Exercise 1.7

]]>
Sat, 08 Sep 2007 21:56:00 -0700 http://www.ozten.com/sweetcron/items/view/2635/sicp-exercises-11-17
Thoughts on SICP 1.1 http://www.ozten.com/sweetcron/items/view/2637/thoughts-on-sicp-11

Section 1.1 of SICP starts of with some simple, straight forward basics of programming languages, but at the same time provided some deep food for thought. Judging for this limited exposure, Scheme has a very minimal syntax and is incredibly regular. We learn how to use expressions and names. Names are similar to variable names from a language like Java, but are more general in that they also serve the purpose of naming data or functions, by placing them into the current environment.

Next we see that we can combine expressions and that a grouping of operator followed by operands is called a combination. Again very simple and regular. The postfix notation doesn't bother me since I have spent some time playing with Common Lisp for doing generative graphics.

The section on substitution models is really fascinating and I am having a hard time keeping the two notions straight. The two notions being applicative order and normal order. I have created a mnemonic "nORmal order is ||". This means most substitution follows the textual pattern, except some things are conditionally or lazily computed, just like || in Java. If we say if( foo() || bar() ){ baz() }

in Java, it is poosible that bar() may never be computed.

I had rarely considered this formally as a first class notion. I have created a template language in the past and when implementing looping and conditional logic I had to implement a normal order substitution model, but just kind of stumbled through it, without the formal perspective.

Scheme seems to run in applicative order normally, except for when you declare that you want to step out into normal order.

The chapter moves on to look at Newton's Method for approximating square roots. These mathematical passages are challenging to me, and I better buck up if I am going to finish this book. Perhaps I will learn a fair amount of math along the way. It would be great to rewrite the domain aspect of this text using the domain of web programming instead of math :) Of course you would have to dive into input output very early, which isn't desirable from a pedagogical point of view.

Lastly this chapter defines several functions in a nested fashion within an overall function. This left me in awe for a few minutes. Wowsers. This is so simple, regular, and powerful! This immediately reminded me of Java classes and how they must be implemented under the covers. Except that Java has many more restrictions and semantics on top of the class keyword. Here we are left with the raw power and goodness of nested function definition. Parameters to the top-most function are visible within the scope of the nested function. The nested function isn't defined in the global environment, and thus doesn't pollute it's namespace. The is something really interesting going on here, which I think will become clearer as I gain more experience with these constructs, but all ready it sets my mind alight.

The ability to name functions and nest functions allows us to build powerful black box abstractions. No notion of interface or documentation has been introduced yet, but the idea is that you can tell someone if you calll operator X with arguments y and z then you can expect foo as a result.

This allows construction of programs in a layered fashion, whereby each piece follows contracts between interfaces and the overall complexity of the system is broken down into manageable chunks that can be

tested thought about reused

Exercises 1.5 and 1.6 were great. Working them out on paper, as well as exploring some possibilities from Scheme REPL really helps to understand the substitution model.

]]>
Thu, 30 Aug 2007 10:45:00 -0700 http://www.ozten.com/sweetcron/items/view/2637/thoughts-on-sicp-11
HELO http://www.ozten.com/sweetcron/items/view/2641/helo

Howdy.I am going to use this livejournal for recording my progress through SICP. I have wanted to work through this text for a long time, as "The Structure and Interpretation of Computer Programs" is a classic. I am doing two independent study classes with Regis university as part of a Masters degree through their professional studies program.So the focus of this journal will be Lisp including Scheme and Common Lisp and working through the exercises  in the text, commentary on videos, etc.

]]>
Wed, 22 Aug 2007 09:42:00 -0700 http://www.ozten.com/sweetcron/items/view/2641/helo