Arc Forumnew | comments | leaders | submit | conanite's commentslogin
3 points by conanite 5945 days ago | link | parent | on: Arc3: mysterious (fn args ...) behaviour

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 5945 days ago | link

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

-----

1 point by conanite 5946 days ago | link | parent | on: Step Three of Installing Arc

Is ./mzscheme a symbolic link pointing to a missing file? Or is ./mzscheme a shell script with an invalid interpreter line? (the first line, beginning with #! )

-----

1 point by CatDancer 5946 days ago | link

yeah, you might try typing "file mzscheme" and see what it says.

-----

1 point by noodle 5946 days ago | link

no, its an ELF.

-----

1 point by conanite 5947 days ago | link | parent | on: How about (each (k v) table ...)

"me too!!!"

I totally have to remind myself every time that it's "ontable" for tables, not "each"

The (each (k v) h ...) syntax feels like a natural destructuring way to iterate over a table. And the cost of an extra pair of parens is more than offset by having an each that behaves the way you'd expect it to.

-----

3 points by rntz 5947 days ago | link

Thirded. I'd very much like to see this get into arc3's final release. This makes iterating over a given table just like iterating over the corresponding association list.

It's a single-line patch:

    diff --git a/arc.arc b/arc.arc
    index a2a6a8d..ac5ea3e 100644
    --- a/arc.arc
    +++ b/arc.arc
    @@ -467,7 +467,7 @@
                      (self (cdr ,g))))
                  ,gseq)
                (isa ,gseq 'table)
    -            (maptable (fn (,g ,var) ,@body)
    +            (maptable (fn ,var ,@body)
                           ,gseq)
                 (for ,g 0 (- (len ,gseq) 1)
                   (let ,var (,gseq ,g) ,@body))))))

-----

1 point by CatDancer 5945 days ago | link

This makes iterating over a given table just like iterating over the corresponding association list

That's a cool point!

If calling a list wasn't already doing a lookup by position, I might like a call on a cons to do an alref so that I could use x!foo to do a lookup by 'foo whether x was a table or an assoc list.

-----

2 points by CatDancer 5947 days ago | link

It's a single-line patch if no other code in Arc/News uses each with tables...

-----

7 points by conanite 5947 days ago | link | parent | on: Arc Logo

It's easily recognisable even when small which is important for a logo and a favicon. I like the colours. And clearly it shows an amazing degree of artistic talent, the sort that could only be acquired in art school :)

Allow me nonetheless second some other commenters who observed

- the #\a concept is not obvious

- the keystone would normally be part of the arch, not under it

- the blue and black are difficult to distinguish in the small version

- while you explain the #\a and the keystone, the red/blue business is mysterious, and perhaps a tad decadent - art for art's sake and all that.

At a glance, it looks like the white bit has risen up out of the red bit (if you'll forgive the technical language here), and the blue bit is just background.

A slight improvement might be to make the horizontal edges of the #\a (top and bottom) a little thicker, to enhance the a-ity (although I can see that that might diminish the arch-ness). Another might be to use a brighter blue.

Are you planning to stick with this or are you inviting suggestions (not that the absence of an invitation has stopped me or anyone else) ?

-----

1 point by conanite 5947 days ago | link | parent | on: Arc Logo

you can configure a different banner colour on your user-settings page

-----

2 points by pg 5947 days ago | link

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

-----

1 point by rntz 5947 days ago | link

This works for most pages, but even after changing back to the old color the color of the banner on the reply page is still orange.

-----

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

in arc 2,

  arc> (coerce "1.234" 'int)
  1.234
arguably, this is incorrect, because 1.234 obviously isn't an integer, so arc3 improves on this by rounding. But (coerce "1.234" 'num) isn't available (in arc 2 or 3), so there's no way to use coerce for non-integers.

-----

2 points by pg 5947 days ago | link

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

-----

1 point by conanite 5947 days ago | link

Cool, thanks. My test scripts were unhappy.

-----

2 points by conanite 5948 days ago | link | parent | on: Arc Logo

it's asking for "Guest or Admin password" - I tried "guest" but that didn't work ...

and here's a suggestion (and a shameless plug for iconfu)

http://iconfu.com/tags/list/0.html?browse=arc-logo

(implementation of miked's earlier idea)

-----

1 point by jcsalterego 5948 days ago | link

Thanks for pointing that out, I've failed us all. (Link works now)

-----

1 point by conanite 5948 days ago | link | parent | on: Size of a list or table

If there's a way to restrict the memory used by the mzscheme process, you could set an upper limit, and then

  (with (things nil n 0)
    (while t
      (prn (++ n))
      (push (new-thing) things))) ; not tested!
and wait for it to die. You won't have the memory size in bytes of each thing, but at least you know how many fit in your process, and that might be the more important number depending on your purpose.

-----

1 point by conanite 5952 days ago | link | parent | on: Arc presentation

"warning: future releases of arc are likely to break all of your existing presentations"

I'll find another example so.

assuming print is some function you defined yourself, and you don't mean pr.

is this because only only takes 1-arg functions? Something like

  (def only (f)
    (fn (arg)
      (if arg (f arg))))

?

-----


Are you prematurely worrying about conflicting names ? :))

I admit I'm a bit confused about the bridging-code issue. I think if there was a bit of scheme functionality I wanted permanently available in my arc, I would add the relevant xdef in ac.scm. 'mz as it stands is fine for once-off or exploratory hacks, and as it's not there unless you've installed the patch, the name conflict isn't such an issue really.

I wonder is anyone preparing an app for mediocre zoos, motorcycle zen, or the Mark of Zorro?

-----

1 point by CatDancer 5953 days ago | link

Are you prematurely worrying about conflicting names ? :))

touché, mayhap I am

add the relevant xdef in ac.scm

Sure, that works. I prefer to program in Arc though.

as it's not there unless you've installed the patch, the name conflict isn't such an issue really

Oh, but I'm writing more code like my "lib" library which uses mz, so if you want to use my libraries, the name conflict issue will come up, if it is an issue.

Maybe I'll decide that I like "ac-passthru", not because I'm worried about possible future naming conflicts (which, as you point out, I've previously claimed should be dealt with in a different way), but because I think it's a better name for what it does.

An "mz" for once-off or exploratory hacks could after all be implemented in different ways, using ac-passthru or Scheme eval or connecting to a remote Scheme process, so I might be more comfortable not assuming that if I want to hack with a bit of Scheme code that passing through the Arc compiler is necessarily the way I want to do it.

-----

More