lisp

org--agenda-prefix-format %? does not work

ぐ巨炮叔叔 提交于 2019-12-21 06:04:11
问题 Currently, I have my global TODO list shown as follows thanks to erikstokes: (org-agenda-prefix-format " %i %?-12(concat \"[ \"(org-format-outline-path (list (nth 1 (org-get-outline-path)))) \" ]\") "))) which outputs: for org layout: However, as you can see, for Task A, even though there is nothing in the project, it still shows up on the list. describe-variable for org-agenda-prefix-format says : If the first character after `%' is a question mark, the entire field will only be included if

Universal Func<> type in c#

半腔热情 提交于 2019-12-21 05:31:42
问题 I'm writing a small Lisp interpreter in C#, and it's basically working already. Currently I'm using an interface to represent functions: public interface LispFunction { object Apply(ArrayList parameters); } The interface is implemented by multiple classes for internal (standard) functions, lambdas, macro expansion, calling methods in .net objects via reflection and so on. Please note that speed is NOT an issue here, just the joy of getting the interpreter to, and use it at, work. Now I'd like

Genetic Programming in Haskell

[亡魂溺海] 提交于 2019-12-21 05:18:16
问题 There is GenProg (http://hackage.haskell.org/package/genprog) for example, but that only deals with numerical optimization, in this case finding an equation that describes the data. But I require for loops, if statements, when statements, Boolean checks etc. I need to be able to generate imperative structures. Any thought on this? My best options so far seem to be husk-scheme where I can run Scheme code as a DSL in Haskell. Surely there must be better ways? 回答1: If you're looking for

How do I read a web page in Racket?

烂漫一生 提交于 2019-12-21 04:38:04
问题 All of the information I can find online is about writing web servers, but there seems to be very little about functions useful for web clients. Ideally, I would like the function to look something like this: (website "http://www.google.com") And return a string containing the entire web page, but I would be happy with anything that works. 回答1: Here's a simple program that looks like it does what you want: #lang racket (require net/url) (port->bytes (get-pure-port (string->url "http://www

How to run Clozure CL (Lisp) from a shell script on OS X?

╄→гoц情女王★ 提交于 2019-12-21 04:32:27
问题 I tried the following: $ cat args.sh \#! /Applications/ccl/dx86cl64 (format t "~&~S~&" *args*) $ ./args.sh Couldn't load lisp heap image from ./args.sh I can run lisp fine directly: $ /Applications/ccl/dx86cl64 Welcome to Clozure Common Lisp Version 1.5-r13651 (DarwinX8664)! ? Is it possible to write a shell script to run lisp code with Clozure CL? I am sure I am doing something silly. I installed it from: http://openmcl.clozure.com/ 回答1: Just following up on Charlie Martin's answer and on

Hierarchy of standard-object and standard-class in Common Lisp

怎甘沉沦 提交于 2019-12-21 04:02:08
问题 I'm studying Common Lisp (with Lispworks) and I'm trying to get into class system right now. There is a class called standard-object and it is defined as The class standard-object is an instance of standard-class and is a superclass of every class that is an instance of standard-class except itself. (taken from http://www.lispworks.com/documentation/HyperSpec/Body/t_std_ob.htm#standard-object) so it is an instance of standard-class On the other hand standard-class is a subclass of standard

Mapping a function over two lists in elisp

我与影子孤独终老i 提交于 2019-12-21 03:38:12
问题 In common lisp I can do this: (mapcar #'cons '(1 2 3) '(a b c)) => ((1 . A) (2 . B) (3 . C)) How do I do the same thing in elisp? When I try, I get an error: (wrong-number-of-arguments mapcar 3) If elisp's mapcar can only work on one list at a time, what is the idomatic way to combine two lists into an alist? 回答1: You want mapcar* , which accepts one or more sequences (not just lists as in Common Lisp), and for one sequence argument works just like the regular mapcar . (mapcar* #'cons '(1 2 3

Check if item is in a list (Lisp)

走远了吗. 提交于 2019-12-21 03:09:13
问题 What's a simple way to check if an item is in a list? Something like (in item list) might return true if item=1 and list=(5 9 1 2) and false if item=7 回答1: Common Lisp FIND is not a good idea: > (find nil '(nil nil)) NIL Above would mean that NIL is not in the list (NIL NIL) - which is wrong. The purpose of FIND is not to check for membership, but to find an element, which satisfies a test (in the above example the test function is the usual default EQL ). FIND returns such an element. Use

Emacs mode that highlight Lisp forms

久未见 提交于 2019-12-21 02:56:18
问题 What is the Emacs mode or package that highlights Lisp forms changing the color of the backgrounds so that the form you are in has one color, the outer form another, the outer outer form another and so on? 回答1: You may want to try mwe-color-box (screenshot below) or read Five approaches to s-expression highlighting by Lemondor. (source: foldr.org) 回答2: Take a look at screenshots here http://lemonodor.com/archives/001207.html, may be that is what you want. 回答3: I don't use it, but this might

Lisp: can a macro be recursive?

三世轮回 提交于 2019-12-20 21:59:03
问题 I've recently started coding in Lisp, and have already been most impressed with macros - they allowed me to do complex loop-unrolling at compile-time, something I can't do this elegantly in any other language that I know of (i.e. code-generate while keeping the original structure). On to optimization: I've sprinkled type annotations (lots of "the fixnum") in the same code. Once I've added 3 or 4 of them, I realized I was doing it wrong - this is what macros are for, Dont Repeat Yourself... ;