Arc Forumnew | comments | leaders | submitlogin
4 points by kens 6055 days ago | link | parent

If you want to display a string without the quotes, use "disp" instead of "write".

If you want to convert a string into an S-expr, use "read", and then if you want to evaluate that expression, use "eval".

  (eval (read "(cons (cons 1 2) 3)"))
But I'm pretty sure you don't want to do either of those in this case. If what you want is nested lists, generate the nested lists - Lisp is good at that. Don't try to piece together your code out of parentheses. The following code will more-or-less generate the nested lists you asked about:

  (def xw (n)
    (let l '()
      (for x 1 n
        (= l (join 'w/link (list l))))
      l))
However, the other problem with your approach is that even if you get xv working, it will pass a quoted expression to defop instead of an expression, and defop won't work right. To generate code, you need a macro, not a function. Here's a macro that will solve your original problem:

  (mac xw args
    (if (is (len args) 1)
          `(pr ,@args)
          `(w/link (xw ,@(cdr args)) (pr ,(car args)))))

  (defop wc req (xw "Wel" "come" "to" "Sweden" "!"))