PDA

View Full Version : More Common Lisp



danbaron
09-06-2010, 07:27
[font=courier new][size=8pt]I finally got something to work in Lisp.

In the beginning, some languages are harder than others, yes?

(In the version of Lisp I am trying, Corman Common Lisp (from Roger Corman), all code is compiled.)

("Common" Lisp, is the ANSI standard version of Lisp.)

:oops:
Dan :x :P


;In Common Lisp, anything following a semi-colon is considered to be a comment.

;Make an array of 1000 doubles.
(setf a (make-array 1000 :element-type 'double-float))

;Assign the value, pi, to the first element.
(setf (aref a 0) pi)

;Open a stream (file) for output.
(setq out (open "c:/users/root/desktop/lisp/cz.dat" :direction :output))

;Write "hello" to the output file. "~%", indicates a newline.
(format out "hello~%")

;Write "goodbye" to the output file.
(format out "goodbye~%")

;Format and write the value of the first array element to the output file.
(format out "~16,15,,,,F~%" (aref a 0))

;Close the output file.
(close out)

;The contents of the output file are (without the semi-colons):

;hello
;goodbye
;3.141592653589793

kryton9
09-06-2010, 21:17
Dan, if you haven't joined already, there is also another nice forum that many members here belong to named Coding Monkeys. Coding Monkeys is a sight for programmers and covers many languages. I am sure your examples would be helpful in that forum also. There are still many language sections with very little posts, so it would be nice to have those fleshed out. You can check the forum out at:
http://www.codingmonkeys.com/index.php?action=forum

If you just enter www.codingmonkeys.com make sure to click on the forum sub menu to get to what is pointed to by the link above.

danbaron
09-06-2010, 21:47
[font=courier new][size=8pt]I joined a while ago, Kent. I guess that, somehow, I got the impression that, not much goes on there. And, I guess I thought that it was primarily meant for discussing various dialects of Basic. But, you are right, there is a section for other programming languages. Maybe I should try posting there. But, I bet that you feel like me - sometimes when you post on any of the programming sites, it seems that, you are posting to yourself, like to a private diary. In fact, if you want to keep it secret, then maybe it is best to post it at one of these locations --> I must be exaggerating, yes?

:oops:
Dan :x :P

kryton9
10-06-2010, 02:32
I don't let the lack of lots of posts deter me. Smaller sites have a tighter community feeling to them and I enjoy them more than the very busy forums I frequent.
Many of the big busy forums, I just read and never post because out of big crowds there are a lot of jerks that make you regret every writing anything.

I'm glad you are a member of coding monkeys... it is nice forum too as is thinBasic!

danbaron
10-06-2010, 06:42
Many of the big busy forums, I just read and never post because out of big crowds there are a lot of jerks that make you regret every writing anything.

[font=courier new][size=8pt]I agree with that. There is one place that I posted on once, and since defending myself from attacks, I haven't posted there a second time.

I've heard the word, "troll", used before, but have never learned exactly what it means with respect to the Internet. But, from fairy tales, I think it is a semi-human creature which lives under bridges, and tries to make it difficult for people to pass over. That is also my impression of some of the people in certain forums (not here). I imagine that they have no real lives at all. I imagine that they have grown to adulthood, but have never moved out of their parents' houses. The parents may be in their 80s, but, Sonny Boy, is still living in the basement. His life is on the Internet, 16 hours per day. He never sees the sun. If he's fortunate, maybe his avatar has made some virtual friendships with some other avatars. I think that poor excuse for a life would warp and embitter almost anyone.

:xyzw: :x :violent:

Dan