Arc Forumnew | comments | leaders | submit | thaddeus's commentslogin

yup (and prioritized):

  * great documentation & write ups.
  * feature rich well supported libraries (i.e. database connections, vector graphics libraries etc..)
  * macOSX and Linux support.
  * active community of users at all levels. 
  * low overhead (I like that arc is a dynamic language, has type inference, and lexical scope)

-----


Good point. Although I didn't stipulate this in my original post I kinda assumed no matter what language I pick I will have to continue increasing my js knowledge to continue building web apps. I already do already use js and jquery often.

-----

1 point by thaddeus 5768 days ago | link | parent | on: Use x!foo with association lists

lol. I've tried to vote for this post like 4 times. On the first day posted and today. I think andrew must have triggered the 'adding-too-much-value-thresh-hold' in pg's voting algorithm. :) or I've somehow triggered pg's 'newb-alert+ban-thresh-hold'.

-----

2 points by aw 5768 days ago | link

or maybe voting ring detection code I wonder?

-----

1 point by akkartik 5768 days ago | link

Hmm, that may be why several of my upvotes on your stories haven't seemed to register :)

-----

1 point by thaddeus 5768 days ago | link | parent | on: using MySQL with arc?

ok, It took me about an hour to install & learn MySQL without any hickups. :)

I did get stuck on the arc mysql library. I have to admit I'm not loading anarki I am just seeing if I can load ffi.scm into arc3.1.

in ffi.scm there's:

  (require #%foreign)
which I'm guessing is the reason I get:

   #%foreign: bad module path in: #%foreign
   === context ===
   standard-module-name-resolver
Anyone understand the syntax '(require #%foreign)'? Is this a scheme thing or an anarki thing?

Thanks, T.

-----

2 points by thaddeus 5768 days ago | link | parent | on: using MySQL with arc?

Which is what I've been doing too and is fine if you own & control the data, but what happens when the data you want to consume exist in a source where the owner uses an Oracle or MySQL db?

-----

1 point by akkartik 5768 days ago | link

Yeah, I didn't mean to imply arc doesn't need mysql bindings or anything like that. I think I was just giving thanks :)

-----

1 point by thaddeus 5768 days ago | link

I agree. The fact that I've been able to develop fairly complex applications in arc for so long without requiring a db is awesome.

-----

1 point by thaddeus 5776 days ago | link | parent | on: Use x!foo with association lists

Awesome! This is much better than my hack.

Too bad (= x!first "new") didn't work, but I still like yours better as it's cleaner not to have a pre-symbol.

Also note, (and I hope I am not cuttering your post) I also created a template like abstraction called 'arrange'for alists:

  (= arrangements* (table))

  (mac arrange (item . fields)
    (withs (name (carif item) includes (if (acons item) (cdr item)))
      `(= (arrangements* ',name) 
          (+ (mappend arrangements* ',(rev includes))
             (list ,@(map (fn ((k v)) `(list ',k (fn () ,v)))
                          (pair fields)))))))

  (def actuate (item . args)
    (let x nil
      (each (k v) (rev (if (acons item) item (arrangements* item)))
        (unless (no v) (push (list k (v)) x)))
      (each (k v) (pair args)
        (push (list k (v)) x))
      x))

It's just a copy of pgs templates only instead of creating a table it instantiates alists. This allows me to store the order of things (even for tables).

example use:

  arc> (arrange author first "First Name" last "Last Name")
   ((first #<procedure: gs6338>) (last #<procedure: gs6338>))
  
  arc> (= x (actuate 'author))
  ((first "First Name") (last "Last Name"))

  arc> x!first
  "First Name"
I've used this to output large tables in CSV format, where the header and sort order is derived from an 'arrangement'.

and now I can use the intra symbols too! T

-----

2 points by aw 5776 days ago | link

Too bad (= x!first "new") didn't work

hmm, it seems like the association list thing to do for a set would be to push a new pair onto the front of the association list, so that

  (= x!foo 'bar)
would be like saying

  (push '(foo bar) x)
when x was a cons and foo wasn't a number. But I don't know how to do that, or if it's possible.

On the other hand, if you want to modify existing associations in place:

  (extend sref (com val ind) (and (acons com) (isnt (type ind) 'int))
    (aif (assoc ind com) (= (cadr it) val)))

  arc> (= x '((a "A") (b "B") (c "C")))
  ((a "A") (b "B") (c "C"))
  arc> (= x!b "X")
  "X"
  arc> x
  ((a "A") (b "X") (c "C"))
though that won't let you add new keys to the alist.

-----

2 points by thaddeus 5779 days ago | link | parent | on: "as" macro for a more readable "coerce"

'as' is much better - changing my code now :)

I had also created coerce-if for coercing args from an defop arg-req:

  (def coerce-if (v type) 
     "coerce value if not nil"
     (if v (coerce v type)))
only when substituting for "as" I start getting arc-slang-talk:

  (def as-if (type v) 
     (if v (coerce v type)))

   (defop myserv req
      (let id (as-if int (arg-req "id"))
        (pr id))
lol.

-----

1 point by akkartik 5779 days ago | link

More than as-if, I want a really-as, which will convert nil to a default value.

Right now I just have int2, which is like int, but converts nil to 0. Still mulling how to generalize it. Perhaps it doesn't need to be generalized.

Anybody have a better name than int2?

-----

2 points by aw 5779 days ago | link

Maybe a function like 'only', but which defaults to 0 instead of nil?

  (def default0 (f)
    (fn args (if (car args) (apply f args) 0)))

  arc> (default0.int "123")
  123
  arc> (default0.int nil)
  0

-----

1 point by rocketnia 5778 days ago | link

You could even name it "0nly", with a zero. ^_^ That could be a bit deceptive, though.

-----


As a note the http-utils str->url has a reference to a function '1+' that probably exists in some other library? if you're using anarki. If not you may need to:

  (def 1+ (n)
    (+ n 1))

-----

1 point by palsecam 5790 days ago | link

See 'inc in arc.arc (there is also '++).

-----


Nevermind. Looks like its a known issue. it appears logins don't work from web interface, rather one has to create an andriod app to handle the authentication to the page.

-----

1 point by conanite 5804 days ago | link

curious - does the browser not handle cookies, or do you know why this is an issue? Do you mean every web app that requires a login needs a custom app in order to be usable on an android? (I know nothing about android, count me a total noob)

-----

1 point by thaddeus 5804 days ago | link

ugh - I had thought it was the browser:

http://news.ycombinator.com/item?id=849521

but I am not sure anymore. I can log into google docs and such, but google makes android so not sure what magic they make.

I only got the phone yesterday. And naturally I tried to see if any of my arc apps or the arc forum worked.

The webpages load great, it's only the login...hmmm guess I'll keep googlin :)

-----

2 points by thaddeus 5802 days ago | link

Looks like I was correct:

Google has bugs:

http://code.google.com/p/android/issues/detail?can=2&q=1...

http://code.google.com/p/android/issues/detail?id=4305

-----

1 point by thaddeus 5806 days ago | link | parent | on: Rainbow: client-socket

how about: socket-to-em

lol.

-----

More