Arc Forumnew | comments | leaders | submitlogin
1 point by akkartik 4198 days ago | link | parent | on: Modified/updated Semi-Arc for Android

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

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!

It's not signed. Feel free to compile it from source :)
1 point by jsgrahamus 4199 days ago | link | parent | on: Modified/updated Semi-Arc for Android

My Android phone gave me a security alert on the apk.
1 point by akkartik 4201 days ago | link | parent | on: Passing a string to defop for the url?

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 bh 4201 days ago | link | parent | on: Passing a string to defop for the url?

Thanks, I got it. Also, is there a way to catch all requests?
2 points by akkartik 4201 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 akkartik 4202 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


New Source (.apk in bin folder): https://docs.google.com/file/d/0B7T0CVHnS8CQY1ptQy1Obi1mdUE/...

I want to get the networking and i/o portions working, clean up where possible and make the gui (slightly) customizable... It'd be pretty nice if I could get it to be compatible with anarki :)


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

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 4202 days ago | link | parent | on: Modified/updated Semi-Arc for Android

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 :)

1 point by akkartik 4202 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 jsgrahamus 4216 days ago | link | parent | on: OT: Contract jobs

I've been contracting for the last few years. Hope to continue.
2 points by jsgrahamus 4216 days ago | link | parent | on: OT: Contract jobs

Thanks.
1 point by akkartik 4216 days ago | link | parent | on: OT: Contract jobs

I hope you find something soon!
2 points by bh 4217 days ago | link | parent | on: OT: Contract jobs

Consulting?
1 point by akkartik 4217 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.
2 points by ChristophRe 4217 days ago | link | parent | on: DrRacket(Libs) and Arc

in the end it would be nicer to have an Arc library that wraps the underlying gui racket library in the spirit of Arc. Arc is much simpler than scheme code. I does not like complicated syntax. I also does not like OO and classes of racket. It is the wrong way. Hashtable like in Javascript and writing your own OO-like library is much more flexible.
2 points by ChristophRe 4217 days ago | link | parent | on: DrRacket(Libs) and Arc

Thank you very much. I assume that I could use another syntax for [...] like in Arc. But I did not find it. So often it is better to ask people you has better scheme background. I am not grown up with Lisp stuff.
2 points by Pauan 4218 days ago | link | parent | on: DrRacket(Libs) and Arc

I just fixed a bug in Arc/Nu, so now you can do this:

  (%:require racket/class)
  (%:require racket/gui/base)

  (= frame (%:new frame% (label "Example")))
Notice that you can use () rather than [], because in Racket the syntax reader converts [] into ().

You need to require "racket/class" because Arc/Nu only requires "racket/base", rather than all of "racket".

2 points by ChristophRe 4218 days ago | link | parent | on: DrRacket(Libs) and Arc

I wanted create a frame with in Racket

; Make a frame by instantiating the frame% class (define frame (new frame% [label "Example"]))

but because of Arc special syntax like [+ _ 1] this does not work, because the interpreter translage [label "example"] into a anonymous function.

Anyone who know how to solve this?

3 points by Pauan 4220 days ago | link | parent | on: DrRacket(Libs) and Arc

I would just like to point out that Arc/Nu is fully compatible with Arc 3.1, and it doesn't need conversions between Racket and Arc, so it's the easiest way to deal with Racket in Arc programs.
1 point by akkartik 4221 days ago | link | parent | on: DrRacket(Libs) and Arc

No, you'll have to add it. The simplest way to do this is probably aw's original hack: http://hacks.catdancer.ws/ac.html

You'll need to add one line to ac.scm, and then:

  arc> (ac-scheme.pair? '(1))
  #t
Feel free to rename ac-scheme to $ or % if you think you'll use it often enough.

If you start using this you'll start finding the need for some of the other functions in that link, which transform data back and forth to the way racket or arc likes it. Come back and ask us more questions when you run into errors like this:

  arc> (ac-scheme.length '(1 2 3))
  Error: "length: contract violation\n  expected: list?\n  given: '(1 2 3 . nil)"
2 points by jsgrahamus 4221 days ago | link | parent | on: DrRacket(Libs) and Arc

Thanks, Akkartik. Is there a way to do such from arc itself?
2 points by akkartik 4222 days ago | link | parent | on: DrRacket(Libs) and Arc

To call racket functions in anarki:

  arc> ($.pair? '(1))
  #t
In Nu:

  > (%.pair? '(1))
  #t
3 points by jsgrahamus 4222 days ago | link | parent | on: DrRacket(Libs) and Arc

I didn't specify. Could you give an example in each of them? Thanks, Steve
1 point by akkartik 4222 days ago | link | parent | on: DrRacket(Libs) and Arc

You mean in Nu? % on Nu is like $ on anarki. Does that answer your question?
1 point by jsgrahamus 4222 days ago | link | parent | on: DrRacket(Libs) and Arc

Can anyone refer me to the method of accessing the underlying mzscheme or racket functions?

Thanks, Steve

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

Arc3.1 and Anarki are built on the outdated mzscheme language. But you might be able to use Pauan's Arc/Nu: https://github.com/arclanguage/arc-nu. We'd love to hear your experiences if you try it out.
More