Arc Forumnew | comments | leaders | submit | eds's commentslogin
1 point by eds 6617 days ago | link | parent | on: Reducing Parentheses

Just tried Paredit and I really like it. Thanks!

-----


  arc> (round 4.5)
  4
  arc> (roundup 4.5)
  5
Or said another way,

  arc> (map round (map [+ _ 1/2] '(0 1 2 3 4 5 6)))
  (0 2 2 4 4 6 6)
  arc> (map roundup (map [+ _ 1/2] '(0 1 2 3 4 5 6)))
  (1 2 3 4 5 6 7)

-----

2 points by rincewind 6618 days ago | link

Thank you!

I think the docstrings on anarki should say that round does unbiased rounding.

-----

1 point by eds 6621 days ago | link | parent | on: arc2c update

Is this on Anarki yet? (For that matter, I don't even see your version using Boehm GC on Anarki.)

Edit: I just found http://github.com/sacado/arc2c/tree/master. Is this the repo you are talking about?

-----

1 point by sacado 6620 days ago | link

No, it's not on the git yet as I cannot access it this week. And yes, arc2c's git is http://github.com/sacado/arc2c/tree/master

-----

3 points by almkglor 6620 days ago | link

Just a question, but I wonder if you could give eds write access to the repo? And of course, if there's anyone else out there who would like to contribute, just let us know, I think sacado would be glad to accommodate you ^^

-----

1 point by stefano 6620 days ago | link

I'd like to have access too. Currently I don't have much free time to contribute, but if I find some time i'll be glad to contribute. My github username is, surprisingly, 'stefano'.

-----

1 point by sacado 6620 days ago | link

You're on the list now :)

-----

1 point by stefano 6619 days ago | link

Thanks :)

-----

1 point by sacado 6620 days ago | link

Sure, eds, do you have a github account ? What's your login ?

-----

1 point by eds 6620 days ago | link

Yeah, my github username is slaguth.

-----

1 point by sacado 6620 days ago | link

done.

-----

1 point by almkglor 6621 days ago | link

Yes ^^

-----

1 point by eds 6621 days ago | link | parent | on: arc2c update

> Wonder how eds is doing on arc2c?

I've been following up on the forum threads but I haven't had time to actually read the code yet. (And the last time I checked, the arc2c executable gave me a segfault.)

-----

1 point by almkglor 6621 days ago | link

LOL. In any case to reduce the possibility of things being screwy I do the following on my C output:

  //#include<gc.h>
  #define GC_MALLOC malloc
  #define GC_INIT()
The current arc2c output assumes that you have a proper Boehm GC installation, but since I can't seem to get a good install here (prolly something to do with being AMD64 again) I just disable the GC for now.

Hmm, can you try on a later version?

-----

2 points by eds 6621 days ago | link

I finally got arc2c to work (without GC as you suggested). One note though: apparently arc2c relies on rm-global.arc, but doesn't load it by default. So under the current version of the compiler, 'compile-file will error until you (load "rm-global.arc").

Now I just have to get it to work with GC...

-----

2 points by almkglor 6621 days ago | link

Oops. Must have forgotten to add it to arc2c.arc then ^^. Unfortunately I won't be able to fix this until maybe 7 hours from now T.T, haha, I'm in the office ^^

The thing about GC working: well, you need to somehow download the development version of Boehm GC, and, well, that's what's stopping me for now T.T

-----

1 point by eds 6621 days ago | link

Are your latest changes on Anarki? Even after "git pull" I still seem to have the old version.

-----

1 point by eds 6623 days ago | link | parent | on: Errors with (asv)

There are a number of problems with the official distribution on several operating systems (e.g. Windows). This should be fixed on Anarki in the stable branch, which you can download from git://github.com/nex3/arc.git (or http://github.com/nex3/arc/tree/stable if you don't have git installed).

-----

1 point by eds 6624 days ago | link | parent | on: On Lisp?

Still, it would be nice to have real printed copies of On Lisp instead of having to print it all yourself.

-----

3 points by skrishna23 6623 days ago | link

Well, why not use some service like lulu.com to print this out as a book ?

-----

1 point by eds 6620 days ago | link

Perhaps, but what about copyright issues?

-----

1 point by almkglor 6624 days ago | link

Well, yes, I suppose so ^^

-----

2 points by eds 6625 days ago | link | parent | on: Where are the fast dynamic languages?

An Arc to C compiler in Arc might be able to do it, with appropriate optimizations. I might actually work on that for GSoC next summer. I guess we'll see where it goes...

In the meantime:

http://arclanguage.org/item?id=5678

-----

1 point by almkglor 6625 days ago | link

We may need to define extensions for optimization purposes though.

As an aside, defm may help, by ensuring that certain variables always belong to certain types (although the other problem is with regards to . rest arguments). Really, having an optional type declaration is good, and helps make it easier for the compiler to optimize.

-----


My guess is pg just hasn't gotten around to it. For example, starting a new poll hasn't been integrated into the submit page yet.

-----

2 points by eds 6628 days ago | link | parent | on: arc-to-c : soon on the git

> In the sample we already have a "built-in" which is in fact added to the source to be compiled: ccc or call/cc. We could extend/generalize this to include a set of built-ins that are added to the source to be compiled.

I suppose the set of functions to be included would be those in arc.arc and libs.arc, in which case you would just compile arc.arc and libs.arc before compiling the target file, right?

-----

2 points by almkglor 6628 days ago | link

Basically, ccc is handled by detecting if it is used. If it's not used, it's not inserted. When I was talking about extending this, this is what I was referring to: adding code which is defined as "inserted if used".

Simply inserting the entire arc.arc code will add bloat, because most programs don't even use most of the arc.arc code. Given the level of documentation of arc functions (arcfn.com notwithstanding), it is more than likely that the user will not use arc.arc code. So it's better if we simply insert the code if it is used.

Also, it may be better to use arc2c specific code, to take advantage of certain peculiarities in how code is generated. For example, if you decide to use unrolled lists, map1 and friends are better off allocating the full list and then iterating over the values.

-----

1 point by eds 6627 days ago | link

This is fine if the compiler is static like Stalin, but if you omit parts of arc.arc that aren't used, you run the risk of not being able to deal with code known only at run time (e.g. (loop:print:eval:read)).

-----

2 points by almkglor 6627 days ago | link

And if 'eval is an interpreter?

Come now, if you want real support for eval, you'll also need to include the compiler:

  (eval `(fn (x) ,@my-variable)) ;how will it build the function?
The alternative is to punt: if there's ever an 'eval, then add arc.arc completely, make 'eval an interpreter which somehow uses 'symeval to lookup globals (and execute global functions as compiled functions), and when it encounters a function, will build the function as an interpreted function (and obviously allow interpreted code to call compiled functions and vice versa).

Basically you create a virtual function:

  (def eval (e (o env))
    (if
      (caris e 'fn)
        (add-attachment
          'environment env
          (annotate 'virtual-function
            (cdr e)))
      ...))
  (defcall virtual-function (f . args)
    (with (env (get-attachment 'environment)
           (arglist . body) args)
      ; has to be nondestructive
      (zap add-args-to-environment env arglist args)
      (each e body
        (eval e env))))

-----

6 points by eds 6630 days ago | link | parent | on: Comments on html.arc

But if you don't get the standard library right, then everyone is going to start using their personal version of it, and then you lose portability, etc.

It is worth getting the language right, even if the fix is trivial.

-----

3 points by almkglor 6628 days ago | link

I was actually thinking some time ago about using something like this:

  (mac mapeach (var coll . body)
    "Like 'map, but with 'each syntax"
    `(map1 (fn (,var) ,@body) ,coll))

  (marcup
    `(html
       (head (title ,(+ page-title " - My Website")))
       (body
         (.content
           ,(enformat page-content))
         (.sidebar
           ,@(mapeach (link dest) weblinks
               `(.sidelink (a href= ,dest ,link)))))))
Basically 'marcup would accept a list representing an abstract syntax tree for the HTML code to be generated.

Then I decided to implement w/html instead, which was almost as good ^^; >.< In fact it's arguably better, since the copious ' marks denote non-Arc code (i.e. HTML tags), as opposed to the marcup style above where , marks denote Arc code.

-----

More