(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
, 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
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
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
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
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
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 ))]
[
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
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
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
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
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
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
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/
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
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))
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
(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
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])
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
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
());
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
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
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
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
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
-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
^: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
...)
(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
[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
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
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
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
, 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
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:
35 matches
Mail list logo