Arc Forumnew | comments | leaders | submit | lg's commentslogin
1 point by lg 3688 days ago | link | parent | on: Atdefs - mutual atomicity

I thought about this too, but it doesn't look right to me. I would expect this makes the act of defining the functions atomic, but not calls to those functions once defined.

-----

1 point by zck 3688 days ago | link

To me, it feels the same as

  (let ctr 0
       (def inc () (++ ctr))
       (def reset () (= ctr 0))

-----

1 point by lg 3688 days ago | link | parent | on: Atdefs - mutual atomicity

Ha, thanks, good to know. In that case, I'll save this for the day when arc gets a new threading model!

-----

2 points by lg 3726 days ago | link | parent | on: Poll: What language should I learn after Arc?

ruby is slower than arc? i'm curious what your benchmarks were...

-----

3 points by thaddeus 3726 days ago | link

Assuming arc is marginally slower than PLT scheme:

http://shootout.alioth.debian.org/u64/which-languages-are-fa...

  Scheme PLT	         1.14	1.14	7.65	13.61	20.05	38.65	62.92
  Smalltalk VisualWorks	13.79	13.79	17.46	19.56	27.98	43.78	65.61
  Lua	                 1.39	2.00	16.02	22.85	25.37	39.39	47.59
  Ruby JRuby	        11.30	11.30	16.85	28.99	70.01	149.76	199.57
  PHP	                 2.00	2.00	9.11	58.75	90.47	105.12	105.12
  Python CPython	 1.93	1.93	12.76	62.45	69.75	110.98	110.98
  Perl               	 2.01	2.01	7.28	67.28	107.69	192.28	192.28
  Ruby MRI	         7.44	7.44	28.42	91.00	195.87	447.05	535.97

-----

2 points by lg 3733 days ago | link | parent | on: Poll: What language should I learn after Arc?

i think powerset got rails running on yaws, i never checked that out though.

-----

3 points by lg 3733 days ago | link | parent | on: Missing string stuff

I like this cut, except I changed the (< end 0) case to (+ (len seq) end 1). This gives the behavior I expect:

  (cut "abc" 0)
  ;=> "abc"

  (cut "abc" 0 -1)
  ;=> "abc"

  (cut "abc" -3 -2)
  ;=> "ab"
Also if anyone's interested, here's lastmatch (i.e. #1):

  (def lastmatch (pat seq)
    (catch (if (isa pat 'fn)
               (let leng (- (len seq) 1)
                 (for i 0 leng
                      (when (pat (seq (- leng i))) (throw (- leng i)))))
               (let leng (- (len seq) (len pat))
                 (for i 0 leng
                    (when (headmatch pat seq (- leng i)) (throw (- leng i))))))
           nil))

-----

1 point by lg 3735 days ago | link | parent | on: Multiple cases in 'case branches

I think it'd be cool if a case-clause could be a fn, and if it is, and calling it on the case-arg returns true, then it matches. but maybe there should be a special sort of case for this called fncase or something.

-----

1 point by rocketnia 3735 days ago | link

I like that idea, and it would be just as minor a change.

  - `(if (is ,var ',(car args))
  + `(if ((testify ,(car args)) ,var)
A difference is that in order to test against a literal value, you have to quote it. It's closer to Anarki's 'switch that way.

Oh, and akkartik and twilightsentry had just mentioned this idea elsewhere in this thread. :-p

-----

3 points by lg 3772 days ago | link | parent | on: A bug in assign?

That's a mzscheme thing, I guess it's what it prints when the expression has no return value? (assign) gets turned into

  (eval `(begin))
and if you type that at the mzscheme prompt, it prints nothing; if you type

  (write (eval `(begin)))
as arc does, it prints that weird void.

-----

3 points by zhtw 3772 days ago | link

Yeah, but shouldn't it be changed to nil?

  (define (ac-set x env)
    (if (null? x)
       (list 'quote 'nil)
       `(begin ,@(ac-setn x env))))
I realize that it's not very important but still it's a bug. No?

-----

1 point by lg 3849 days ago | link | parent | on: Question: What are Arc's strengths?

>Hopefully someone will find time to take the best of these two Lisp dialects and create a new language in the future that rethinks "brevity" in terms of the ideas behind Clojure.

I'm curious which particular ideas you're talking about? I've used both and I don't know what clojure brings to the table that arc really needs, besides the stuff that arc will certainly get anyway, like libraries, some kind of module system, and facilities for performance tuning. (Although I think clojure could use some better libraries, too :)

-----

1 point by lg 3857 days ago | link | parent | on: Atstring problem

whoops, I forgot about the formatting and now it's too late to edit.

Maybe my original problem wasn't important then. Also it seems like your first problem means there should be more parens for disambiguation. "x/@(y)/z" or "x/@((funcall))/z" etc. "add more parens" always seems too easy to be right, though :)

-----

8 points by lg 3921 days ago | link | parent | on: New Version of Arc

hmm, this bit me... can't use each within an afn because each uses afn internally, and it leaks the 'self binding into the body. I changed it to use an rfn with a uniq name and it works.

-----

5 points by pg 3921 days ago | link

Oops, fixed:

    (mac each (var expr . body)
      (w/uniq (gseq gf gv)
        `(let ,gseq ,expr
           (if (alist ,gseq)
                ((rfn ,gf (,gv)
                   (when (acons ,gv)
                     (let ,var (car ,gv) ,@body)
                     (,gf (cdr ,gv))))
                 ,gseq)
               (isa ,gseq 'table)
                (maptable (fn (,gv ,var) ,@body)
                          ,gseq)
                (for ,gv 0 (- (len ,gseq) 1)
                  (let ,var (,gseq ,gv) ,@body))))))

-----

5 points by jmatt 3919 days ago | link

Are you going to fix this and other small bugs in the tar or are we just going to patch them on the fly? If the plan is to patch maybe we need a thread with patches - so people can get up and running fast.

Personally I think using Anarki is fast, straightforward and community friendly... So that may be my choice in the end when arc3/mz372 has some time to stabilize.

Is there a reason you are avoiding source control?

EDIT: Added the last question.

-----

More