Arc Forumnew | comments | leaders | submit | Jesin's commentslogin
1 point by Jesin 5756 days ago | link | parent | on: Anarki Stable

When I try to

  git clone git://nex-3.com/arc-wiki.git
I just get this message:

  Initialized empty Git repository in /home/jesin/arc-wiki/.git/
  nex-3.com[0: 70.87.222.25]: errno=Connection refused
  fatal: unable to connect a socket (Connection refused)
I'm new to git. Is there anything I can do about this, or is this a problem on the server side?

-----

1 point by CatDancer 5756 days ago | link

It was moved to github, see http://www.arclanguage.org/item?id=4951

-----

4 points by Jesin 6025 days ago | link | parent | on: (/ 0 0.0) = 0

Well, it depends.

  lim{x -> 0}(x/x) = 1
  lim{x -> 0}(x/0) = NaN
  lim{x -> 0}(0/x) = 0

-----

1 point by Jesin 6026 days ago | link | parent | on: I fixed it!

Aah! Didn't know about that, thanks for bringing that up. Yes, the error did say something about (quote nil). That should make things much easier.

-----

1 point by Jesin 6027 days ago | link | parent | on: I fixed it!

By the way, I think I said elsewhere that I've been rewriting arc.arc and cleaning it up a little. I have been paying attention to the comments, so if anything is a little messy but runs 3x as fast as the clean way, I'm leaving it as is.

Anyway, one of the comments is that, while iso takes 2 args now, it really should take n args. Here's what I came up with:

  (let iso1 nil
    (def iso1 (x y)
      (or (is x y)
          (and (acons x)
               (acons y)
               (iso1 (car x) (car y))
               (iso1 (cdr x) (cdr y)))))
    (def iso (x . xs)
      (if xs
          (and (iso1 x (car xs))
               (apply iso xs))
          t)))
I also came up with this function, a macex that expands more than just the car:

  (def macex-all (e)
    (zap macex e)
    (if acons.e
        (map1 macex-all e)
        e))

-----

2 points by Jesin 6027 days ago | link | parent | on: Suggestion for two core features

I don't like the list concatenation idea, but I think the Church encoding idea, while maybe not good per se, is at least interesting and perhaps worth considering.

-----

1 point by cchooper 6027 days ago | link

Really? I thought easy list concatenation was the better idea. Arc is a list-based language, and concatenation is a very basic list operation, so I thought it would be a good thing to optimise it as much as possible.

-----

1 point by Jesin 6028 days ago | link | parent | on: Smalltalk vs LISP

It would be interesting write Smalltalk and Lisp, and Lisp in Smalltalk. You could probably learn a lot about both languages that way.

On a related note, can WINE run Cygwin?

-----

2 points by Jesin 6028 days ago | link | parent | on: Implementation Question: Macros?

Basically, as long as it has a termination condition that is always reached, it works. For example (this may not match arc.arc as I'm making this up on the spot):

  (mac aif (test . body)
    (if body
        `(let it ,test
           (if it
               ,(car body)
               (aif ,@(cdr body))))
        test))
Now, let's expand this (I won't bother expanding let, just aif):

  (aif a b c d e)

  ; expand aif

  (let it a
    (if it
        b
        (aif c d e)))

  ; expand aif

  (let it a
    (if it
        b
        (let it c
          (if it
              d
              (aif e)))))

  ; expand aif

  (let it a
    (if it
        b
        (let it c
          (if it
              d
              e))))
If you feed in an even number of terms, this happens:

  (aif a b)

  ; expand aif

  (let it a
    (if it
        b
        (aif nil)))

  ; expand aif

  (let it a
    (if it
        b
        nil))
That works because (car nil) is nil. Convenient!

Also, I'm something of a perfectionist, and sometimes when I get bored I've been cleaning up some of the macros in arc.arc. I've been able to work out cleaner implementations that produce cleaner expansions for some of them. For example, I don't know why while is implemented as:

  (mac while (test . body)
    (w/uniq (gf gp)
      `((rfn ,gf (,gp)
          (when ,gp ,@body (,gf ,test)))
        ,test)))
when this should also work:

  (mac while (test . body)
    (w/uniq g
      `((rfn ,g ()
          (when ,test ,@body (,g))))))

-----

1 point by Jesin 6051 days ago | link | parent | on: SVG

Messing with XML in general should be pretty easy in Lisp.

-----

1 point by drcode 6051 days ago | link

FYI- In case anyone is doing this, here is my version of the canonical sexp->xml function:

  (def xexp (x (o indent 0))
    (if acons.x
        (withs ((tg . lst) x
	        atts nil
	        pad (apply string (n-of indent " "))
  	      pretty (all acons lst))
  	(and lst (acons caar.lst) (= atts pop.lst))
  	(string pad 
  		"<" 
  		tg 
  		(tostring:map [pr " " car._ "=\"" cdr._ "\""] atts) 
  		">" 
  		(when pretty
  		  "\n")
  		(apply string (map [xexp _ (+ indent 3)] lst)) 
  		(when pretty
  		  pad)
  		"</" 
  		tg 
  		">\n"))
        string.x))
It assumes the standard PLT-scheme "xexpr" format...it is naive about character encoding right now BTW.

Example:

  (xexp '(ying (foo ((bar . baz)) "zing") (yang)))

  <ying>
     <foo bar="baz">zing</foo>
     <yang>
     </yang>
  </ying>
(fyi, 'tag makes html assumptions and breaks on most xml, nor is it really appropriate in style for building xml)

-----

2 points by Jesin 6051 days ago | link | parent | on: arc2c update

Wow. That's a big improvement.

-----


Ugh. I think I'm going to vote no on this one. When's the last time you tried to read Perl?

-----

More