This file contains 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
(defrecord Car [year make model]) |
This file contains 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 interface demo.api.Store{ | |
public abstract demo.api.Store buy(); | |
public abstract demo.api.Store buy(int); | |
public abstract demo.api.Store sell(); | |
public abstract int getQty(); | |
} |
This file contains 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 interface demo.impl.boat.Boat{ | |
public abstract java.lang.Object go(java.lang.Object); | |
} |
This file contains 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
(gen-interface | |
:name demo.api.SpeedBoat | |
:methods [[zoom [int] int] | |
[fuelLeft [] int]]) | |
(deftype BoatImpl [state] | |
demo.api.SpeedBoat | |
(zoom [this distance] | |
(dosync | |
(alter state - (* 10 distance))) |
This file contains 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
import demo.api.Store; | |
import demo.api.StoreFactory; | |
public class Main { | |
public static void main(String[] args) { | |
Store s = StoreFactory.makeStore(); | |
System.out.println("qty = " + s.getQty()); | |
s.buy().buy().buy().sell().buy(); | |
System.out.println("qty = " + s.getQty()); |
This file contains 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
(ns demo.impl.store) | |
(gen-interface | |
:name demo.api.Store | |
:methods [[buy [] demo.api.Store] | |
[buy [int] demo.api.Store] | |
[sell [] demo.api.Store] | |
[getQty [] int]]) | |
(gen-class |
This file contains 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
(ns clojure.examples.instance | |
(:gen-class | |
:implements [java.util.Iterator] | |
:init init | |
:constructors {[String] []} | |
:state state)) |
This file contains 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
(defprotocol Boat | |
(go [boat ^int distance])) | |
(deftype BoatImpl [state] | |
Boat | |
(go [this distance] | |
(dosync | |
(alter state - distance)))) |
NewerOlder