Should have a Leiningen Clojure project in workspace.
Go up one directory
cd ..
then go to bin directory since this is already in the $PATH
cd bin
defmodule CashRegister do | |
def new do | |
Agent.start_link(fn -> 0 end) | |
end | |
def add(pid, amount) do | |
Agent.update(pid, fn(register) -> register + amount end) | |
end | |
def reset(pid) do |
ExUnit.start | |
defmodule Grader do | |
def grade(grade) do | |
cond do | |
grade <= 5.0 and grade > 4.0 -> "A" | |
grade <= 4.0 and grade > 3.0 -> "B" | |
grade <= 3.0 and grade > 2.0 -> "C" | |
grade <= 2.0 and grade > 0 -> "D" | |
grade == 0 -> "F" |
Should have a Leiningen Clojure project in workspace.
Go up one directory
cd ..
then go to bin directory since this is already in the $PATH
cd bin
$VERBOSE = nil | |
require File.expand_path('../rooby', __FILE__) | |
Person = Rooby::Class.new 'Person' do | |
define :initialize do |name| | |
@name = name | |
end | |
define :name do |
require 'digest/sha2' | |
require 'base64' | |
class HashClod < Hash | |
def [](key) | |
r = super(key) | |
puts r | |
if r == nil | |
puts "set cache" | |
else |