Re: Storing data and code in a Db with LISP-like interface

From: Neo <neo55592_at_hotmail.com>
Date: 1 Apr 2006 17:12:44 -0800
Message-ID: <1143940364.714031.164420_at_v46g2000cwv.googlegroups.com>


> Use standard style - don't put closing parentheses on their own lines

Since some expressions involve sub expressions to a large depth (like the ones shown earlier), it is easier for me to verify proper number and placement of parentheses by lining them up vertically in a fixed-font editor. But I think you are correct that after such verfication, the closing parenthesis could be moved to the prior line to make the script more compact and conserve veritcal space.

// Thus the following is less preferrable ... (func1 param1

       (func2 param1
              param2
              ...
       )
       param3
       ...

)

// ... than the below (according to "standard style"). (func1 param1

       (func2 param1
              param2
              ...)
       param3
       ...)

I haven't formed a standard style for writting expressions in the LISP-like interface to the experimental db, thus you see the lack of it, in my postings.

> and use hyphens instead of the accursed camel case.

I had no I idea what that meant, so I googled around. It seems you are saying to use "get-root" instead of "getRoot" to identify the function. My choice of capitalizing the first letter of subsequent words and concatenating together is now hardWired in my brain from having programmed in C for a while (which does not allow a dash). Since this is not a limitation in the LISP-like interface, I will have to re-evaluate my personal preference. From the few posts that I googled, it seems the dash is preferred to the underscore which is preferred to camelCase (get-root > get_root > getRoot). At the moment, get-root makes me think of subtracting root from get. Also, the dash in get-root makes me think it is multi-worded modifier of the next word as in hot-blooded male, hard-wired memory, make-it-happen thinking, etc. Also some word processors, like that in google, will split get-root over two lines, if it appears near the end of a long sentence :)

>> (firstNode (select * name (firstNode (select * symbol (select 'e' 'm'
>> 'p' 'l' 'o' 'y' 'e')))))
>

> Does this even compile?

It would depend on your definition of "compile" and in reference to who or what. But in general, the parser doesn't compile it in the sense of converting high-level instructions to a list of values executable by the CPU.

> If you want to refer to a specific character, use #\x where x is the character.

:) you are probably correct (the db interface is LISP-like, not LISP).

> But the question remains: why are you passing in each character of a word separately?

I was showing what a simple element of an expression actually translates into by the LISP-like parser.

> Your code is not very idiomatic, and is downright baffling at times, e.g.:

:)

>> (create (it) name (findElseCreate name instance 'accord'))
>

> I have no idea what this means

In simple terms names a thing with an existing name. If the name does not exist, creates it. The approximate equivalent in a relational database would be:

First there exists a table named T_Symbols with a row for each symbol (ie a, b, c ...).
Insert a record in T_String.
Insert 6 records in T_String_Symbol_Map, which relates the new record in T_String with records for 'a', 'c', 'c', 'o', 'r', 'd' in T_Symbols.
Insert a record in T_Name.
Insert a record in T_Name_String_Map,
which relates the new record in T_Name with the new record in T_String. Insert a record in T_Thing.
Insert a record in T_Thing_Name_Map,
which relates the new record in T_Thing with the new record in T_Name.

> .. and to be perfectly frank, no real interest in finding out).

That is ok. However I would be interested in seeing a LISP solution (or any other methodoloy's) to the original problem. I'll restate it breifly here.

Create a function that given a hierarchy and a thing in the hierarchy returns the root. In C, it might look like: getRoot(hierarchy, thing) or getRoot(parent, adam) or getRoot(child, god). Each thing can be in any number of other hierarchies. Not only should the function work for things/hierarchies entered (in db or something roughly equivalent) prior to writing the function but also for the same or new things in new hierarchies specified after the function is written! (I have already posted such a solution using the experimental db with LISP-like interface)

The initial data included the following persons in a parent/child hierarchy:
god (root parent)

__adam & eve
____abraham 
______issace & ishmael


See earlier posts for details. Received on Sun Apr 02 2006 - 03:12:44 CEST

Original text of this message