lisp

Running flymake for python when files don't have .py extension

点点圈 提交于 2019-12-12 15:15:50
问题 I'm not a lisp guy at all, but my primary scripting environment lives on emacs and I need some help to get my flymake/pyflakes running when there is no .py extension on files. Because some of the scripts here at my work doesn't have .py extension on them. This is pretty working with pylint, pep8, pychecker etc, when I'm reading/coding a file that has the .py extension. ;; flymake for python (add-to-list 'load-path "~/.emacs.d/plugins/flymake") (when (load "flymake" t) (defun flymake-pylint

slime-connect not working

本秂侑毒 提交于 2019-12-12 14:43:15
问题 I am an Emacs and Common Lisp novice. I have successfully installed SLIME in my Emacs, but I am unable to run it. Alt + x slime-connect gives the following options, accepting which gives the error pasted below the options. Host: 127.0.0.1 Port: 4005 Connecting to Swank on port 4005... make client process failed: connection refused, :name, SLIME Lisp, :buffer, nil, :host, 127.0.0.1, :service 4005, :nowait, nil How do I get this to work? 回答1: to fix the whitespace - escape it with double

What is the difference between defining a function inline or not?

天大地大妈咪最大 提交于 2019-12-12 14:00:51
问题 I'm working through the book Structure and implementation of computer programs and in one of the chapters there were some code used to calculate the factorial of a number: (define (factorial n) (fact-iter 1 1 n)) (define (fact-iter product counter max-count) (if (> counter max-count) product (fact-iter (* counter product) (+ counter 1) max-count))) Earlier in the book I learned that I can define functions inline in another function like this: (define (factorial n) (define (fact-iter product

Lisp difference between (cons 'a (cons 'b 'c)) and (cons 'a '(b.c))

谁都会走 提交于 2019-12-12 13:11:00
问题 What's the difference between: (cons 'a (cons 'b 'c)) ;; (A B . C) and (cons 'a '(b.c)) ;; (A B.C) I need to create the following list ((a.b).c) using cons so i'm trying to understand what that "." represents. L.E. : I have the following (cons (cons 'a 'b) 'c) but it produces ((A . B) . C) and not ((A.B).C) (Note the extra spaces) 回答1: Spaces are used to separate list tokens. A.B is a single token. (A.B) is a list with a single element. (A . B) is a cons cell with A as car and B as cdr. A

Can I write this macro without using eval?

邮差的信 提交于 2019-12-12 13:07:29
问题 I'm trying to write a macro which will catch a compile time error in Clojure. Specifically, I would like to catch exceptions thrown when a protocol method, which has not been implemented for that datatype, is called and clojure.lang.Compiler$CompilerException is thrown. So far I have: (defmacro catch-compiler-error [body] (try (eval body) (catch Exception e e))) But of course, I've been told that eval is evil and that you don't typically need to use it. Is there a way to implement this

Is there an inverse of Common Lisp's FORMAT?

二次信任 提交于 2019-12-12 13:02:04
问题 I have a question that's been bothering me for some time. Is the Common Lisp format function reversible (at least to some degree) in that the format string could be used to retrieve original arguments from format 's output? I am aware that the mapping is not one-to-one (one example is the ~@:(~a~) which turns input to uppercase and is not reversible), so necessarily some information is lost. What I have in mind exactly is rather an alternative to regular expressions for string parsing. For

Quote a reader macro invocation

こ雲淡風輕ζ 提交于 2019-12-12 12:15:35
问题 is there a way to quote an invocation of a reader macro? More specifically, I want to create a macro, that once evaluated, will generate a defclass statement and a respective XML file. Is this possible? I thought about using #.( ... ) reader macros, but I assume the macro parameters aren't bound for use inside the reader macro. Is this correct? Therefore, my second thought was to try to generate a statement that included the reader macros, but I'm unsure if there is a way to do that. Any

Why not implement `let` in terms of lexically closed `define`?

时光毁灭记忆、已成空白 提交于 2019-12-12 12:09:03
问题 I have been working with lisp-family languages for several years and feel like I have a pretty good grasp on them. I'm now writing my own lisp (as is the fashion, of course), but almost entirely avoiding re-implementing the same patterns that Scheme, Common Lisp and friends have used. One particular thing that I always found odd was all the variants of let ( letrec , flet , labels , let* ...). Say in a "no legacy carried over from the past" implementation of a lisp, I'd like to just be able

Is everything a list in scheme?

守給你的承諾、 提交于 2019-12-12 12:08:54
问题 Along with the book "Simply Scheme" (Second Edition) i'm watching the "Computer Science 61A - Lectures" on youtube. On the lectures , the tutor uses Stk interpreter, but i'm using chicken scheme interpreter. In the first lecture he uses the "first" procedure which if it's called like : (first 'hello) it returns "h". On the book of "Simply Scheme" it has an example of how first can be implemented: (define (first sent) (car sent)) Which to my testing and understanding works if sent is a list .

Emacs CEDET Semantic tag folding

為{幸葍}努か 提交于 2019-12-12 11:33:26
问题 I would like that every time I open a .cpp file, semantic tag-folding would become activated. I am using the latest version of cedet (loading cedet-devel-load.el). I have (semantic-mode 1) (require 'semantic/ia) (require 'semantic/bovine/gcc) (load-file "path/to/semantic/tag/folding/semantic-tag-folding.el") (require 'semantic-tag-folding) I added a hook (add-hook 'c-mode-common-hook 'setupcpp) and in 'setupcpp I simply have (defun setupcpp () (interactive) (semantic-tag-folding-mode t))