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
; nREPL 0.1.7-preview | |
user> (use 'seesaw.core) | |
nil | |
user> (def myframe (frame :title "Hello" :on-close :exit)) | |
#'user/myframe | |
user> (import com.mxgraph.view.mxGraph) | |
com.mxgraph.view.mxGraph | |
user> (def mygraph (mxGraph.)) | |
#'user/mygraph | |
user> (defn display [content] |
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 REPL-based, annotated Seesaw tutorial | |
; Please visit https://github.com/daveray/seesaw for more info | |
; | |
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers | |
; Seesaw's basic features and philosophy, but only scratches the surface | |
; of what's available. It only assumes knowledge of Clojure. No Swing or | |
; Java experience is needed. | |
; | |
; This material was first presented in a talk at @CraftsmanGuild in | |
; Ann Arbor, MI. |
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
trait ReflectionSugars{ | |
import scala.reflect.runtime.{universe => ru} | |
private lazy val universeMirror = ru.runtimeMirror(getClass.getClassLoader) | |
def companionOf[T](implicit tt: ru.TypeTag[T]) = { | |
val companionMirror = universeMirror.reflectModule(ru.typeOf[T].typeSymbol.companionSymbol.asModule) | |
companionMirror.instance | |
} | |
} |
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
object x { | |
// stream a sql query | |
def sql( str:String ):Stream[ResultSet] = withStatement { s => | |
val rs = s executeQuery str | |
new Iterator[ResultSet] { def hasNext = rs.next ; def next = rs }.toStream | |
} | |
// loan a sql statement |
NewerOlder