reader-macro

What advantage does common lisp reader macros have that Clojure does not have?

*爱你&永不变心* 提交于 2020-01-29 02:51:05
问题 I have been using Clojure alot recently but I still don't understand what functionality I do not get that common lisp reader macros provide. Can explain explain this to me in simple terms? 回答1: In short, reader macros provide you with the ability to redefine the programming language's syntax within some delimited context. For example, you could implement regular expression literals (e.g. #"pattern" ) yourself given reader macros. Without them, you would be forced to properly escape regular

Common lisp: is there a less painful way to input math expressions?

房东的猫 提交于 2019-12-12 08:02:17
问题 I enjoy common lisp, but sometimes it is really painful to input simple math expressions like a(8b^2+1)+4bc(4b^2+1) (Sure I can convert this, but it is kind of slow, I write (+ () ()) first, and then in each bracket I put (* () ())...) I'm wondering if anyone here knows a better way to input this. I was thinking about writing a math macro, where (math “a(8b^2+1)+4bc(4b^2+1)”) expands to (+ (* a (1+ (* 8 b b))) (* 4 b c (1+ (* 4 b b)))) but parsing is a problem for variables whose names are

Why does Clojure lack user defined reader macros?

最后都变了- 提交于 2019-12-07 10:42:29
问题 As I understand it Clojure does not expose the reader macro table or allow user defined reader macros. From http://clojure.org/reader: The read table is currently not accessible to user programs. I'm just wondering if there is a definitive or explicit statement (presumably from Rich Hickey) stating the rationale for leaving them out of Clojure. Note I'm not asking if it is a good or bad thing that Clojure lacks user defined reader macros. Just wondering why. 回答1: From the link in matt's

Why does Clojure lack user defined reader macros?

旧城冷巷雨未停 提交于 2019-12-05 12:58:10
As I understand it Clojure does not expose the reader macro table or allow user defined reader macros. From http://clojure.org/reader : The read table is currently not accessible to user programs. I'm just wondering if there is a definitive or explicit statement (presumably from Rich Hickey) stating the rationale for leaving them out of Clojure. Note I'm not asking if it is a good or bad thing that Clojure lacks user defined reader macros. Just wondering why. From the link in matt's comments, to quote the answer by Rich Hickey, the author of Clojure: I am unconvinced that reader macros are

Read macros: what do you use them for? [closed]

╄→гoц情女王★ 提交于 2019-12-03 19:11:23
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I'm trying to get a feel for the parts of Lisp that I haven't used very much up to now. Read macros have caught my attention at the

Use of # a.k.a. read-macro

大城市里の小女人 提交于 2019-12-02 06:51:03
问题 Reading book "Let Over Lambda" by Doug Hoyte, I found the following description of #. sign, a.k.a. read-macro: A basic read macro that comes built in with COMMON LISP is the #. read-time eval macro. This read macro lets you embed objects into the forms you read that can't be serialised, but can be created with a bit of lisp code. It's from Chapter 4, most part of the book can be found here: http://letoverlambda.com/index.cl/toc This is example from the book that shows how the same expression

Use of # a.k.a. read-macro

南笙酒味 提交于 2019-12-02 02:38:41
Reading book "Let Over Lambda" by Doug Hoyte, I found the following description of #. sign, a.k.a. read-macro: A basic read macro that comes built in with COMMON LISP is the #. read-time eval macro. This read macro lets you embed objects into the forms you read that can't be serialised, but can be created with a bit of lisp code. It's from Chapter 4, most part of the book can be found here: http://letoverlambda.com/index.cl/toc This is example from the book that shows how the same expression may be read differently every time: * '(football-game (game-started-at #.(get-internal-real-time))

Read macros: what do you use them for? [closed]

隐身守侯 提交于 2019-11-30 06:28:11
I'm trying to get a feel for the parts of Lisp that I haven't used very much up to now. Read macros have caught my attention at the moment. There isn't a huge amount of info about their use and it would help to see what people have done with them, both to get examples of how they work and also to see what sorts of problems can be approached with them. Following on that, are there any guidelines for knowing what constitutes good and bad use of read macros? S-expressions are Lisp's syntax for Lisp data. S-expressions are read with the function READ and read macros are Lisp's built-in way to

operator #+ and #- in .sbclrc

久未见 提交于 2019-11-28 13:26:22
Anybody know what #+ and #- operators means in .sbclrc ? I couldn't find it in the manual. I see #- in .sbclrc after I installed quicklisp: #-quicklisp (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) I also see #+ in the SBCL User Manual, but I couldn't find explanation of their functionality. Looks like something related for loading individual module. Are they only for SBCL implementation or part of Common lisp? That's a general facility of Common Lisp, not only SBCL. There is a variable cl: