Arc Forumnew | comments | leaders | submit | akkartik's commentslogin
2 points by akkartik 3949 days ago | link | parent | on: Why is "do" a macro and not a function?

So you mean (def newdo args)? My mind is blown.

-----

3 points by Pauan 3949 days ago | link

Well, no, because "do" returns the last argument, so it would be:

  (def do args (last args))

-----


Yeah, that's a bug on my part in anarki. Thanks for the report!

Edit 10 minutes later: now fixed: https://github.com/arclanguage/anarki/commit/fcfbfcdb80. Thanks again.

-----

3 points by akkartik 3958 days ago | link | parent | on: Interested in being an Arc tutor?

I think I might be interested. I've been working on teaching people programming a lot, but haven't really had a chance to teach my favorite language. Are you thinking in person or over video conference?

-----

2 points by jackcouch 3958 days ago | link

Video (Google hangouts?) when needed, but most of the time (once I'm up and running especially) email will probably be fine.

-----

2 points by jackcouch 3958 days ago | link

Actually I live in the SF area (eastbay) so if it is helpful to be in person I can do that too. I'm flexible.

-----

1 point by akkartik 3958 days ago | link

Me too. How about we get together in person to discuss more details?

-----

2 points by jackcouch 3958 days ago | link

Sounds great. My email is jack8couch@gmail.com. Send me your contact info. Really looking forward to it.

-----

1 point by akkartik 3960 days ago | link | parent | on: Executing files in windows

Great! Keep asking us questions as you do more learning.

-----

3 points by akkartik 3963 days ago | link | parent | on: Executing files in windows

I think that should be platform-independent:

  arc> (load "foo.arc")
Am I misunderstanding your question?

(Sorry about the delay in noticing your question.)

-----

2 points by zck 3962 days ago | link

This should work as long as foo.arc is in the same directory you're running Arc out of.

If your file is somewhere else, you'll have to specify the full path to it (warning: untested):

  arc> (load "C:\\Users\\Benben\\Documents\\foo.arc")

-----

2 points by akkartik 3969 days ago | link | parent | on: Passing a string to defop for the url?

defop is a macro that doesn't evaluate its first arg. So your question is similar to asking why this doesn't bind y to 34:

  (let x 'y
    (= x 34))
To do what you want you'll need to define the url directly. The definition of defop (approximately, after dropping some indirections) is:

  (mac defop (name parms . body)
    `(= (srvops* ',name)
        (fn ,parms
          ,@body)))
So you can do:

  (let url "hello"
    (= (srvops* sym.url)
       (fn (output req)
         (w/stdout output
           (prrn)
           (pr "hello world")))))
There's a few extra details here. You have to work through the details of how defop is defined. Feel free to ask more questions if something is unclear.

-----

2 points by bh 3969 days ago | link

Thanks, I got it. Also, is there a way to catch all requests?

-----

1 point by akkartik 3969 days ago | link

Can you elaborate? You want to call the same function on any request, and pass in the url from the request? Are you using arc 3.1 or anarki?

Edit: on anarki you get this behavior by replacing the function respond in lib/srv.arc with this code:

  (def respond (out req)
    (w/stdout out
      (prrn "HTTP/1.1 200 OK")
      (prrn "Content-Type: text/html; charset=utf-8")
      (prrn "Connection: close")
      (prrn)
      (wildcard-handler req)))

  (def wildcard-handler (req)
    (prn req!op))
This will display whatever op you request.

-----

2 points by akkartik 3970 days ago | link | parent | on: Modified/updated Semi-Arc for Android

That would all be awesome.

I've been building my latest project atop anarki. It would be most interesting to try it on android: http://github.com/akkartik/mu

-----

1 point by akkartik 3970 days ago | link | parent | on: Modified/updated Semi-Arc for Android

Nice! What does the 'oa' stand for? :)

Also, can you summarize what changes you made?

-----

2 points by c-a-smallwood 3967 days ago | link

Modernized the main user interface and unified the Semi-Arc jar and apk sources. At the moment, I'm doing a cleanup/rewrite of most of the major internals because (as stated by the original author) everything is far from optimal in the performance market. After that, I plan to make a branch of anarki's arc code be the main library. So it'll be like anarki on android!

-----

1 point by akkartik 3967 days ago | link

Nice! This might get us to replace srv.arc with app-development tools. Though it would be neat to see a webserver running on my phone :p

-----

2 points by c-a-smallwood 3970 days ago | link

And the "oa" stood for "on Android". Originally, it was just a command-line .jar

-----

1 point by akkartik 3970 days ago | link

Hmm, doesn't look like all the sources are there. I think you left out those for libs/semi_arc.jar?

I think we arc folks care even more about looking at the sources than running it :)

-----

2 points by c-a-smallwood 3970 days ago | link

Whoops! I'll upload the latest one which has all of the source in one project. The original author left the sources separate like that, so I had to do some digging and splice it together.

-----

1 point by akkartik 3985 days ago | link | parent | on: OT: Contract jobs

I hope you find something soon!

-----

2 points by jsgrahamus 3985 days ago | link

Thanks.

-----

1 point by akkartik 3985 days ago | link | parent | on: DrRacket(Libs) and Arc

You should build it :) Doesn't have to be complete at the start, just use it for a certain program and try to think of a cleaner way to express what you build. Then come ask us for help.

-----

More