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

Re: Access the datastructure used to create a function?

2013-11-26 Thread Jamie Brandon
, Nov 26, 2013 at 6:16 AM, Jamie Brandon ja...@scattered-thoughts.net wrote: (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

[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

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

Re: Moseley's FRP

2013-12-09 Thread Jamie Brandon
in a host language 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.inf.ed.ac.uk/wadler/topics/recent.html

Re: Moseley's FRP

2013-12-09 Thread Jamie Brandon
for a normalised view over a denormalised database. On 10 December 2013 01:57, Jamie Brandon ja...@scattered-thoughts.netwrote: 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

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 ))] [

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

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

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

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 dnolen.li...@gmail.com wrote: On Wed, Oct 24, 2012 at 6:07 PM, Jamie Brandon ja...@scattered-thoughts.net wrote: It sounds like something that would benefit from good constraint propagation. If I remember

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

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 andy.finger...@gmail.com 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

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/

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

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))

[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

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 ja...@scattered-thoughts.net wrote: Useful tools

Confused by var eval behaviour

2013-08-08 Thread Jamie Brandon
This has me stumped: user= (with-local-vars [x nil] (eval x)) #Var: --unnamed-- 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])

Re: Confused by var eval behaviour

2013-08-08 Thread Jamie Brandon
difference in behaviour. On Thu, Aug 8, 2013 at 3:40 PM, Jamie Brandon ja...@scattered-thoughts.net wrote: This has me stumped: user= (with-local-vars [x nil] (eval x)) #Var: --unnamed-- user= (with-local-vars [x nil] (eval [x])) CompilerException java.lang.NullPointerException, compiling

Re: Confused by var eval behaviour

2013-08-08 Thread Jamie Brandon
at all though. On 8 August 2013 15:44, Jamie Brandon ja...@scattered-thoughts.net wrote: What if it isn't inside a constant? user= (eval `(fn [] ~#'x)) #user$eval1366$fn__1367 user$eval1366$fn__1367@15dbb76 user= (with-local-vars [x nil] (eval `(fn [] ~x))) CompilerException

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 ja...@scattered-thoughts.net wrote: What if it isn't inside a constant? user= (eval `(fn [] ~#'x)) #user$eval1366$fn__1367 user

Re: Confused by var eval behaviour

2013-08-09 Thread Jamie Brandon
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. On Thu, Aug 8, 2013 at 6:30 PM, Jamie Brandon ja...@scattered-thoughts.net

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

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 or

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 aa...@assonance.org 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

Re: eval/macros with functions with metadata

2013-08-28 Thread Jamie Brandon
-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 wolf...@gmail.com wrote: On Wed, Aug 28, 2013 at 9:27 AM, Jamie Brandon ja...@scattered-thoughts.net wrote: If you aren't worried about leaking memory, a possible

Re: eval/macros with functions with metadata

2013-08-28 Thread Jamie Brandon
^: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 ja...@scattered-thoughts.net wrote: You will also run into problems if your functions close over any data: user (let [f (fn [] 1)] (eval `(~f))) 1

Re: eval/macros with functions with metadata

2013-08-28 Thread Jamie Brandon
...) (succ ...) (zero ...)] (num input__2288__auto__))) On Wed, Aug 28, 2013 at 1:59 PM, Jamie Brandon ja...@scattered-thoughts.net wrote: That sort of works for my use case. What I want to do is define a grammar... (def num-graph (graph num ~(or ~succ ~zero) succ

Re: eval/macros with functions with metadata

2013-08-29 Thread Jamie Brandon
[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:19 AM UTC-7, Jamie Brandon wrote: That sort of works for my use case. What I want to do is define

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 islonsche...@gmail.com wrote: I wonder if it would be possible to improve it using the core.typed library and doing some kind of static analysis

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

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 ja...@scattered-thoughts.net wrote: I ran a little benchmark comparing different implementations of a toy pattern matching protocol: https

Re: Hotspot predictability

2013-09-18 Thread Jamie Brandon
, 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 ja...@scattered-thoughts.net wrote: I ran a little benchmark comparing different implementations of a toy pattern

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 #Unbound Unbound: