Main | November 2004 »

October 24, 2004

lists coming from methods

I have functions with lists working! Oh the joy, but not THAT much joy yet. Now I have 2 more problems, similar.

Every function returns a list! Do you know how uncool that is? it started out when I first made CX. Don't worry, the codebase is not big enough for that fact to mean much. When I first made CX, I made it so that you could evaluate two expressions at once, seperated by nothing. "hi" "there" would return 'hi there', and this was how your expression was evaluated into more than one result. When I build upon this, I did enough factoring where this same 'idea' is implemented in quotes:

set["x" {twice twice 3 twice 3}]

x => [12 , 6]

Now, thats coolish, but if the function of x was just 'twice twice 3', it would return [12], which is a list holding one number. It's not the number itself!

set["x" {twice twice y}]
set["y" {*[3 4]}]

x => ERROR: twice: input was not a single number.

twice recieved a list of one number, not the number itself! To fix this, I need to make it so that typing "hi" "there" only returns "there". Lispy, huh? Yah, don't spit on me anymore. If you want to evaluated more than one thing at once, do [ "hi" "there" ]. I also need to change most of the LinkedLists to be my own CXList classes because LinkedList.toString has comma seperated slots and I need spaces. Anyway, once those small things are done,

x => 144

Once that is done, the sacred 'inp' word will be implemented for user-defined functions that use application rather than concatenation.

Posted by Rex at 05:49 PM | Comments (0)

October 21, 2004

problem with quoted lists

CX has an issue with any function that contains a list inside the quote. In other words, quoted lists don't work.

set["x" {+[2 c]}]

This is the peice of code I'll be referring to for now on. The problem is that when the list [2 c] is read, the 'c' is evaluated on the spot! when we run 'x', the interpreter attempts to add 2 to null, because at the time of the creation of the list [2 c], c was not linked to anything. My best solution is to do 2 things:

first, I need to seperate lists from quotes. I'm going to subclass Stack.java into CXList and CXQuote. The next step is to have quoting levels for the parser; every '{' character will raise the quoting level, and every '}' will lower it. The quoting level starts at 0, so when it is at 0, lists are evaluated on the spot. If the quoting level is above zero, lists are created as CXList's, where the values in the list are going to be evaluated later. Once this is done, I'll clean up the code and make this newest release 0.36 Alpha. When conditions are done, it'll be 0.36.

here is a demonstation of a function working becuase it has no list in the quotation

Posted by Rex at 08:11 AM | Comments (0)

October 12, 2004

Maintainance programming

I spent a day to make the rest of my days easier. First I took a look at my largest file, Parser.java. This class was doing two things when it was better off doing one; it was parsing the String of typed CX code, then commiting (evaluating) the parsed structure.

Now, there is a new file in CVS named Evaluater.java and this class is just for the committing. After that work, I just found out something I didn't really know about java- all references to fields marked with the 'final' modifyer are not really references. They are compiled as though you really typed the number in replacement of the variable name everywhere- including other classes. This means that if you even decide to change the final field in one file, but it is refered to in another, the other class will remain acting as though the value never changed, until you purposely recompile it. I had to find this out the hard way, and I'm not certain of what I think about that. Really, the issue is that I was taught that 'final' was a modifyer to make constants, but this is much more than constants to me. How embarrassing. Now conditionals are on their way to being implemented. The code is already made, but it doesnt work, and I know why- so it's just a matter of time.

Also, CX now has a release on SF.net (version 0.35): here.

Posted by Rex at 12:58 AM | Comments (0)

October 07, 2004

Contex is here

Contex is here! CX is my programming language and there is so much to say about it.

For a description of the language which I don't want to duplicate, you can look at the entry on my personal blog. CX is in its very beginning and so major foundational decisions are being made right now. As of now, there is no distribution available in binary form, but the source code is available via anonymous cvs. Just click that link and scroll down to the information about anonymous cvs, and read carefully. the module name is "contex", so you can basically paste the shell code into your favorite *nix console and only switch 'modulename' with 'contex'. Even this very content management system is still being settled into place. Assistance with ConteX is available when it comes to planning and documentation. the foundational code needs to be as tightly integrated as possible (in my opinion). This means that if you want to work on the foundational code from here, you'll be best making your own project from my source.

Posted by Rex at 08:26 PM | Comments (0)