Arc Forumnew | comments | leaders | submitlogin
using scheme libraries
4 points by antiismist 6013 days ago | 5 comments
Is there a standard way to use the PLT scheme libraries from within Arc?


2 points by absz 6013 days ago | link

It depends. In arc2.tar, there is not. In the Anarki version, there is: the seval primitive function evaluates its argument in mzscheme, e.g.

  arc> (seval '(zero? 1))
  #f
The $ macro, also on Anarki, is a wrapper around that:

  arc> (let x 3.1415926 ($ (asin ,x)))
  5.35897931700532e-08
It implicitly quasiquotes its arguments, so to embed Arc values, use unquote (which is the same as ,).

-----

2 points by skenney26 6013 days ago | link

Wouldn't it be more intuitive if $ returned a scheme function and applied it to the arguments?

  ($ asin x)

-----

5 points by absz 6013 days ago | link

To get that, you can write

  ($.asin x)
; in fact, that's often what I do. But being able to write snippets of Scheme can be important, if you need to work with things (for instance, datatypes like the boolean) which don't exist in Arc.

-----

1 point by tokipin 6013 days ago | link

is there any way to implicitly quasiquote in arc2.tar? curious because that would be useful for one of my macros

-----

3 points by absz 6005 days ago | link

From Anarki:

  (mac $ body
    " Allows access to the underlying Scheme. "
    (list 'seval (cons 'quasiquote body)))
In other words, it generates a literal list containing 'quasiquote; when this is evaluated, it looks like (seval (quasiquote body0 body1 ... bodyN)). This technique is perfectly valid Arc2.

-----