lisp

Help writing emacs lisp for emacs etags search

天涯浪子 提交于 2019-11-30 21:23:17
I'm looking for some help developing what I think should be an easy program. I want something similar to Emacs tags-search command, but I want to collect all search results into a buffer. (I want to see all results of M-,) I'm thinking this python style pseudo code should work, but I have no idea how to do this in emacs lisp? Any help would be greatly appreciated. def myTagsGrep(searchValue): for aFile in the tag list: result = grep aFile seachValue if len(result) > 0: print aFile # to the buffer print result # to the buffer I would like to be able to browse through the buffer with the same

Using a lambda value from function as first element of list

∥☆過路亽.° 提交于 2019-11-30 19:41:55
I'm reading over Peter Norvig's Paradigms of Artificial Intelligence Programming, and I've come across an issue I cannot resolve on my own (this is my introduction to Lisp). The issue is quite a small one, really, but obviously not one my little brain can solve. Why is it that when a function's value is a lambda, it is an error to use that function as the first element to a list. For example: Lisp: (defun some-func () #'(lambda (x) x)) ;; At REPL ;; Does not work > ((some-func) 1) ;; Does work > ((lambda (x) x) 1) ;; Also works > (funcall (some-func) 1) I hope that makes sense! This is a good

running shell commands with gnu clisp

為{幸葍}努か 提交于 2019-11-30 17:47:49
问题 I'm trying to create a "system" command for clisp that works like this (setq result (system "pwd")) ;;now result is equal to /my/path/here I have something like this: (defun system (cmd) (ext:run-program :output :stream)) But, I am not sure how to transform a stream into a string. I've reviewed the hyperspec and google more than a few times. edit: working with Ranier's command and using with-output-to-stream, (defun system (cmd) (with-output-to-string (stream) (ext:run-program cmd :output

How to examine list of defined functions from Common Lisp REPL prompt

天涯浪子 提交于 2019-11-30 17:35:13
I'm evaluating/testing a browser based application presumably written in common lisp. Apart from the browser based interface, the software provides a 'Listener' window with a 'CL-User >' REPL prompt. I wish to examine the list of functions, symbols, and packages from the REPL prompt. So that I could co-relate the frontend functionality with what is exposed via the REPL. Google search is futile for me as it leads to tutorials and resources that teaches lisp step-by-step. Any hints, pointers on examining the state via REPL will be much appreciated. If you don't know what symbols you're looking

How to examine list of defined functions from Common Lisp REPL prompt

我怕爱的太早我们不能终老 提交于 2019-11-30 16:38:51
问题 I'm evaluating/testing a browser based application presumably written in common lisp. Apart from the browser based interface, the software provides a 'Listener' window with a 'CL-User >' REPL prompt. I wish to examine the list of functions, symbols, and packages from the REPL prompt. So that I could co-relate the frontend functionality with what is exposed via the REPL. Google search is futile for me as it leads to tutorials and resources that teaches lisp step-by-step. Any hints, pointers on

Can I extend lisp with c++?

天涯浪子 提交于 2019-11-30 15:45:36
问题 Can I call a function from lisp from a library written in c or c++? How can I extend lisp? This is useful when you want to do some system calls or stuff like that. 回答1: It is unusual to call non-lisp code from lisp, and rarely necessary. CLX (the X11 client implementation for CL) doesn't link to the Xlib implementation but "speaks" X11 directly. On any system, your CL implementation is likely to already have excellent operating system hooks rendering this unnecessary. That said, the answer

Can I extend lisp with c++?

那年仲夏 提交于 2019-11-30 15:07:14
Can I call a function from lisp from a library written in c or c++? How can I extend lisp? This is useful when you want to do some system calls or stuff like that. It is unusual to call non-lisp code from lisp, and rarely necessary. CLX (the X11 client implementation for CL) doesn't link to the Xlib implementation but "speaks" X11 directly. On any system, your CL implementation is likely to already have excellent operating system hooks rendering this unnecessary. That said, the answer depends on the lisp implementation: In ECL you can actually host a CL environment under C and simply call cl

Unix signal handling in (common) lisp

流过昼夜 提交于 2019-11-30 13:56:15
问题 I've done a bit of research on this subject and am turning up blanks. There seem to be implementation-dependent ways of doing Unix signal handling in Common Lisp, but is there a package that gives a cross-implementation way of doing signal handling? I would mainly like to listen for SIGINT and do a graceful shutdown in my app. I'm using Clozure CL 1.7 on linux...like mentioned, it would be great for a package for this, but if I have to resort to implementation-specific code, that's fine. I'm

Killing buffers whose names start with a particular string

风格不统一 提交于 2019-11-30 13:48:25
问题 Here's my problem: I use Emacs and get lots of buffers that are pretty useless all the time, like *Messages* or *Completions*. I want to bind \C-y to close all buffers that start with * except for *shell* (and *shell* < k >) buffers. To do that, I'd like to add some Emacs-Lisp in my .emacs file: (defun string-prefix s1 s2 (if (> (string-length s1) (string-length s2)) nil (string=? s1 (substring s2 0 (string-length s1))) )) (defun curry2 (lambda (f) (lambda (x) (lambda (y) (f x y) )))) (defun

Mysterious Racket error: define: unbound identifier; also, no #%app syntax transformer is bound in: define

大憨熊 提交于 2019-11-30 13:28:29
This program produces an error: define: unbound identifier; also, no #%app syntax transformer is bound in: define When pasted into the REPL (to be exact, the last line: (displayln (eval-clause clause state ))), it works. When run in definition window, it fails. I don't know why. #lang racket (define *state* '((a false) (b true) (c true) (d false))) (define *clause* '(a (not b) c)) (define (eval-clause clause state) (for ([x state]) (eval `(define ,(first x) ,(second x)))) (eval (cons 'or (map eval clause)))) (displayln (eval-clause *clause* *state*)) This too: (define (eval-clause clause state