Hey, I'm a relative newbie to programming. I've picked up some very basic Java (File I/O, GUIs, inheritance) and would like to take a look at functional programming - in particular, I would like to learn Scheme. I'm having some trouble finding a Scheme implementation I can understand. Interpreters are weird; I'm not sure how to save my p...
Why can Lisp with all its dynamic features be statically compiled but Python cannot (without losing all its dynamic features)?
...
I am working on a custom .emacs file that I will be able to use on several different computers. I would like to be able to load a mode if it exists on the system. If it does not exist I would like Emacs to stop showing the error: File error: Cannot open load file, X.
For example:
(require 'darkroom-mode)
Results in:
File error: Cann...
Hello,
As I had written in title, I need a little help with improvement of this sexp:
* TODO remeber about thingie.
SCHEDULED: <%%(or (= 1 (calendar-day-of-week date))
(= 3 (calendar-day-of-week date))
(= 5 (calendar-day-of-week date)))>
Now it shows itself in the following days, but I woul...
Erlang was already installed:
$dpkg -l|grep erlang
ii erlang 1:13.b.3-dfsg-2ubuntu2 Concurrent, real-time, distributed function
ii erlang-appmon 1:13.b.3-dfsg-2ubuntu2 Erlang/OTP application monitor
ii erlang-asn1 1:13.b.3-dfsg-2ubuntu2 Er...
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 statment I want to be able to execute (setq num NEWNUM) and (FUNCT...
Hi there.
When I want to read in an S-expression stored in a file into a running Common Lisp program, I do the following:
(defun load-file (filename)
"Loads data corresponding to a s-expression in file with name FILENAME."
(with-open-file (stream filename)
(read stream)))
If, for example, I have a file named foo.txt that cont...
Hi,
What exactly the definition of a "Lisp form"?
As far as I know, it's "either an atom or a list that has a symbol as its first element".
But then, this (in Scheme) would not be a form:
((lambda () 42)) ;; The answer to Life, the Universe and Everything.
Because the first element of the list is itself another list. And after it'...
I am thinking of using McClim for an application, where can I find a tutorial that covers buttons, keyboard/mouse I/O, drawing images, etc. STFW for mcclim tutorial and clim tutorial didn't help much. Any pointers?
If such a tutorial doesn't exist, please point that out and I'll try to RTFM (maybe eventually write such a tutoriial)
...
I need to write a macro (with-hooks (monster method who what) &body body) for a game I'm writing. Monster is a CLOS object, method and who are strings and what is a function (#' notation). The macroexpansion would be something to the effect of
(add-hook monster method who what)
,@body
(remove-hook monster method who)
I have absolutely...
Several months ago, I was inspired by the magnificent book ANSI Common Lisp written by Paul Graham, and the statement that Lisp could be used as a secret weapon in your web development, published by the same author on his blog. Wow, that is amazing. That is something that I have been looking for long time. The author really developed a s...
Is there a way to stop a running operation in the SLIME REPL?
The Clojure SLIME folks apparently have some way to do this, so how about in ordinary Common Lisp?
Thanks /Erik
...
In python, you might do something like
i = (0, 3, 2)
x = [x+1 for x in range(0,5)]
operator.itemgetter(*i)(x)
to get (1, 4, 3).
In (emacs) lisp, I wrote this function called extract which does something similar,
(defun extract (elems seq)
(mapcar (lambda (x) (nth x seq)) elems))
(extract '(0 3 2) (number-sequence 1 5))
but I fe...
I'm 21 and am pretty efficient in html/css, python, and javascript. I also know my way around lisp languages and enjoy programing in them. My problem is that I'm extremely self-taught and not quite confident that I could land a job programing, but I really need a job soon as I've just become a father.
I haven't even created a resume yet...
Which language would you propose for solving a system with:
first order differential equations
complex variables
N-dimensions
using 4th order Runge Kutta or the like.
Speed matters a lot but would sacrifice for:
Elegant (clean and short) code
Flexibility + scalability
I'm mostly between a Lisp and OCaml but any other suggestion...
(defun (matrix-add m1 m2)
(defun (matrix-add-row r1 r2 res-row)
(if (and (not (null? r1)) (not (null? r2)))
(matrix-add-row (cdr r1) (cdr r2)
(cons (+ (car r1) (car r2)) res-row))
(reverse res-row)))
(defun (matrix-add-each m1 m2 res)
(if (and (not (null? m1)) (not (null? m2)))
(let ((res-row (ma...
(defun merge-matrix (matrix-1 matrix-2)
(if (not (or (eql (matrix-rows matrix-1) (matrix-rows matrix-2)) (null matrix-1) (null matrix-2))) (error "Invalid dimensions."))
(cond
((null matrix-1) (copy-tree matrix-2))
((null matrix-2) (copy-tree matrix-1))
(t (let ((result (copy-tree matrix-1)))
...
In the following Lisp REPL interaction:
CL-USER> (defparameter *unison* 0)
*UNISON*
CL-USER> (member *unison* '(*unison*))
NIL
why is nil returned?
...
What the heck is the Structure and Interpretation of Computer Programs cover drawing about? I mean I know what "eval", "apply", and 'λ' all mean, but I'm having a hard time deciphering the rest of the picture.
Who the heck is the maiden? Does she work for the wizard? Why the heck is she pointing at the table? Is she pointing at that...
Hi!
I need to translate some code from Scheme to Common Lisp. Now, I have something like this:
(defun sum (term a next b)
(if (> a b)
0
(+ (term a) (sum term (next a) b))))
(defun sum-int (a b)
(defun (ident x) x)
(sum ident a 1+ b))
but it produces errors.
* - DEFUN: the name of a function must be a symbol, not (I...