gensym

Uninterned symbols symbols

隐身守侯 提交于 2020-05-23 12:08:07
问题 There is something I can't understand about Common lisp. Assume I'm writing a macro similar to this: (defmacro test-macro () (let ((result (gensym))) `(let ((,result 1)) (print (incf ,result))))) Than I can do > (test-macro) 2 2 Now I want to see how it expands > (macroexpand-1 '(test-macro)) (LET ((#:G4315 1)) (PRINT (INCF #:G4315))) ; T Ok. There are unique symbols generated with gensym that were printed as uninterned. So as far as I know the uninterned symbols are the symbols for which the

Why does this Lisp macro as a whole work, even though each piece doesn't work?

若如初见. 提交于 2019-12-10 13:13:20
问题 I'm reading/working through Practical Common Lisp. I'm on the chapter about building a test framework in Lisp. I have the function "test-+" implemented as below, and it works: (defun test-+ () (check (= (+ 1 2) 3) (= (+ 5 6) 11) (= (+ -1 -6) -7))) Remember, I said, it works , which is why what follows is so baffling.... Here is some code that "test-+" refers to: (defmacro check (&body forms) `(combine-results ,@(loop for f in forms collect `(report-result ,f ',f)))) (defmacro combine-results

How to break conversation data into pairs of (Context , Response)

懵懂的女人 提交于 2019-11-30 06:48:11
I'm using Gensim Doc2Vec model, trying to cluster portions of a customer support conversations. My goal is to give the support team an auto response suggestions. Figure 1: shows a sample conversations where the user question is answered in the next conversation line, making it easy to extract the data: during the conversation "hello" and "Our offices are located in NYC" should be suggested Figure 2: describes a conversation where the questions and answers are not in sync during the conversation "hello" and "Our offices are located in NYC" should be suggested Figure 3: describes a conversation

How to break conversation data into pairs of (Context , Response)

孤街醉人 提交于 2019-11-29 07:01:33
问题 I'm using Gensim Doc2Vec model, trying to cluster portions of a customer support conversations. My goal is to give the support team an auto response suggestions. Figure 1: shows a sample conversations where the user question is answered in the next conversation line, making it easy to extract the data: during the conversation "hello" and "Our offices are located in NYC" should be suggested Figure 2: describes a conversation where the questions and answers are not in sync during the