Re: sLisp
Brought to you by:
set
From: salvador <sal...@in...> - 2001-09-24 12:47:26
|
"Thiago F.G. Albuquerque" wrote: > Today I would like to talk about some sLisp-related stuff. > > 1)In Emacs there is this "scratch buffer", where you can type Lisp expressions and then you > press C-j and it evaluates it on the fly. It would be nice if SETEDIT had something like this. > It would be great to debug macros. Yes, I guess it could help. And isn't hard to implement. But I also think it will expose some limitations ;-) > 2) Sometime ago I asked SET for the possibility of assigning a (real) macro to a pseudo-macro > trigger. I was thinking about it, and I wondered if it could be implemented as a sLisp macro, > that would be assigned to Ctrl-Space. It would take the last two characters and depending on > them, trigger other macros. Here's the code: > > (defmacro 'pmacro' > (eval > (SendCommands cmcSelectOn cmcCharLeft cmcCharLeft cmcSelectOff) > (let ((str (GetSelection))) > (cond ((== str "#i") (InsertText "#include ")) > ; ((== str "") ()) ; put your other macros here > ; ((== str "") ()) > (t (SendCommands cmcCharRight cmcCharRight)) > ) > ) > ) > ) > > But I need some new sLips commands: > > let I think what you wrote is currently: (setv "str" (GetSelection)) > cond And I think that's (if (not (strcmp "#i")) (InsertText "...")) strcmp is just like the C function, so a match is 0, that's why I need the `not', `if' is just like the C counterpart. > == > (Lisp has several equality predicates (eq, equal, =,...). I don't know to which the one I am > asking for corresponds, but it would be good to use the same notation as Lisp). I don't know, the only reason of the "Lisp" like stuff is that it is really easy to parse. I preffer to make it closer to C and Perl. > Also, I would like a macro to be able to call another macro. Currently, code like this: > > (defmacro 'macro2' > ; something > ) > > (defmacro 'macro1' > (macro2) > ) > > doesn't work. I agree, something like (call "function" [arguments ...]) could help. The implicit way (function ....) could be also a solution, not sure. > 3) > > SET, > > I guess there is a number of open source embbedable Lisp interpreters out there. I've heard of > one called "xlisp". Have you ever considered using one of them instead of sLisp in SETEDIT? Not at all. > The > advantage is that all of Lisp's standard constructs (such as cond, let, etc...), types and > functions are already implemented; you just have to add the editor-specific stuff. You don't > have to reimplement everything from scratch. And the disadvantage is that I must learn how it was coded and live with any thing I don't like from it. Adding new commands to my sLisp parser is really easy, just go and take a look how is implemented strcmp. > Please, don't take this as a criticism to sLisp. It is just a suggestion. What do you think? What really considered was using a powerful script language, like Perl, but for this I must investigate how to do it. I know Perl can be used in C through libperl, but I don't know if it can handle "persistence" between calls. Having Perl embedded in the editor could be really nice. It will be added before version 1.0.0, of course it could be in 20 years ;-) But it should be optional, so I need a basic macro language. SET -- Salvador Eduardo Tropea (SET). (Electronics Engineer) Visit my home page: http://welcome.to/SetSoft or http://www.geocities.com/SiliconValley/Vista/6552/ Alternative e-mail: se...@co... se...@ie... Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013 |