lisp

Lisp and Prolog for Artificial Intelligence? [closed]

送分小仙女□ 提交于 2019-12-03 02:44:26
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . Now since i've taken a class 3 years ago in A.I. im clearly proficient enough to ask this question......just kidding just kidding ;) but seriously, what is it about these languages that make them so popular for A.I. research. Even though A.I. research is "old"...it's came

Common Lisp: What does #+nil?

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The other day (perhaps yesterday) I was quite perplexed about this #+nil read-time conditional found in https://github.com/billstclair/defperson/blob/master/defperson.lisp#L289 . After some deep thinking I came to the conclusion that this is very lispy way of commenting out code. Can someone confirm this? Perhaps my assumptions are completely wrong. Anyway, thanks in advance. 回答1: See CLHS 2.4.8.17 Sharpsign Plus To conditionalize reading expressions from input, Common Lisp uses feature expressions . In this case it has been used to comment

Common Lisp: Launch subprocess with different working directory than lisp process

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Suppose I have a directory A, and subdirectory B. I cd into A and launch lisp. In that lisp process, I would like to launch a Python subprocess where Python sees B as its current working directory. The lisp process needs to have cwd in A, and the python process should have cwd in B. How do I do this in a cross-platform, simple way? I'm looking for a solution that works with CCL and SBCL (probably using 'run-program function), and works for Windows, Linux, and OS X. I looked at the CCL run-program documentation, and I didn't see a way to

Using Lisp in C#

匿名 (未验证) 提交于 2019-12-03 02:18:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: As a lot of people pointed out in this question , Lisp is mostly used as a learning experience. Nevertheless, it would be great if I could somehow use my Lisp algorithms and combine them with my C# programs. In college my profs never could tell me how to use my Lisp routines in a program (no, not writing a GUI in Lisp, thank you). So how can I? 回答1: Try these .Net implementations of Lisp: IronScheme IronScheme will aim to be a R6RS conforming Scheme implementation based on the Microsoft DLR. L Sharp .NET L Sharp .NET is a powerful

What can you do with Lisp macros that you can't do with first-class functions?

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I think I understand Lisp macros and their role in the compilation phase. But in Python, you can pass a function into another function def f(filename, g): try: fh = open(filename, "rb") g(fh) finally: close(fh) So, we get lazy evaluation here. What can I do with macros and not with functions as first class objects? 回答1: First of all Lisp has first-class functions too, so you could as well ask: "Why do I need macros in Lisp if I already have first-class functions". The answer to that is that first-class functions don't allow you to play with

Python vs. Ruby for metaprogramming [closed]

不羁岁月 提交于 2019-12-03 01:48:59
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm currently primarily a D programmer and am looking to add another language to my toolbox, preferably one that supports the

LISP: Find occurrences of each word in a sentence.

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can someone please explain to me how I search for the occurrences of each word in a sentence, such as "the cat sat on the mat" in Common lisp ? The user has to have inputted this line of text before hand and then the occurrences must be counted from that. Any help on even where to start would help. 回答1: Have a look at split-by-one-space in The Common Lisp Cookbook (defun split-by-one-space (string) "Returns a list of substrings of string divided by ONE space each. Note: Two consecutive spaces will be seen as if there were an empty string

Are functional programming languages suitable for graphics programming?

狂风中的少年 提交于 2019-12-03 01:43:44
问题 Just very curious about this, from my own experience , all the graphic programming seems to C or C++ related. Like the Direct10X. Does functional programming language provide some sort of graphic library to develop video game? 回答1: You can use functional languages to do graphics/game programming just as in any other language. It's only a simple game, but I wrote Ironclad: Steam Legions in Clojure as an exercise in functional programming for game development. Here are some lessons I learnt /

Understanding tailp in Common Lisp

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: While looking through the "Common Lisp Quick Reference" by Bert Burgemeister, I stumbled over tailp . First, I misunderstood the definitions of this function. And I tried: ( tailp '(3 4 5) ' ( 1 2 3 4 5 )) But it returned NIL CLTL2 says, tailp is true iff the first argument is any (nthcdr n list) with existing n . ( nthcdr 2 '(1 2 3 4 5)) ;; (3 4 5) I further tried: ( tailp '(3 4 5) ' ( 1 2 3 4 5 )) ;; NIL - and I would expect : T following the definition above . ( tailp '() ' ( 1 2 3 4 5 )) ;; T ( tailp '5 ' ( 1 2 3 4 . 5 )) ;; T

Why is consing in Lisp slow?

女生的网名这么多〃 提交于 2019-12-03 01:19:31
I read in the book 'On Lisp' that one should avoid excessive use of cons in the body of expanded macros. Why is cons considered to be an inefficient operation? Does Lisp not do structure sharing with the cons cells? You need to understand the jargon first. CONS is a primitive operation to create a fresh cons cell. Consing means allocation of memory on the heap in general, not only cons cells: Consing of numbers, Consing of arrays, Consing of CLOS objects, ... The definition from the 'memory management glossary' says: cons (1) In Lisp, cons is a primitive operation creating a list element (from