How do I increment (add one to) or decrement (subtract one from) a number, in Common Lisp?
It's all in the title, really. ...
It's all in the title, really. ...
The name for Lisp derives from LISt Processing. Linked lists are the major data structure of Lisp languages, and Lisp source code is itself made up of lists. As a result, Lisp programs can manipulate source code as a data structure (this is known as homoiconicity). However, a list is by definition a sequential construct. This encourages...
Ninth bullet point in Paul Graham's What Made Lisp Different says, 9. The whole language always available. There is no real distinction between read-time, compile-time, and runtime. You can compile or run code while reading, read or run code while compiling, and read or compile code at runtime. Running code at read-time le...
I have heard that the active symbol table is accessible within the Common Lisp runtime. Have I misunderstood? ...
I have to do a term project in my symbolic programming class. But I'm not really sure what a good/legitimate project would be. Can anyone give me examples of symbolic programming? Just any generic ideas because right now I'm leaning towards a turn based fight game (jrpg style basically), but I really don't want to do a game. ...
The Program (115 Chars) (defun rpn(e)(let((s()))(dolist(x e)(if(numberp x)(push x s)(push(eval(reverse(list(pop s)(pop s)x)))s)))(car s))) A simple test: CL-USER> (rpn '(1 2 3 * + 4 2 / +)) And it returns 9 Anyone has some good ideas about writing an Infix-to-RPN program inside one single tweet? I failed. I can wrote that one in 2...
In The Structure and Interpretation of Computer Programs part 3.2, an "environment" is defined as "a sequence of frames." But as far as I can see, the book doesn't further discuss the difference between an environment and a frame. Also, I suspect the drawings of environments conflates them with frames because books drawings are small a...
I am trying to figure out how to find duplicate atom in possibly nested lists. I have been trying to figure this out all day. If you could please give me the logic, that would be great because I really want to learn. basically (findDup '(a b b)) would return t (findDup '(a c ((d (f a)) s))) would also return t ...
Hi, I'm just starting off with Lisp and need some help. This is technically homework, but I gave it a try and am getting somewhat what I wanted: (defun speed (kmp) (cond ((> kmp 100) "Fast") ((< kmp 40) "Slow") (t "Average"))) However, if I run the program it displays "Average" instead of just Ave...
Hi guys, According to you, which language do you think would be the best for implementing monads (Python/Ruby/LISP)?,also can anyone tell me some possible uses of monads (please give examples),like exceptions? Thanks in advance ...
for example, I pass the function name to another funciton (personal-function 'func-name '(attr1 attr2 ...)) and what I want to do is (defun personal-function (func-name) (defun func-name '(attr1 attr2 ...) (dosomething))) however, it said I can't defun with a symbol.. what should I do? Thanks so much! ...
Imagine a simple (made up) language where functions look like: function f(a, b) = c + 42 where c = a * b (Say it's a subset of Lisp that includes 'defun' and 'let'.) Also imagine that it includes immutable objects that look like: struct s(a, b, c = a * b) Again analogizing to Lisp (this time a superset), say a struct definitio...
I know this is not a very technical question, but it's for all technical people, that's why I ask it here. Here is my question: Can someone help me understand the current and future of learning LISP? One of my papers in university uses LISP for a project (it's a big project - may be two semester long), and I am not able to decide wheth...
What does a very general function look like in functional programming? Somebody said "we don't have objects, but we have higher order functions". Do higher order functions replace objects? While programming object-oriented apps, I try to go from a more general to a more detailed idea, lots of times. If I try to do that in functional pr...
I've learned Clojure previously and really like the language. I also love Emacs and have hacked some simple stuff with Emacs Lisp. There is one thing which prevents me mentally from doing anything more substantial with Elisp though. It's the concept of dynamic scoping. I'm just scared of it since it's so alien to me and smells like semi-...
Coming from a background in Clojure, I am taken with the potential that its pre-/post-conditions provide as a basis for design by contract: ;; sqr.clj (defn sqr [n] {:pre [(not= 0 n) (number? n)] :post [(pos? %) (number? %)]} (* n n)) (sqr 10) ;=> 100 (sqr 0) ; Assertion error Is there a similar pre/post capability in Commo...
I'm pretty new to lisp; I was wondering if anyone here could help me out. I have the following code snippet: (defun write-lookup (binding-list pattern fact) (cond ; No bindings have been stored ; Return the binding list with a new one! ((not binding-list) (cons (cons pattern fact) nil)) ; A list of bind...
I recently read Eric Steven Raymond's article "How To Become A Hacker" and I like his suggestion of learning 5 key languages (he suggests Python, C/C++, Lisp, Java, and Perl) as a way of covering the main programming paradigms in use today. His advice is that it's not so important which specific languages a programmer knows. It's more ...
Hi.... I have this question for a homework assignment.... I'm having difficulty with cost-of-applying-operator and estimated-distance-from-goal Basically its the 2 jug problem one 4ltr jug and one 3 ltr jug and we need to get 2 ltrs in one... we're provided with the a-star code and i've done the jug-problem.lisp just not sure how to w...
I'm working my way through the online MIT lectures for the classic 6.001 course: The Structure and Interpretation of Computer Programs. I'm trying to gain an understanding of analyzing code complexity in terms of memory usage vs. execution time. In the first few lectures, they present a solution in Scheme for the Fibonacci Series. ...