Search found 106 matches
- Fri Aug 05, 2011 5:13 pm
- Forum: Common Lisp
- Topic: trying to run LISP code in LispIDE
- Replies: 5
- Views: 10234
Re: trying to run LISP code in LispIDE
First of all, I know nothing about Common Lisp or any kind of Lisp. I am just begining to learn. So I downloaded LispIDE in order to have an environment in which I can experiment. I wrote a very simple program: (* 2 (cos 0) (+ 4 6)) which, according to this website, should print out 20.0. Well, I'm...
- Sat Jul 30, 2011 5:02 am
- Forum: Common Lisp
- Topic: Eval
- Replies: 1
- Views: 2927
Re: Eval
So far I could replicate any macro by using (eval) in a function. I have to add quotes when I call the function though, but I feel like I've began to understand macros and now I am back at square 1. Could anyone give me an example of a macro where eval won't work? Ultimately a macro is just a funct...
- Thu Jul 28, 2011 2:57 am
- Forum: Common Lisp
- Topic: Print the contents of a multi-dimensional array
- Replies: 11
- Views: 19114
Re: Print the contents of a multi-dimensional array
(loop named <name> ...) Unless I forgot more LOOP than I thought I did, this only names the loop block and allows a named RETURN, and does not allow execution of clauses in a different LOOP context. Oh, just read the heading and the first paragraph...you're right, you can't do that "collect in...
- Wed Jul 27, 2011 5:15 pm
- Forum: Common Lisp
- Topic: Print the contents of a multi-dimensional array
- Replies: 11
- Views: 19114
Re: Print the contents of a multi-dimensional array
That is only one of many reasons I prefer iterate, which provides this exact feature . Unless the code walker somehow gets tangled. (loop named <name> ...) FWIW, you don't need two loops: (defun print-2d-array-as-table (array) (loop for i below (array-total-size array) do (if (zerop (mod i (array-d...
- Tue Jul 26, 2011 2:54 pm
- Forum: Common Lisp
- Topic: Why does this "let" work?
- Replies: 4
- Views: 4950
Re: Why does this "let" work?
They all "follow the rules"...amachina wrote:Thanks. That allows me to move forward. As you said, all of these are equivalent:
I like the middle one because it "follows the rules".Code: Select all
(let ((a 0) b) (let ((a 0) (b nil)) (let ((a 0) (b))
- Mon Jul 25, 2011 4:12 pm
- Forum: Common Lisp
- Topic: Problem with auto closing parentheses
- Replies: 3
- Views: 4781
Re: Problem with auto closing parentheses
Hello. I recently installed "Ready Lisp" for mac which is consisted with aquamacs, sbcl, and slime. When I typed open bracket, closing bracket appeared automatically. Does anyone have an idea to get rid of this annoying automatic closing parenthesis completion? M-x local-set-key ENTER ( s...
- Sun Jul 24, 2011 8:54 pm
- Forum: Common Lisp
- Topic: Passing extra keywords to with-open-file() at runtime?
- Replies: 3
- Views: 4179
Re: Passing extra keywords to with-open-file() at runtime?
(defun serialize-hmm-model-to-file (file &rest kwords &key &allow-other-keys) (let ((s (apply #'open (append (list file :direction :output) kwords)))) (serialize-hmm-model s) (close s))) I know you now know you can just use with-open-file, but if you did want to do something like the ab...
- Sun Jul 24, 2011 8:49 pm
- Forum: Common Lisp
- Topic: is it possible to write a strict AND function?
- Replies: 17
- Views: 14668
Re: is it possible to write a strict AND function?
Fourth post in this threadyesimthetaxman wrote:turns out that the answer is actually quite simple:
(defun and-nl (a b) (and a b))
since arguments are evaluated before they are passed to the routine body we have an AND that forces the evaluation of both arguments to AND.
- Mon Jul 11, 2011 5:13 am
- Forum: Common Lisp
- Topic: Extend integer?
- Replies: 11
- Views: 12445
Re: Extend integer?
Thank you, but I rather meant something different. I'd like, on the contrary, to help to narrow down the possible selection options. I.e. here's an example: ;; I don't want to eventually set the value in the hash table ;; to something that I potentially won't be able to serialize later ;; so, amf-v...
- Fri Jul 08, 2011 5:07 pm
- Forum: Common Lisp
- Topic: Telling the time
- Replies: 6
- Views: 5973
Re: Telling the time
I've written this: (defun set-alarm (m h d mo y) (loop if (equal (encode-universal-time 0 m h d mo y) (get-universal-time)) return "wake up!")) However, I would like to just have the user input minute and hour. Is there any functions like this: get-current-day, get-current-month, get-curr...