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
(defn build-id3-tree | |
"Builds an ID3 Decision tree to find target-attr based on the examples" | |
[examples target-attr attributes] | |
(cond | |
(same? target-attr examples) { :label (target-attr (first examples)) } | |
(empty? attributes) { :label (most-common target-attr examples) } | |
:else (let [attr (max-val #(information-gain % examples) attributes) | |
groups (group-by attr examples) | |
child-agent (agent {})] | |
(loop [[value subset] (first groups) |
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
class Closure | |
attr_reader :formals, :bodies, :env | |
def initialize(formals, bodies, env) | |
@formals = Array(formals) | |
@bodies = Array(bodies) | |
@env = env | |
end | |
def call(*args) | |
raise argument_error(args) if args.length != formals.length |
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
$ ri Faraday::Middleware | |
/Users/isaac/.rvm/gems/ruby-2.0.0-p195@chicago_ideas/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:196:in `load': instance of RDoc::Context::Section needs to have method `marshal_load' (TypeError) | |
from /Users/isaac/.rvm/gems/ruby-2.0.0-p195@chicago_ideas/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:196:in `block in load_class' | |
from /Users/isaac/.rvm/gems/ruby-2.0.0-p195@chicago_ideas/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:195:in `open' | |
from /Users/isaac/.rvm/gems/ruby-2.0.0-p195@chicago_ideas/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:195:in `load_class' | |
from /Users/isaac/.rvm/gems/ruby-2.0.0-p195@chicago_ideas/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:609:in `block in classes_and_includes_for' | |
from /Users/isaac/.rvm/gems/ruby-2.0.0-p195@chicago_ideas/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:607:in `map' | |
from /Users/isaac/.rvm/gems/ruby-2.0.0-p195@chicago_ideas/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:607:in `classes_and_includes_for' | |
from /Users/isaac/.rvm/gems/ruby-2.0.0-p195@chicago_ideas/gems/rdoc-3. |
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
define_method :foo do |bar, &block| | |
block.call(bar) | |
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
namespace "Foo::Bar" do | |
# Define methods in here. | |
# `namespace` defines modules all the way down, | |
# or classes if the constant is already defined. | |
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
adminDashboard :: User -> Page | |
adminDashboard Admin user = dashboardPage | |
adminDashboard _ = unauthorizedPage | |
homePage :: User -> Page | |
homePage Admin user = adminHomePage | |
homePage Member user = memberHomePage | |
homePage _ = signInPage |
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
$ ruby | |
Could not find i18n-0.6.1 in any of the sources | |
Run `bundle install` to install missing gems. |
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
=== OpenSSL for Ruby configurator === | |
=== Checking for system dependent stuff... === | |
have_library: checking for t_open() in -lnsl... -------------------- no | |
"/usr/local/bin/gcc-4.2 -o conftest -I../../.ext/include/x86_64-darwin12.2.0 -I../.././include -I../.././ext/openssl -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/opt/local/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -I/usr/local/opt/curl-ca-bundle/include -I/usr/local/opt/sqlite/include -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -pipe conftest.c -L. -L../.. -L/opt/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/op |
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
%W{ X - O | |
- X - | |
O - X } |
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
public static int search(Integer[] arriArrayToBeSearched, Integer iItemToBeFoundInArray){ | |
int iIndexOfItemToBeFoundInArrayInArrayToBeSearched = -1; | |
int iLengthOfArrayToBeSearched = 0; | |
int iTemporaryVariable = arriArrayToBeSearched.length; | |
while (iTemporaryVariable > 0) { | |
iLengthOfArrayToBeSearched += 1; | |
iTemporaryVariable -= 1; | |
} | |
for (int indexInArrayToBeSearched = 0; indexInArrayToBeSearched < iLengthOfArrayToBeSearched; indexInArrayToBeSearched += 1) { | |
Integer iMemberOfArrayToBeSearchedAtCurrentIndex = arriArrayToBeSearched[indexInArrayToBeSearched]; |