Bach.. After reading GEB
Other music i listen to is not lisp related
Search found 133 matches
- Tue Oct 23, 2012 3:24 pm
- Forum: The Lounge
- Topic: What music genre do lispers listen to?
- Replies: 7
- Views: 27816
- Fri Oct 19, 2012 4:56 pm
- Forum: Common Lisp
- Topic: Behaviour of EVAL inside LET
- Replies: 14
- Views: 28025
Re: Behaviour of EVAL inside LET
The hyperspec says it evaluates the expression in the current dynamic environment, but the null lexical environment. Thus: (defparameter z 666) ; z is dynamicly scoped (let ((z 14)) (eval '(setf www z))) www ==> 14 Since z is dynamicly scoped and not lexical. So what let is shadowing is important.
- Thu Oct 18, 2012 2:59 pm
- Forum: Common Lisp
- Topic: Adding element to a sorted list
- Replies: 9
- Views: 19259
Re: Adding element to a sorted list
Hi, Thanks to all of you for your responses. One thing I forgot to mention in the original question is that I am using this function in a loop and using the built-in sort after adding each element(as I needed the sorted list for the next iteration as well) sounded inefficient to me. So you add to a...
- Wed Oct 17, 2012 3:47 pm
- Forum: Common Lisp
- Topic: Adding element to a sorted list
- Replies: 9
- Views: 19259
Re: Adding element to a sorted list
Konfusius's is the fastes judging by my test which adds 1000 random numbers to an empty list. WIth a litte change to the tail recusive version it matches it: (defun sort-push-iter(lst n &key (test #'<) (key #'identity)) (labels ((rec (lst n acc) (if (null lst) (nreverse (cons n acc)) (if (funcal...
- Mon Oct 15, 2012 1:43 pm
- Forum: Common Lisp
- Topic: Equality of functions?
- Replies: 9
- Views: 15202
Re: Equality of functions?
When I'm looking at that I'm thinking stack machine and parameters on stack. In that case the name of the variable is irellevant but it's order is. Would you consider these two the same as well? (defun add1 (x y) (+ x y)) ;; (clambda 2 (apply #+)) (defun add2 (x y) (+ y x)) ;; (clambda 2 (swap) (app...
- Mon Oct 15, 2012 11:39 am
- Forum: Common Lisp
- Topic: eq eql at work...
- Replies: 2
- Views: 4903
Re: eq eql at work...
push and pop are actually macroes: (macroexpand-1 '(push 'd x)) ==> (SETQ X (CONS 'D X)) ; (macroexpand '(pop x)) ==> (LET ((TMP-1 (CAR X))) (SETQ X (CDR X)) TMP-1) As you suspected CL doesn't change the target but makes a new list and associate X with that instead. Y still points to the same value ...
- Wed Oct 03, 2012 4:38 am
- Forum: Common Lisp
- Topic: sample defun with return
- Replies: 3
- Views: 8256
Re: sample defun with return
Code: Select all
(defun return-a-value (return-value)
return-value)
(return-a-value 'test) ==> test
(return-a-value (* 3 6)) ===> 18
- Mon Sep 24, 2012 3:45 am
- Forum: Common Lisp
- Topic: Binary tree insert.
- Replies: 4
- Views: 8011
Re: Binary tree insert.
Wvxvw assumes you found answ3 only. It seems like you have done search prior to your insert? If you changed your search function to include the parent the insert would be trivial. You could return the parent as a second return value in your search with (values ans ans-parent) and do search for updat...
- Wed Sep 12, 2012 8:02 am
- Forum: Common Lisp
- Topic: Antireader macros
- Replies: 14
- Views: 27460
Re: Antireader macros
The reading I have got solved, the issue is printing lisp-objects in my syntax by the standard print function, so REPL returns results in my syntax. If I understand you correctly your reader reads {} as () so that ANY place in an expression it could be entered as curlies. You can overload print, bu...
- Mon Sep 10, 2012 10:11 am
- Forum: Common Lisp
- Topic: Antireader macros
- Replies: 14
- Views: 27460
Re: Antireader macros
If you know exactly where there are curlies and where there are normal parenthesis such that the structure makes it obvious you can just make a function my-print to deal with it. If there is no way of knowing where the curlies are they are kind of like how Racket reads all types of brackets. (Yes, I...