Search found 3 matches
- Mon Aug 22, 2011 4:09 pm
- Forum: Common Lisp
- Topic: (incf x) slower than (setf x (+ x 1))?
- Replies: 5
- Views: 9522
Re: (incf x) slower than (setf x (+ x 1))?
In compiled code, there is no difference: [8]> (defun f () (let ((test 0)) (dotimes (i 10000) (incf test)))) f [9]> (defun g () (let ((test 0)) (dotimes (i 10000) (setf test (+ test 1))))) g [10]> (compile 'f) f ; nil ; nil [11]> (compile 'g) g ; nil ; nil [12]> (time (f)) Real time: 0.001149 sec. R...
- Fri Jun 17, 2011 10:43 am
- Forum: The Lounge
- Topic: Avoiding funcall in a Lisp-2
- Replies: 0
- Views: 6993
Avoiding funcall in a Lisp-2
Hello! Today I had an idea to reduce the need for funcall in a Lisp-2: allowing some parameters of a lambda-list to be bound in the function namespace. So you could write, for example: (defun map (#'fun ls) (if (null ls) nil (cons (fun (first ls)) (map #'fun (rest ls))))) Here is an implementation f...
- Fri Sep 03, 2010 5:35 pm
- Forum: The Lounge
- Topic: Average Lisp age?
- Replies: 36
- Views: 548294
Re: Average Lisp age?
I'm 19. I learned some Scheme for a CS class last year, and fell in love with functional programming. (Even my C code is full of higher-order functions since then.) I have been playing with Haskell for some time, and finally met Common Lisp about two months ago. So far, Common Lisp is the language I...