Hi, I'm trying to have a function compare the first argument of a passed in argument to a value, then if it is true, perform some function, then recursively call the same function.
(defun function (expression)
(cond
((equal (first expression) "+")
(progn (print "addition")
(function (rest expression))))))
For so...
Hi I am trying append a simple element to a lisp list.
(append queue1 (pop stack1))
I thought the above code would append the first element of stack1 to queue1. Does queue1 need to be non nil? Thanks.
...
I have this problem to work on:
The sum higher order procedure can be generalised even further to capture the idea of combining terms with a fixed operator. The mathematical product operator is a specific example of this idea, with multiplication replacing the addition of the summation operator.
The procedure accumulate, started below, ...
I need to have an at-home project now that I'm working on Python/Django at work. I'd like to learn something new, so I was thinking of checking out Java.
What's the most well respected web framework for deploying Java web apps?
The only reason I'm not checking out ruby on rails is because of how similar the ORM and other parts are to Dj...
When using parenscript if I execute
(parenscript:ps
(slot-value ($ "#mytextarea") 'selectionStart))
It produces the javascript
$('#mytextarea').selectionstart;
Note that selectionStart is now selectionstart. It lost the uppercase S on the Start!
How do I keep that uppercase S around?
...
It seems that the software language skills most sought for embedded devices and robots are C, C++, and LISP. Why haven't more recent languages made inroads into these applications?
For example, Erlang would seem particularly well-suited to robotic applications, since it makes concurrent programming easier and allows hot swapping of co...
I picked up a LISP book at a garage sale the other day and was just wondering if it was worth spending some time on.
...
I'm bewildered by all the built-in Mathematica functions that purport to prevent evaluation in some way: Unevaluated, Defer, Hold, and over half a dozen of the form Hold*. The Mathematica documentation just explains each function in isolation without explaining why you would choose one or the other. Can anyone offer a coherent explanat...
I learned quite a bit of scheme from SICP but am more interested in common lisp now. I know common lisp's fold is reduce, with special arguments for left or right folding, but what is the equivalent of unfold? Googling has not helped much. In fact I get the impression there is no unfold???
...
On the xkcd site today, the following appeared as a joke in a <script language="scheme"> tag
so what does the following code do / represent?
(define
(eval exp env)
(cond ((self-evaluating? exp) exp)
((variable? exp)
(lookup-variable-value exp env))
((quoted? exp)
(text-of-quotation exp))
((assignment? exp)
...
I'm trying to pass a function as an argument and call that function within another function.
A piece of my code looks like this:
(defun getmove(strategy player board printflag)
(setq move (funcall strategy player board))
(if printflag
(printboard board))
strategy is passed as a symbol represented in a two dimensional list as some...
This question is really moot, I think I must have hit a bug in my program or something. If you are still looking for PicoLisp and onOff behaviour, look here.
is this supposed to happen?
: (show NIL)
NIL NIL
-> NIL
: (onOff)
-> T
: (show NIL)
T T
-> T
: (=T NIL)
-> T
:
(onOff sym ..) -> flg
Logical negates the VAL's of all arg...
It seems one is not supposed to quote KEYMAP when using define-key.
(define-key org-remember-mode-map "\C-c\C-r" 'org-remember-kill)
I'm confused because I think that all arguments of a function that is not quoted are evaluated, and according to the help, define-key is a function, not a macro. I don't see why the value of KEYMAP can b...
How might you call a Lisp program from a Rails application?... For example, allow the end user to enter a block of text in the Rails web app, have the text processed by the Lisp program and return results to the Rails app?
...
I'm trying to solve a problem in Scheme which is demanding me to use a nested loop or a nested recursion.
e.g. I have two lists which I have to check a condition on their Cartesian product.
What is the best way to approach these types of problems? Any pointers on how to simplify these types of functions?
I'll elaborate a bit, since m...
Can classes have multiple constructors and/or copy constructors in common-lisp? That is - in order to create a class for a new vector - "vecr" to represent 3-d vectors of real numbers, I'd like to define the new class that can be initialized in multiple ways:
(vecr 1.2) ==> #(1.2 1.2 1.2)
or
(vecr 1.2 1.4 3.2) ==> #(1.2 4.3 2.5)
or...
Greetings,
I search for a programming language for which a compiler exists and that supports self modifying code. I’ve heared that Lisp supports these features, but I was wondering if there is a more C/C++/D-Like language with these features.
To clarify what I mean:
I want to be able to have in some way access to the programms code at...
I'm running up against a problem in understanding the CLOS way of handling file access within a class. In c++ I would be able to do this:
class Foo {
Foo (string filename); // opens the file (my_file) requested by the filename
~Foo (); // close the file
FILE * my_file; // a persistent file-handle
DataStruct my_data; // ...
Hi guys,I have a small and interesting problem,but I cannot come with a perfect solution,I would be grateful if you could help me or give me a hint on this.
The problem is :
given any list ,say like '(a b c),we will convert it to '[a b c]
or '(a (b c)) ,we will convert to '[A [B C]]
In other words,the function should do the same thing ...
I'm forming a class for some work on molecular dynamics as follows:
(defclass %atom (particle)
((name :initarg :name :initform (error "Every atom in the system must have a name!"))
(mass :accessor mass :initarg :mass :initform (getmass name))
(charge :accessor charge :initarg :charge :initform (getcharge name))))
Initially I t...