Few days ago Mike Anderson wrote [a proposal][mike] for a generic matrix API in Clojure which could compete with NumPy. I wanted to write a similar post for months, but was reluctant to start. This problem is very dear to me. Basically, it is a matter if I can use Clojure for most of my work, or it remains a toy language for me. Thanks to Mike for bringing the question up. Though, I have a different vision of how we should approach arrays and matrices in Clojure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A simple example of user demographic dataset generation in scala. | |
* | |
* This highlights the following scala bits: | |
* - Java integration | |
* - Annotations | |
* - Tail recursion optimization | |
* - Enums | |
* - Vals vs. vars | |
* - Working with singleton objects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://github.com/jessitron/BlogCode/blob/master/optionAsFlow.scala | |
object transformers { | |
def openFile(n: String) : Option[java.io.File] = { | |
val f = new java.io.File(n) // catch IOException | |
if (f.exists) | |
Some(f) | |
else | |
None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example; | |
import java.util.Properties; | |
import cascading.flow.Flow; | |
import cascading.flow.FlowDef; | |
import cascading.flow.hadoop.HadoopFlowConnector; | |
import cascading.pipe.CoGroup; | |
import cascading.pipe.Pipe; | |
import cascading.pipe.assembly.CountBy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note: When I started, JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home | |
$ git clone https://github.com/nathanmarz/jzmq.git | |
Cloning into jzmq... | |
remote: Counting objects: 611, done. | |
remote: Compressing objects: 100% (204/204), done. | |
remote: Total 611 (delta 317), reused 570 (delta 292) | |
Receiving objects: 100% (611/611), 304.06 KiB | 298 KiB/s, done. | |
Resolving deltas: 100% (317/317), done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'pp' | |
require 'redis' | |
require 'json' | |
configure do | |
redis = JSON.parse(ENV['VMC_SERVICES']).select {|srvc| srvc['name'] =~ /redis-.*?/ }.first['options'] | |
redis_conf = {:host => redis['hostname'], :port => redis['port'], :password => redis['password']} | |
@@redis = Redis.new redis_conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails::Initializer.run do |config| | |
#....... | |
config.middleware.use 'ResqueWeb' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# these gems won't be loaded by our Rakefile with WORKER_ENVIRONMENT enabled | |
gem 'rails', '3.0.3' | |
gem 'haml', '3.1.0.alpha.147' | |
# ... | |
# load these both for the app and the workers | |
group :default, :worker do | |
gem 'mongo', '1.1.5' | |
gem 'bson', '1.1.5' | |
gem 'bson_ext', '1.1.5' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/bash | |
set_term_bgcolor(){ | |
local R=$1 | |
local G=$2 | |
local B=$3 | |
/usr/bin/osascript <<EOF | |
tell application "iTerm" | |
tell the current terminal | |
tell the current session |