Arc Forumnew | comments | leaders | submit | stefano's commentslogin
1 point by stefano 6541 days ago | link | parent | on: "while" with terminal test...

(mac dowhile (test . body) (w/uniq (f) `(rfn ,f () ,@body (if ,test (,f)))))

Should work(haven't tested it yet).

-----

1 point by almkglor 6541 days ago | link

Here's a better version which puts the test at the end:

  (mac dowhile body
    (with (rbody (cut body 0 -1)
           test (last))
      (w/uniq f
        `(rfn ,f ()
          ,@body
          (if ,test (,f))))))

-----

3 points by drcode 6541 days ago | link

Thanks guys- Sounds like noone else knows of a way to do this with the current libraries either. Now I know I didn't just miss this feature somehow.

-----

1 point by tokipin 6539 days ago | link

i would use something like (based on the rfn idea):

  (= a 0)
  
  ((afn ()
     (pr ++.a)
     (if (isnt a 8) (self))))

-----

3 points by drcode 6539 days ago | link

right- as I mentioned in the other comment, this is less cumbersome with "drain"

  (= a 0)
  
  (drain (do (pr ++.a)
             (isnt a 8)))

-----

3 points by almkglor 6538 days ago | link

shorter thus:

  (drain:do
    (pr ++.a)
    (isnt a 8))

-----

1 point by stefano 6541 days ago | link | parent | on: Moved Anarki to GitHub

I'd like an invite: stefano.dissegna (at) gmail (dot) com

-----

1 point by almkglor 6541 days ago | link

sent ^^

-----

1 point by stefano 6541 days ago | link

Thank you very much! :)

-----


To implement implicit parenthesis is possible to add a parameter to macro definitions to tell the reader how many parameters the function takes, so that it can add an opening brace when it sees a macro name and it closes it after n arguments. I've done so in a toy lisp interpreter I'm writing, but after a while i removed that feature because i didn't like implicit parehthesis, when manipulating forms within macros you have to remember about implicit parenthesis and this makes macros less natural.

-----

2 points by stefano 6546 days ago | link | parent | on: Poll: Where are you from ?

Italy

-----


Arc really needs a FFI. This would make possible using graphical libraries such as GTK+. I know Arc is web-oriented, but for some type of applications a conventional GUI is simply better.

-----

3 points by sacado 6554 days ago | link

As a matter of fact, I'd love Arc to not be only web-oriented. Anyway, what will the web be like in a hundred years ?

-----


I'd like it to be called anum.

-----

3 points by CatDancer 6562 days ago | link

I like that name too.

-----

1 point by lojic 6562 days ago | link

Isn't anumber more consistent?

-----

2 points by stefano 6567 days ago | link | parent | on: Strings as lists, generic regexes

Implementing strings as list would be rather slow and memory consuming: you would have to use a cons cell for every character. Implementing strings as vectors and making them visible to the user as lists would be interesting.

-----

3 points by vrk 6567 days ago | link

It doesn't matter how they are implemented (they can even be cons cells implemented as closures), as long as you can use the ordinary list functions to manipulate them. But this is the direction Arc is headed to anyway.

-----

1 point by stefano 6571 days ago | link | parent | on: . and : I'm not sure I get it

. and ! notation are quite cryptic... I prefer (l 10) to l.10

-----


Using M-expressions would reduce the regularity of Lisp, IMO. But mathematical expressions are more readable with infix notation. I think it would be nice to be able to say (math 8+9(sqrt 67)) instead of (+ 8 ( 9 (sqrt 67))).

-----

2 points by stefano 6578 days ago | link | parent | on: Are Arc macros hygienic after all?

Maybe the symbol do is interpreted as a macro only if it is found in the first position, elsewhere it is interpreted as a variable (or function) name.

-----

2 points by almkglor 6578 days ago | link

It is. Unfortunately this means, as I mentioned, that if you happen to do something like:

  (let obj (table)
       (= (obj 1) 1)
       (obj 1))
... it will fail, miserably.

-----

More