Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First simple function

  • Loading branch information...
commit 5b8e7771e07275dd9ef5795939e679809b3567b0 1 parent 27db1ef
@larrytheliquid authored
View
2  .gitignore
@@ -1,3 +1,5 @@
bin/*
vendor/gems/*
!vendor/gems/cache/
+*.hi
+*.o
View
5 Perceptron.hs
@@ -0,0 +1,5 @@
+module Perceptron where
+
+actualOutputDerivative :: Double -> Double
+actualOutputDerivative n = n * (1-) n
+
View
3  Rakefile
@@ -1,6 +1,7 @@
require "spec/rake/spectask"
+task :default => :spec
Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = FileList["*_spec.rb"]
- t.spec_opts = ["-c"]
+ t.spec_opts = ["-cfs"]
end
View
5 neurosis.rb
@@ -1,2 +1,7 @@
+require 'hubris'
+
module Neurosis
+ class Perceptron
+ hubris :source => 'Perceptron.hs'
+ end
end
View
14 neurosis_spec.rb
@@ -1,7 +1,15 @@
require File.dirname(__FILE__) + "/neurosis"
-describe "A simple test" do
- it "works" do
- true.should be_true
+Spec::Runner.configure do |config|
+ system "rm /var/hubris/cache/Perceptron.so"
+
+ def perceptron
+ Neurosis::Perceptron.new
+ end
+end
+
+describe "actualOutputDerivative given the actual-output" do
+ it "returns its derivative" do
+ perceptron.actualOutputDerivative(0.5250).should be_close(0.2494, 0.0001)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.