Search in sources :

Example 1 with Var

use of clojure.lang.Var in project enclojure by EricThorsen.

the class ReplPanel method createReplEditorPane.

public void createReplEditorPane() {
    try {
        Var createReplEditorPaneFn = RT.var("org.enclojure.ide.repl.repl-panel", "create-repl-editor-pane");
        _replEditorPane = (JEditorPane) createReplEditorPaneFn.invoke(this);
    } catch (Exception ex) {
        Logger.getLogger(ReplPanel.class.getName()).log(Level.SEVERE, null, ex);
    }
    //??_replEditorPane.setInheritsPopupMenu(true);
    jScrollPaneRepl.setViewportView(_replEditorPane);
    _replEditorPane.getDocument().addUndoableEditListener(new UndoableEditListener() {

        public void undoableEditHappened(UndoableEditEvent e) {
            _undoManager.addEdit(e.getEdit());
        }
    });
    _replEditorPane.addKeyListener(new java.awt.event.KeyAdapter() {

        public void keyTyped(java.awt.event.KeyEvent evt) {
            processCharInput(evt);
        }

        public void keyPressed(java.awt.event.KeyEvent evt) {
            processKeyInput(evt);
        }
    });
}
Also used : UndoableEditListener(javax.swing.event.UndoableEditListener) Var(clojure.lang.Var) UndoableEditEvent(javax.swing.event.UndoableEditEvent) KeyEvent(java.awt.event.KeyEvent) BadLocationException(javax.swing.text.BadLocationException)

Example 2 with Var

use of clojure.lang.Var in project enumerable by hraberg.

the class ClojureTest method defnLambda.

@Test
public void defnLambda() throws Exception {
    Var square = defn("square", fn(n, n * n));
    assertEquals(4, square.invoke(2));
    Var found = var(CURRENT_NS.get().toString(), "square");
    assertSame(square, found);
    ISeq squares = (map(square, list(2, 4)));
    assertEquals(list(4, 16), squares);
}
Also used : ISeq(clojure.lang.ISeq) Var(clojure.lang.Var) GroovyTest(org.enumerable.lambda.support.groovy.GroovyTest) ScalaTest(org.enumerable.lambda.support.scala.ScalaTest) JRubyTest(org.enumerable.lambda.support.jruby.JRubyTest) Test(org.junit.Test) JavaScriptTest(org.enumerable.lambda.support.javascript.JavaScriptTest)

Aggregations

Var (clojure.lang.Var)2 ISeq (clojure.lang.ISeq)1 KeyEvent (java.awt.event.KeyEvent)1 UndoableEditEvent (javax.swing.event.UndoableEditEvent)1 UndoableEditListener (javax.swing.event.UndoableEditListener)1 BadLocationException (javax.swing.text.BadLocationException)1 GroovyTest (org.enumerable.lambda.support.groovy.GroovyTest)1 JavaScriptTest (org.enumerable.lambda.support.javascript.JavaScriptTest)1 JRubyTest (org.enumerable.lambda.support.jruby.JRubyTest)1 ScalaTest (org.enumerable.lambda.support.scala.ScalaTest)1 Test (org.junit.Test)1