Defining a function is really just a pattern is matched based on arguments, and is replaced with an expression with the arguments substituted into it. And you can set a constant key argument to a value of a constant value — creating the odd built in hash-table-alike which has been around forever.
That said, Association[] looks nice. Presumably it gets a speed improvement by bypassing the pattern matching. And I remember being annoyed by using JSON data in Mathematica structures, this looks nicer. The literal syntax is appreciated too. Actually I'm kind of surprised they didn't choose another weird unicode symbol like 〚, for the literal syntax.
Well, unlike adding and changing definitions for symbols in the symbol table, associations are actually immutable. So you can pass them around as values, mutate them, and the old versions are still available unchanged. That's just not true of using downvalues of symbols.
Also, using definitions on symbols to store key-values is incredibly limiting, because you can't do reverse lookups without getting into very low level (and slow) hackery via DownValues. Or list the keys or values. Or even know how many keys you have.
Associations really will replace basically all uses of symbol downvalues for storing key-value pairs. And Associations have really nice general-purpose functions like GroupBy, Counts, Merge, and so on (mentioned below).
Associations even support function application syntax, so you should be able to drop them in into existing code that expects symbol downvalues as you're using them above.
Associations are the single most significant language-level improvement we've had in many versions. And we've integrated them really nicely across the system -- they're not just some special-purpose data structure.
Yeah, using definitions on symbols to store key-values is indeed incredibly limiting.
Association seems very similar to List: immutable, really good Part syntax for accessing things in deeper levels, etc. I've started to read some of the docs on it too, it looks very nice.
It would be very interesting to implement something like this atop FUSE[0].
For free you get the ability for the player to use any existing command line tool you want. You could easily make strange and artificial directory structures. And you can dynamically change and detect changes in the filesystem.
As someone who has briefly worked with FUSE for my own toy projects, that seems like it would run into a lot of unexpected difficulties. Programs seem to behave very oddly if their assumptions about a file-system are incorrect.
But aren't the unexpected difficulties half the fun?
Yes. I expect many programs would have trouble, but you probably wouldn't have too much trouble making it work for typical non-interactive command line programs.
But the possibility game mechanics like making files appear after moving a file (an item in the game) into the directory (room) are really interesting.
I should have thought of that. Much of the work to build this (which honestly was a few days spread over a month) was building the list management for subdirectories and files...
Looks like you're setting the <iframe>'s contents with a data uri in the src attribute, you save some characters if you use the HTML5 srcdoc attribute:
Nice. Interesting that you're doing it at the userland level and balancing across IP address and not interfaces. I may find a use for this. (On a network rate limited by IP address, not per physical connection or per MAC address, and allows me to use multiple IPs. Go figure.)
I haven't set this up myself, but I think the iptables method for doing this is `nexthop via`. Never found any great documentation, but this seems to describe it: http://lartc.org/howto/lartc.rpdb.multiple-links.html
I think the iptables method balances across interfaces, not IPs. But I want to balance across IP aliases (multiple IPs, same interface). And I'm usually on a Mac. So I may see if dispatch-proxy is a better choice.
If anyone is interested in my particularly strange use case, this seems to work:
$ sudo ifconfig en0 alias 192.168.2.210 255.255.255.0
$ sudo ifconfig en0 alias 192.168.2.211 255.255.255.0
$ sudo ifconfig en0 alias 192.168.2.212 255.255.255.0
$ dispatch start
SOCKS5 server started on localhost:1080
Dispatching to addresses 192.168.2.28@1, 192.168.2.210@1, 192.168.2.211@1, 192.168.2.213@1
Also the link I mentioned is different from what other people have mentioned in this thread. It's not interface bonding or TCP multipath. It is actually similar to dispatch-proxy, it balances TCP connections across interfaces as far as I can tell.
Was just playing around with the YouTube JavaScript API myself, it's really not that complicated. You can do some pretty cool things with it. Looks like you're using the HTML5 YouTube player too, I haven't tried that.
I'm surprised by how rarely people integrate a YouTube player into sites, does anyone have any other good examples?