Arc Forumnew | comments | leaders | submitlogin
2 points by rocketnia 5084 days ago | link | parent

Essentially, all you need to do is extend 'ac, since compiling is almost all that happens to Arc expressions. In the short term, there's no need to worry about whether a custom type represents a function call, a literal, etc. As long as it compiles, you can start returning it from macros or reader syntaxes.

In the long term, there may be other things that would be useful to extend, like 'ac-macex, 'ac-expand-ssyntax, and 'expand=. Also, it may be easier for a custom syntax type to support 'expand= if there's a separate utility it can extend in order to have all the functionality of a function call. That way it can be 'sref'ed.



2 points by evanrmurphy 5084 days ago | link

Thanks for this guide. It should come in handy for me. :)

If I start messing around with Arc's internals too hard though, I may not be able to resist trying to turn it into an interpreter [1]. I'm too attracted to the notion of first-class environments, eval and fexprs lately. (In this case, I'd be extending eval rather than ac, correct?)

Or maybe I should just stop being such a damn purist. Have to take things one step at a time anyway. ac is a logical place to start.

---

[1] http://arclanguage.org/item?id=13323

-----

1 point by rocketnia 5084 days ago | link

Thanks for this guide. It should come in handy for me. :)

Well, I hope it actually works. :-p

If I start messing around with Arc's internals too hard though, I may not be able to resist trying to turn it into an interpreter.

Yeah. I would have just turned it into Penknife. >.>

I'm too attracted to the notion of first-class environments, eval and fexprs lately. (In this case, I'd be extending eval rather than ac, correct?)

Sure, but there's no interpreting 'eval to build on in Arc (unless you repurpose the macroexpander XD ). I'd find it easiest to approach by building it from scratch--hence kernelish.arc.

Or maybe I should just stop being such a damn purist. Have to take things one step at a time anyway. ac is a logical place to start.

It's all up to whatever you can figure out how to build on, I think.

Also, I'd tell you not to write off purism so quickly, but unfortunately I only like purism in irrational way. ^_^;

-----

3 points by akkartik 5084 days ago | link

Go for the interpreter :)

BTW, remember eight? http://arclanguage.org/item?id=10719

-----

1 point by evanrmurphy 5084 days ago | link

It's come under my radar before [1]. I've read some of the thread you linked to and some of what's on his github [2]. I like the general idea of giving ' and , more power to control evaluation, but I'm afraid I don't grok the language very well yet. :-/

Update: To clarify my confusion, the documentation talks a lot about closures (e.g. that ' does some kind of closure-wrapping), but I thought the language was supposed to be fexpr-based. I don't understand yet what fexprs have to do with closure-wrapping, but I really should study the language more closely.

---

[1] rocketnia referenced it in http://arclanguage.org/item?id=11882, alongside kernel

[2] https://github.com/diiq/eight

-----

3 points by diiq 5084 days ago | link

Eight's documentation is in a terrible state (in part because there are still many things about which I've yet to make up my mind), so blame me for any confusion.

Here's the gist: Fexprs, like macros, take expressions as arguments (duh). Those expressions are made up of symbols (duh). Because a fexpr is evaluated at runtime, those symbols may already be bound to values when the fexpr is called. Eight keeps track of which symbol is bound to which value at the place the expression originated (where the programmer wrote it) --- even if you cons expressions together, or chop them into pieces. This eliminates the need for (uniq), but still allows for anaphoric fexprs when symbol-leaking is desired.

When I wrote the docs on github, I called an expression plus any accompanying bindings a 'closure' (even though it wasn't a function). I also didn't know the word 'fexpr'. I've read a few dozen more old lisp papers since then, and hopefully on the next go-round my vocabulary will be much improved.

-----

1 point by evanrmurphy 5084 days ago | link

Some of your documentation is excellent, actually. This page, for example: https://github.com/diiq/eight/wiki/Better-Questions

-----