LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-20-2005, 09:45 AM   #1
angustia
Member
 
Registered: Apr 2003
Location: chile
Posts: 58

Rep: Reputation: 15
1 or 2 lisp questions


hi, this is short:

how can i make a "while" in common lisp? (i know that scheme has "while", and in common lisp there is "loop" macro, but there is something like scheme's "while"?)

and/or

how can i make a recursive lambda function?

(lambda (x)
(do-something-with x)
(???? (- x 1)))


thanks for any help.
 
Old 04-20-2005, 11:19 AM   #2
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
Quote:
how can i make a "while" in common lisp? (i know that scheme has "while", and in common lisp there is "loop" macro, but there is something like scheme's "while"?)
I haven't encountered a while, but there is a do (as well as, dotimes and dolist). The for macro is an abstraction over do in the first place. You can probably write a macro over do to create a while as well.

Code:
(do ((i 0 (1+ i))) ;; start, and increment at each iteration
    ((>= i 4)) ;; loop while this is false
  (print i)) ;; action
Quote:
how can i make a recursive lambda function?
I can't see a way to get that without naming the function (through a defun or set, whatever). Maybe there is some variable in Common Lisp that can get you the reference to the current function.

Btw, if haven't encountered it yet, there is a new book on Common Lisp that just got published and it's also available for free online: Practical Common Lisp

Last edited by coolman0stress; 04-20-2005 at 11:22 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which Lisp Should I Learn? flamesrock Programming 3 09-16-2005 02:38 PM
Lisp phoenix7 Programming 4 09-24-2004 07:40 AM
Maxima and lisp fettouhi Fedora 0 05-21-2004 07:35 AM
Learning Lisp tireseas Programming 13 01-25-2004 01:08 AM
Lisp, emacs-lisp aizkorri Programming 1 09-04-2002 06:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration