Arc Forumnew | comments | leaders | submit | aw's commentslogin
4 points by aw 6025 days ago | link | parent | on: Simple genome analysis with Arc

Also see "counts" in arc.arc:

  arc> (counts '(a b c a a a c))
  #hash((a . 4) (c . 2) (b . 1))

-----

3 points by kens 6025 days ago | link

Oh, yeah, I forgot that Arc 3 has default values for table. Someone should write some documentation on this :-)

Thanks for the suggestions; I've updated my blog post.

-----

2 points by aw 6031 days ago | link | parent | on: The power of function combinators

I have used Parsec. One of the most dramatic differences is that Parsec supports backtracking, and so it's a more powerful parser. Since parsing JSON doesn't need backtracking, I got to avoid both the complexity of implementing backtracking and the need to carefully avoid exponential backtracking blowups :D

-----

4 points by aw 6031 days ago | link | parent | on: The power of function combinators

This is an updated and expanded version of my earlier "A parser-combinator approach to parsing JSON" writeup.

-----

3 points by conanite 6031 days ago | link

This is an awesome piece of work - not just the code, but the whole tutorial/guide.

Previously (iirc) you simply used the input stream to keep track of the parse position - now you manage the input as a list of characters. I presume this is to allow backtracking from failed matches, or is there another reason?

My gut reaction to the idea of converting the input to a list was "OMG scaling issues!!!" but I must admit I've never had to deal with a really big json object.

-----

4 points by aw 6031 days ago | link

Thanks!

Actually, all the various versions of my JSON parser have converted the input to a list of characters. I wouldn't be surprised if it did in fact turn to be slow, but I see it as an optimization issue: until I have (or someone else has) a program that's actually slow because of it, then I don't know if it's a useful optimization to work on. For example, if JSON parsing were a thousand times faster if I wasn't using lists, but JSON parsing was only 0.1% of the program's total execution time, then I might not care.

-----


Fixed a bug where loading libraries from the local filesystem wasn't working. (oops)

Version 1 is now available at http://hacks.catdancer.ws/hack

-----

1 point by aw 6040 days ago | link | parent | on: Changing account to "aw"

Thanks!

-----

3 points by aw 6052 days ago | link | parent | on: Changing account to "aw"

what will happen to hacks.catdancer.ws? Do you prefer that people refer to code previously published by CatDancer as "aw's code" now?

I'll be moving the pages on hacks.catdancer.ws to a new site, and I'll have hacks.catdancer.ws redirect to the new site so that old links still work. And yes, all my code can be referred to "aw's" code now.

And, are you really Pure Evil or is that google mixing you up with someone else?

Er, no, never heard of "Pure Evil" before. That's someone else... :-)

-----

1 point by conanite 6052 days ago | link

That's someone else

oh. that's good news.

-----