Ran across this just now and found the comment by Pavol more interesting than curried functions. Yes Pavol! Totally. This is going to be a recurring problem for a lot of imperative programmers beginning to enter the world of functional programming through Swift. ‘Functional first’ is something I have to continually remind myself of. The original (imperative) gist went something like this:
Pavol advocates a more functional approach, without the “minutiae” of loops and temp vars:
Can we continue that train of functional thought? What if we move the separator up the chain, eliminating the function call:
That was an interim step to see if it worked. Now lets wrap it up and bring back that append function, allowing us to pass any separator:
Lastly, to make it even more compact, we can remove some syntax noise in the call to reduce:
I installed CouchDB 1.0.1 with MacPorts 1.9.1 and quickly ran into problems:
The ‘attachments’ test hung in Chrome 6.0.472.55. I ran the same test in Firefox 3.6.9 and it worked.
The ‘reader_acl’ failed with an exception.
I couldn’t create an admin.
The couchdb.log certainly had errors but I couldn’t find a solution online. I tried uninstalling the port and reinstalling with no luck. Eventually I gave up and downloaded CouchDBX. Creating an admin worked but it also had problems running the Test Suite (I had to Force Quit).
Then I tried Homebrew. After installation I ran the Test Suite with 100% success and was able to create an admin! Awesome, now I’ll just add org.apache.couchdb to launchctrl…hmm it’s not under /Library/LaunchDaemons or /opt/local/Library/LaunchDaemons. After a little digging I eventually found it under /usr/local/Cellar/couchdb/1.0.1/Library/LaunchDaemons/. Only a few steps remain:
Copy org.apache.couchdb.plist into /Library/LaunchDaemons
Change the value under the UserName key to your user short name (hint: look under /Users)
sudo launchctl start org.apache.couchdb or you can test it for sure by restarting (shortcut key: Control-Command-Eject)
If you look inside the as3-signals dir, there is a build.xml file which requires a FLEX_HOME variable to be set. So, I downloaded the Flex 4 SDK and dropped it under /Developer/SDKs/flex_sdk_4. In the terminal, we need to set the env variable FLEX_HOME. First, lets check if you have an existing one defined. In the shell, type
You should see a list of defined variables. If you need to remove an existing FLEX_HOME, you can do so by typing
export -n FLEX_HOME
Otherwise, you can add a new FLEX_HOME by typing:
If you type env again FLEX_HOME is now added to the list. Now we can build as3-signals.
Ant looks for a build.xml by default. Upon a successful build you’ll find a .swc in the bin folder.
Note: Setting FLEX_HOME this way will only last for 1 terminal session. If you’d like a more permanent solution, see: http://mactip.blogspot.com/2004/04/setting-environment-variables.html