Arc Forumnew | comments | leaders | submit | pg's commentslogin
2 points by pg 5827 days ago | link | parent | on: Questions from a newcomer

Having separate meaning, determined by context, means that you don't have to use as many distinct identifiers in your program.

That would make your code very confusing. Even in Lisp 2s, programmers avoid using the same names for functions and ordinary variables.

Arc3 is getting stable enough that you can probably start with that. Most basic stuff (e.g. everything in the tutorial) should be the same anyway.

-----

7 points by zbeane 5826 days ago | link

> Even in Lisp 2s, programmers avoid using the same names for functions and ordinary variables.

No, they don't.

-----

1 point by Adlai 5825 days ago | link

I'm a big fan of using identifiers such as 'list, 'string, 'fn (isn't a problem in CL, but is one in Arc), 'array, 'char, etc. Often a general name is the most concise and appropriate name to use.

I think that since Arc is supposed to be designed towards flexibility and usability for the programmer, it should have few restrictions, and a common namespace is such a restriction.

However, my opinion on this could change as I explore Arc over the next few weeks.

-----

4 points by pg 5827 days ago | link | parent | on: Arc3: mysterious (fn args ...) behaviour

Thanks, this was a bug. Rtm has fixed it and his fix is now in the current version (http://ycombinator.com/arc/arc3.tar).

-----

3 points by conanite 5827 days ago | link

oops ...

  arc> (coerce "foo" 'num)
  #f
I think this should be

  arc> (coerce "foo" 'num)
  Error: "Can't coerce \"foo\" num"
The fix for http://arclanguage.org/item?id=9450 in ac.scm seems to be missing the guard clause for the case where the string is not parsable as a 'num

  ((string? x)    (case type
                  ((sym)    (string->symbol x))
                  ((cons)   (ac-niltree (string->list x)))
;; -> num needs to be checked same way as 'int in the subsequent clause

                  ((num)    (apply string->number x args)) 

                  ((int)    (let ((n (apply string->number x args)))
                              (if n 
                                  (iround n)
                                  (err "Can't coerce" x type))))
                  (else     (err "Can't coerce" x type))))

-----

3 points by pg 5827 days ago | link

Yes, you're right. It's now fixed in arc3.tar.

-----

2 points by pg 5828 days ago | link | parent | on: Table defaults

I thought about specifying the default when the table was created, but it seemed more flexible to do it at lookup, because you could choose a value for the default (e.g. a newly created object) that would let you distinguish between having no entry for some key and having an entry whose value was the default.

-----

3 points by Adlai 5828 days ago | link

What if a default specified at lookup overrode the default specified when the table was created?

My Arc knowledge is essentially #f at the moment, but this

  ((hash-table? fn)
   (ar-nill (or (hash-table-get fn (car args) #f)
                (hash-table-get fn hash-table-default #f))))
seems to be the code for looking up a key using the (some-table key) syntax (i.e. putting the table as the "function" in a form). Would it work to have an optional parameter, so that somebody could call (some-table key default) if they wanted to override the default? I'm thinking that this optional parameter would default to #f if unspecified, and would be passed to the first hash-table-get in the above code. This seems to enable overriding of a pre-specified default.

-----

1 point by skenney26 5828 days ago | link

I like your idea of having a default that can be overridden.

The code above is actually Scheme (which Arc is implemented in). Getting and setting table values in Arc is much less clunky.

-----

1 point by Adlai 5828 days ago | link

Yeah, I can tell it's Scheme because of #f used for false, instead of NIL.

If it's possible to pass an optional parameter to an Arc-style hash-table lookup (one where you use the table name as the function), than that would also allow overriding a default to NIL, because the 'or in that Scheme code would return NIL rather than evaluating the hash-table-get for the original default.

-----


Unfortunately it's mixed together with a lot of other yc-specific code. If a lot of people want this, though, I could go through and separate it.

-----

3 points by pg 5828 days ago | link | parent | on: Ask PG: gui lib in next release?

Do you mean when I was asking about image manipulation? If so, yes, I want to add some libs for that soon.

-----

2 points by pg 5829 days ago | link | parent | on: New arc: (coerce "1.234" 'int) doesn't

I added a clause so (coerce "1.234" 'num) works. Thanks.

-----

1 point by conanite 5829 days ago | link

Cool, thanks. My test scripts were unhappy.

-----

3 points by pg 5829 days ago | link | parent | on: Arc Logo

A logo doesn't have to look the same at every size, just fairly good at every size. Nor do the references have to be obvious; e.g. the arrow in the Fedex logo.

-----

2 points by pg 5829 days ago | link | parent | on: Arc Logo

If anyone misses the old color, it was 99aadd.

-----

6 points by pg 5829 days ago | link | parent | on: Arc Logo

The red and blue bits together make a lowercase a. The white rectangle is supposed to represent a keystone.

-----

3 points by pmarin 5829 days ago | link

I see the lowercase a. The blue and black colors are too similar in my screen, I had to use the ancient xmag program to zoom the logo ;)

Anyway, I like the logo.

http://i39.tinypic.com/os8g8x.png

-----

3 points by pg 5829 days ago | link

You could have just clicked on the link: http://ycombinator.com/arc/arclogo.html

-----

5 points by olifante 5829 days ago | link

terrible logo, way too clever. Even after reading your explanation I didn't immediately get it. At the very least try a different colorscheme.

-----

5 points by gvb 5829 days ago | link

Ditto on not "getting" it. :-(

My first thought was "5 1/4 floppy icon."

-----

2 points by tc-rucho 5829 days ago | link

Lol, that's what it looked like to me at first sight too.

-----

1 point by w8lvn 5829 days ago | link

I do see the keystone, but the lowercase a is escaping me. It does stand out nicely as a favicon, however.

-----

1 point by bitdiddle 5829 days ago | link

ok, I see it now. Too square, perhaps if you rounded the a a little it would be more obvious.

-----

1 point by carmapple 5829 days ago | link

Supposed to is about as far as it goes.

Don't you have a friend who does design work? This isn't any good, not even as a starting place.

-----

6 points by pg 5829 days ago | link

Would you like it better if I told you I went to art school?

-----

1 point by verec 5802 days ago | link

And how many classes did you skip? :-)

-----

1 point by mitchellh 5829 days ago | link

I'm sorry... I just don't see it. =[

-----

3 points by pg 5830 days ago | link | parent | on: New Version of Arc

Oops, yes, that's correct.

-----

More