|
Hi Yves,
I haven't implemented a function to load just Lisp code. The main TXR language has a @(load ...) directive for loading dependent .txr files. You can put Lisp definitions into them; just wrap it all with @(do ...).
I implemented load it so that if the path is relative, it resolves relative to the directory of the file which the @(load ...) directive occurs, similarly to how #include "relpath.h" works in C compilers or the way Windows programs look for DLL's. So it is easy to break a program into multiple files, regardless of where it is placed and invoked from.
On 23.09.2014 18:58, Yves Cloutier wrote:
Thanks!So my question is if I can define TXR LISP functions like (bold arg), (size arg1 arg2) and "import" them into a TXR prorgam?Initially I thought of using the pattern matching feature of TXR to define tokens, match them and do something accordingly. But Now I'm sort of cluing in to the brilliance of LISP languages that code is data and data is code paradigm, and that instead, I could just translate my input text file into LISP form and just do a (eval ) which just executes the entire document as a LISP program!The idea is to generate output from the input, for example, could be Groff, LaTex, HTML, etc...=> (size +2 (bold (up 3 "text")))<size +2, bold, up 3<text><up 3<text><smallcaps<text><bold<text>In my project I have some simple markup language I have defined which translated itself very nicely to lisp code. For example:Where myfunctions is an external module in which I have defined some functions.What I mean is, in Scheme I can do the following:Hello list,I would like to know if it's possible to "import" code or modules into TXR Lisp.
(require myfunctions)Which converted into LISP would look something like:(bold "text")(smallcaps "text")(up 3 "text")Or as nested inline commands:
--
Memorize Japanese Characters with Tankan.
This message was posted to the following mailing lists: | ||||
---|---|---|---|---|
TXR Users Mailing list info | Nearby messages |
Kaz'z Mailing List Archives adminstered by Kaz | Lurker (version 2.3, substantialy hacked by Kaz). Icon artwork from VisualPharm. |