Arc Forumnew | comments | leaders | submit | smallpaul's commentslogin
1 point by smallpaul 6168 days ago | link | parent | on: Clarification about Character Sets

Why would you extend rather than subclass the Array class? It kind of confirms all of my worst fears about Ruby's too-easy class reopening. (what happens when someone else defines an Array method called "categorize" for a totally unrelated purposes?)

I think that the Python syntax for this is

h[x] = h.get(x, 0) + 1

It isn't quite as concise as the Common Lisp but more so than Arc. I'd be curious to see what the Common Lisp looks like if you are doing something more complicated than an in-place increment. E.g. the equivalent of:

h[x] = h.get(x, 1) * 2

-----

2 points by bOR_ 6165 days ago | link

I'm a phd, working alone on projects, and the scripts I write a generally < 300 lines + 6 functions from a library I wrote. The agent-based models i write are ~ 200 lines, no libraries.

For me there's not much risk in redefining things.

-----

1 point by jsg 6168 days ago | link

(setf (gethash x h) (* (gethash x h 1) 2))

-----