Search found 28 matches

by stackman
Sun Dec 02, 2012 5:08 am
Forum: Common Lisp
Topic: Help me on Tokinzer
Replies: 2
Views: 2911

Re: Help me on Tokinzer

As far as I know, there is no ready-to-use splitting function in the cl standard. However you can use the cl-split-sequence library, available through quicklisp . Assuming quicklisp is installed, CL-USER> (ql:quickload :split-sequence) To load "split-sequence": Load 1 ASDF system: split-sequence ; L...
by stackman
Sat Dec 01, 2012 12:39 pm
Forum: Common Lisp
Topic: what is a list designator?
Replies: 2
Views: 2590

Re: what is a list designator?

Thanks, I looked at the section 1.4.1.5 on designators, but the info is indeed in the glossary.
by stackman
Sat Dec 01, 2012 11:04 am
Forum: Common Lisp
Topic: what is a list designator?
Replies: 2
Views: 2590

what is a list designator?

Hi, The hyperdoc for the case macro talks about list designators. But what is a list designator? Reading the definition in the hyperspec did not help. I guess I understand what is a string designator: a keyword, a symbol or a string. But a list designator? The case examples seem to indicate that eve...
by stackman
Sun Nov 18, 2012 10:37 am
Forum: Common Lisp
Topic: iterative copy of a tree
Replies: 0
Views: 3151

iterative copy of a tree

Recently, the recursive code for the copy-tree function in sbcl was rewritten so as to prevent stackoverflow on long lists. This prompted me to write an iterative version, one-pass, no stack, no unnecessary consing, version of copy-tree in common-lisp, working with nested, perhaps dotted, lists. The...
by stackman
Mon Nov 12, 2012 4:01 am
Forum: Common Lisp
Topic: Replacing a function in an expression
Replies: 20
Views: 16295

Re: Replacing a function in an expression

@Paul I found that the pcl code walker ships with sbcl. A bit of googling even dug up a thread showing how to use it in my particular case. Many thanks to all the people that answered my question. I now understand a lot more about code transformation in common lisp, and I will try to build up my own...
by stackman
Sun Nov 11, 2012 2:39 pm
Forum: Common Lisp
Topic: Replacing a function in an expression
Replies: 20
Views: 16295

Re: Replacing a function in an expression

@ Paul Are there implementation independant common lisp code walkers? A quick google search suggests that there are a few edge cases which are not so easy to handle. I am using sbcl, so maybe there is a way to leverage some sbcl compatible code walker to deal with code substitution, without having t...
by stackman
Sun Nov 11, 2012 2:32 pm
Forum: Common Lisp
Topic: Replacing a function in an expression
Replies: 20
Views: 16295

Re: Replacing a function in an expression

Thanks for the answer, Goheeca, still I fail to see how it addresses the question.
macrolet does expansion then evaluation, doesn't it?
I want to transform the source code without evaluating it, in order to modify programmatically source files.
by stackman
Sun Nov 11, 2012 2:02 pm
Forum: Common Lisp
Topic: Replacing a function in an expression
Replies: 20
Views: 16295

Re: Replacing a function in an expression

Unfortunately, the code provided by Goheeca does not work for me. I never used the macrolet operator before, maybe someone can point to a beginner friendly introduction to macrolet? I have used macros before, but I don't understand the macrolet section of the hyperspec at the moment. CL-USER> (defun...
by stackman
Sun Nov 11, 2012 3:34 am
Forum: Common Lisp
Topic: Replacing a function in an expression
Replies: 20
Views: 16295

Replacing a function in an expression

I am trying to understand the "code-is-data" motto in common lisp. So I have an expression and I want to replace all occurrences of the function list by my-list, as follows. (defparameter *expr* '(let ((list (quote (1 2 3)))) ;; comment list (append list (list 4 5 'list "list, 'list, LIST")))) (do-r...
by stackman
Fri Nov 09, 2012 9:34 am
Forum: Common Lisp
Topic: format with two lists
Replies: 1
Views: 2359

format with two lists

hi,
is there a format directive that loops over two lists, as follows?

Code: Select all

(format "..." (list 1 2 3) (list 'a 'b 'c ))
=> 1 'a
   2 'b
   3 'c
I know that I can map format on the two lists. My goal here
is to understand the format directives a bit better.