freenode/#lisp - IRC Chatlog
Search
17:58:59
thmprover
Hmm...I wish there were more examples on how to use parenml, though...or some documentation...
20:11:49
Josh_2
I just had to use eval to get rid of a ' so that I get consistent output between a list generated like `( ..) and a list generated like `'(.. )
20:13:31
Josh_2
well I tried just using (rest list) as the arg but the returned results werent consistent
20:17:14
Josh_2
when I get rid of eval I get varying results between the `( ) and `'( ) lists, I tried using something like (rest list) when (first list) was eql to 'quote
20:18:09
Josh_2
I'm basically tryna write a compiler-macro to automatically compile templates when they are constants ie `'( ) lists
20:18:33
jackdaniel
so however you want to access the list, you should start from this representation
20:21:15
aeth
I think this is the test for quoted and you then separately have to test the cadr if you want its contents to be something specific: (defun quoted-p (form) (and (listp form) (eql (car form) 'quote) (endp (cddr form))))
20:21:29
jackdaniel
its late, I might have forgot some parenthesis, but I hope you will figure this out
20:21:47
aeth
Note, though that (quoted-p ''a) and (quoted-p `'a) would be T but (quoted-p 'a) would not because the REPL is evaluating the 'a input once
20:24:56
aeth
and (quoted-p '`a) would also be false even though quasiquoting like that (no unquoting) is effectively the same as quoting.
20:26:30
Josh_2
I'm not sure why I have to use (first ..) to get a result equiv to an input that is unquoted
20:26:42
aeth
I guess if you want it to match in style you would replace CAR with FIRSt and CDDR with (rest (rest ...))
20:27:35
aeth
I personally tend to use the CXRs for syntax where DESTRUCTURING-BIND isn't desirable (it usually is, since errors are good, but in this case, it would error instead of returning NIL)
20:39:35
jackdaniel
yes, it is (quote foo) ; for my defense, I've added a disclaimer that it is late :)
21:04:04
aeth
my bad, it's (defun quoted-p (form) (and (listp form) (eql (car form) 'quote) (cdr form) (endp (cddr form))))
21:04:42
aeth
But you have to try really hard to actually get that edge case because e.g. (quote) is an error