Arc Forumnew | comments | leaders | submitlogin
This would make my programs shorter.
10 points by maxharris 5830 days ago | 8 comments
According to Perry Metzger:

"1) It is too difficult to use real data structures in Lisp.

2) Deeply nested data structures create verbose programs.

3) Lists get used instead because they are “easy”.

Solution: make other data structures easy, too.

* Otter adds new “quote”-like reader-expanded syntactic sugar.

* New syntax:

* foo[bar] a.k.a. (aref foo bar)

* foo.bar a.k.a. (sref foo ’bar)

* New syntax expands into Cambridge Polish (just like quote).

* sref, aref are generic functions.

* No need for struct accessors, so the syntax wars vanish.

* (+ point.x 0.5) is better anyway."

Slides 13-15 on ftp://lispnyc.org/meeting-assets/2007-08-14_otter/presentation.pdf



3 points by conanite 5830 days ago | link

"Paul Graham is doing Arc. Why can’t I have fun too?" (p.4)

oh-oh, the floodgates are open. One day, there will be as many lisps as there are lisp programmers. Which is not necessarily a bad thing. It might even be inevitable.

-----

1 point by maxharris 5830 days ago | link

This is off-topic.

(And Otter doesn't seem to be going anywhere - no website, no new information for about a year and a half.)

What do you think about the content posted at the top of this page?

-----

4 points by conanite 5830 days ago | link

I don't get the difference between foo[bar] and foo.bar ... why not use only one? Doesn't the context determine whether you're setting or retrieving a value?

  (= foo[bar] "value")
vs

  (prn foo[bar])
At least, arc makes no distinction:

  (= foo (table))
  (= foo!bar 123)
  (prn foo!bar)
does what you would expect. But it's true that arc syntax for accessing nested tables

  foo!bar
is awkward, in particular because it can't be chained. There's no syntax for

  ((foo 'bar) 'toto)
because

  foo!bar!toto
expands to

  (foo 'bar 'toto)
and that throws an error. I may well be missing some tricks, but deeply nested structures appear to be difficult to use in Arc, and it would be great to fix this. It would be great to write something like

  foo[bar][toto]
And arc's exclamation marks suck as syntax: they make the code look way too urgent and excited.

-----

6 points by skenney26 5830 days ago | link

I agree that the exclamation marks aren't that useful.

Here's a macro that might be useful for digging down into a nested table:

  (mac dig args
   `(,@(reduce list args)))

  arc> (= x (table))
  #hash()
  arc> (= (x 'y) (table))
  #hash()
  arc> (= ((x 'y) 'z) 0)
  0
  arc> x
  #hash((y . #hash((z . 0))))
  arc> (dig x 'y 'z)
  0
  arc> (= (dig x 'y 'z) 1)
  1
  arc> x
  #hash((y . #hash((z . 1))))

-----

3 points by Darmani 5830 days ago | link

Luckily, Lisp makes this a library-level problem. PG has already made a huge step in the right direction by renaming 'make-hash-table to 'table.

-----

8 points by skenney26 5830 days ago | link

Why not just 'hash? Using 'hash would also help to distinguish hash-tables from html-tables in html.arc

-----

4 points by cchooper 5829 days ago | link

This bugs me too. Perhaps the rationale is that a hash table is not the same thing as a hash (key).

-----

1 point by arnoooooo 5828 days ago | link

I never liked the array and hash accessors in CL, so I use a reader macro to access hash/sequence elements, and call functions stored in value slots :

   {sequence 1} -> (elt array 1)
   {sequence 1 2} -> (subseq sequence 1 2)
   {hash 'test} -> (gethash 'test hash)
   {function 2} -> (funcall function 2)
I can also do

  (setf {sequence 1} 2).

-----