One step forward, X steps backward.

I’ve made some progress, but I think I’m after hitting a wall I didn’t anticipate. For your consideration, I will first post what I have working, then I’ll briefly discuss what isn’t and why I’m going in the wrong direction.

Working:

(defun ‘factorial ‘(n)
(if
(<= n 1) 1 (* n (factorial (- n 1) ) ) ) ) [/sourcecode] So, functions and control statements with no strings attached =). There is no quoting of the function code either - I have implemented a very simple Macro system. Just to be clear, there really aren't any strings being used "under the hood" - everything is done at compile time, the function is created at runtime by copying the bytecode that contains the expressions, without evaluating them. The quoted function name and argument list could easily be fixed too, but I won't yet because I have hit this wall. The problem is that I've been so focused on making functions work without using strings (which - fair enough - I've succeeded in doing) that I haven't addressed the underlying issue, which should have been more obvious. The problem (it so obvious now! *hits self*) is that I am trying to represent LISP code and data as two separate things at the bytecode level. This worked well at the beginning - quoted lists are data and code was everything else. Now I need the intermediate stage, code stored in lists before it is passed to defun, if, while and the like. I think I've settled on a new solution - one that might hopefully solve the wider problems, but I haven't had time to implement it yet. When I do, I promise I'll get around to describing the current state of the system and how it works. The nice thing about my new solution, if it works, is that it will take me a huge step close to being able to define macros in LISP - which is neat. Until then...

Advertisements

2 Responses to “One step forward, X steps backward.”

  1. Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.

  2. Thanks! It’s been neglected of late… but I hope I will soon restart work on it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: