Arc Forumnew | comments | leaders | submitlogin
Odd errors
3 points by jsgrahamus 3131 days ago | 10 comments
Am I doing something wrong here?

  C:\Users\Steve\Documents\arc3.1>racket -f as.scm
  Use (quit) to quit, (tl) to return here after an interrupt.
  arc> (= columns nil)
  nil
  arc> (= blist nil)
  nil
  arc> (= columns '(1 2 3 4 5 6 7 8))
  (1 2 3 4 5 6 7 8)
  arc> columns
  (1 2 3 4 5 6 7 8)
  arc> blist
  nil
  arc> (= alist (rev columns))
  (8 7 6 5 4 3 2 1)
  arc> alist
  (8 7 6 5 4 3 2 1)
  arc> (= alen (len alist))
  Error: "list-ref: contract violation\n   expected: exact-nonnegative-integer?\n  given:   '(((alen (len alist . nil) . nil) . nil))\n
  argument position: 2nd\n  other arguments...:\n     '(8 7 6 5 4 3 2 1 . nil)"
  arc> alen
  Error: "_alen: undefined;\n cannot reference undefined identifier"
  arc> (quit)


2 points by jsgrahamus 3131 days ago | link

Another odd error:

  C:\Users\Steve\Documents\arc3.1>racket -f as.scm
  Use (quit) to quit, (tl) to return here after an interrupt.
  arc> ;; Get rid of rows-tried entries for column col
  (def remove-column-number-from-rows-tried (column-# rows-tried)
       (with columns-rows -1 list1 (rev rows-tried) list2  '()
             (for i 1 (len rows-tried)
                  (= columns-rows (pop list1))
                  (if (~is (car columns-rows) column-#)
                      (push columns-rows list2)))
             (rev list2)))
  Error: "Can't take cdr of columns-rows"
  arc>

-----

2 points by akkartik 3131 days ago | link

You need parens around the variable bindings in with, otherwise Arc can't tell where bindings end and the body begins.

  (with (columns-rows  -1
         list1  (rev rows-tried)
         list2  '())
    ..)

-----

1 point by jsgrahamus 3131 days ago | link

FWIW, rows-tried is a list of lists.

-----

2 points by jsgrahamus 3131 days ago | link

Thank you.

-----

2 points by zck 3131 days ago | link

Oh, here's what's going on. Alist is already a function (https://arclanguage.github.io/ref/predicates.html#alist). So redefining it makes code using it fail.

If you restart Arc, and rename the variable to something else (e.g., a-list), you won't see this.

-----

1 point by akkartik 3131 days ago | link

Ah, thanks for spotting that so quickly. Arc warns when we replace a function with another. Perhaps it should also do so when we replace a function with anything else?

Edit 28 minutes later: this is now done.

  arc> (= alist t)
  *** redefining alist
  t
https://github.com/arclanguage/anarki/commit/b7d17d8c13

Let me know if y'all run into any problems. Unit tests pass, but we can always add more..

-----

2 points by jsgrahamus 3131 days ago | link

Will anarki run on Windows?

-----

1 point by akkartik 3131 days ago | link

I did see it running momentarily on Windows a few weeks ago: http://arclanguage.org/item?id=19458. It might have a few issues, but if you report them I'll try to fix them.

-----

2 points by jsgrahamus 3131 days ago | link

Thanks, zck!

-----

1 point by zck 3131 days ago | link

No problem! Glad to help.

-----