A New Language
Hi,
I am currently developing a "chimeric" language that may have AI uses, hence this post. The language will combine features of Prolog and Haskell with two new features: implications and structured output. Currently I am defining the grammar that will be allowed in version 1.
The above may seem vague, so I will list some examples of what will work when it is completed. If you already have a basic grasp of Prolog and Haskell, everything should be fairly understandable. Let's begin.
--------
isExpressed(substance, gene) :- expresses(substance, gene).
expressedGenes(substance) = [x | x <- expresses(substance, x)].
--------
Before introducing anything really new, let me explain the above. The first statement is true when 'substance' expresses 'gene'; A fairly simple Prolog construct.
The second statement uses the list comprehension feature from Haskell. It will return a list of genes expressed by the given 'substance'.
--------
commonElements(xs, ys) = [x | x <- xs, y <- ys, x == y].
commonGenes((x:[])) = expressedGenes(x).
commonGenes((x:xs)) = commonElements(expressedGenes(x), commonGenes(xs)).
substancesThatExpress((gene:[])) = [sub | sub <- expresses(sub, gene)].
substancesThatExpress((g:enes)) = commonElements(substancesThatExpress(g), substancesThatExpress(enes)).
--------
Here it gets a little more interesting. :-)
commonElements returns a list of elements that exist in both of the list arguments
commonGenes returns a list of genes that a given list of substances both express
substancesThatExpress returns a list of all substances that express a given list of genes
So far, everything above comes from either Prolog or Haskell -- or some combination thereof.
--------
neuron(name) -> expresses(name, 'gene1'), expresses(name, 'gene2'), expresses(name, 'geneN').
--------
The above is an example of an implication (notice the familiar mathematic notation A -> B, read A implies B). The use of this feature will be, primarily, to ease the input of data. Say the following line is encountered after the above:
--------
neuron('corticoSpinal').
--------
This would then assume that all of the predicates are true. In this example, 'corticoSpinal' would express 'gene1', 'gene2', and 'geneN'.
The final feature of version 1 will be structured output. A slight modification to a previous predicate will serve as a decent example.
--------
isExpressed(substance, gene) :- expresses(substance, gene) ? gene + " is expressed by " + substance : gene + " is NOT expressed by " + substance.
--------
If the predicate is true, the first string is displayed. Otherwise, the latter is.
My purpose in posting this is to get an idea of how useful it will be and some applications for it. As my examples demonstrate, I am biased towards using it to help with genetic research.
The language will be developed as a special topics computer science course next semester, so my professor may not allow me to develop the first version as an open source project. After the course, however, it will definitely go that route.
Any comments and/or critiques will be appreciated. :-)
Thanks,
-Steven
|