[core.logic] How to implement synthetic answers?

2012-10-26 Thread Tassilo Horn
Hi all, I successfully use core.logic to query a custom Java graph structure. That is, I have these core relations: , | (typeo g e t) | e is a vertex or edge of graph g with type t | | (vertexo g v) | v is a vertex of graph g | | (edgeo g e s t) | e is an edge of graph g starting at vertex

Re: ANN: Guzheng 1.2.5

2012-10-26 Thread Tassilo Horn
David Greenberg dsg123456...@gmail.com writes: Hi David, Guzheng is a library for doing branch coverage analysis on Clojure projects at the command line. Hey, that's pretty cool. But it errors when being applied to my project. I've found the bug in guzheng and already sent you a pull

Re: what is the simplest user auth system possible?

2012-10-26 Thread Dave Sann
For authorisation, I really like mozilla persona (previously browserid) which I discovered from refheap. javascript lib plus an http request from the server to validate. really simple. https://login.persona.org/ Dave On Friday, 26 October 2012 01:35:53 UTC+11, Stephen Compall wrote: On

Re: what is the simplest user auth system possible?

2012-10-26 Thread Dave Sann
Sorry, I meant to say authentication. On Friday, 26 October 2012 22:06:48 UTC+11, Dave Sann wrote: For authorisation, I really like mozilla persona (previously browserid) which I discovered from refheap. javascript lib plus an http request from the server to validate. really simple.

Re: fastest way to remove nils

2012-10-26 Thread kevin roth
Be careful with the (filter identity ...) which will also remove falses from seqs. (filter identity [nil 2 3 nil false true 4]) = (2 3 true 4) Since (identity false) and (identity nil) returns respectively false and nil they are BOTH rejected by filter. This could do the trick: (filter (comp

Re: fastest way to remove nils

2012-10-26 Thread Moritz Ulrich
(filter (comp not nit?) [nil 2 3 nil false true 4]) - (remove nil? [...]) On Fri, Oct 26, 2012 at 12:53 PM, kevin roth kevin.c.zucker...@gmail.com wrote: Be careful with the (filter identity ...) which will also remove falses from seqs. (filter identity [nil 2 3 nil false true 4]) = (2 3 true

Re: ANN: Guzheng 1.2.5

2012-10-26 Thread dgrnbrg
Tassilo: I've incorporated this fix and rereleased as [lein-guzheng 1.4.4] (which will automatically pull in the latest guzheng). Ambrose: Guzheng works by instrumenting all code just before it's eval'ed, using Zach Tellman's sleight library, which is essentially a way to do whole program

Re: let in the middle of thread-first

2012-10-26 Thread Jonathan Fischer Friberg
You could also let every function take a map as input/output. Then, b could return a map with key :result-b or similar. This result would then pass through the rest of the functions and be accessible in e. Like this: a ; = {:result-a ...} b ; = {:result-b ... :result-a ...} ... d ; = {...

Re: compile fails but stack trace does not mention a line of code in my app

2012-10-26 Thread Stathis Sideris
I've seen this error when putting the function name *after* the docstring instead of before in a defn. Stathis On Thursday, 25 October 2012 20:05:25 UTC+1, Philip Potter wrote: Since we're wild mass guessing, I'd say from that stack trace that there's invalid syntax in a defn's signature

Re: ANN: data.json 0.2.0

2012-10-26 Thread Stuart Sierra
It is done. data.json 0.2.1 coming to a repository near you. http://build.clojure.org/job/data.json/77/ https://github.com/clojure/data.json/tree/data.json-0.2.1 -S -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Clojurescript externs when using a local file (cljsbuild)

2012-10-26 Thread Sean S
Awesome. Thanks. On Friday, October 26, 2012 12:30:07 AM UTC-4, Evan Mezeske wrote: One other thing I ought to mention is that your *.cljs files need to be arranged in an appropriate directory structure (i.e. the directories must match the namespaces):

Re: fastest way to remove nils

2012-10-26 Thread Softaddicts
I avoid making explicit distinctions between false and nil in my code. In Clojure a falsy value is either nil or false. In interop I ensure that null and false when returned in the upper layers are made consistent (including Boolean objects set to false). Too much potential trouble in my

Re: fastest way to remove nils

2012-10-26 Thread kevin roth
The difference between nil and false is really handy in some cases and for many people removing nil (or keeping not-nil) values from a seq is not removing falsy values. I just wanted to point out the issues that may arise from a blind use of (filter identity [...]) ;) On Friday, October 26,

Re: fastest way to remove nils

2012-10-26 Thread Softaddicts
No problem, however this nuance has broader implications than just this code snippet :) If you pass false and nil values to a library and expect them to be processed differently, you may end up with a big surprise. Luc The difference between nil and false is really handy in some cases and

[ANN] Typed Clojure 0.1, analyze 0.2

2012-10-26 Thread Ambrose Bonnaire-Sergeant
Hi, I've cleaned up a release of Typed Clojure to coincide with my dissertation (also released another version of analyze). Please try it out. (Clojure 1.5.0-beta1 only) Typed Clojure 0.1 https://github.com/frenchy64/typed-clojure [typed 0.1] analyze 0.2

monads

2012-10-26 Thread Brian Craft
I've read about four tutorials on monads so far, but it still escapes me. In fact, I'm still not sure what problem it solves. I'm familiar with the problem of having, say, three functions like f(a) - b, g(c) - d, h(e) - f, which you'd like to chain like f(g(h(x))), but you can't because b is a

compare doubles for equality fn

2012-10-26 Thread Michael
Can someone recommend a library that contains a function comparing doubles for equality? This clojure cookbook has a section on comparing floating-point numbers. http://www.gettingclojure.com/cookbook:numbers This blog post makes me want to find an implementation by someone who has more

Re: [core.logic] How to implement synthetic answers?

2012-10-26 Thread David Nolen
On Fri, Oct 26, 2012 at 4:16 AM, Tassilo Horn t...@gnu.org wrote: Any ideas and pointers how to implement that? I don't really see anyway to do this without the graph itself being a relational data structure. I haven't seen any data structure that fits that bill beyond lists (which of course

Re: monads

2012-10-26 Thread Andy Fingerhut
I can't say I grok monads completely yet, but was one of the tutorials you read this one? http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html I like the style of showing how they solve problems that arise naturally in the context of purely functional programming, with

Re: monads

2012-10-26 Thread Brian Marick
On Oct 26, 2012, at 11:06 AM, Brian Craft wrote: I've read about four tutorials on monads so far, but it still escapes me. In fact, I'm still not sure what problem it solves. Monads are hard to understand, and I too found I wasn't the target audience for the explanations I read. I finally

Re: what is the simplest user auth system possible?

2012-10-26 Thread Pierre R
+1 for Persona. Please give your user a chance to break the cycle of password madness ;-) On Friday, October 26, 2012 1:10:42 PM UTC+2, Dave Sann wrote: Sorry, I meant to say authentication. On Friday, 26 October 2012 22:06:48 UTC+11, Dave Sann wrote: For authorisation, I really like

Has anyone posted with Clojurescript (XhrIo) to a non Clojure based web framework?

2012-10-26 Thread Sean S
Can't seem to get it to work. Have tried posting to a .Net Mvc 4 action, and a Ruby/Rails action. Have had no success at all. It attempts and then just throws an exception: SYNTAX_ERR: DOM Exception 12 Error: An invalid or illegal string was specified. Problem is, that doesn't really help

Re: Has anyone posted with Clojurescript (XhrIo) to a non Clojure based web framework?

2012-10-26 Thread Jack Moffitt
(.send goog.net.XhrIo action callback 'POST' serialized ))) You are using the clojure symbol 'POST' not the string POST. Switch to double quotes and I bet it works. jack. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

ANN: core.logic-0.8.0-beta2

2012-10-26 Thread David Nolen
Enhancements: - experimental support for Datomic - eqfd now supports - / Fixes: - distinctfd goal behaved badly if argument wasn't ground - LOGIC-62: distincto bug reveals much larger issues around how we look up constraints. because vars can be bound in any order and we use vars to map to

with-open and line-seq

2012-10-26 Thread Dave Ray
Hi, At work I've had a few conversations about treating files, especially large ones, as seqs of lines. In particular, the apparent conflict between using clojure.core/with-open to ensure a file is closed appropriately, and clojure.core/line-seq as a generic sequence of lines which may be

Re: let in the middle of thread-first

2012-10-26 Thread Jason Bennett
Appreciate everyone's responses! I'll certainly check out the let- option. jason On Friday, October 26, 2012 6:16:28 AM UTC-7, Jonathan Fischer Friberg wrote: You could also let every function take a map as input/output. Then, b could return a map with key :result-b or similar. This result

Re: with-open and line-seq

2012-10-26 Thread Devin Walters
I usually wind up with the line-seq from old contrib. Could you be more clear about what isn't satisfying about that? For me it usually boils down to: it's unsatisfying that core line-seq doesn't do that by default. '(Devin Walters) On Oct 26, 2012, at 6:45 PM, Dave Ray dave...@gmail.com

Re: what is the simplest user auth system possible?

2012-10-26 Thread Anthony Grimes
Another +1 for Persona. I'm the author of Refheap which uses Persona, and I chose it specifically because of how easy it was to implement and use. On Friday, October 26, 2012 3:26:16 PM UTC-5, Pierre R wrote: +1 for Persona. Please give your user a chance to break the cycle of password

Re: with-open and line-seq

2012-10-26 Thread Andy Fingerhut
Devin, did you mean read-line from the old clojure.contrib.io? http://clojuredocs.org/clojure_contrib/clojure.contrib.io/read-lines Click the + symbol next to Source to see source code, also available here:

Re: with-open and line-seq

2012-10-26 Thread Dave Ray
Andy, That's the custom seq that closes the file... I was referring to. I guess I looking for a magical line-seq that closes the file correctly even if you consume part of the sequence, is resilient to exceptions, etc, etc. I realize that it might be impossible, so I asked. :) Thanks, Dave On

Re: monads

2012-10-26 Thread Stephen Compall
On Fri, 2012-10-26 at 09:06 -0700, Brian Craft wrote: First, do monads provide a generic solution, so I can apply f(g(h(x)))? Yes. control.algo.monads provides it as m-chain. The closest equivalent to m-chain in Haskell is (foldl' (=) return), but in most situations you would favor f = g = h

core.logic and other types of solvers

2012-10-26 Thread Brandon Bloom
There was a mention of linear programming in this threadhttps://groups.google.com/d/topic/clojure/oFCk5rOQUUo/discussionabout core.logic. I wonder: Is it possible to compose the techniques? I've only just started digging into core.logic (ie today), but I've messed with less-general constraint

Re: monads

2012-10-26 Thread Ben Wolfson
On Fri, Oct 26, 2012 at 8:39 PM, Stephen Compall stephen.comp...@gmail.com wrote: On Fri, 2012-10-26 at 09:06 -0700, Brian Craft wrote: First, do monads provide a generic solution, so I can apply f(g(h(x)))? Yes. control.algo.monads provides it as m-chain. Can you expand on this? If the

CLJS: Working with js-lib calls (?)

2012-10-26 Thread Frank Siebenlist
When you're calling functions of js-libs in clojurescript, you will face a lot of boilerplate transformations to native js-objects and/or arrays. The calls that I make start to look like: (js-lib-fn (jayq.util/clj-js param1) (jayq.util/clj-js param2) (jayq.util/clj-js param3)) where the