Arc Forumnew | comments | leaders | submitlogin
1 point by Pauan 4618 days ago | link | parent

"`(cons ,@(list 1 2))"

I would assume that it is splicing it into the list. In other words, it would evaluate into this list:

  (cons 1 2)
But I don't know how you're implementing splicing, so I'm not sure how much I can help.

---

"Neither seems quite what I want."

Why not? Both seem to end up as the same end result as you would get in Arc, right?



1 point by akkartik 4618 days ago | link

Yeah I want it to splice it into the list. That's what it does right now. But it takes a special-case. I'm having trouble figuring out how it would work if I removed the special-case from tokenize, parse, and eval. I'm not sure that the behavior of ,@ can be boiled down to just , and @. It should be independent of my implementation.

Perhaps I should just try it, see what happens.

-----

3 points by rocketnia 4618 days ago | link

I think it's kinda intuitive for `(foo ,@(list 1 2)) to expand to (quasiquote (foo (unquote 1 2))). If unquote takes multiple subexpressions, as it does in Common Lisp (http://arclanguage.org/item?id=9912), this can evaluate to (foo 1 2).

However, I really think this should be considered part of the behavior of 'quasiquote. Just like 'unquote has no meaning except as interpreted by 'quasiquote, it's fine for @ to have no meaning except as interpreted by function calls and 'quasiquote.

Hmm... if you say `@(list 1 2), does that pass (splicing (list 1 2)) or something to 'quasiquote, or does it actually pass 1 and 2? If I were trying to accomplish @ with fexprs, I think I'd prefer the former, and I'd treat regular functions/applicatives as though they were fexprs that expanded (splicing ...) manually.

-----

1 point by Pauan 4618 days ago | link

"Perhaps I should just try it, see what happens."

Yeah, that would be my suggestion.

-----