Re: New release of Light Table (which is now open source!)

2014-01-08 Thread Jamie Brandon
You can disable the bracket insertion by disabling the keys that trigger it. Add this to your user.keymap: :- {:editor.keys.normal {"\"" [(:editor.repeat-pair "\"")] "(" [(:editor.open-pair "(")] ")" [(:editor.close-pair ")")]

Re: Moseley's FRP

2013-12-09 Thread Jamie Brandon
a normalised view over a denormalised database. On 10 December 2013 01:57, Jamie Brandon wrote: > That part that seemed relevant to your question is compile queries on > denormalised views to queries on normalised databases. > > > On 9 December 2013 22:07, Brian Craft w

Re: Moseley's FRP

2013-12-09 Thread Jamie Brandon
to sql queries against a db. It > doesn't, for example, address indexing in-memory data. > > > On Monday, December 9, 2013 11:23:36 AM UTC-8, Jamie Brandon wrote: > >> Take a look at "A practical theory of language-integrated query" at >> http://homepages

Re: Moseley's FRP

2013-12-09 Thread Jamie Brandon
Take a look at "A practical theory of language-integrated query" at http://homepages.inf.ed.ac.uk/wadler/topics/recent.html . In the FPDays talk linked there Wadler demonstrated writing queries which returned denormalised views on tables, composing those with queries on the denormalised view and co

[ANN] strucjure 0.4.0

2013-12-09 Thread Jamie Brandon
Better late than never :) https://github.com/jamii/strucjure Strucjure is a library for describing stuff in an executable manner. It gives you pattern matching (with first-class patterns), validators, parsers, walks and lenses (and eventually generators). The shape of your data is immediately app

Re: Access the datastructure used to create a function?

2013-11-26 Thread Jamie Brandon
> > Thanks > Guru > > > On Tue, Nov 26, 2013 at 6:16 AM, Jamie Brandon > wrote: >> >> > (def f (let [y 1] (fn [x] (+ x y >> >> Let's have a look inside. >> >> > (require '[no.disassemble :refer [disassemble]]) >> >

Re: Access the datastructure used to create a function?

2013-11-26 Thread Jamie Brandon
> (def f (let [y 1] (fn [x] (+ x y Let's have a look inside. > (require '[no.disassemble :refer [disassemble]]) > (println (disassemble f)) // Compiled from /home/jamie/strucjure/src/strucjure.clj (version 1.5 : 49.0, super bit) public final class strucjure$fn__5589$fn__5590 extends clojure.l

Re: print-dup is not defined? Ok, what do you want me to do about that?

2013-09-20 Thread Jamie Brandon
JVM bytecode can't contain data-structures, only code. If you eval something or embed it in macro output the clojure compiler needs to be able to output code that reconstructs an equal object. There are some types that it can't do that for. user=> (def x) #'user/x user=> x # user=> (eval x) # user

Re: Hotspot predictability

2013-09-18 Thread Jamie Brandon
n Tuesday, September 17, 2013 10:00:46 AM UTC-7, Jamie Brandon wrote: >> >> For larger patterns, the staged version is actually significantly faster: >> >> https://gist.github.com/jamii/6597235 >> >> On 17 September 2013 16:29, Jamie Brandon >> wrote: >>

Re: Hotspot predictability

2013-09-17 Thread Jamie Brandon
For larger patterns, the staged version is actually significantly faster: https://gist.github.com/jamii/6597235 On 17 September 2013 16:29, Jamie Brandon wrote: > I ran a little benchmark comparing different implementations of a toy > pattern matching protocol: > > https://gist.gith

Hotspot predictability

2013-09-17 Thread Jamie Brandon
I ran a little benchmark comparing different implementations of a toy pattern matching protocol: https://gist.github.com/jamii/6595850 I'm surprised to find that the staged version is not significantly slower than the compiled version. Now I'm wondering whether this is feasible on a larger scale.

Re: wally: a alternative way to discover functions

2013-09-07 Thread Jamie Brandon
I wonder if you can do something clever with class-loaders to prevent side-effects when testing functions... On 7 September 2013 20:16, Islon Scherer wrote: >> I wonder if it would be possible to improve it using the core.typed >> library and doing some kind of static analysis similar to Haskell'

Re: eval/macros with functions with metadata

2013-08-29 Thread Jamie Brandon
which Hotspot > seems to be able to optimize just fine): > > (let [y 1 f (fn [x] (+ x y))] ((eval `(fn [g#] (g# 1))) f)) > > Happy to elaborate if you like. > > Cheers, > Jason > > [1] http://dev.clojure.org/jira/browse/CLJ-1206 > > > On Wednesday, August 28, 2013 10:59:

Re: eval/macros with functions with metadata

2013-08-28 Thread Jamie Brandon
-in are doing. > > If the letfn is being generated by your compilation step, why can't that go > inside of your generated fn rather than outside it? > > (clojure.core/fn > [input__2288__auto__] > (clojure.core/letfn > [(num ...) > (succ ...) &

Re: eval/macros with functions with metadata

2013-08-28 Thread Jamie Brandon
; repeat until you get bored >> ) >> >> (defn e [f] >> (let [wr (Wrapper. f)] >> (eval `(~wr 1)))) >> >> (e inc) >> >> (e (with-meta (fn [x] (+ 4 x)) {})) >> >> >> >> On Wed, Aug 28, 2013 at 1:59 PM, Jamie Brandon >>

Re: Eval vs the repl

2013-08-28 Thread Jamie Brandon
> Just curious: what do you expect that to do? It was actually the second example that was causing me trouble and when I was digging through the compiler for the cause I noticed the first. I don't actually want to write that code, I'm just confused as to why nrepl.el gives a different answer to le

Re: eval/macros with functions with metadata

2013-08-28 Thread Jamie Brandon
nsider this hacky or not. > > (def ^:dynamic *fn-helper*) > > (defn eval-at-one [f] (binding [*fn-helper* f] (eval '(*fn-helper* 1 > > > On Wed, Aug 28, 2013 at 1:28 PM, Jamie Brandon > wrote: >> >> You will also run into problems if your functions close ov

Re: eval/macros with functions with metadata

2013-08-28 Thread Jamie Brandon
(fn [] (do-stuff-with @~f))) {::strong-ref f})) So that way f will be freed up when the resulting fn is gced. On 28 August 2013 17:59, Ben Wolfson wrote: > On Wed, Aug 28, 2013 at 9:27 AM, Jamie Brandon > wrote: >> >> >> If you aren't worried about leaking memory, a

Re: Eval vs the repl

2013-08-28 Thread Jamie Brandon
Huh, I'm using nrepl.el but if I use lein repl I get the same results as you. On 28 August 2013 18:16, Aaron Cohen wrote: > What repl are you using? I think it's doing something weird. > > java -cp clojure-1.5.1.jar clojure.main > user=> [do (inc 1)] > 2 > user> ^{:line 11, :column 20} [] > Class

Re: eval/macros with functions with metadata

2013-08-28 Thread Jamie Brandon
Clojure struggles with staged programming because of JVM limitations. "The deeper issue here is that JVM bytecode is fundamentally static: it's not allowed to contain references to objects that only exist at runtime. In languages that have a built-in concept of a "runtime image," like Smalltalk o

Eval vs the repl

2013-08-28 Thread Jamie Brandon
I had previously assumed that the clojure repl effectively just did (eval (read-string input)). That doesn't seem to be the case eg: user> [do (inc 1)] CompilerException java.lang.RuntimeException: Unable to resolve symbol: do in this context, compiling:(NO_SOURCE_PATH:1:1) user> (eval '[do (inc 1

Re: Confused by var eval behaviour

2013-08-09 Thread Jamie Brandon
d? > Regular code forms (as returned by the reader) don't usually contain > functions. When the compiler doesn't know how to evaluate some value it > treats it as a constant. Constants are serialized in the class and read > back/instanciated when the class is loaded. > &g

Re: Confused by var eval behaviour

2013-08-08 Thread Jamie Brandon
gen.invokeStatic(RT_TYPE, Method.getMethod("clojure.lang.Var > var(String,String)")); > } > > Christophe > > > > On Thu, Aug 8, 2013 at 4:44 PM, Jamie Brandon > wrote: >> >> What if it isn't inside a constant? >> &

Re: Confused by var eval behaviour

2013-08-08 Thread Jamie Brandon
quot;foo")]) CompilerException java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: java.io.StringReader@7504a5ce, compiling:(NO_SOURCE_PATH:1:1) So I guess Fn and Var have print-dup methods defined. I still don't understand why print-dup is used at all though. On 8 August 2

Re: Confused by var eval behaviour

2013-08-08 Thread Jamie Brandon
lize the constant. > # is unreadable while #'user/x is that explains teh > difference in behaviour. > > > On Thu, Aug 8, 2013 at 3:40 PM, Jamie Brandon > wrote: >> >> This has me stumped: >> >> user=> (with-local-vars [x nil] (eval x)) >> # >

Confused by var eval behaviour

2013-08-08 Thread Jamie Brandon
This has me stumped: user=> (with-local-vars [x nil] (eval x)) # user=> (with-local-vars [x nil] (eval [x])) CompilerException java.lang.NullPointerException, compiling:(NO_SOURCE_PATH:1:1) By comparison: user=> (def x nil) #'user/x user=> (eval #'x) #'user/x user=> (eval [#'x]) [#'user/x] --

Re: [ANN] lein-gnome 0.1.0

2013-06-24 Thread Jamie Brandon
(I fell afoul of the new gmail compose window) Useful tools for writing gnome extensions in cljs: https://github.com/jamii/lein-gnome As a side effect, allows injecting a cljs repl into gnome-shell. On 24 June 2013 23:02, Jamie Brandon wrote: > Useful tools for writing gnome extensions

[ANN] lein-gnome 0.1.0

2013-06-24 Thread Jamie Brandon
Useful tools for writing gnome extensions in cljs: -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first po

Fair conjunction and parallel solvers in core.logic

2012-12-19 Thread Jamie Brandon
Last week I figured out how to add fair conjunction and a parallel solver (via fork-join) to core.logic. I just wrote up an explanation of how it works which may be interesting: http://scattered-thoughts.net/blog/2012/12/19/search-trees-and-core-dot-logic/ https://github.com/jamii/core.logic/tree

Re: way to test if a coll is a record?

2012-12-13 Thread Jamie Brandon
A2. (instance? clojure.lang.IRecord (Foo.)) On 12 December 2012 14:53, Andy Fingerhut wrote: > I haven't dug into the details, but this Clojure ticket looks like it might > be related, if not the same issue: > > http://dev.clojure.org/jira/browse/CLJ-1105 > > It has been vetted by Stuart Hallowa

ANN concerto 0.1.0-SNAPSHOT

2012-11-13 Thread Jamie Brandon
Concerto extends nrepl (and nrepl.el) with a broadcast mechanism so that multiple users can colloborate within a single repl. Just an experiment, I'm curious to see whether anyone has a use for this. My eventual goal is to use it for collaborative ovetone sessions but for now I have to get back to

Re: core.logic for constraint logic programming

2012-10-24 Thread Jamie Brandon
Ok, clearly I've not been keeping up, sorry :) On 24 October 2012 18:17, David Nolen wrote: > On Wed, Oct 24, 2012 at 6:07 PM, Jamie Brandon > wrote: >> >> It sounds like something that would benefit from good constraint >> propagation. If I remember corre

Re: core.logic for constraint logic programming

2012-10-24 Thread Jamie Brandon
It sounds like something that would benefit from good constraint propagation. If I remember correctly, core.logic only support propagating equality/inequality constraints which can be pretty slow for exploring large domains. Something like gecode (http://www.gecode.org) might be a better fit if you

Re: ANN strucjure 0.1.0

2012-10-12 Thread Jamie Brandon
> Compared to core.logic Oops, that should be core.match. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your

ANN strucjure 0.1.0

2012-10-12 Thread Jamie Brandon
Strucjure is a library for parsing and pattern matching using PEGs, roughly modelled after OMeta. https://github.com/jamii/strucjure Compared to core.logic, strucjure does not perform decision tree optimisation and probably generates worse code but it supports first-class, recursive views and can

Troubles with truthiness

2012-05-14 Thread Jamie Brandon
I ran across this behaviour today: shackles.examples=> (import '[clojure.lang Seqable]) clojure.lang.Seqable shackles.examples=> (deftype Foo [] Seqable (seq [this] ())) shackles.examples.Foo shackles.examples=> (empty? (Foo.)) false shackles.examples=> (deftype Bar [] Seqable (seq [this] nil)) sh

Crowdfunding an open-source clojure library for p2p NAT traversal, dynamic addressing and pubsub

2012-02-26 Thread Jamie Brandon
This is something I have been experimenting with on and off for a while, up to the point of building a working prototype. I'm considering crowdfunding (probably on indiegogo) to fund a few months of full-time development and would greatly appreciate any feedback / interest / boos / hisses on the in

Re: Clojure Poll 09/2008

2008-09-10 Thread Jamie Brandon
> 1. Not a good way to READ from a string, (read (PushbackReader. (StringReader. my-string))) > I've noticed functions can only refer to those previously defined, so you > couldnt have 2 that depend on one another This is because symbols are looked up at compile time. So what you can do is (d