Lisp 的单行注释和多行注释

本文介绍了Lisp语言中单行注释与多行注释的使用方法。通过具体示例展示了如何利用分号进行单行注释,以及如何使用特殊标记进行多行注释。此外还介绍了不同数量分号用于不同范围注释的用法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Lisp中的注释和多行注释

多行注释LISP:

  1. #|
  2. 您的意见在这里
  3. |#

当然,你可以有单行注释,但每行注释前面必须用分号。 一个注释行的分号标题可能是一个或多达4个。 它取决于范围注释。

Comment and Multiline Comment in Lisp

February 5th, 2009

I was a little surprised to find there's so little resource on the Internet about Lisp.Is it really too old to get people interested?

As a beginner, after writing some code, I wanted to find a way to comment out several lines of code to do an A/B test.But surprisingly, I couldn't find any document saying how to do it.Thanks to an email fromZach , I finally know how to do it. So, Multiline comment in LISP:

  1. #|
  2. your comments here
  3. |#

Of course, you could have single-line comments, but each line of comment must be prefaced with semicolon(s).The semicolons heading a line of comment could be one or up to 4.It depends on the scope of the comment.You will understand what scope is from the following example.

  1. ;;;; Four semicolons used for a file header comment

  2. ;;; comment with 3 semicolons usually be a paragraph
  3. (defun foo (x)
  4. (dotimes (ix)
  5. ;; Two semicolons indicate this comment applies
  6. ;; to the code that follows.
  7. (some-function-call)
  8. (another i) ; for this line only
  9. (and-another) ; for this line only
  10. (baz)))
(原文链接 在这里 )

转载于:https://www.cnblogs.com/leonxyzh/archive/2012/08/26/7289186.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值