On Mon, 2013-07-29 at 15:21 +0400, 白い熊 wrote: > Nala Ginrut <nalagin...@gmail.com> wrote: > > >> I would like to program for Guile as the lowest denominator. > >> > >> What is the proper check I should define that would tell me whether > >I'm currently interpreting the code in Guile, or Emacs, or Crisp. > >> > > > >If you just want to check whether a symbol was defined, try: > >(module-defined? (current-module) 'function-lambda-expression) > > Hi: > > Thanks for the tip. > > What I'm trying to do: I have a host of kx-... functions which I want to > call from any interpreter with the same syntax, i.e. let's say for instance > (kx-file-open "funny-file.txt") > > Now, within the kx-file-open I need to find out whether I'm in guile or > clisp or emacs, via a function call, let's say kx-interpreter. >
I have no better idea but I think it can be handled by 'catch exception', but I don't think guile/clisp/emacs have same procedure named 'catch' or else. > This function should return let's say 0 for guile, 1 for clisp and 2 for > emacs. Based on this, the file open function will use the appropriate lisp > syntax for opening the file. > > Now I'm wondering what the most effective / fastest way is to find out not > whether a symbol is defined, but basically the answer to the self-awareness > question: am I in guile, or am I in emacs... > Here's a dilemma, unless guile/clisp/emacs have the same checker-procedure with same name and definition, you have no promise to check it under different language environment. The best way is prepossess which is portable. Maybe there's better idea I didn't know? Thanks!