lisp

What are some examples of LISP being used in production, outside of AI and academia? [duplicate]

﹥>﹥吖頭↗ 提交于 2019-11-30 03:43:23
Possible Duplicate: Lisp in the real world A search query on Google reveals that the search term 'practical lisp' returns a link for Practical Common LISP , which is a very nice starter book. However, this is not what I was looking for or had in mind when I set out to search those terms. EMACS is written in LISP ;-) You're probably not going to get many useful answers, not because Lisp isn't widely used, but because nobody wants to reveal that they used Lisp, because: Lisp is their secret sauce, and they don't want their competitors to know about it Lisp programmers want to show off their app

Can call-with-current-continuation be implemented only with lambdas and closures?

谁说胖子不能爱 提交于 2019-11-30 03:39:11
Does anyone know if call/cc can be implemented with just lambdas and closures? It seems that call/cc interrupts the program's flow (like an exception) but lambdas and closures can't do that. Therefore I think call/cc can't be implemented via lambdas and closures. Any more ideas? The question is not particularly clear, since what exactly does "implemented with just lambdas and closures" mean? In any case, continuations can be used in any language with closures by manually writing in continuation passing style . Then automatic translation into this form can be implemented by extending the

Can you execute multiple statements in an “if” statement?

这一生的挚爱 提交于 2019-11-30 03:27:52
This is my function: (defun MyFunction(input) (let ((NEWNUM (find input num))) (if (find input num) //if this (setq num NEWNUM) (FUNCT2) //then execute both of these (list 'not found)))) //else output this So after the if statement I want to be able to execute (setq num NEWNUM) followed by (FUNCT2) in order to set a new variable and then call a function. Any ideas on how to do this? To do several things in sequence, you want progn . (defun MyFunction(input) (let ((NEWNUM (find input num))) (if (find input num) //if this (progn (setq num NEWNUM) (FUNCT2)) //then execute both of these (list 'not

What type of lambda calculus would Lisp loosely be an example of?

南笙酒味 提交于 2019-11-30 03:00:24
I'm trying to get a better grip on how types come into play in lambda calculus. Admittedly, a lot of the type theory stuff is over my head. Lisp is a dynamically typed language, would that roughly correspond to untyped lambda calculus? Or is there some kind of "dynamically typed lambda calculus" that I'm unaware of? Lisp is a dynamically typed language, would that roughly correspond to untyped lambda calculus? Yes, but only roughly. In the "pure" untyped lambda calculus, everything is coded as functions. (You can google for the popular "Church encoding" and the less popular "Scott encoding".)

How do I increment or decrement a number in Common Lisp?

回眸只為那壹抹淺笑 提交于 2019-11-30 02:58:46
What is the idiomatic Common Lisp way to increment/decrement numbers and/or numeric variables? Use the built-in "+" or "-" functions, or their shorthand "1+" or "1-", if you just want to use the result, without modifying the original number (the argument). If you do want to modify the original place (containing a number), then use the built-in "incf" or "decf" functions. Using the addition operator: (setf num 41) (+ 1 num) ; returns 42, does not modify num (+ num 1) ; returns 42, does not modify num (- num 1) ; returns 40, does not modify num (- 1 num) ; NOTE: returns -40, since a - b is not

How to implement a Lisp macro system?

心已入冬 提交于 2019-11-30 02:25:19
I've implemented my own Lisp on top of node.js, I can run s-expressions like this: (assert (= 3 (+ 1 2))) (def even? (fn [n] (= 0 (bit-and n 1)))) (assert (even? 4)) (assert (= false (even? 5))) Now I would like to add macros - the defmacro function - but this is where I'm stuck. I'm wondering how macro systems are implemented in other Lisps but I couldn't find many pointers (apart from this and this ). I've looked at the Clojure macro system - the Lisp I'm most familiar with - but that seemed too complicated and I couldn't find additional clues that I can readily apply (Clojure macros

Common Lisp Parallel Programming

久未见 提交于 2019-11-30 01:38:34
I want to implement my particle filtering algorithm in parallel in Common Lisp. Particle Filtering and sampling can be parallelized and I want to do this for my 4-core machine. My question is whether programming in parallel is feasible in CL or not and if it is feasible are there any good readings, tutorials about getting started to parallel computing in CL. Definitely feasible! The Bordeaux Threads project provides thread primitives for a number of implementations; I would suggest using it instead of SBCL's implementation-specific primitives (especially if you aren't on SBCL!). The thread

clojure 新手指南(14):Hash-Maps ,Array-Maps & Sorted...

我与影子孤独终老i 提交于 2019-11-30 00:48:48
hash-map 创建 在clojure中,哈希表是最通用的一种Map,和java中的HashMap一样,它们在处理大量数据方面效率非常高,但是不保证顺序。我们可以使用函数hash-map来创建哈希表: =>(hash-map :truck "Toyota" :car "Subaru" :plane "de Havilland") {:plane "de Havilland", :truck "Toyota", :car "Subaru"} =>(class (hash-map :truck "Toyota" :car "Subaru" :plane "de Havilland")) clojure.lang.PersistentHashMap 在clojure中,所有的类型对象都可以作为map的键,甚至是函数对象也可以。但是 我们推荐使用关键字类型(以冒号开头)作为map的键,因为关键字作为键时哈希表性能最好。创建哈希表时不一定非得用hash-map 函数,下面就是一个更简便的方式: ;;直接使用{}来创建哈希表 =>{:truck "Toyota" :car "Subaru" :plane "de Havilland"} {:truck "Toyota", :car "Subaru", :plane "de Havilland"} 不过,用上面这种方式,如果传入的键值对少于9个

clojure 新手指南(7):定义函数

核能气质少年 提交于 2019-11-30 00:48:32
前几章中,我们用了一种比较迂回的方式创建函数:把匿名函数绑定到一个变量上。实际上,clojure提供了一个更好的方式做同一件事情。“defn” 这个函数就是专门用于定义函数的。 在我们使用defn之前,我们再回顾一下之前我们怎么使用def来创建函数的,然后我们使用defn来做同一件事情对比一下。 ;;使用def =>(def alphabet-length (fn [ ](count alphabet))) #'user/alphabet-length =>(alphabet-length) 26 ;;使用defn =>(defn alphabet-length [ ](count alphabet)) #'user/alphabet-length =>(alphabet-length) 26 上面两种方式做的都是同一件事情。但是defn能做更多的事情。下面是defn定义函数的一个脚手架: [1] (defn name 函数名 [2] "description" 函数描述 (可选) [3] {metadata} 元数据 (可选) [4] [arguments] 参数列表 [5] body-of-expressions...) 函数体 上面我们可以看出,defn在定义函数时可以提供更多的信息。 下面让我们用上面这些信息定义一个函数: =>(defn select-random

Programming Scheme(Racket) with VIM - How to get started

依然范特西╮ 提交于 2019-11-30 00:01:21
recently, I started programming Racket (formerly Scheme) in DrRacket. I quite fast I began to miss all the features of VIM in DrRacket, so I would like to use VIM for my scheme(racket) programming. I know that Emacs might be the best choice for intense lisp programming, but all I want is write a scheme(racket) file check syntax and then run it. Unfortunately, I could not figure out, how to invoke "racket" in the commandline on a file to get it doing the same as DrRacket. I am running Ubuntu 10.10 Maverick Meerkat, VIM 7.3 and I downloaded and installed Racket from the official website. Help to