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

Yes, but I'm currently using Racket's reader, so no infix or other syntax shortcuts for now.

And I gave up on the $ prefixes, so just use "def":

  (def foo 5)
If you have any other issues, feel free to say something.


1 point by Pauan 4406 days ago | link

Oh, I guess I should point out a few things to try... firstly, I just pushed out an update that makes all the gensyms visible to Nulan.

Now, let's create a function[1]:

  > (def foo (fn (list a b) (+ a b)))
This function takes two numbers and adds them together:

  > (foo 1 2)
  3
Because everything is an object in Nulan, you can query the different properties of the function:

  > (get foo %arguments)
  (list a b)

  > (get foo %body)
  (#<procedure:do> (+ a b))

  > (get foo %environment)
  ~

  > (get foo %scope)
  ...

  > (get foo %fn)
  #t
You can turn "foo" into a vau just by removing the %fn property, or turn a vau into a function by adding an %fn property.

---

* [1]: That's with Racket's reader. When I get Nulan's reader working, it'll look something like this:

  (def foo -> a b (+ a b))
But that's just syntax sugar; you can always write it out the long way if you want to.

-----