Angel “Java” Lopez on Blog

February 9, 2010

New Smalltalk Group

Filed under: Smalltalk — ajlopez @ 11:29 am

Smalltalk community is active, but scattered in many list, dialects and framework. Mariano Martinez Deck announced a new Smalltalk Group. This is his presentation:

We were discussing about this in the Pharo mailing list but the idea is for all Smalltalkers. I am not sure if this will work, but it is worth to try it as I don’t have anything to loose.
We were thinking to have a place, an environment and hopefully a community, where we can freely discuss about Smalltalk papers or OO in general. All smalltalkers of all flavors can join, discuss, tell their experiences and thoughts, share and learn.
The main purpose about that list is:
- be able to FREELY discuss about papers about Smalltalk or OO in general. I say freely because maybe someone gives an opinion of a paper that the person who wrote it is also in this place. We are all professional and I think we can discuss with respect.
- LEARN.
Other uses:
- Don’t reinvent the wheel. Maybe I wanted to do something and I read that XXX person did YYY. So, I can look at it.
- Be aware of what other people is doing, working, writing and learning.
- Have different opinions of a certain topic / paper.
- A little step to join all the Smalltalk community in one place. We can meet people, join forces, etc.
- Help in the preparation, ANN, collaborate, etc in Workshops, conferences, and so on.
- Ask for help on review. Several times someone has several papers to review for a certain conference. This can be a place to ask for that help.
- Publish papers that were rejected from someone. How many times some papers where rejected but do you still read it and find it useful ?
- Educate people and being educated.
- Share latex template, commands, or tricks related to smalltalk code for example.
- Discuss about research in general.
- Ask for a certain topic. Suppose I want to start to work in XXX topic, I can ask to see if someone knows related papers or work.
- others
In two words: DISCUSS AND LEARN.
FAQ:
1) Which is the address?
http://groups.google.com/group/smalltalk-research
2) Do I need to be "Researcher" to join ?
Not necessary. You may just be interested.
3) Is there a Nabble interface?
Yes: http://n4.nabble.com/Smalltalk-Research-f1473466.html
Now, please what I would appreciate is if you can help me to you distribute (I am not in Gemstone, Cincom or GNU for example) this ANN. It would be cool to create a community.  I know there are a lot of Smalltalk researchers that doesn’t have time to follow the active smalltalks lists. If you can send private mails to them would be fantastic!

There is an active Smalltalk community, here in my country, Argentina. I hope there will be a new Smalltalk meeting this year 2010, after successful ones in 2007, 2008 and 2009. And I hope a better communication and knowledge transfer with other software development communities. In my opinion, smalltalkers are too “closed” to themselves: there are so many interesting topics to share and discuss, in Smalltalk and beyond. Note the generalized used of Virtual Machines (Java, .NET) to use as the base for new languages. It would be nice to have more cross-pollinization between communities and ideas.

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

February 7, 2010

Genetic Algorithms using GoRoutines and Channels in C#

Filed under: .NET, C Sharp, Genetic Algorithm — ajlopez @ 10:39 am

More than a year ago, I wrote:

Genetic Algorithms with AjAgents and Concurrency and Coordination Runtime (CCR)

exploring concurrency in the implementation of Travelling Salesman Problem using a genetic algorithm. At the end of past year, I wrote an example, using the ideas implemented in:

GoRoutines and Channels in C#

The code is in the AjConcurr.Tsp project at:

http://code.google.com/p/ajcodekatas/source/browse/#svn/trunk/AjConcurr

This is the result (not a great interface… ;-) :

TSP is not a good problem to resolve using Genetic Algorithm: the result depends of the improvement of population after each iteration. My implementation uses a mutation algorithm that tries to generate better individuals (a fair algorithm should only mutate). The code is written in a big method, under the Run button click, only for demo purpose.

At the beginning, I define the channels:

            Channel genomas = new Channel();
            Channel evaluated = new Channel();
            Channel bestsofar = new Channel();
            Channel mutator = new Channel();

Remember: you can put a value (object) in a channel, and in another thread, you can get that value. If you put a value in a channel, and no thread is reading the channel, your thread is blocked. If you read a value from a channel, and no value is present, your thread is blocked. In this way, producers and consumers are synchronized.

Evaluated channel receives individuals (solutions to the problem) and collects it, forming a new population. The best individual is send to bestsofar channel, that keeps the best individual found in process. Genomas channel receives an individual, evaluate its fitness, and forward it to Evaluated channel. Mutator receives a genoma, mutates and evaluates it. The new genoma is forwarded to Evaluated channel.

Many populations are processed in parallel. More accurate: there is no population, there are N * M individuals that are processed, mutated, and collected. For each group of N collected individuals, the best are selected, and a new group of N individuals are injected again in the process.

This is the code. First, launch a goroutine to generate the initial populations:

// Generates the initial populations
GoRoutines.Go(() =>
{
    Genoma genoma = GenerateGenoma();
    for (int j = 0; j < PopulationSize * 10; j++)
    {
        genomas.Send(this.Mutate(genoma));
    }
});
 

Launch a goroutine to evaluate new genomas:

// Evaluate genomas
GoRoutines.Go(() =>
{
    while (true)
    {
        Genoma genoma = (Genoma)genomas.Receive();
        genoma.value = this.CalculateValue(genoma);
        evaluated.Send(genoma);
    }
});

A goroutine to collect genomas, select them, and generate a new group, population:

// Collect and select
GoRoutines.Go(() =>
{
  GenomaComparer comparer = new GenomaComparer();
    while (true)
    {
    List<Genoma> genomalist = new List<Genoma>();
    for (int k = 0; k < PopulationSize; k++)
    {
      Genoma genoma = (Genoma)evaluated.Receive();
      genomalist.Add(genoma);
    }
    genomalist.Sort(comparer);
    GoRoutines.Go(() => bestsofar.Send(genomalist[0]));
    for (int k = 0; k < PopulationSize / 5; k++)
      GoRoutines.Go(() => evaluated.Send(genomalist[k]));
    for (int k = 0; k < PopulationSize / 5; k++)
    {
      GoRoutines.Go(() => mutator.Send(genomalist[k]));
      GoRoutines.Go(() => mutator.Send(genomalist[k]));
      GoRoutines.Go(() => mutator.Send(genomalist[k]));
      GoRoutines.Go(() => mutator.Send(genomalist[k]));
    }
    }
});

A goroutine for receives genomas, improve them, and forwards them to evaluated channel:

// Mutates
GoRoutines.Go(() =>
{
    Random rnd = new Random();
    while (true)
    {
    Genoma genoma = (Genoma)mutator.Receive();
    Genoma newgenoma = this.Mutate(genoma);
        while (newgenoma.value >= genoma.value)
        {
            if (rnd.Next(3) == 0)
                break;
        newgenoma = this.Mutate(genoma);
        }
        evaluated.Send(newgenoma);
    }
});

A goroutine to receives and process the best-so-far indivuals:

// Receives and draws the results
GoRoutines.Go(() =>
{
    Genoma best = null;
    while (true)
    {
        Genoma genoma = (Genoma)bestsofar.Receive();
        if (best == null || best.value > genoma.value)
        {
            best = genoma;
            this.BestGenoma(genoma);
        }
    }
});

I didn’t write support for crossover, but it could be added. The problem and algorithm could be changed. The main idea of this spike is to show the parallel implementation of a genetic algorithm.

The main problem is in the evaluated channel reading and processing. In that step, the goroutine forwards values to many channels. I had to launch many goroutines to feed the channels, because if one of these is blocked, the full process were blocked.

Next step: implement and use Queue Channels as in:

Implements actor model, and put each step in an agent. And then, implement distributed agents.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

February 5, 2010

Functional values in AjSharp

Filed under: .NET, AjSharp, Open Source Projects, Programming Languages — ajlopez @ 10:44 am

One of the features I want to have in my AjSharp interpreter is functions and subroutines as first-class citizens in the language (in this post, I use function keyword but you can use sub keyword to define a subroutine).

The code is in my Google code project:

http://code.google.com/p/ajcodekatas/source/browse/#svn/trunk/AjLanguage

AjLanguage is the core language definition (without parser and lexer). AjSharp is the parser, lexer implemented using neutral AjLanguage. In this way, I could implement AjBasic or other similar languages, using AjLanguage as core.

In AjSharp, you can define functions as usual:

function Square(n) { return n*n; }

You can define and assign a function to a variable:

MySquare = function (n) { return n*n; };

A functional value can be used as a parameter:

function Apply(func,values)
{
  list = new List();

  foreach (value in values)
    list.Add(func(value));

  return list;
}
numbers = new List();
numbers.Add(1);
numbers.Add(2);
numbers.Add(3);
function Square(n) { return n*n; }
squared = Apply(Square, numbers);
squared2 = Apply(function (n) { return n*n; }, numbers);

Apply function defined about, take a function, a list, and returns a list of f(e), where f is the function received, applied to each element e of the list parameter. You can invoke Apply with the name of the function (the name of a variable that has a functional value) or defining the function “inline”.

I’m still thinking about some scope implementation (free variables, bounded variables) in function expressions. If you define a function, AjLanguage (the core of AjSharp) uses a closure, so when the function is invoked, the original binding environment is used. I use that feature in the following examples. Every function implements:

    public interface ICallable
    {
        int Arity { get; }
        IBindingEnvironment Environment { get; }
        object Invoke(IBindingEnvironment environment, object[] arguments);
        object Invoke(object[] arguments);
    }

that is, when it is invoked, it can receive an environment. A functional value doesn’t use that received environment, replacing it by the original environment at the point of its definition.

You can return a function as returning value of a function:

function MakeIncrement(x)
{
  return function(n) { return n + x; }; // x is bounded to local parameter
}
Increment2 = MakeIncrement(2);
result = Increment2(2);
// result == 4
Increment3 = MakeIncrement(3);
result2 = Increment3(2);
// result2 == 5
result3 = MakeIncrement(4)(3);
// result3 == 7
x = 4;
result4 = function(n) { return n+x; }(5);
// result4 == 9

MakeIncrement returns a function that uses and access the variable x, bounded to the calling binding environment.

In the last command, the function is defined and invoked in place.

AjSharp has classes, and you can define functions as usual:

class Person
{
  var Name;
  var Age;

  function AddYears(years)
  {
    this.Age = this.Age + years;
  }
}

But you can add functions at any moment:

class Person
{
  var Name;
  var Age;

  function Person()
  {
    x = 100;
    this.GetYears = function () { return this.Age; };
    this.GetX = function() { return x; };
  }
}
adam = new Person() { Name = "Adam", Age = 800 };
result = adam.GetYears();
// result == 800
result2 = adam.GetX();
// result2 == 100

or add functions/subroutines directly to objects:

adam.AddYears = sub(n) { this.Age = this.Age + n; };

Some weeks ago, I read the post:

Functional Programming in Javascript

by James Carr, so I decided to test AjSharp functional values adapting examples presented in that post. For example:

function runningSum(start){
  sum = start;  // you could use var sum, it's local

  return function(a){
    sum = sum + a;  // function access the "outer" sum
    return sum;
  };
}
sum = runningSum(3);  // makes function
result = sum(2); // returns 5  
result2 = sum(10); // returns 15  

You can use directly the parameter as accumulator:

function runningSum(start){
  return function(a){
    start = start + a;  // function access the "outer" start
    return start;
  };
}
sum = runningSum(3);  // makes function
result = sum(2); // returns 5  
result2 = sum(10); // returns 15  

I added support to apply a function as a method to an object, as in one of Carr’s example (this kind of call is supported by javascript Functions):

person = new { Name = "Adam", Age = 800 };
GetAdjustedAge = function (x) { return x + this.Age; };
result = GetAdjustedAge.Call(person, 10); // result == 810

Next steps: stabilize variable scope and access to global environment. By now, I had fun implementing …err.. functional values.. ;-)

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

January 27, 2010

Queue Channels in AjSharp

Filed under: .NET, AjSharp, Open Source Projects, Programming Languages — ajlopez @ 10:50 am

Some weeks ago, I implemented channels in my AjSharp interpreter. You can read about that implementation:

Channels and GoRoutines in AjSharp (part 1)
Channels and GoRoutines in AjSharp (part 2)

If you read the value of a channel, and there is no value, the read thread is blocked until a value is available. This is a way to synchronize the consumers and producers that operates over the channel. But sometimes, you want to put a value on a channel and continue. So, I added a “queue channel” (I could named it queued channel): you can put N values in the channel without blocking, saving them in an internal queue. The size of the queue is set in the constructor of the channel. The queue is limited in size, in order to preserve the synchronization features.

The name of the new class is QueueChannel. A test:

        [TestMethod]
        public void CreateAndUseQueueChannelWithTenElements()
        {
            QueueChannel channel = new QueueChannel(10);
            for (int k = 1; k <= 10; k++)
                channel.Send(k);
            for (int k = 1; k <= 10; k++)
                Assert.AreEqual(k, channel.Receive());
        }

The channel receives 10 values without blocking. If you send more values, you should use another thread:

        [TestMethod]
        public void CreateAndUseQueueChannelWithMoreEntriesThanSize()
        {
            QueueChannel channel = new QueueChannel(10);
            Thread thread = new Thread(new ThreadStart(delegate()
            {
                for (int k = 1; k <= 20; k++)
                    channel.Send(k);
            }));
            thread.Start();
            for (int k = 1; k <= 20; k++)
                Assert.AreEqual(k, channel.Receive());
        }

I rewrote my prime example using queue channels:

numbers = new QueueChannel(10);
running = true;
k = 1;
go while(running) { k++; numbers <- k; }
function filter(in, out, prime)
{
  while (true)
  {
    value = <-in;
    if (value % prime)
      out <- value;
  }
}
function makefilter(channel, number)
{
  newchannel = new QueueChannel(10);
  go filter(channel, newchannel, number);
  return newchannel;
}
channel = numbers;
number = <-channel;
while (number < 1000)
{
  PrintLine("Prime " + number);

  channel = makefilter(channel, number);

  number = <-channel;
}
running = false;

The code is in my Google code project:

http://code.google.com/p/ajcodekatas/source/browse/#svn/trunk/AjLanguage

My motivation for a queue channel, is that I’m writing a parallel genetic algorithm example, that suffered of too many blockings. I feel that a good algorithm doesn’t need queues, but if you have many consumers and producers, and one thread produce many values to various channels, using common channel could raise blockings. Another way, to avoid blocking, is using the go command:

go channel <- newvalue;

But I guess it’s over killing to launch a goroutine only to feed a channel.

I should present the parallel genetic algorithm, write about ideas of implementing actor model in AjSharp, and about distributed agents.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

January 25, 2010

AjSharp: Implementing Futures

Filed under: .NET, AjSharp, Open Source Projects, Programming Languages — ajlopez @ 10:55 am

I implemented channels in my AjSharp interpreter. I wrote about it in:

Channels and GoRoutines in AjSharp (part 1)
Channels and GoRoutines in AjSharp (part 2)

I could use channels to implement futures. One option is to add Task Parallel Library from Microsoft, but I should use .NET 4: apparently, the original library is no more available. I guess I could leverage the new classes in the upcoming framework, but meanwhile, I want to explore the ideas of futures programming.

Channels can be used to implement some future process:

channel = new Channel();
go channel <- SomeLengthlyCalculation();
// .. more process
result = <- channel;

But channels are designed to resolve other problems: to have many values during its life, and be used as sync objects between producers and consumers of such values. The above channel variable, if used as a future, could be consulted only one. This is a minor issue, but signals a difference between channels and futures.

So, I wrote a new native classes, accessible by AjSharp programs, Future:

    public class Future : IReference
    {
        private object value;
        private ManualResetEvent handle = new ManualResetEvent(false);
        private bool set = false;
        public void SetValue(object value)
        {
            lock (this)
            {
                if (this.set)
                    throw new InvalidOperationException("Future value already calculated");
                set = true;
                this.value = value;
                this.handle.Set();
            }
        }
        public object GetValue()
        {
            this.handle.WaitOne();
            return this.value;
        }
    }

In the current version at trunk, IReference interface (SetValue, GetValue) is implemented by Channel class. AjSharp operators a <- b, a = <-b, are mapped to those methods. So, I can use Futures in this way:

future = new Future();
go future <- SomeLenghtlyProcess();
// ... more process
result = <-future;
result2 = <-future;

Consulting the future value is explicit. So, you can pass the variable future to any other function, by name, without viewing its value. I could drop the go in the set of the future, assuming the right value were computed in parallel. But I prefer to make parallelism explicit, using the go command.

This is a minor improvement in parallel features in AjSharp. I was working on queue channels: channels that support the storage of more than one value. You can check the code at:

http://code.google.com/p/ajcodekatas/source/browse/#svn/trunk/AjLanguage

I want to implement agents, to support actor model programming. It could be nice to have agent as keyword, as class keyword. And that the agents could be run in remote machines.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

January 19, 2010

Tales from the Scrum: Is Agile/Scrum Hard?

Filed under: Agile Software Devevelopment, Scrum, Software Development — ajlopez @ 10:02 am

Recently, via some messages at Twitter, I found the post Agile/Pervagile on Slashdot in the multi-author blog Agile Advice – Working With Agile Methods (Scrum, OpenAgile, Lean). It’s an interesting reading, presenting Pervagile, the Perverted Agile. Most companies claims that they are using Agile, with Scrum or something alike, but, really, their adoption is partial. The author mention other deviations: Scrumbutt, Waterscrum, Scrummerfall, that deserve more comments here.

But today, I want to comment about the paragraph:

Agile is Hard

Okay, I’m actually being a little dis-honest.  The real truth is that doing agile is extremely, exceptionally, agonizingly difficult (for most people in most  organizations).  Why?  Because agile is not just another process to roll out.  It is, as has been mentioned in numerous places, a deep cultural change.  Agile is actually a liberation movement for people involved in software development.  Like most movements, however, it has been subject to corruptive forces.

Yes, true, but… I want to moderate above assertions, in the context of Scrum application (not Agile in general). If you are involved to introduce Scrum first time in your company, you need a cultural change, but I guess it could be not so deep. You need a proactive group of team members, a good ScrumMaster and Product Owner. AND (a no small and) the support from the management, to protect the team of outer interference, AND SPECIALLY the support of the Product Owner (protect him/her from other managers pressures, political forces, that could alter the priorities in product backlog, or that could interfere in the middle of the Sprint). The rest of your company can run in the old regime. But you need that your first project be protected. It needs nurturing and protection. Not a deep cultural change. The change in the rest of the company could be progressive. And the change in the team (I guess this is the first encounter of the members with Scrum) should be progressive, helped by an experienced ScrumMaster.

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

January 13, 2010

AjClipper: a Clipper-like interpreter that uses .NET

Filed under: .NET, ASP.NET, AjClipper, Open Source Projects — ajlopez @ 10:57 am

You can find a Clipper-like (I wrote Remember Clipper; you’ll find more links in that post) interpreter source code at my Code Katas Google project:

http://code.google.com/p/ajcodekatas/source/browse/#svn/trunk/AjClipper

It’s an interpreter, written in C#, that can create and use native .NET objects. I wrote the interpreter to:

- Practice TDD
- Create a simple tool to leverage Clipper knowledge in one of my teams, to learn more .NET concepts

I should write posts about internal implementation, access to .NET objects, manage of work areas, etc… One idea I’m exploring, is running the interpreter from an ASP.NET web page:

 

(There is a web app in the project containing the above test page).

My collected links about Clipper:

http://delicious.com/ajlopez/clipper

I should improve the access to database, and complete language command and features. Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

January 9, 2010

Refactoring AjLisp: a lisp interpreter written in C#

Filed under: AjLisp, C Sharp, Open Source Projects — ajlopez @ 11:47 am

These days I was working on reimplementing the core of my open source AjLisp lisp interpreter. I wrote about the previous version in my 2008 post:

AjLisp: a Lisp interpreter in .NET

The work is in progress. You can download the current code from:

http://code.google.com/p/ajlisp/source/browse/#svn/trunk/AjLisp

(there are two other implementations in that repository, work in progress: AjScheme, an Scheme-like lisp, and AjSharpure, following Clojure ideas). I should write more about these implementations. This post is the initial one in a series about this new AjLisp. It’s a short introduction to the current status of the project.

The main change in the new version: the interpreter can manage native objects and values. The alternative was to point to such objects using a wrapper, a class that implements SymbolicExpression or something similar. But I choose to point and manage direct native object and values. So, I changed the primitives and related classes to receive objects instead of IExpression. Now, there is an interface IExpression, that is defined:

    public interface IExpression
    {
        object Evaluate(ValueEnvironment environment);
    }

The ValueEnvironment (I’m planning to rename it to BindingEnvironment, and to derive from it an interface IBindingEnvironment) keeps nested association of names to values:

There is an interface IFunction:

    public interface IFunction
    {
        object Apply(List arguments, ValueEnvironment environment);
    }

that it should be implemented by any form expression (the head of a list to evaluate).

There are two main classes that represent the core types in AjLisp: identifiers and lists:

All the project was built using Test-Driven Development, so I could change the previous versions with courage: I had my battery of tests ready to help me in the refactoring process. This is the current status:

I should write about:

- ValueEnvironment implementation

- Native objects and values management

- List type and evaluation

- Identifier evaluation

- Implemented primitives

- Lexer and Parser

- Numeric operations

- Rational numbers (AjLisp can manage integral numerator/denominator pairs)

Currently, after the wisdom gained developing these projects (AjLisp, AjScheme, AjSharpure), I’m writing a minimal core AjCoreLisp, to show what are the minimal primivites we need to create a Lisp interpreter. Armed with such implementation, I would like to explore compilation alternatives (Dynamic Language Runtime is my first candidate). It could be overwhelming to me do such exploration based on a “bigger” interpreter like AjLisp. First, I’ll try to compile an interpreter with few primitives.

Keep tuned!

Angel “Java” Lopez

http://www.ajlopez.com

http://twitter.com/ajlopez

January 7, 2010

Agile Estimation by Mike Cohn

Filed under: Agile Software Devevelopment, Scrum, Software Development, Video — ajlopez @ 10:09 am

One of the frequent question from the attendees to my Scrum talks, is how to estimate an agile/Scrum project? Some month ago, I found this videos. I want to share with you. Mike Cohn is a recognized expert in Agile and Scrum world. You can visit his blog to learn more from him. In this two videos, he explain clearly what it means estimation in an agile project (involving the team, doing iterations, poker planning, all the Scrum practices…):

High resolution: http://www.youtube.com/watch?v=jeT0pOVg0EI

High resolution: http://www.youtube.com/watch?v=jeT0pOVg0EI

The video was taken in the March 20, 2007 Bay XP Meeting.

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

January 4, 2010

AjLisp family: implementing lisp interpreters in C#

Filed under: .NET, AjCoreLisp, AjLisp, AjScheme, AjSharpure, Lisp, Programming Languages — ajlopez @ 3:22 am

In the last months, I was active written Lisp interpreters. Since the eighties, I like to write such interpreters. One of my preferred exercises when I study a new programming language, is to write a Lisp interpreter.

In 2008, I published a code written in C#, AjLisp:

AjLisp: a Lisp interpreter in .NET

At mid of 2009, I started to research Clojure. Then, I decide to explore the news ideas of that language, reimplemeting it in C# (original Clojure is written in Java, but there is a version written in .NET, that compiles to .NET using Dynamic Language Runtime). It’s only an interpreter (I should study more about DLR or .NET compilation, to write down a compiler; and about how to do it… ;-) . The result is work in progress, named AjSharpure (I named it AjClojure, but I had to change the name). You can see the code, under development:

http://code.google.com/p/ajlisp/source/browse/#svn/trunk/AjSharpure

Initially, my idea was to port “one-to-one” Clojure java code, but I realized that its code is not easily read, no test on code, no spefication about the behavior of dozens of methods, so I stopped, and rethinked my way. I took courage, forget my initial code, and start bottom-up, full TDD, implementing piece by piece, only trying to follow the external behavior of the language, instead of its internal implementation.

I stopped AjSharpure development, to study more about variables in Clojure, Shared Transactional Memory, and other topics. Then I back to 2008 version of AjLisp. I write a new version in 2009, with major refactoring of the previous one. Now, it can manage native objects and values. The trunk is at:

http://code.google.com/p/ajlisp/source/browse/#svn/trunk/AjLisp

There is no “plain vanilla” Lisp, and there are TWO main dialects: Common Lisp and Scheme. I don’t like Common Lisp (I should write a post about my reasons), so, in order to know more about Clojure and current Lisp development, I started AjScheme, an interpreter that implements most of the Scheme reference (I give up to implement macros as in Scheme, I back to mlambdas and alike):

http://code.google.com/p/ajlisp/source/browse/#svn/trunk/AjScheme

AjLisp was born following an old Christian Queinnec book (I didn’t find the code of that book in the web). He wrote a Lisp interpreter in Lisp itself. Queinnec use a simplified Lisp. But I want to study more about the minimal needed kernel. So, now I’m working on AjCoreLisp:

http://code.google.com/p/ajlisp/source/browse/#svn/trunk/AjCoreLisp

It has no parser or lexer. The idea is implement an minimal interpreter using AjCoreLisp as the basis: the result is named MinimaLisp, and it’s included in the trunk. I’m implementing few primitives, and I’m trying to write the rest of the common forms as functions or macros. A geeky decision: implement backspace macro expansion as a macro! See code at:

http://pastie.org/765371

Once I have AjCoreLisp stabilized, I will refactor AjLisp, AjScheme, to use a more slim kernel, but re-implementing the most used forms as primitives. I should measure the impact of using most used forms as macro. I’m confident on the successful of changes, since all is backed by a battery of test (TDD and tests save my day many times, when I refactored much of this code base).

I will write detailed posts about these different interpreters, variations over a leit motiv: the beautiful ideas of Lisp language.

Keep tuned!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

Older Posts »

Blog at WordPress.com.