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

Which has nothing to do with MzScheme

Given that arc compiles to mzscheme, mz seems like the right name. If there was a CL-based arc with the same feature, the name would be more debatable. In rainbow for example, a "pass through the compiler unchanged" feature is meaningless - there is nothing on the other side that would understand. "mz" also has the advantage of being short, expressive and euphonic, unlike "qac" or "ptac"

-----

3 points by rntz 5948 days ago | link

More generally, why would you want the pass-through-compiler feature to be named the same thing in different arc systems if the backend is different? Code that works when you're compiling to mzscheme is useless if you're compiling to CL; you'd rather have it warn you that it doesn't know what the hell you're talking about when it sees "mz" than have it (mis)interpret your mzscheme code as CL code.

-----

2 points by conanite 5954 days ago | link | parent | on: Arc presentation

These are the slides for an arc presentation I gave today at xpday france - http://xpday.fr/

I hope they represent arc reasonably well. There's a slight rainbow bias, and a lot of blub-bashing.

enjoy, and feel free to re-use parts you like.

[edit: the slides are in english]

-----

1 point by sacado 5953 days ago | link

How was it perceived at xpday ? Did people seem to like Arc's ideas ?

-----

2 points by conanite 5952 days ago | link

Various languages were represented in the audience. Generally, python and erlang users were less impressed; but users of java and other blubs found a new way in which their language was inadequate :)

Some were concerned about unreadability, and others dismissed arc as impractical, but overall I think people seemed to appreciate the power macros can bring to a language, and how hopeless the situation is for java et al, given their heteroiconicity.

-----

1 point by sacado 5950 days ago | link

OK, thanks :)

-----


I'm curious, in the example you give, you show a missing closing paren after a def; but how does the reader know that the missing paren isn't missing from a later form? (assuming the reader has little understanding of the content it's reading beyond paren-balancing - especially since it's a scheme reader reading arc code).

The only obvious clue I can see is indentation ...

-----

3 points by CatDancer 5957 days ago | link

At this stage, MzScheme is reading lists from the input file as data. Once a complete list has been read, Arc then takes that list and interprets it as a piece of Arc code.

On line 4, the MzScheme reader sees the first opening parenthesis which starts the def. It then reads all the way to the end of the file without finding a closing parenthesis, and so complains that it isn't able to read the list starting on line 4.

-----

2 points by conanite 5956 days ago | link

ummm ... doh. I understand now, it's reporting the line number of the unmatched opening paren ... I was thinking it was the line number where the missing one should have been. thanks.

-----

3 points by CatDancer 5956 days ago | link

In the description I moved the comment up a line so it doesn't make it appear that the parser is doing magic ^__^

-----


app* is a nested structure something like this:

  app*
    yardwork
      budget
      forecast
    house
      budget
        roof = 1996.0
        windows = 1000.0
      forecast
        roof = 1996.0
        windows = 1800.0
And you want a clean way to access, for example, (((app* 'house) 'budget) 'roof), given 'house and 'roof as parameters.

Am I right so far?

An alternative definition of area-situation might look like this:

  (def area-situation (area sub-area)
    (with (budget   ((app* area) 'budget)
           forecast ((app* area) 'forecast))
      (if (is (- (budget sub-area) (forecast sub-area)) 0)
        (= (budget sub-area) 200))
      (prn "forecast " (forecast sub-area) " budget " (budget sub-area))))
You can use 'with to create variables pointing just to the two tables you need and then there's less digging to do when you need to look up or alter values.

You might get better mileage by changing the data structure though if that's possible:

  app*
    yardwork ...
    house
      roof
        budget = 1996.0
        forecast = 1996.0
      windows
        budget = 1000.0
        forecast = 1800.0
Then, area-situation becomes even simpler:

  (def area-situation (area sub-area)
    (let situation ((app* area) sub-area)
      (if (is (- (situation 'budget) (situation 'forecast)) 0)
        (= (situation 'budget) 200))
      (prn "forecast " (situation 'forecast) " budget " (situation 'budget))))
Arc doesn't really have "pointers" (at least not in the c/c++ sense) - you either have global variables, or local (lexically-scoped) variables. So you can create a local variable pointing to the innermost table using 'let or 'with. Oh, I said "pointing" - well, they're kinda pointers.

Does that point you in the right direction, or did I miss the point entirely?

btw with the hot new special-syntax you can write app.area.sub-area instead of ((app area) sub-area) - see http://arclanguage.org/item?id=9220

-----

1 point by thaddeus 5957 days ago | link

wow!

i didn't have an appreciation for the 'hot new special-syntax' until I compared my original hack against your last function with the infixing....

    (def area-situation (area sub-area)
        (let situation app*.area.sub-area
          (if (is (- situation.budget situation.forecast) 0.0)
            (= situation.budget 200)
          (prn "forecast " situation.forecast " budget " situation.budget))))
This is awesome!

T.

-----

1 point by thaddeus 5957 days ago | link

    *Am I right so far?*
yep.

I have to spend more time using 'with'; it's not a well well used tool in my tool shed as it should be.

and your last solution looks great to me.

thanks. T.

-----


  (toerr is-human)
sorry, couldn't resist :)

-----

4 points by thaddeus 5959 days ago | link

LOL. hmmmm...

    arc> (toerr ((or (no t) toerr)))
    nilnil
Guess that means I should not error!

T

-----

2 points by conanite 5959 days ago | link | parent | on: Last call for Arc bugs

Have a look at http://steve-yegge.blogspot.com/2008/02/portrait-of-n00b.htm... ... you might find it reeks of arrogance, or you might enjoy it:

"The sticking point is compression-tolerance. As you write code through your career, especially if it's code spanning very different languages and problem domains, your tolerance for code compression increases. It's no different from the progression from reading children's books with giant text to increasingly complex novels with smaller text and bigger words."

If my understanding is vaguely correct, Yegge argues for compact code for the same reasons pg does.

I personally wish there were a means to quickly identify the data-type

Something that an editor for a dynamic language can give you is run-time analysis of your code - so, indeed, a mouse-over could in fact give you a list of the types assigned to any given symbol. This is something I'd love to get welder to do ... it's entirely possible, in theory :)

Alternatively, you could write your own function definition macro that lets you specify param types and checks them for you at runtime:

  (typed-fn fillcup ((string with) (table size)) 
    (let ...
But my tendons recoil in horror at the implications of this. Remember: strong typing hurts your keyboard!

-----

2 points by thaddeus 5959 days ago | link

I enjoyed the first half - then he went on and on and on....

My goal is to try making code readable enough that documentation or 'metadata' is barely needed. I'm going to rework my code and start keeping my code idealized - not descriptive - not short.

I'm going see how it works when I drop the data type tagging all together and hope one day when I am a little more knowledgeable I will be able to craft a solution.

Maybe in a few years I'll let you know how it went :) T

-----

7 points by conanite 5961 days ago | link | parent | on: Thank you pg and rtm!

Hear, hear. Arc makes even ruby look terribly verbose, and has considerably augmented my curse-per-LOC metric for java projects.

-----

2 points by conanite 5965 days ago | link | parent | on: PG's syntax patches pushed to git

Just curious, should a tailing . or ! mean something or be considered an error? I get

  arc> (ssexpand 'a.b.c.)
  (((a b) c) #<eof>)
  arc> (ssexpand 'a.b.c!)
  (((a b) c) (quote #<eof>))

-----

3 points by CatDancer 5965 days ago | link

I don't know, but the ac.scm source does mention "no error-checking!" :-)

-----


Awesome work. Watch out for the numerous number formats scheme allows -

  1.3e-32-4.3e+56i
  3/8-4.3e+56i
I can attest that it's hell to parse these numbers - and imz returns 56 in each of these cases. You might need to use real-part and imag-part from scheme if you don't want to write a complex number parser in arc :)

-----

1 point by wgac 5957 days ago | link

I found some errors in the recent post. Here is the (I hope so) final version or rez and imz. Enjoy :)

    ;;Realis of complex number z
    (def rez (z)
         (with (lz (tocons z) i 0 j 0)
         (until (or (is i (len lz))
                    (and (isnt (lz j) #\e)
                         (or (is (lz i) #\+)
                             (is (lz i) #\-)))) 
            (if (is i 0) (++ i) (do (++ i) (++ j))))
            (toint (firstn i lz))))

    ;;Imaginaris of complex number z
    (def imz (z)
         (with (lz (tocons z) i 0 j 0)
         (until (or (is i (len lz))
         	    	(and (isnt (lz j) #\e)
	    	     (or (is (lz i) #\+)
	    	     	 (is (lz i) #\-)))) 
    	(if (is i 0) (++ i) (do (++ i) (++ j))))
    	(toint (if (pos #\i lz) (rem #\i (nthcdr i lz)) 0))))

-----

1 point by wgac 5961 days ago | link

Thanks for the feedback, conanite :) I think I know how to cope with that problem. I'll post my results as soon as I have some spare time. I'm also planning to successively add more elaborate mathematical functions. Maybe some numerical integration or solving differential equations.

-----


So we'll have arc distros like we have linux distros today?

It might even work :))

btw it's impressive how simple the patch is ... a dozen lines, wow.

-----

4 points by CatDancer 5967 days ago | link

btw it's impressive how simple the patch is ... a dozen lines, wow

Yes, I'm coming to realize that a corollary to pg's hypothesis that succinctness is power is that succinct software is simple to extend! :-)

-----

More