lisp

Apache + mod_lisp + clisp

落花浮王杯 提交于 2019-12-03 07:22:45
问题 How to to configure apache + mod_lisp + clisp and set up a "Hello World!"? I couldn't find any complete howto on the subject. Thanks. Edit: Vebjorn's solution works, but then I don't how to code the "hello world!". Can anyone tell me how to proceed? There's something like SWANKing the clisp, then connect to it with SLIME, but then when I launch mod_lisp's demo, the test page is not served and my slime doesn't return? Thanks again. 回答1: Download http://www.fractalconcept.com:8000/public/open

A simple example of using the stepper in SBCL

被刻印的时光 ゝ 提交于 2019-12-03 07:18:44
问题 Going through the computation with the LispWorks stepper is rather intuitive, but I cant figure it out in SBCL. Can somebody please give me a step-by-step example of how to use the SBCL stepper in the REPL on some simple function? Thanks. 回答1: * (proclaim '(optimize (debug 3))) * (defun foo (a b) (* (+ a b) b)) FOO * (step (foo 1 2)) ; Evaluating call: ; (FOO 1 2) ; With arguments: ; 1 ; 2 1] step ; Evaluating call: ; (+ A B) ; With unknown arguments 0] step ; Evaluating call: ; (* (+ A B) B)

What is the correct term for the following functional programming pattern?

倖福魔咒の 提交于 2019-12-03 07:17:42
I've heard it referred to as a stream , as an infinite list , and sometimes even as a lazy sequence . What is the correct term for the following pattern? (Clojure code shown) (def first$ first) (defn second$ [str] (cond (empty? str) () true ((first (rest str))))) (defn stream-builder [next_ n] (cons n (cons (fn [] (stream-builder next_ (next_ n))) ()))) (defn stream [str n] (cond (= 0 n) () true (cons (first$ str) (stream (second$ str) (- n 1))))) (def odd (stream-builder (fn [n] (+ 2 n))1)) (println (stream odd 23)) > (1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45) Short

Load file with a relative path

冷暖自知 提交于 2019-12-03 07:11:04
I am trying to load a file in Lisp from a file in the same directory using a relative path. My file structure looks like this: repo/ subdir/ main.lisp test.lisp In main.lisp I have a number of function definitions, and in test.lisp I want to test the functions. I have tried using (load "main.lisp") and (load "main") in test.lisp , as well as a number of variations on the pathname (i.e., including ./ before the filename) but both times I get the following error (where <filename> is the filename passed to the load function): File-error in function LISP::INTERNAL-LOAD: "<filename>" does not exist

How Functional language are different from the language implementation point of view

末鹿安然 提交于 2019-12-03 06:53:24
问题 There is the whole new paradigm of "functional programming", which needs a total change of thought patterns compared to procedural programming. It uses higher order functions, purity, monads, etc., which we don't usually see in imperative and object oriented languages. My question is how the implementation of these languages differs from imperative or object oriented languages, with respect to, for example, memory management or internals like pointers etc.. There are functional languages that

Functional Programming in C# vs LISP [closed]

百般思念 提交于 2019-12-03 06:36:40
问题 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 6 years ago . What are the primary differences between LISP and C# with regards to functional programming? In specific, if a LISP programmer was to switch to using C#, what are the features they are most likely to miss? 回答1: Doing functional programming in C# is technically possible (well,

What is ' (apostrophe) in Lisp / Scheme?

拜拜、爱过 提交于 2019-12-03 06:27:55
问题 I am on day 1 hour 1 of teaching myself Scheme. Needless to say, I don't understand anything. So I'm reading The Little Schemer and using this thing: http://sisc-scheme.org/sisc-online.php as an interpreter. I need to use ' in for example (atom? 'turkey) to avoid an "undefined variable" error. The ' , according to the book, is a Common Lisp thing. I have two questions: Is the interpreter I mentioned above a good one? Can you recommend another? I need one that will go well with The Little

In common lisp, how can I check the type of an object in a portable way

陌路散爱 提交于 2019-12-03 06:24:10
I want to define a method that will specialize on an object of array type with unsigned byte 8 elements. In sbcl, when you (make-array x :element-type '(unsigned-byte 8)) the object class is implemented by SB-KERNEL::SIMPLE-ARRAY-UNSIGNED-BYTE-8. Is there an implementation independent way of specializing on unsigned-byte array types? Use a sharpsign-dot to insert the implementation dependent object class at read-time: (defmethod foo ((v #.(class-of (make-array 0 :element-type '(unsigned-byte 8))))) :unsigned-byte-8-array) The sharpsign-dot reader macro evaluates the form at read-time,

How can I get all possible permutations of a list with Common Lisp?

▼魔方 西西 提交于 2019-12-03 06:11:17
I'm trying to write a Common Lisp function that will give me all possible permutations of a list, using each element only once. For example, the list '(1 2 3) will give the output ((1 2 3) (1 3 2) (2 1 3) (2 3 1) (3 1 2) (3 2 1)). I already wrote something that kind of works, but it's clunky, it doesn't always work and I don't even really understand it. I'm not asking for code, just maybe for some guidance on how to think about it. I don't know much about writing algorithms. Thanks, Jason Vatine As a basic approach, "all permutations" follow this recursive pattern: all permutations of a list L

Do you know of a language with Static Type checking where Code is Data? [closed]

*爱你&永不变心* 提交于 2019-12-03 05:57:45
Can you name languages with static type checking (like Java) and where code is data (like in LISP)? I mean both things in one language. Qi is a statically-typed Lisp dialect. Also, many other Lisp dialects have (optional) static typing. Java itself has very limited capabilities of this kind. The interesting question is not so much whether you can have metaprogramming and static typing, it's whether you can have dynamic metaprogramming be statically type-safe . There is Template Haskell which does metaprogramming and is type-safe, but it is static metaprogramming. At the moment I can not think