[ANN] http-kit 2.0.0 released

2013-03-28 Thread Shen, Feng
Hello folks.

I just released version 2.0.0 of http-kit.


*2.0.0 (2013/3/29)*

   1. Unify WebSocket and HTTP long polling/streaming with Channel protocol
   and with-channel (API breaks with the RC)
   2. WebSocket support sending and receiving binary frame with byte[]
   3. Support HTTP streaming
   4. WebSocket message ordering is guaranteed by server


Updated documentation: http://http-kit.org/server.html

Let's build amazing realtime applications with Clojure, using http-kit.

The with-channel API is not compatible with the RC releases. The new is
better and much easier to understand and use. The old's documentation can
be found here 

- feng

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the status of Clojure on LLVM or C?

2013-03-28 Thread Alan Moore

On Thursday, March 28, 2013 2:15:34 PM UTC-7, John Szakmeister wrote:
>
> On Wed, Mar 27, 2013 at 5:21 PM, Timothy Baldridge 
> > 
> wrote: 
> > What use-case do you have for such an implementation? Is there something 
> > that Clojure on LLVM will give you that Clojure on the JVM or on V8 
> won't 
> > allow you to do? 
>
> Clojure on C would likely allow me to use Clojure in a deeply embedded 
> environment.  Such as an ARM processor with 32MB of Flash and 64MB of 
> RAM.  To run the JVM, that may require licensing, and V8 doesn't allow 
> for threads. 
>

+1 - Absolutely - I would love to see an LLVM target for clojure. I have 
been looking into how clojurescript is implemented and how 
similar/different an LLVM target would be to implement...

Alan

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] Amazonica: Clojure client for the entire AWS api

2013-03-28 Thread Michael Cohen
I ran a quick and dirty benchmark comparing Amazonica with James' rotary 
library, which uses no explicit reflection. This was run from an EC2 
instance in East, hitting a Dynamo table in the East region. tl;dr 
 Amazonica averaged 9ms for gets, rotary averaged 6ms, both averaged 13ms 
for puts. Summary is at https://github.com/mcohen01/amazonica#performance. 
Benchmark code is 
at 
https://github.com/mcohen01/amazonica-benchmark/blob/master/test/benchmark/runner.clj.
 

It's pretty simplistic, but I just wanted to see if reflection just 
completely turned the library into a dog. Seems the contrary, that any 
reflection performance penalty is basically not even worth mentioning. 
Maybe some folks who have better understanding of jvm internals can explain 
if the test is invalid because of some sort of caching of the method 
lookups or something. 


On Wednesday, March 27, 2013 7:29:00 AM UTC-7, Herwig Hochleitner wrote:
>
> 2013/3/26 Hugo Duncan >
>
>>
>> Or can the cost be confined to compile time...
>>
>
> That would be nice to have!
> Generating type-hinted clojure code from the reflection result and 
> emitting that with macros would be an option.
>
> I think the dynamic use of reflection would be enough to put me off
>> using this in something like pallet, for example.
>>
>
> I agree with Michael on this: Any reflection overhead should pale next to 
> the context switch and network communication, that AWS commands do.
> OTOH, I also agree that driving a generated java api via reflection, to 
> generate xml seems a bit heavy handed.
> Still, first priority should be to get the interface right.
>
> Regarding that: I think the first context argument should be mandatory.
> We are just saw clojure.java.jdbc painstakenly deprecate a lot of API, to 
> get rid of the dynamic *db* var.
> The reasons against passing context in a dynamic var go double against a 
> global atom: A function parameter can be set at from any data model in 
> every callsite. Everything that's less flexible constrains your users for 
> little gain (in the case of passing context).
>
> Also, my experience with ClojureQL showed me, that with multiple sources 
> of a context arg, it's hard to get the ordering right.
> E.g. the new implementation seems to prefer dynamically bound credentials 
> over credentials passed as argument.
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] Javelin, spreadsheet-like FRP for ClojureScript

2013-03-28 Thread Alan Dipert
Hank, I did my best to answer your questions and respond to your thoughts 
as I understand them, below.  Thanks in advance for interpreting my 
suppositions and word choices liberally, as the words and ideas in this 
area of computing are notoriously overloaded. 

I'm looking forward to viewing your Clojure/West talk as soon as it comes 
> out on video.
>
 
Thanks!
 

> In the meantime, I don't think javelin qualifies as "functional reactive". 
> It is just "reactive". State like this: 
> https://github.com/tailrecursion/javelin/blob/master/src/cljs/tailrecursion/javelin/core.cljs#L64
>  is 
> place-oriented computing vs. the value-oriented computing that FP is aiming 
> for.
>

Cell deref rarely appears in user code, and signifies departure from 
Javelin's evaluation environment.  Even so, if one admits Clojure + refs as 
"FP", I think there remains an argument to sell the Javelin model as 
"functional".
 

> The functional qualifier would require that producers output some 
> immutable data structure that consumers read. This is important for 
> concurrency, so that each producing/consuming task can run in separate 
> thread and be scheduled at will, decoupled from any other task. This is a 
> Hard Problem (tm). Infinite sequences are a popular data structure for 
> decoupling consumers from producers, but naive implementations lead to 
> uncontrolled resource usage esp. when it gets more complicated with higher 
> order functions.
>

Javelin was not particularly designed to tackle concurrency, but we think 
the Javelin model might empower the underlying propagation machinery to 
leverage concurrency in a JVM implementation.
 

> In the JavaScript world, Elm tries to tackle this. They have the right 
> goals but not yet the right implementation if I understand correctly. E.g. 
> see this discussion: 
> https://groups.google.com/d/msg/elm-discuss/7oFhwuIX0Go/OA3rvEh-lcIJ
>

Yes, Classic FRP's switch operation can be thought of as a concurrency 
primitive not unlike Go's switch statement, and EventStream objects can be 
thought of as a kind of coroutine.  I don't think Elm is tackling this, as 
browser JSVMs aren't generally multi-threaded, but maybe other FRP impls. 
are.  Re: the discussion you linked: to the extent that one can implement 
green threads with arrows or CPS, switch might be useful as a (contrived?) 
concurrency primitive in single-threaded environments.

On a meta note, I am glad every time FRP comes up in Clojure circles. The 
> reactive space is populated by naive implementations that don't scale and 
> fail at concurrency on the one side, and academic Haskell-types that 
> conjure up unimplementable pie-in-the-sky schemes on the other side. The 
> hope is that Clojure folks are ambitious enough to produce something that 
> scales in complexity and performance while having plenty real-world 
> scenarios to test their schemes against at their disposal
>

Yes, I'm glad when it comes up too.  I'm personally convinced there's a lot 
of utility in the general idea of dataflow, and look forward to further 
developments in the Clojure space.

Alan

.
>
> Cheers
> -- hank
>
> On Wednesday, February 20, 2013 6:33:56 PM UTC+11, Alan Dipert wrote:
>>
>> Hi all,
>> We recently released a ClojureScript library for FRP called Javelin. 
>>  Links of interest: 
>>
>> * Release announcement: 
>> http://tailrecursion.com/blog/2013/02/15/introducing-javelin-an-frp-library-for-clojurescript/
>> * Demos (more on the way): http://tailrecursion.com/~alan/javelin-demos/
>> * GitHub project: https://github.com/tailrecursion/javelin
>>
>> In a nutshell, Javelin is an abstract spreadsheet that encourages working 
>> with concrete values instead of abstract event streams a la FRP.  It 
>> supports "discrete propagation", which most FRP implementations provide as 
>> the event stream, via the ability to toggle cells between 
>> discrete/continuous propagation modes.  Cell mutation semantics are those 
>> of ClojureScript atoms.
>>
>> We have ported Javelin's core to a ref-based Clojure implementation 
>> capable of parallel propagation and hope to release it soon.  Among other 
>> things, our hope is to use it to process Prismatic graph [1] -compatible 
>> workflows reactively.  If you are using graph or flow [2] and are 
>> interested in reactive processing, and wouldn't mind helping us with 
>> performance testing, drop me a line. 
>>
>> Thanks for giving Javelin a look! I look forward to your feedback and 
>> collaboration.
>>
>> Alan
>>
>> 1. https://github.com/Prismatic/plumbing
>> 2. https://github.com/stuartsierra/flow
>>
>>
>>
>>
>>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://gr

GSoC application: time's almost up

2013-03-28 Thread Daniel Solano Gómez
Hello, all,

As I write this, there are less than 15 hours for us to finish our
application for Google Summer of Code 2013.  Thanks a lot to all of you
who have taken the time to prepare project ideas.

In these last few hours, there are two things we need to do:

1. Review the answers for our application[1].  I based our answers for
this year on last year's answers, and I have already submitted the
current draft to Google.  We can still update it before the deadline, so
I can incorporate edits from the community.

2. More project ideas! Our project ideas page[2] is looking pretty good.
However, we can always use more.  Also, there are no web+Clojure ideas
up.  Given some of the interest from students on Clojure and the web, I
think it'd be great to see some ideas from mentors posted.

Thank you all for your help, and here's to hoping we get into GSoC again
this year.

Sincerely,

Daniel

[1]: http://dev.clojure.org/display/community/Mentoring+Organization+Application
[2]: http://dev.clojure.org/display/community/Project+Ideas


signature.asc
Description: Digital signature


Re: What is the status of Clojure on LLVM or C?

2013-03-28 Thread Timothy Baldridge
This is something I've thought/talked about for some time now. In reality
this is one of the reasons I started Mjolnir. I would like to see an
implementation of Clojure on LLVM. Mjolnir is several months away from
being able to handle a project like this, but I took the time tonight to
type up my thoughts on the topic.

https://github.com/halgari/clojure-metal/blob/master/README.md

I'd love to hear anyone's input on this doc. I just typed this up, so it's
a bit rough, but it should communicate some of the ideas I have.

Timothy Baldridge



On Thu, Mar 28, 2013 at 7:26 PM, Mikera wrote:

> On Friday, 29 March 2013 05:45:53 UTC+8, Laurent PETIT wrote:
>
>> 2013/3/28 Marko Topolnik :
>> > Or you may have just a trivial requirement for a program that both
>> starts
>> > and executes quickly.
>>
>> To what extent would an LLVM / C version of a Clojure program not
>> incur startup penalty as the JVM does.
>>
>> As far as I understand it, the startup cost is manyfold:
>> 1/ JVM startup
>> 2/ loading of Clojure Core
>> 3/ loading of non-lazy parts of your application (generally from
>> loading a global namespace to invoke its -main function)
>>
>
> In my experience 1) is a small fraction of the total. A trivial "hello
> world" Java program runs in less than 0.1sec on my machine, which proves
> that JVM startup isn't really important. Or at least, far less important
> than most people think.
>
>
>>
>> I know AOT compilation can somehow reduce load-time of 2/ and 3/, but
>> not bring them to zero. As far as I understand it, all the namespaces
>> involved in your application will still have to be linearly executed,
>> in a depth-first manner following the graph of namespace dependencies
>> + loaded configuration files etc. Only the compilations of functions
>> will be optimized into loading of their corresponding classes.
>>
>> So, short of having a "image-like" environment, I wonder what the time
>> taken to do 2/ + 3/ would be in LLVM / C versions of Clojure.
>>
>
> It might even be slower in LLVM / C, unless you can at least match the JVM
> in terms of JIT optimisation and garbage collector efficiency, which in
> turn affects the runtime for 2+3 (I believe a garbage collector is a
> requirement to execute Clojure?). Beating the JVM isn't an easy feat.
>
> Something I would be very interested in would be enhancements to Clojure
> that allow for lazy compilation, i.e. deferring compilation of parts of
> your application or Clojure Core until they are directly invoked for the
> first time. This is probably going to be the most promising approach for
> reducing Clojure startup time, although I expect it would require some
> breaking changes.
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Mikhail Kryshen
On Thu, 28 Mar 2013 17:08:46 -0700
Mark Engelberg  wrote:

> Bug or feature?

Certainly a feature for complex patterns with whitespace and embedded
comments.

For example, the following regexp parses line in Combined Log Format used
by Apache httpd and other web servers:

(def clf-pattern
  #"(?x)^
(\S*)\s  # remote host
(\S*)\s  # remote logname
(\S*)\s  # remote user
\[([^\]]+)\]\s   # time the request was received
\"([^\"\\]*(?:\\.[^\"\\]*)*)\"\s # first line of request
(\S*)\s  # status
(\S*)\s  # size of response in bytes
\"([^\"\\]*(?:\\.[^\"\\]*)*)\"\s # referer
\"([^\"\\]*(?:\\.[^\"\\]*)*)\"   # user-agent
\s*$")

You probably would not want it to be printed in a single line.

--
Mikhail

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure libraries on remote machines

2013-03-28 Thread Phil Hagelberg
You would need to run a mirror for Maven Central and Clojars. Once the
mirror is set up you can look at "lein help sample" under :mirrors to see
how to configure Leiningen to use it.

Phil

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Mikhail Kryshen
On Fri, 29 Mar 2013 05:32:52 +0400
Mikhail Kryshen  wrote:

> (re-pattern "a\nb") returns regexp pattern that contains the newline
> char literally.
> 
> (re-patter "a\\\nb") returns pattern that contains '\n' (two-char
> sequence).

  ^ should be (re-pattern "a\\nb").

And (re-pattern "a\\\nb") returns pattern that contains '\' followed by
the newline char.

> These are not the same. '\n' always matches newline, while literal
> newline will be ignored if ?x flag is present.
> 
> => (re-matches (re-pattern "(?x)a\\\nb") "a\nb")
> "a\nb"

Also
=> (re-matches (re-pattern "(?x)a\\nb") "a\nb")
"a\nb"

> => (re-matches (re-pattern "(?x)a\nb") "a\nb")
> nil
> 
> => (re-matches #"(?x)a\nb" "a\nb")
> "a\nb"
> 
> => (re-matches #"(?x)a
>b" "a\nb")
> nil
> 
> 
> On Thu, 28 Mar 2013 17:08:46 -0700
> Mark Engelberg  wrote:
> 
> > I'm in reader hell right now, trying to puzzle out how escape sequences and
> > printing work for strings and regular expressions.
> > 
> > I notice that:
> > (re-pattern "a\nb")
> > (re-pattern "a\\nb")
> > (re-pattern "a\\\nb")
> > 
> > all produce semantically equivalent regular expressions that match "a\nb"
> > 
> > The middle one prints the way I'd expect, as #"a\nb"
> > 
> > However, the first and last example print as:
> > #"a
> > b"
> > 
> > Even weirder, printing it with pr has no effect, and it still prints as:
> > #"a
> > b"
> > 
> > I can sort of imagine why the middle one (re-pattern "a\\nb") might be
> > stored internally in a somewhat different format than the other two, but I
> > really can't figure out why the "machine-oriented print" of pr would still
> > print the blank line rather than \n in this context.
> > 
> > Bug or feature?
> > 
> > Can anyone point me to the relevant code where I can get a better
> > understanding of how the reading and printing of regexps differs from
> > strings?
> > 
> > --Mark
> > 

--
Mikhail

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Andy Fingerhut
On Thu, Mar 28, 2013 at 6:23 PM, Mark Engelberg wrote:

> On Thu, Mar 28, 2013 at 6:16 PM, Andy Fingerhut 
> wrote:
>
>> When you say a "sane, readable way", do you mean human-readable, or
>> readable via clojure.core/read or clojure.core/read-string?
>>
>
> I meant human readable
>
>
>>
>> (defn print-regex-my-way [re]
>>   (print "#regex \"" (str re) "\""))
>>
>
> If you try this:
> (print-regex-my-way (re-pattern "a\nb"))
> you'll see that it still splits the line.
>

Sorry, try this version:

(defn print-regex-my-way [re]
  (print "#regex ")
  (pr (str re)))

That might be closer to what you want.



> Note: clojure.core/read and read-string are not safe to read from anything
> but trusted data sources, so I wouldn't recommend it for anything except
> files you write yourself, or code.  See here for details if you are curious:
>
> http://clojuredocs.org/clojure_core/clojure.core/read
>
> Also note that the new clojure.edn/read and read-string, and the edn
> readers in the tools.reader contrib library, don't read Java regexes.  This
> is by choice, I believe, with the reason given that regexes are not
> portable across Java, JavaScript, etc. platforms.
>
> https://github.com/edn-format/edn/issues/26
>


I'd like to know more about this, because I think I found a way around my
problem using the built in read-string.to create a variation of re-pattern
that handles "a\nb" as #"a\\nb" rather than the current way it handles it.
(As you pointed out, I can't use edn/read-string because it doesn't support
regexes).

So what's wrong with this?:
(defn safe-read-string [s]
  (binding [*read-eval* false]
(read-string s)))



Does the text at the link below answer that question?  I know it isn't
exactly short, but hopefully it eventually gets to the point:

htt 
p://clojuredocs.org/clojure_core/clojure.core/read

If it doesn't answer your question, I'd like to know what question you
still have afterwards so I can update the explanation there.  You know,
make it longer so even fewer people will read it :-)

Andy

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Mikhail Kryshen
(re-pattern "a\nb") returns regexp pattern that contains the newline
char literally.

(re-patter "a\\\nb") returns pattern that contains '\n' (two-char
sequence).

These are not the same. '\n' always matches newline, while literal
newline will be ignored if ?x flag is present.

=> (re-matches (re-pattern "(?x)a\\\nb") "a\nb")
"a\nb"

=> (re-matches (re-pattern "(?x)a\nb") "a\nb")
nil

=> (re-matches #"(?x)a\nb" "a\nb")
"a\nb"

=> (re-matches #"(?x)a
   b" "a\nb")
nil


On Thu, 28 Mar 2013 17:08:46 -0700
Mark Engelberg  wrote:

> I'm in reader hell right now, trying to puzzle out how escape sequences and
> printing work for strings and regular expressions.
> 
> I notice that:
> (re-pattern "a\nb")
> (re-pattern "a\\nb")
> (re-pattern "a\\\nb")
> 
> all produce semantically equivalent regular expressions that match "a\nb"
> 
> The middle one prints the way I'd expect, as #"a\nb"
> 
> However, the first and last example print as:
> #"a
> b"
> 
> Even weirder, printing it with pr has no effect, and it still prints as:
> #"a
> b"
> 
> I can sort of imagine why the middle one (re-pattern "a\\nb") might be
> stored internally in a somewhat different format than the other two, but I
> really can't figure out why the "machine-oriented print" of pr would still
> print the blank line rather than \n in this context.
> 
> Bug or feature?
> 
> Can anyone point me to the relevant code where I can get a better
> understanding of how the reading and printing of regexps differs from
> strings?
> 
> --Mark
> 

--
Mikhail

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the status of Clojure on LLVM or C?

2013-03-28 Thread Mikera
On Friday, 29 March 2013 05:45:53 UTC+8, Laurent PETIT wrote:

> 2013/3/28 Marko Topolnik >: 
> > Or you may have just a trivial requirement for a program that both 
> starts 
> > and executes quickly. 
>
> To what extent would an LLVM / C version of a Clojure program not 
> incur startup penalty as the JVM does. 
>
> As far as I understand it, the startup cost is manyfold: 
> 1/ JVM startup 
> 2/ loading of Clojure Core 
> 3/ loading of non-lazy parts of your application (generally from 
> loading a global namespace to invoke its -main function) 
>

In my experience 1) is a small fraction of the total. A trivial "hello 
world" Java program runs in less than 0.1sec on my machine, which proves 
that JVM startup isn't really important. Or at least, far less important 
than most people think.
 

>
> I know AOT compilation can somehow reduce load-time of 2/ and 3/, but 
> not bring them to zero. As far as I understand it, all the namespaces 
> involved in your application will still have to be linearly executed, 
> in a depth-first manner following the graph of namespace dependencies 
> + loaded configuration files etc. Only the compilations of functions 
> will be optimized into loading of their corresponding classes. 
>
> So, short of having a "image-like" environment, I wonder what the time 
> taken to do 2/ + 3/ would be in LLVM / C versions of Clojure. 
>

It might even be slower in LLVM / C, unless you can at least match the JVM 
in terms of JIT optimisation and garbage collector efficiency, which in 
turn affects the runtime for 2+3 (I believe a garbage collector is a 
requirement to execute Clojure?). Beating the JVM isn't an easy feat.

Something I would be very interested in would be enhancements to Clojure 
that allow for lazy compilation, i.e. deferring compilation of parts of 
your application or Clojure Core until they are directly invoked for the 
first time. This is probably going to be the most promising approach for 
reducing Clojure startup time, although I expect it would require some 
breaking changes. 

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Mark Engelberg
On Thu, Mar 28, 2013 at 6:16 PM, Andy Fingerhut wrote:

> When you say a "sane, readable way", do you mean human-readable, or
> readable via clojure.core/read or clojure.core/read-string?
>

I meant human readable


>
> (defn print-regex-my-way [re]
>   (print "#regex \"" (str re) "\""))
>

If you try this:
(print-regex-my-way (re-pattern "a\nb"))
you'll see that it still splits the line.



>
> Note: clojure.core/read and read-string are not safe to read from anything
> but trusted data sources, so I wouldn't recommend it for anything except
> files you write yourself, or code.  See here for details if you are curious:
>
> http://clojuredocs.org/clojure_core/clojure.core/read
>
> Also note that the new clojure.edn/read and read-string, and the edn
> readers in the tools.reader contrib library, don't read Java regexes.  This
> is by choice, I believe, with the reason given that regexes are not
> portable across Java, JavaScript, etc. platforms.
>
> https://github.com/edn-format/edn/issues/26
>


I'd like to know more about this, because I think I found a way around my
problem using the built in read-string.to create a variation of re-pattern
that handles "a\nb" as #"a\\nb" rather than the current way it handles it.
(As you pointed out, I can't use edn/read-string because it doesn't support
regexes).

So what's wrong with this?:
(defn safe-read-string [s]
  (binding [*read-eval* false]
(read-string s)))

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Andy Fingerhut
On Thu, Mar 28, 2013 at 5:49 PM, Mark Engelberg wrote:

> I'm on 1.5.1 and I get that too, but even though:
> (pr #"a\nb") prints in a sane, readable way
> (pr (re-pattern "a\nb")) does not.
>
> The latter is what I need to print in a nice way.
>

Sorry, I missed that fine point.

When you say a "sane, readable way", do you mean human-readable, or
readable via clojure.core/read or clojure.core/read-string?

If the latter, then it already does print that way:

user=> (def p1 (re-pattern "a\nb"))
#'user/p1
user=> (def p2 (read-string (pr-str p1)))
#'user/p2
user=> p1
#"a
b"
user=> p2
#"a
b"

If you want clojure.core/read'ability but no actual newline character, I
don't think there is any way to create a syntax with #"" and only
non-newline characters between the quotes, such that the resulting regex
will contain the three characters a,newline,b as the original did.

If you don't need clojure.core/read'ability, then you can make up whatever
format you like, e.g. print the regex as a string with some type tag to
identify it as a regex.  This might even be readable by making your own
data-reader for it:

(defn print-regex-my-way [re]
  (print "#regex \"" (str re) "\""))

Note: clojure.core/read and read-string are not safe to read from anything
but trusted data sources, so I wouldn't recommend it for anything except
files you write yourself, or code.  See here for details if you are curious:

http://clojuredocs.org/clojure_core/clojure.core/read

Also note that the new clojure.edn/read and read-string, and the edn
readers in the tools.reader contrib library, don't read Java regexes.  This
is by choice, I believe, with the reason given that regexes are not
portable across Java, JavaScript, etc. platforms.

https://github.com/edn-format/edn/issues/26

Andy

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Alan Malloy
On Thursday, March 28, 2013 5:36:45 PM UTC-7, Andy Fingerhut wrote:

>
> I don't understand why (re-pattern "a\\\nb") would match the same thing.  
> I would have guessed that it wouldn't, but it does indeed do so.  For all I 
> know that could be bug or weird dark corner case in the Java regex 
> library.  I would have expected such a regex to match the only the 
> 4-character sequence a,backslash,newline,b.
>
>
That's a string with four characters: a, backslash, newline, b. When the 
regex engine compiles that, it sees the backslash-newline construct as 
"unnecessary escaping" of the newline character: since newline is neither a 
metacharacter nor alphabetic, backslash-newline just matches the single 
character newline.

The j.u.regex.Pattern javadoc, in explaining backslash-quoting, contains: 
"It is an error to use a backslash prior to any alphabetic character that 
does not denote an escaped construct; these are reserved for future 
extensions to the regular-expression language. A backslash may be used 
prior to a non-alphabetic character regardless of whether that character is 
part of an unescaped construct."

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Mark Engelberg
I'm on 1.5.1 and I get that too, but even though:
(pr #"a\nb") prints in a sane, readable way
(pr (re-pattern "a\nb")) does not.

The latter is what I need to print in a nice way.



On Thu, Mar 28, 2013 at 5:42 PM, Andy Fingerhut wrote:

> On Thu, Mar 28, 2013 at 5:15 PM, Mark Engelberg 
> wrote:
>
>> On Thu, Mar 28, 2013 at 5:08 PM, Mark Engelberg > > wrote:
>>
>>> However, the first and last example print as:
>>> #"a
>>> b"
>>>
>>
>> Follow up question:
>> Is there any way to make (re-pattern "a\nb") print as #"a\nb"?
>>
>> I've tried pr, print-dup, and various combinations of printing the
>> outputs of those under with-out-str, but no luck yet.  Any ideas?
>>
>
> With a Clojure 1.5.1 REPL I see this:
>
> user=> *print-readably*
> true
> user=> (pr #"a\nb")
> #"a\nb"nil
>
> Andy
>
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Andy Fingerhut
On Thu, Mar 28, 2013 at 5:15 PM, Mark Engelberg wrote:

> On Thu, Mar 28, 2013 at 5:08 PM, Mark Engelberg 
> wrote:
>
>> However, the first and last example print as:
>> #"a
>> b"
>>
>
> Follow up question:
> Is there any way to make (re-pattern "a\nb") print as #"a\nb"?
>
> I've tried pr, print-dup, and various combinations of printing the outputs
> of those under with-out-str, but no luck yet.  Any ideas?
>

With a Clojure 1.5.1 REPL I see this:

user=> *print-readably*
true
user=> (pr #"a\nb")
#"a\nb"nil

Andy

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Andy Fingerhut
Look in the Clojure source, file LispReader.java, classes RegexReader and
StringReader for the code that reads strings and regular expressions.

Basically the difference for regular expressions is that since things like
\d to match a single decimal digit, or \s to match a single whitespace
character, are so common in regexes, the regex reader in Clojure tries to
help the developer out by not requiring them to escape the backslashes,
which they would have to do if they specified the regex using a normal
string.  For example, these two are equivalent:

#"\d+\s+"
(re-pattern "\\d+\\s+")

The first is much easier to read, and the improvement is even more
noticeable for longer regexes.


Starting in core.clj with function print leads you to function pr-on, which
then calls method print-method if *print-dup* has its default value of
false.  Look in file core_print.clj for "regex" and you will find the
print-method method for printing regex patterns.


You say your first and last examples print as:

#"a
b"

but I see this with a Clojure 1.5.1 REPL:

user=> (print (re-pattern "a\nb"))
#"a
b"nil
user=> (print (re-pattern "a\\\nb"))
#"a\
b"nil

Not exactly the same, and not too surprising to me in how they differ.

The patterns (re-pattern "a\nb") and (re-pattern "a\\nb") both match the
same strings, because the first one matches exactly the three characters
a,newline,b, and so does the second one.  The first one matches it because
the regex itself contains a newline character to match.  The second one
matches it because it contains a backslash-n, which in Java regex's can be
used to denote that a newline character should be matched.

I don't understand why (re-pattern "a\\\nb") would match the same thing.  I
would have guessed that it wouldn't, but it does indeed do so.  For all I
know that could be bug or weird dark corner case in the Java regex
library.  I would have expected such a regex to match the only the
4-character sequence a,backslash,newline,b.

Andy


On Thu, Mar 28, 2013 at 5:08 PM, Mark Engelberg wrote:

> I'm in reader hell right now, trying to puzzle out how escape sequences
> and printing work for strings and regular expressions.
>
> I notice that:
> (re-pattern "a\nb")
> (re-pattern "a\\nb")
> (re-pattern "a\\\nb")
>
> all produce semantically equivalent regular expressions that match "a\nb"
>
> The middle one prints the way I'd expect, as #"a\nb"
>
> However, the first and last example print as:
> #"a
> b"
>
> Even weirder, printing it with pr has no effect, and it still prints as:
> #"a
> b"
>
> I can sort of imagine why the middle one (re-pattern "a\\nb") might be
> stored internally in a somewhat different format than the other two, but I
> really can't figure out why the "machine-oriented print" of pr would still
> print the blank line rather than \n in this context.
>
> Bug or feature?
>
> Can anyone point me to the relevant code where I can get a better
> understanding of how the reading and printing of regexps differs from
> strings?
>
> --Mark
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Quirk with printing regexps

2013-03-28 Thread Mark Engelberg
On Thu, Mar 28, 2013 at 5:08 PM, Mark Engelberg wrote:

> However, the first and last example print as:
> #"a
> b"
>

Follow up question:
Is there any way to make (re-pattern "a\nb") print as #"a\nb"?

I've tried pr, print-dup, and various combinations of printing the outputs
of those under with-out-str, but no luck yet.  Any ideas?

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Clojure libraries on remote machines

2013-03-28 Thread Ramesh
Hi,

I have a few machines without internet connection. We have a ubuntu
repository mirror, so I can install clojure using apt-get.

But, how do I install clojure libraries with all dependencies for projects
on these machines? Even maven is not an option here.


ramesh

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Quirk with printing regexps

2013-03-28 Thread Mark Engelberg
I'm in reader hell right now, trying to puzzle out how escape sequences and
printing work for strings and regular expressions.

I notice that:
(re-pattern "a\nb")
(re-pattern "a\\nb")
(re-pattern "a\\\nb")

all produce semantically equivalent regular expressions that match "a\nb"

The middle one prints the way I'd expect, as #"a\nb"

However, the first and last example print as:
#"a
b"

Even weirder, printing it with pr has no effect, and it still prints as:
#"a
b"

I can sort of imagine why the middle one (re-pattern "a\\nb") might be
stored internally in a somewhat different format than the other two, but I
really can't figure out why the "machine-oriented print" of pr would still
print the blank line rather than \n in this context.

Bug or feature?

Can anyone point me to the relevant code where I can get a better
understanding of how the reading and printing of regexps differs from
strings?

--Mark

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ClassNotFoundException when using fetch RPC from cljs

2013-03-28 Thread Steve Buikhuizen
Sadly, this was not the end of the story. I discovered that my fix posted 
above did not work properly so I decided to bite the bullet and move to 
shoreleave. This held the promise of using an edn reader.

A couple of things were tricky in making this migration, I'll list them 
here for any future readers.

   1. If using shoreleave-remote (client) and shoreleave-remote-ring 
   (server) then make sure they have matching versions (currently 0.3.0)
   2. ensure you don't use cemerick.shoreleave.rpc for your middleware 
   wrapper. it's there for backward compat but the latest middleware is 
   shoreleave.middleware.rpc and it doesn't use the new edn reader
   3. pay careful attention to the extra required middlewares for wrap-rpc 
   and the order in which they are included

Even now that I am fully migrated I have a new problem. It appears that the 
edn reader cannot support tagged literals i.e. defrecords. I guess this 
makes sense for edn but it's a problem for anyone using defrecords for rpc 
writes. I have worked around it by removing the tag literals after 
serialisation on the client but it's a dirty hack. I'll try using non-edn 
for reading instead and I hope that it doesn't bring me full circle back to 
the ClassNotFoundException.

At least it's good to be ported away from Noir and using the client pooled 
requests. Might provide a performance boost in my client.

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[ANN] Leiningen 2.1.2 released

2013-03-28 Thread Phil Hagelberg

Hello folks.

I just released version 2.1.2 of Leiningen, fixing a number of bugs:

## 2.1.2 / 2013-02-28

* Allow TieredCompilation to be disabled for old JVMs. (Phil Hagelberg)
* Fix a bug merging keywords in profiles. (Jean Niklas L'orange)
* Fix a bug where tests wouldn't run under with-profiles. (Phil Hagelberg)
* Support for calling set! on arbitrary vars on startup. (Gary Verhaegen)
* Allow update-in to work on top-level keys. (Marko Topolnik)
* Fix a bug breaking certain templates. (Colin Jones)
* Fix a bug where trampolined repl would hang. (Marko Topolnik)

If you run tests under various profiles, run the repl under a
trampoline, or run on older JVMs you should definitely upgrade.

Thanks to everyone who reported and fixed issues this release.

-Phil

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[ANN] emoji 0.1.0 (initial release) - a library to emojify a ring app or pedestal service

2013-03-28 Thread Gabriel Horner
emoji is a library that provides ring middleware and pedestal 
interceptorware to replace a response containing emoji names with bundled 
emoji images.

To use as an interceptor for a pedestal service:

(require '[io.pedestal.service.interceptor :refer [defon-response]])
(require '[emoji.core :refer [emoji-response]])
(defon-response emoji-interceptor
  [response]
  (emoji-response response))

;; add emoji-interceptor to a route
["/" {:get some-endpoint ^:interceptors [emoji-interceptor]]


To use as middleware for a ring app:

(require '[emoji.core :refer [emoji-response]])
(require '[ring.middleware.resource :refer [wrap-resource]])

;; Assuming a compojure routes table called app-routes
;; resource middleware is needed to serve up bundled emojis
(-> app-routes
wrap-emoji
(wrap-resource "/public"))


For more info, see https://github.com/cldwalker/emoji
For a demo app using it, see http://emojinator.herokuapp.com/ 
and https://github.com/cldwalker/emojinator

Have fun!
Gabriel

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: hash-map initialization issue

2013-03-28 Thread Jonathan Fischer Friberg
No problem, glad to be of help. :)

Jonathan



On Thu, Mar 28, 2013 at 11:19 PM, Ryan  wrote:

> Thanks for all your help Jonathan :) I went with the standard fn syntax,
> its a two-liner anyway so not a big of deal :)
> The important part here was that I learned that #() executes the content
> as a function, very helpful!
>
> Ryan
>
>
> On Friday, March 29, 2013 12:08:04 AM UTC+2, Jonathan Fischer Friberg
> wrote:
>
>> It can still be done with the #(), with for example the hash-map function.
>> It's basically the same as the {} but as a function, like this:
>> (hash-map :a 3 :b 4)
>> => {:a 3, :b 4}
>>
>> So you should be able to write the function as:
>> #(hash-map :foo_id foo-id (keyword a-keyword) (:BAR_KEY %))
>>
>> I think you should use the standard (fn []) syntax though, since it's
>> shorter.
>>
>> > Hyphens is my preferred way as well, but, those keys represent sql
>> columns which they use underscore so I gotta go with underscores in order
>> code to match them :)
>> I see. :)
>>
>> Jonathan
>>
>>
>> On Thu, Mar 28, 2013 at 10:51 PM, Ryan  wrote:
>>
>>> Thanks for your explanation Jonathan. I am still a bit confused however
>>> what is the proper solution here. Should i use an anonymous function
>>> instead to do what I want or can it be done with the #() syntax?
>>>
>>> Hyphens is my preferred way as well, but, those keys represent sql
>>> columns which they use underscore so I gotta go with underscores in order
>>> code to match them :)
>>>
>>> Ryan
>>>
>>> On Thursday, March 28, 2013 11:24:38 PM UTC+2, Jonathan Fischer Friberg
>>> wrote:
>>>
 It's because the #() syntax always calls the content as a function.

 So #(...) is the same as (fn [] (...)). In your case,
 #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)})
 is the same as:
 (fn [%] ({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}))
 Note the extra () around {}. In other words, your map is called
 as a function.

 Maps can normally be called as functions, like this:
 ({:hello :world} :hello)
 => :world
 That's why you get the "Wrong number of args" error
 (and not a "a map is not a function" error).
 Hope that makes sense.

 Btw, hyphen is normally used instead of underscore
 in both variables and keywords. Just a slight style
 "issue", but maybe you had your reasons. :)

 Jonathan


 On Thu, Mar 28, 2013 at 10:16 PM, Ryan  wrote:

> Hello!
>
> I am having a small issue with a hash-map initialization and I am
> failing to understand why. I have the following situation:
>
> (def a-list '({:BAR_KEY bar-value}, {:BAR_KEY another-value}))
>
>
> (defn my-function [foo-id a-keyword a-list]
>
>   (map #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}) a-list))
>>
>
> So, by running the above function like this:
>
> (my-function 5 "my_keyword" a-list)
>
>
> I get the following error:
>
> *clojure.lang.ArityException: Wrong number of args (0) passed to:
>> PersistentArrayMap*
>
>
> I am trying to get the following result:
>
> ({:foo_id 5 :my_keyword bar-value}, {:foo_id 5 :my_keyword
> another-value})
>
> Any ideas? I have played around in repl for the last 2 hrs but I
> haven't found the proper way to do this.
>
> Thank you for your time :)
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
>
> Note that posts from new members are moderated - please be patient
> with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@**googlegroups.com
>
> For more options, visit this group at
> http://groups.google.com/**group**/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+u...@**googlegroups.com.
>
> For more options, visit 
> https://groups.google.com/**grou**ps/opt_out
> .
>
>
>

  --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@**googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop

Re: hash-map initialization issue

2013-03-28 Thread Ryan
Thanks for all your help Jonathan :) I went with the standard fn syntax, 
its a two-liner anyway so not a big of deal :)
The important part here was that I learned that #() executes the content as 
a function, very helpful!

Ryan

On Friday, March 29, 2013 12:08:04 AM UTC+2, Jonathan Fischer Friberg wrote:
>
> It can still be done with the #(), with for example the hash-map function.
> It's basically the same as the {} but as a function, like this:
> (hash-map :a 3 :b 4)
> => {:a 3, :b 4}
>
> So you should be able to write the function as:
> #(hash-map :foo_id foo-id (keyword a-keyword) (:BAR_KEY %))
>
> I think you should use the standard (fn []) syntax though, since it's 
> shorter.
>
> > Hyphens is my preferred way as well, but, those keys represent sql 
> columns which they use underscore so I gotta go with underscores in order 
> code to match them :)
> I see. :)
>
> Jonathan
>
>
> On Thu, Mar 28, 2013 at 10:51 PM, Ryan  >wrote:
>
>> Thanks for your explanation Jonathan. I am still a bit confused however 
>> what is the proper solution here. Should i use an anonymous function 
>> instead to do what I want or can it be done with the #() syntax?
>>
>> Hyphens is my preferred way as well, but, those keys represent sql 
>> columns which they use underscore so I gotta go with underscores in order 
>> code to match them :)
>>
>> Ryan
>>
>> On Thursday, March 28, 2013 11:24:38 PM UTC+2, Jonathan Fischer Friberg 
>> wrote:
>>
>>> It's because the #() syntax always calls the content as a function.
>>>
>>> So #(...) is the same as (fn [] (...)). In your case, 
>>> #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)})
>>> is the same as:
>>> (fn [%] ({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}))
>>> Note the extra () around {}. In other words, your map is called
>>> as a function.
>>>
>>> Maps can normally be called as functions, like this:
>>> ({:hello :world} :hello)
>>> => :world
>>> That's why you get the "Wrong number of args" error
>>> (and not a "a map is not a function" error).
>>> Hope that makes sense.
>>>
>>> Btw, hyphen is normally used instead of underscore
>>> in both variables and keywords. Just a slight style
>>> "issue", but maybe you had your reasons. :)
>>>
>>> Jonathan
>>>
>>>
>>> On Thu, Mar 28, 2013 at 10:16 PM, Ryan  wrote:
>>>
 Hello!

 I am having a small issue with a hash-map initialization and I am 
 failing to understand why. I have the following situation:

 (def a-list '({:BAR_KEY bar-value}, {:BAR_KEY another-value}))


 (defn my-function [foo-id a-keyword a-list] 

   (map #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}) a-list))
>

 So, by running the above function like this:

 (my-function 5 "my_keyword" a-list) 


 I get the following error:

 *clojure.lang.ArityException: Wrong number of args (0) passed to: 
> PersistentArrayMap*

  
 I am trying to get the following result:

 ({:foo_id 5 :my_keyword bar-value}, {:foo_id 5 :my_keyword 
 another-value})

 Any ideas? I have played around in repl for the last 2 hrs but I 
 haven't found the proper way to do this.

 Thank you for your time :)

  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clo...@googlegroups.com

 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups "Clojure" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .
  
  

>>>
>>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.

Re: Working with a huge graph - how can I make Clojure performant?

2013-03-28 Thread Niels van Klaveren
That's quoting far out of context Alan. All Christophe says in his blog is 
he dislikes the statefulness of most implementations of Tarjan, and shows 
how this isn't needed, and can be done in a functional way.

You could have stated the arguments why you think your version is superior, 
and it might very well be, but don't picture it like Christophe said he 
doesn't like his own implementation.

On Thursday, March 28, 2013 7:38:41 PM UTC+1, Alan Malloy wrote:
>
> Have you looked at https://github.com/jordanlewis/data.union-find ? 
> Personally, I'd prefer it to Christophe's implementation, since his blog 
> post seems to start with "I dislike this algorithm"; I also helped out a 
> bit in writing this version.
>
> On Monday, March 11, 2013 10:37:39 AM UTC-7, Balint Erdi wrote:
>>
>> Hey,
>>
>>
>> I got an assignment to implement an algorithm to calculate strongly 
>> connected components in a graph (
>> http://en.wikipedia.org/wiki/Kosaraju's_algorithm). The graph is rather 
>> big, it has ~900.000 vertices.
>>
>>
>> In its first pass, it needs to do a depth-first search on the graph and 
>> calculate the finishing time for each node (the finishing time for a node 
>> is a number from 0…V-1 where V is the number of vertices). Potentially 
>> several depth-first search need to be launched (done in the finishing-times 
>> function below) to discover all components.
>>
>>
>> The version I pasted below is the most performant. It discovers ~600.000 
>> vertices (2/3 of all vertices). However, on subsequent 
>> dfs-by-finishing-times it becomes extremely slow (exploring a handful of 
>> additional nodes/second) and I'm not sure why.
>>
>>
>> Here are a few things I tried to speed up the algorithm:
>>
>>
>> * rewrite to a recursive function (not tail-recursive) and use lazy-seqs
>>
>> * define dfs-by-finishing-times in finishing-times so that the whole 
>> graph (G) does not have to be passed at each call.
>>
>> * use persistent data structures everywhere instead of transients (I know 
>> this would only slow things down but it did not hurt to try)
>>
>> * use a profiler (VisualVM) to learn where the bottlenecks are. I'm not 
>> very proficient with profilers but I could not extract any valuable 
>> information
>>
>>
>> Here are the code snippets in question:
>>
>> (I also pasted it here: 
>> https://www.refheap.com/paste/3840cc772cc3a5b1d9c4f1db3 for better 
>> readability)
>>
>> (defn dfs-by-finishing-times
>>
>>   ([G u]
>>
>>  (dfs-by-finishing-times G u #{}))
>>
>>   ([G u explored]
>>
>>  (loop [[v & vs :as stack] (list u), explored (transient explored), 
>> lhalf [], rhalf [],  iter-cnt 0]
>>
>>  (if (seq stack)
>>
>>   (let [neighbors (persistent!
>>
>>(reduce
>>
>> (fn [c u] (if (explored u) c (conj! c u)))
>>
>> (transient [])
>>
>> (G v)))]
>>
>> (cond
>>
>>  (explored v) (recur vs explored lhalf rhalf (inc iter-cnt))
>>
>>  (empty? neighbors) (recur vs (conj! explored v) (conj lhalf 
>> v) rhalf (inc iter-cnt))
>>
>>  :else (recur (reduce (fn [stack e] (cons e stack)) vs 
>> neighbors)
>>
>>(conj! explored v)
>>
>>lhalf
>>
>>(cons v rhalf)
>>
>>(inc iter-cnt
>>
>>   (concat lhalf rhalf)))
>>
>>  ))
>>
>>
>> (defn finishing-times [G vertices]
>>
>>   "The first pass of Kosaraju's algorithm.
>>
>>Scan the transpose graph of G, and mark the finishing time for each.
>>
>>G should already be the transposed graph"
>>
>>   (loop [[u & vs :as stack] (seq vertices)
>>
>>   explored #{},
>>
>>   finished []]
>>
>>  (if (nil? u)
>>
>>finished
>>
>>(let [path (dfs-by-finishing-times G u explored)
>>
>>  new-explored (into explored path)]
>>
>>  (recur (remove new-explored vs)
>>
>> new-explored
>>
>> (into finished path))
>>
>> Do you have any insights into what technique I could use to speed up my 
>> algorithm? I'm pretty sure I'm missing a key point but I'm not sure 
>> what. Presumably the whole algorithm runs under 10 seconds in C# on the 
>> same graph so this is rather embarrassing :)
>>
>> Appreciate your help,
>>
>> Balint
>>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to

Re: hash-map initialization issue

2013-03-28 Thread Jonathan Fischer Friberg
It can still be done with the #(), with for example the hash-map function.
It's basically the same as the {} but as a function, like this:
(hash-map :a 3 :b 4)
=> {:a 3, :b 4}

So you should be able to write the function as:
#(hash-map :foo_id foo-id (keyword a-keyword) (:BAR_KEY %))

I think you should use the standard (fn []) syntax though, since it's
shorter.

> Hyphens is my preferred way as well, but, those keys represent sql
columns which they use underscore so I gotta go with underscores in order
code to match them :)
I see. :)

Jonathan


On Thu, Mar 28, 2013 at 10:51 PM, Ryan  wrote:

> Thanks for your explanation Jonathan. I am still a bit confused however
> what is the proper solution here. Should i use an anonymous function
> instead to do what I want or can it be done with the #() syntax?
>
> Hyphens is my preferred way as well, but, those keys represent sql columns
> which they use underscore so I gotta go with underscores in order code to
> match them :)
>
> Ryan
>
> On Thursday, March 28, 2013 11:24:38 PM UTC+2, Jonathan Fischer Friberg
> wrote:
>
>> It's because the #() syntax always calls the content as a function.
>>
>> So #(...) is the same as (fn [] (...)). In your case,
>> #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)})
>> is the same as:
>> (fn [%] ({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}))
>> Note the extra () around {}. In other words, your map is called
>> as a function.
>>
>> Maps can normally be called as functions, like this:
>> ({:hello :world} :hello)
>> => :world
>> That's why you get the "Wrong number of args" error
>> (and not a "a map is not a function" error).
>> Hope that makes sense.
>>
>> Btw, hyphen is normally used instead of underscore
>> in both variables and keywords. Just a slight style
>> "issue", but maybe you had your reasons. :)
>>
>> Jonathan
>>
>>
>> On Thu, Mar 28, 2013 at 10:16 PM, Ryan  wrote:
>>
>>> Hello!
>>>
>>> I am having a small issue with a hash-map initialization and I am
>>> failing to understand why. I have the following situation:
>>>
>>> (def a-list '({:BAR_KEY bar-value}, {:BAR_KEY another-value}))
>>>
>>>
>>> (defn my-function [foo-id a-keyword a-list]
>>>
>>>   (map #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}) a-list))

>>>
>>> So, by running the above function like this:
>>>
>>> (my-function 5 "my_keyword" a-list)
>>>
>>>
>>> I get the following error:
>>>
>>> *clojure.lang.ArityException: Wrong number of args (0) passed to:
 PersistentArrayMap*
>>>
>>>
>>> I am trying to get the following result:
>>>
>>> ({:foo_id 5 :my_keyword bar-value}, {:foo_id 5 :my_keyword
>>> another-value})
>>>
>>> Any ideas? I have played around in repl for the last 2 hrs but I haven't
>>> found the proper way to do this.
>>>
>>> Thank you for your time :)
>>>
>>>  --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>>
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@**googlegroups.com
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+u...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an ema

Re: hash-map initialization issue

2013-03-28 Thread Ryan
Thanks for your explanation Jonathan. I am still a bit confused however 
what is the proper solution here. Should i use an anonymous function 
instead to do what I want or can it be done with the #() syntax?

Hyphens is my preferred way as well, but, those keys represent sql columns 
which they use underscore so I gotta go with underscores in order code to 
match them :)

Ryan

On Thursday, March 28, 2013 11:24:38 PM UTC+2, Jonathan Fischer Friberg 
wrote:
>
> It's because the #() syntax always calls the content as a function.
>
> So #(...) is the same as (fn [] (...)). In your case, 
> #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)})
> is the same as:
> (fn [%] ({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}))
> Note the extra () around {}. In other words, your map is called
> as a function.
>
> Maps can normally be called as functions, like this:
> ({:hello :world} :hello)
> => :world
> That's why you get the "Wrong number of args" error
> (and not a "a map is not a function" error).
> Hope that makes sense.
>
> Btw, hyphen is normally used instead of underscore
> in both variables and keywords. Just a slight style
> "issue", but maybe you had your reasons. :)
>
> Jonathan
>
>
> On Thu, Mar 28, 2013 at 10:16 PM, Ryan  >wrote:
>
>> Hello!
>>
>> I am having a small issue with a hash-map initialization and I am failing 
>> to understand why. I have the following situation:
>>
>> (def a-list '({:BAR_KEY bar-value}, {:BAR_KEY another-value}))
>>
>>
>> (defn my-function [foo-id a-keyword a-list] 
>>
>>   (map #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}) a-list))
>>>
>>
>> So, by running the above function like this:
>>
>> (my-function 5 "my_keyword" a-list) 
>>
>>
>> I get the following error:
>>
>> *clojure.lang.ArityException: Wrong number of args (0) passed to: 
>>> PersistentArrayMap*
>>
>>  
>> I am trying to get the following result:
>>
>> ({:foo_id 5 :my_keyword bar-value}, {:foo_id 5 :my_keyword another-value})
>>
>> Any ideas? I have played around in repl for the last 2 hrs but I haven't 
>> found the proper way to do this.
>>
>> Thank you for your time :)
>>
>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the status of Clojure on LLVM or C?

2013-03-28 Thread Laurent PETIT
2013/3/28 Marko Topolnik :
> Or you may have just a trivial requirement for a program that both starts
> and executes quickly.

To what extent would an LLVM / C version of a Clojure program not
incur startup penalty as the JVM does.

As far as I understand it, the startup cost is manyfold:
1/ JVM startup
2/ loading of Clojure Core
3/ loading of non-lazy parts of your application (generally from
loading a global namespace to invoke its -main function)

I know AOT compilation can somehow reduce load-time of 2/ and 3/, but
not bring them to zero. As far as I understand it, all the namespaces
involved in your application will still have to be linearly executed,
in a depth-first manner following the graph of namespace dependencies
+ loaded configuration files etc. Only the compilations of functions
will be optimized into loading of their corresponding classes.

So, short of having a "image-like" environment, I wonder what the time
taken to do 2/ + 3/ would be in LLVM / C versions of Clojure.

Just asking, not even sure the above makes sense,

-- Laurent

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the status of Clojure on LLVM or C?

2013-03-28 Thread Marko Topolnik
Or you may have just a trivial requirement for a program that both starts *
and* executes quickly.

-marko

On Thursday, March 28, 2013 10:15:34 PM UTC+1, John Szakmeister wrote:
>
> On Wed, Mar 27, 2013 at 5:21 PM, Timothy Baldridge 
> > 
> wrote: 
> > What use-case do you have for such an implementation? Is there something 
> > that Clojure on LLVM will give you that Clojure on the JVM or on V8 
> won't 
> > allow you to do? 
>
> Clojure on C would likely allow me to use Clojure in a deeply embedded 
> environment.  Such as an ARM processor with 32MB of Flash and 64MB of 
> RAM.  To run the JVM, that may require licensing, and V8 doesn't allow 
> for threads. 
>
> I'm not the OP, but I thought I'd share my view too. 
>
> -John 
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: hash-map initialization issue

2013-03-28 Thread Jonathan Fischer Friberg
It's because the #() syntax always calls the content as a function.

So #(...) is the same as (fn [] (...)). In your case,
#({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)})
is the same as:
(fn [%] ({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}))
Note the extra () around {}. In other words, your map is called
as a function.

Maps can normally be called as functions, like this:
({:hello :world} :hello)
=> :world
That's why you get the "Wrong number of args" error
(and not a "a map is not a function" error).
Hope that makes sense.

Btw, hyphen is normally used instead of underscore
in both variables and keywords. Just a slight style
"issue", but maybe you had your reasons. :)

Jonathan


On Thu, Mar 28, 2013 at 10:16 PM, Ryan  wrote:

> Hello!
>
> I am having a small issue with a hash-map initialization and I am failing
> to understand why. I have the following situation:
>
> (def a-list '({:BAR_KEY bar-value}, {:BAR_KEY another-value}))
>
>
> (defn my-function [foo-id a-keyword a-list]
>
>   (map #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}) a-list))
>>
>
> So, by running the above function like this:
>
> (my-function 5 "my_keyword" a-list)
>
>
> I get the following error:
>
> *clojure.lang.ArityException: Wrong number of args (0) passed to:
>> PersistentArrayMap*
>
>
> I am trying to get the following result:
>
> ({:foo_id 5 :my_keyword bar-value}, {:foo_id 5 :my_keyword another-value})
>
> Any ideas? I have played around in repl for the last 2 hrs but I haven't
> found the proper way to do this.
>
> Thank you for your time :)
>
>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




hash-map initialization issue

2013-03-28 Thread Ryan
Hello!

I am having a small issue with a hash-map initialization and I am failing 
to understand why. I have the following situation:

(def a-list '({:BAR_KEY bar-value}, {:BAR_KEY another-value}))


(defn my-function [foo-id a-keyword a-list] 

  (map #({:foo_id foo-id (keyword a-keyword) (:BAR_KEY %)}) a-list))
>

So, by running the above function like this:

(my-function 5 "my_keyword" a-list) 


I get the following error:

*clojure.lang.ArityException: Wrong number of args (0) passed to: 
> PersistentArrayMap*

 
I am trying to get the following result:

({:foo_id 5 :my_keyword bar-value}, {:foo_id 5 :my_keyword another-value})

Any ideas? I have played around in repl for the last 2 hrs but I haven't 
found the proper way to do this.

Thank you for your time :)

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What is the status of Clojure on LLVM or C?

2013-03-28 Thread John Szakmeister
On Wed, Mar 27, 2013 at 5:21 PM, Timothy Baldridge  wrote:
> What use-case do you have for such an implementation? Is there something
> that Clojure on LLVM will give you that Clojure on the JVM or on V8 won't
> allow you to do?

Clojure on C would likely allow me to use Clojure in a deeply embedded
environment.  Such as an ARM processor with 32MB of Flash and 64MB of
RAM.  To run the JVM, that may require licensing, and V8 doesn't allow
for threads.

I'm not the OP, but I thought I'd share my view too.

-John

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Right Right.  That makes sense.  Thanks.

On Thursday, 28 March 2013 17:05:58 UTC-4, David Nolen wrote:
>
> On Thu, Mar 28, 2013 at 5:01 PM, JvJ >wrote:
>
>> (defn hates-drink
>>[d]
>>(is-drink d)
>>(not-likes-drink d))
>>
>
> This is a common mistake. But consider that the following hardly makes any 
> sense in Clojure either:
>
> (defn foo [a b]
>(+ a b)
>(- a b))
>
> Clearly the addition is going to get discarded ;)
>
> You must wrap conjunctions in a fresh or all (which is just sugar for 
> fresh w/o creating logic vars).
>  

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
On Thu, Mar 28, 2013 at 5:01 PM, JvJ  wrote:

> (defn hates-drink
>[d]
>(is-drink d)
>(not-likes-drink d))
>

This is a common mistake. But consider that the following hardly makes any
sense in Clojure either:

(defn foo [a b]
   (+ a b)
   (- a b))

Clearly the addition is going to get discarded ;)

You must wrap conjunctions in a fresh or all (which is just sugar for fresh
w/o creating logic vars).

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Also, on a side note, what's the deal with this:

(run* [q]
(is-drink q)
(not-likes-drink q))

(:dialogic2.bobbysally/Vodka :dialogic2.bobbysally/Daiquiri 
:dialogic2.bobbysally/Beer)


(defn hates-drink
   [d]
   (is-drink d)
   (not-likes-drink d))

(run* [q] (hates-drink q))

(_.0)

Why is it that, what appear to be essentially equivalent expressions don't 
do the same thing?  Does it have something to do with the fact that the 
hates-drink function definition somehow doesn't combine the two goals?

I actually redefined hates-drink to the following, and that worked.  What's 
the deal?

(defn hates-drink
  [d]
  (fresh []
 (is-drink d)
 (not-likes-drink d)))

On Thursday, 28 March 2013 16:53:09 UTC-4, David Nolen wrote:
>
> Excellent! :)
>
>
> On Thu, Mar 28, 2013 at 4:46 PM, JvJ >wrote:
>
>> HOORAY!  I did it all by myself! (with your help)
>>
>> (defn not-membero
>>   [x l] 
>>   (fresh [head tail]
>>  (conde
>>( (== l ()) )
>>( (conso head tail l)
>>  (!= x head)
>>  (not-membero x tail) 
>>
>> On Thursday, 28 March 2013 16:21:41 UTC-4, David Nolen wrote:
>>
>>> My point here isn't to tickle your brain but point out that there's a 
>>> bit of misunderstanding about how core.logic works and what facilities you 
>>> should use to handle your problem.
>>>
>>> It should be clear soon enough that it will be very difficult to 
>>> formulate your problem in terms of facts or conde.
>>>
>>> You said you wanted q to be a member of a some list A. Then why not use 
>>> membero? But you don't want q to be a member of some list B. Then try to 
>>> write a not-membero in terms of disequality.
>>>
>>> (run* [q]
>>>  (membero q '(1 2 3 4))
>>>  (not-membero q '(3 4 5 6)))
>>>
>>> David
>>>
>>>
>>> On Thu, Mar 28, 2013 at 4:12 PM, JvJ  wrote:
>>>
 Any other hints?  I'd love to spend time on this brain tickler, but I 
 have other things to do.


 On Thursday, 28 March 2013 16:05:00 UTC-4, JvJ wrote:
>
> Alright, I'm starting to get it but not quite there
>
> (run* [q]
> (fresh [x]
>   (conde
>( (== q 1) )
>( (== q 2) )
>( (== q 3) )
>( (== q 4) ))
>   
>   (conde
>( (== x 3) )
>( (== x 4) )
>( (== x 5) )
>( (== x 6) ))
>   
>   (!= q x)))
> (1 1 1 2 1 2 2 2 3 4 3 3 4 4)
>
> On Thursday, 28 March 2013 15:44:01 UTC-4, David Nolen wrote:
>>
>> This won't work. Rewrite this example w/o using facts and try to 
>> understand why it won't work.
>>
>> David
>>
>> On Thu, Mar 28, 2013 at 3:37 PM, JvJ  wrote:
>>
>>> Here's what I'm trying...
>>>
>>> (facts a  [[1]
>>>  [2]
>>>  [3]
>>>  [4]])
>>> nil
>>> (facts b  [[3]
>>>  [4]
>>>  [5]
>>>  [6]])
>>>
>>> (run* [q]
>>> (a q)
>>> (fresh [x]
>>>(b x)
>>>(!= q x)))
>>> (1 1 2 1 1 2 2 2 3 4 3 3 4 4)
>>>
>>> So what the heck is this all about?
>>>
>>> On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:
>>>
 negation is hard. This has come up several times. It may be 
 possible to a better form of negation as failure via delays, but this 
 not 
 high on my current priority list. Patches to make it work are of 
 course 
 most welcome.


 On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:

> Thanks, but there's another aspect to this.
>
> Let's say I had two relations A and B, and I wanted all q such that
> (A q)
> (not (B q))
>
> How would that work?
>
>
> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>
>> clojure.set/difference 
>> 'membero' combined with its negated form? 
>>
>> Jim 
>>
>> On 28/03/13 18:47, JvJ wrote: 
>> > In core.logic, how do the following: "Give me everything that 
>> is a 
>> > member of list A and not a member of list B"? 
>> > -- 
>> > -- 
>> > You received this message because you are subscribed to the 
>> Google 
>> > Groups "Clojure" group. 
>> > To post to this group, send email to clo...@googlegroups.com 
>> > Note that posts from new members are moderated - please be 
>> patient 
>> > with your first post. 
>> > To unsubscribe from this group, send email to 
>> > clojure+u...@**googlegroups.com 
>> > For more options, visit this group at 
>> > http://groups.google.com/**group**/clojure?hl=en
>> >  
>> > --- 
>> > You received this message because you are subscribed to the 
>> Google 
>> > Groups "Clojure" group. 
>> > To unsubscribe from this group and stop receiving ema

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Also, on a side note, the following doesn't seem to make sense:

(defn hates-drink
  [d]




On Thursday, 28 March 2013 16:53:09 UTC-4, David Nolen wrote:
>
> Excellent! :)
>
>
> On Thu, Mar 28, 2013 at 4:46 PM, JvJ >wrote:
>
>> HOORAY!  I did it all by myself! (with your help)
>>
>> (defn not-membero
>>   [x l] 
>>   (fresh [head tail]
>>  (conde
>>( (== l ()) )
>>( (conso head tail l)
>>  (!= x head)
>>  (not-membero x tail) 
>>
>> On Thursday, 28 March 2013 16:21:41 UTC-4, David Nolen wrote:
>>
>>> My point here isn't to tickle your brain but point out that there's a 
>>> bit of misunderstanding about how core.logic works and what facilities you 
>>> should use to handle your problem.
>>>
>>> It should be clear soon enough that it will be very difficult to 
>>> formulate your problem in terms of facts or conde.
>>>
>>> You said you wanted q to be a member of a some list A. Then why not use 
>>> membero? But you don't want q to be a member of some list B. Then try to 
>>> write a not-membero in terms of disequality.
>>>
>>> (run* [q]
>>>  (membero q '(1 2 3 4))
>>>  (not-membero q '(3 4 5 6)))
>>>
>>> David
>>>
>>>
>>> On Thu, Mar 28, 2013 at 4:12 PM, JvJ  wrote:
>>>
 Any other hints?  I'd love to spend time on this brain tickler, but I 
 have other things to do.


 On Thursday, 28 March 2013 16:05:00 UTC-4, JvJ wrote:
>
> Alright, I'm starting to get it but not quite there
>
> (run* [q]
> (fresh [x]
>   (conde
>( (== q 1) )
>( (== q 2) )
>( (== q 3) )
>( (== q 4) ))
>   
>   (conde
>( (== x 3) )
>( (== x 4) )
>( (== x 5) )
>( (== x 6) ))
>   
>   (!= q x)))
> (1 1 1 2 1 2 2 2 3 4 3 3 4 4)
>
> On Thursday, 28 March 2013 15:44:01 UTC-4, David Nolen wrote:
>>
>> This won't work. Rewrite this example w/o using facts and try to 
>> understand why it won't work.
>>
>> David
>>
>> On Thu, Mar 28, 2013 at 3:37 PM, JvJ  wrote:
>>
>>> Here's what I'm trying...
>>>
>>> (facts a  [[1]
>>>  [2]
>>>  [3]
>>>  [4]])
>>> nil
>>> (facts b  [[3]
>>>  [4]
>>>  [5]
>>>  [6]])
>>>
>>> (run* [q]
>>> (a q)
>>> (fresh [x]
>>>(b x)
>>>(!= q x)))
>>> (1 1 2 1 1 2 2 2 3 4 3 3 4 4)
>>>
>>> So what the heck is this all about?
>>>
>>> On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:
>>>
 negation is hard. This has come up several times. It may be 
 possible to a better form of negation as failure via delays, but this 
 not 
 high on my current priority list. Patches to make it work are of 
 course 
 most welcome.


 On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:

> Thanks, but there's another aspect to this.
>
> Let's say I had two relations A and B, and I wanted all q such that
> (A q)
> (not (B q))
>
> How would that work?
>
>
> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>
>> clojure.set/difference 
>> 'membero' combined with its negated form? 
>>
>> Jim 
>>
>> On 28/03/13 18:47, JvJ wrote: 
>> > In core.logic, how do the following: "Give me everything that 
>> is a 
>> > member of list A and not a member of list B"? 
>> > -- 
>> > -- 
>> > You received this message because you are subscribed to the 
>> Google 
>> > Groups "Clojure" group. 
>> > To post to this group, send email to clo...@googlegroups.com 
>> > Note that posts from new members are moderated - please be 
>> patient 
>> > with your first post. 
>> > To unsubscribe from this group, send email to 
>> > clojure+u...@**googlegroups.com 
>> > For more options, visit this group at 
>> > http://groups.google.com/**group**/clojure?hl=en
>> >  
>> > --- 
>> > You received this message because you are subscribed to the 
>> Google 
>> > Groups "Clojure" group. 
>> > To unsubscribe from this group and stop receiving emails from 
>> it, send 
>> > an email to clojure+u...@**googlegroups.com. 
>> > For more options, visit https://groups.google.com/**grou**
>> ps/opt_out . 
>> > 
>> > 
>>
>>  -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient 
> with your first post.

Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
Excellent! :)


On Thu, Mar 28, 2013 at 4:46 PM, JvJ  wrote:

> HOORAY!  I did it all by myself! (with your help)
>
> (defn not-membero
>   [x l]
>   (fresh [head tail]
>  (conde
>( (== l ()) )
>( (conso head tail l)
>  (!= x head)
>  (not-membero x tail) 
>
> On Thursday, 28 March 2013 16:21:41 UTC-4, David Nolen wrote:
>
>> My point here isn't to tickle your brain but point out that there's a bit
>> of misunderstanding about how core.logic works and what facilities you
>> should use to handle your problem.
>>
>> It should be clear soon enough that it will be very difficult to
>> formulate your problem in terms of facts or conde.
>>
>> You said you wanted q to be a member of a some list A. Then why not use
>> membero? But you don't want q to be a member of some list B. Then try to
>> write a not-membero in terms of disequality.
>>
>> (run* [q]
>>  (membero q '(1 2 3 4))
>>  (not-membero q '(3 4 5 6)))
>>
>> David
>>
>>
>> On Thu, Mar 28, 2013 at 4:12 PM, JvJ  wrote:
>>
>>> Any other hints?  I'd love to spend time on this brain tickler, but I
>>> have other things to do.
>>>
>>>
>>> On Thursday, 28 March 2013 16:05:00 UTC-4, JvJ wrote:

 Alright, I'm starting to get it but not quite there

 (run* [q]
 (fresh [x]
   (conde
( (== q 1) )
( (== q 2) )
( (== q 3) )
( (== q 4) ))

   (conde
( (== x 3) )
( (== x 4) )
( (== x 5) )
( (== x 6) ))

   (!= q x)))
 (1 1 1 2 1 2 2 2 3 4 3 3 4 4)

 On Thursday, 28 March 2013 15:44:01 UTC-4, David Nolen wrote:
>
> This won't work. Rewrite this example w/o using facts and try to
> understand why it won't work.
>
> David
>
> On Thu, Mar 28, 2013 at 3:37 PM, JvJ  wrote:
>
>> Here's what I'm trying...
>>
>> (facts a  [[1]
>>  [2]
>>  [3]
>>  [4]])
>> nil
>> (facts b  [[3]
>>  [4]
>>  [5]
>>  [6]])
>>
>> (run* [q]
>> (a q)
>> (fresh [x]
>>(b x)
>>(!= q x)))
>> (1 1 2 1 1 2 2 2 3 4 3 3 4 4)
>>
>> So what the heck is this all about?
>>
>> On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:
>>
>>> negation is hard. This has come up several times. It may be possible
>>> to a better form of negation as failure via delays, but this not high 
>>> on my
>>> current priority list. Patches to make it work are of course most 
>>> welcome.
>>>
>>>
>>> On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:
>>>
 Thanks, but there's another aspect to this.

 Let's say I had two relations A and B, and I wanted all q such that
 (A q)
 (not (B q))

 How would that work?


 On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:

> clojure.set/difference
> 'membero' combined with its negated form?
>
> Jim
>
> On 28/03/13 18:47, JvJ wrote:
> > In core.logic, how do the following: "Give me everything that is
> a
> > member of list A and not a member of list B"?
> > --
> > --
> > You received this message because you are subscribed to the
> Google
> > Groups "Clojure" group.
> > To post to this group, send email to clo...@googlegroups.com
> > Note that posts from new members are moderated - please be
> patient
> > with your first post.
> > To unsubscribe from this group, send email to
> > clojure+u...@**googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/**group**/clojure?hl=en
> > ---
> > You received this message because you are subscribed to the
> Google
> > Groups "Clojure" group.
> > To unsubscribe from this group and stop receiving emails from
> it, send
> > an email to clojure+u...@**googlegroups.com.
> > For more options, visit https://groups.google.com/**grou**
> ps/opt_out .
> >
> >
>
>  --
 --
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient
 with your first post.
 To unsubscribe from this group, send email to
 clojure+u...@**googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To unsu

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
HOORAY!  I did it all by myself! (with your help)

(defn not-membero
  [x l] 
  (fresh [head tail]
 (conde
   ( (== l ()) )
   ( (conso head tail l)
 (!= x head)
 (not-membero x tail) 

On Thursday, 28 March 2013 16:21:41 UTC-4, David Nolen wrote:
>
> My point here isn't to tickle your brain but point out that there's a bit 
> of misunderstanding about how core.logic works and what facilities you 
> should use to handle your problem.
>
> It should be clear soon enough that it will be very difficult to formulate 
> your problem in terms of facts or conde.
>
> You said you wanted q to be a member of a some list A. Then why not use 
> membero? But you don't want q to be a member of some list B. Then try to 
> write a not-membero in terms of disequality.
>
> (run* [q]
>  (membero q '(1 2 3 4))
>  (not-membero q '(3 4 5 6)))
>
> David
>
>
> On Thu, Mar 28, 2013 at 4:12 PM, JvJ >wrote:
>
>> Any other hints?  I'd love to spend time on this brain tickler, but I 
>> have other things to do.
>>
>>
>> On Thursday, 28 March 2013 16:05:00 UTC-4, JvJ wrote:
>>>
>>> Alright, I'm starting to get it but not quite there
>>>
>>> (run* [q]
>>> (fresh [x]
>>>   (conde
>>>( (== q 1) )
>>>( (== q 2) )
>>>( (== q 3) )
>>>( (== q 4) ))
>>>   
>>>   (conde
>>>( (== x 3) )
>>>( (== x 4) )
>>>( (== x 5) )
>>>( (== x 6) ))
>>>   
>>>   (!= q x)))
>>> (1 1 1 2 1 2 2 2 3 4 3 3 4 4)
>>>
>>> On Thursday, 28 March 2013 15:44:01 UTC-4, David Nolen wrote:

 This won't work. Rewrite this example w/o using facts and try to 
 understand why it won't work.

 David

 On Thu, Mar 28, 2013 at 3:37 PM, JvJ  wrote:

> Here's what I'm trying...
>
> (facts a  [[1]
>  [2]
>  [3]
>  [4]])
> nil
> (facts b  [[3]
>  [4]
>  [5]
>  [6]])
>
> (run* [q]
> (a q)
> (fresh [x]
>(b x)
>(!= q x)))
> (1 1 2 1 1 2 2 2 3 4 3 3 4 4)
>
> So what the heck is this all about?
>
> On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:
>
>> negation is hard. This has come up several times. It may be possible 
>> to a better form of negation as failure via delays, but this not high on 
>> my 
>> current priority list. Patches to make it work are of course most 
>> welcome.
>>
>>
>> On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:
>>
>>> Thanks, but there's another aspect to this.
>>>
>>> Let's say I had two relations A and B, and I wanted all q such that
>>> (A q)
>>> (not (B q))
>>>
>>> How would that work?
>>>
>>>
>>> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>>>
 clojure.set/difference 
 'membero' combined with its negated form? 

 Jim 

 On 28/03/13 18:47, JvJ wrote: 
 > In core.logic, how do the following: "Give me everything that is 
 a 
 > member of list A and not a member of list B"? 
 > -- 
 > -- 
 > You received this message because you are subscribed to the 
 Google 
 > Groups "Clojure" group. 
 > To post to this group, send email to clo...@googlegroups.com 
 > Note that posts from new members are moderated - please be 
 patient 
 > with your first post. 
 > To unsubscribe from this group, send email to 
 > clojure+u...@**googlegroups.com 
 > For more options, visit this group at 
 > http://groups.google.com/**group/clojure?hl=en
 >  
 > --- 
 > You received this message because you are subscribed to the 
 Google 
 > Groups "Clojure" group. 
 > To unsubscribe from this group and stop receiving emails from it, 
 send 
 > an email to clojure+u...@**googlegroups.com. 
 > For more options, visit https://groups.google.com/**grou
 ps/opt_out . 
 > 
 > 

  -- 
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient 
>>> with your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@**googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**group**/clojure?hl=en
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, 
>>> send an email to clojure+u...@**googlegroups.com.
>>> For more options, visit 
>>> https://groups

Re: Reader bug?

2013-03-28 Thread David Powell
Internally they might be the same thing, but lexically they aren't; eg,
Clojure string literals can wrap over multiple lines, and Java strings
can't.

On Thu, Mar 28, 2013 at 8:19 PM, Mark Engelberg wrote:

> According to the Java docs, Java strings support eight escape characters.
> http://docs.oracle.com/javase/tutorial/java/data/characters.html
> One of the valid escape characters is \'
>
> Clojure strings are supposed to be the same as Java strings, but when I
> type the following string into the Clojure REPL, I get an error that \' is
> an unsupported escape character:
> "\'"
>
> Does Clojure have some intentional reason for not fully supporting the
> spec for Java strings, or is this just a bug?
>
> --Mark
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
My point here isn't to tickle your brain but point out that there's a bit
of misunderstanding about how core.logic works and what facilities you
should use to handle your problem.

It should be clear soon enough that it will be very difficult to formulate
your problem in terms of facts or conde.

You said you wanted q to be a member of a some list A. Then why not use
membero? But you don't want q to be a member of some list B. Then try to
write a not-membero in terms of disequality.

(run* [q]
 (membero q '(1 2 3 4))
 (not-membero q '(3 4 5 6)))

David


On Thu, Mar 28, 2013 at 4:12 PM, JvJ  wrote:

> Any other hints?  I'd love to spend time on this brain tickler, but I have
> other things to do.
>
>
> On Thursday, 28 March 2013 16:05:00 UTC-4, JvJ wrote:
>>
>> Alright, I'm starting to get it but not quite there
>>
>> (run* [q]
>> (fresh [x]
>>   (conde
>>( (== q 1) )
>>( (== q 2) )
>>( (== q 3) )
>>( (== q 4) ))
>>
>>   (conde
>>( (== x 3) )
>>( (== x 4) )
>>( (== x 5) )
>>( (== x 6) ))
>>
>>   (!= q x)))
>> (1 1 1 2 1 2 2 2 3 4 3 3 4 4)
>>
>> On Thursday, 28 March 2013 15:44:01 UTC-4, David Nolen wrote:
>>>
>>> This won't work. Rewrite this example w/o using facts and try to
>>> understand why it won't work.
>>>
>>> David
>>>
>>> On Thu, Mar 28, 2013 at 3:37 PM, JvJ  wrote:
>>>
 Here's what I'm trying...

 (facts a  [[1]
  [2]
  [3]
  [4]])
 nil
 (facts b  [[3]
  [4]
  [5]
  [6]])

 (run* [q]
 (a q)
 (fresh [x]
(b x)
(!= q x)))
 (1 1 2 1 1 2 2 2 3 4 3 3 4 4)

 So what the heck is this all about?

 On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:

> negation is hard. This has come up several times. It may be possible
> to a better form of negation as failure via delays, but this not high on 
> my
> current priority list. Patches to make it work are of course most welcome.
>
>
> On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:
>
>> Thanks, but there's another aspect to this.
>>
>> Let's say I had two relations A and B, and I wanted all q such that
>> (A q)
>> (not (B q))
>>
>> How would that work?
>>
>>
>> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>>
>>> clojure.set/difference
>>> 'membero' combined with its negated form?
>>>
>>> Jim
>>>
>>> On 28/03/13 18:47, JvJ wrote:
>>> > In core.logic, how do the following: "Give me everything that is a
>>> > member of list A and not a member of list B"?
>>> > --
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups "Clojure" group.
>>> > To post to this group, send email to clo...@googlegroups.com
>>> > Note that posts from new members are moderated - please be patient
>>> > with your first post.
>>> > To unsubscribe from this group, send email to
>>> > clojure+u...@**googlegroups.com
>>> > For more options, visit this group at
>>> > http://groups.google.com/**group/clojure?hl=en
>>> > ---
>>> > You received this message because you are subscribed to the Google
>>> > Groups "Clojure" group.
>>> > To unsubscribe from this group and stop receiving emails from it,
>>> send
>>> > an email to clojure+u...@**googlegroups.com.
>>> > For more options, visit https://groups.google.com/**grou
>>> ps/opt_out .
>>> >
>>> >
>>>
>>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient
>> with your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@**googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/**group**/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to clojure+u...@**googlegroups.com.
>> For more options, visit 
>> https://groups.google.com/**grou**ps/opt_out
>> .
>>
>>
>>
>
>  --
 --
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com
 For more options, visit this group

Reader bug?

2013-03-28 Thread Mark Engelberg
According to the Java docs, Java strings support eight escape characters.
http://docs.oracle.com/javase/tutorial/java/data/characters.html
One of the valid escape characters is \'

Clojure strings are supposed to be the same as Java strings, but when I
type the following string into the Clojure REPL, I get an error that \' is
an unsupported escape character:
"\'"

Does Clojure have some intentional reason for not fully supporting the spec
for Java strings, or is this just a bug?

--Mark

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Btw if I sounded sarcastic I wasn't.  I actually would love to spend time 
thinking about it.

On Thursday, 28 March 2013 16:12:06 UTC-4, JvJ wrote:
>
> Any other hints?  I'd love to spend time on this brain tickler, but I have 
> other things to do.
>
> On Thursday, 28 March 2013 16:05:00 UTC-4, JvJ wrote:
>>
>> Alright, I'm starting to get it but not quite there
>>
>> (run* [q]
>> (fresh [x]
>>   (conde
>>( (== q 1) )
>>( (== q 2) )
>>( (== q 3) )
>>( (== q 4) ))
>>   
>>   (conde
>>( (== x 3) )
>>( (== x 4) )
>>( (== x 5) )
>>( (== x 6) ))
>>   
>>   (!= q x)))
>> (1 1 1 2 1 2 2 2 3 4 3 3 4 4)
>>
>> On Thursday, 28 March 2013 15:44:01 UTC-4, David Nolen wrote:
>>>
>>> This won't work. Rewrite this example w/o using facts and try to 
>>> understand why it won't work.
>>>
>>> David
>>>
>>> On Thu, Mar 28, 2013 at 3:37 PM, JvJ  wrote:
>>>
 Here's what I'm trying...

 (facts a  [[1]
  [2]
  [3]
  [4]])
 nil
 (facts b  [[3]
  [4]
  [5]
  [6]])

 (run* [q]
 (a q)
 (fresh [x]
(b x)
(!= q x)))
 (1 1 2 1 1 2 2 2 3 4 3 3 4 4)

 So what the heck is this all about?

 On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:

> negation is hard. This has come up several times. It may be possible 
> to a better form of negation as failure via delays, but this not high on 
> my 
> current priority list. Patches to make it work are of course most welcome.
>
>
> On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:
>
>> Thanks, but there's another aspect to this.
>>
>> Let's say I had two relations A and B, and I wanted all q such that
>> (A q)
>> (not (B q))
>>
>> How would that work?
>>
>>
>> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>>
>>> clojure.set/difference 
>>> 'membero' combined with its negated form? 
>>>
>>> Jim 
>>>
>>> On 28/03/13 18:47, JvJ wrote: 
>>> > In core.logic, how do the following: "Give me everything that is a 
>>> > member of list A and not a member of list B"? 
>>> > -- 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> > Groups "Clojure" group. 
>>> > To post to this group, send email to clo...@googlegroups.com 
>>> > Note that posts from new members are moderated - please be patient 
>>> > with your first post. 
>>> > To unsubscribe from this group, send email to 
>>> > clojure+u...@**googlegroups.com 
>>> > For more options, visit this group at 
>>> > http://groups.google.com/**group**/clojure?hl=en
>>> >  
>>> > --- 
>>> > You received this message because you are subscribed to the Google 
>>> > Groups "Clojure" group. 
>>> > To unsubscribe from this group and stop receiving emails from it, 
>>> send 
>>> > an email to clojure+u...@**googlegroups.com. 
>>> > For more options, visit https://groups.google.com/**grou**
>>> ps/opt_out . 
>>> > 
>>> > 
>>>
>>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient 
>> with your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@**googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/**group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google 
>> Groups "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, 
>> send an email to clojure+u...@**googlegroups.com.
>> For more options, visit 
>> https://groups.google.com/**groups/opt_out
>> .
>>  
>>  
>>
>
>  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups "Clojure" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

>>>
>>>

-- 
-- 
You rece

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Any other hints?  I'd love to spend time on this brain tickler, but I have 
other things to do.

On Thursday, 28 March 2013 16:05:00 UTC-4, JvJ wrote:
>
> Alright, I'm starting to get it but not quite there
>
> (run* [q]
> (fresh [x]
>   (conde
>( (== q 1) )
>( (== q 2) )
>( (== q 3) )
>( (== q 4) ))
>   
>   (conde
>( (== x 3) )
>( (== x 4) )
>( (== x 5) )
>( (== x 6) ))
>   
>   (!= q x)))
> (1 1 1 2 1 2 2 2 3 4 3 3 4 4)
>
> On Thursday, 28 March 2013 15:44:01 UTC-4, David Nolen wrote:
>>
>> This won't work. Rewrite this example w/o using facts and try to 
>> understand why it won't work.
>>
>> David
>>
>> On Thu, Mar 28, 2013 at 3:37 PM, JvJ  wrote:
>>
>>> Here's what I'm trying...
>>>
>>> (facts a  [[1]
>>>  [2]
>>>  [3]
>>>  [4]])
>>> nil
>>> (facts b  [[3]
>>>  [4]
>>>  [5]
>>>  [6]])
>>>
>>> (run* [q]
>>> (a q)
>>> (fresh [x]
>>>(b x)
>>>(!= q x)))
>>> (1 1 2 1 1 2 2 2 3 4 3 3 4 4)
>>>
>>> So what the heck is this all about?
>>>
>>> On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:
>>>
 negation is hard. This has come up several times. It may be possible to 
 a better form of negation as failure via delays, but this not high on my 
 current priority list. Patches to make it work are of course most welcome.


 On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:

> Thanks, but there's another aspect to this.
>
> Let's say I had two relations A and B, and I wanted all q such that
> (A q)
> (not (B q))
>
> How would that work?
>
>
> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>
>> clojure.set/difference 
>> 'membero' combined with its negated form? 
>>
>> Jim 
>>
>> On 28/03/13 18:47, JvJ wrote: 
>> > In core.logic, how do the following: "Give me everything that is a 
>> > member of list A and not a member of list B"? 
>> > -- 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> > Groups "Clojure" group. 
>> > To post to this group, send email to clo...@googlegroups.com 
>> > Note that posts from new members are moderated - please be patient 
>> > with your first post. 
>> > To unsubscribe from this group, send email to 
>> > clojure+u...@**googlegroups.com 
>> > For more options, visit this group at 
>> > http://groups.google.com/**group**/clojure?hl=en
>> >  
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> > Groups "Clojure" group. 
>> > To unsubscribe from this group and stop receiving emails from it, 
>> send 
>> > an email to clojure+u...@**googlegroups.com. 
>> > For more options, visit https://groups.google.com/**grou**
>> ps/opt_out . 
>> > 
>> > 
>>
>>  -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient 
> with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@**googlegroups.com
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google 
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to clojure+u...@**googlegroups.com.
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>  
>  
>

  -- 
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with 
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to clojure+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegrou

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Alright, I'm starting to get it but not quite there

(run* [q]
(fresh [x]
  (conde
   ( (== q 1) )
   ( (== q 2) )
   ( (== q 3) )
   ( (== q 4) ))
  
  (conde
   ( (== x 3) )
   ( (== x 4) )
   ( (== x 5) )
   ( (== x 6) ))
  
  (!= q x)))
(1 1 1 2 1 2 2 2 3 4 3 3 4 4)

On Thursday, 28 March 2013 15:44:01 UTC-4, David Nolen wrote:
>
> This won't work. Rewrite this example w/o using facts and try to 
> understand why it won't work.
>
> David
>
> On Thu, Mar 28, 2013 at 3:37 PM, JvJ >wrote:
>
>> Here's what I'm trying...
>>
>> (facts a  [[1]
>>  [2]
>>  [3]
>>  [4]])
>> nil
>> (facts b  [[3]
>>  [4]
>>  [5]
>>  [6]])
>>
>> (run* [q]
>> (a q)
>> (fresh [x]
>>(b x)
>>(!= q x)))
>> (1 1 2 1 1 2 2 2 3 4 3 3 4 4)
>>
>> So what the heck is this all about?
>>
>> On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:
>>
>>> negation is hard. This has come up several times. It may be possible to 
>>> a better form of negation as failure via delays, but this not high on my 
>>> current priority list. Patches to make it work are of course most welcome.
>>>
>>>
>>> On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:
>>>
 Thanks, but there's another aspect to this.

 Let's say I had two relations A and B, and I wanted all q such that
 (A q)
 (not (B q))

 How would that work?


 On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:

> clojure.set/difference 
> 'membero' combined with its negated form? 
>
> Jim 
>
> On 28/03/13 18:47, JvJ wrote: 
> > In core.logic, how do the following: "Give me everything that is a 
> > member of list A and not a member of list B"? 
> > -- 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> > Note that posts from new members are moderated - please be patient 
> > with your first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@**googlegroups.com 
> > For more options, visit this group at 
> > http://groups.google.com/**group**/clojure?hl=en
> >  
> > --- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To unsubscribe from this group and stop receiving emails from it, 
> send 
> > an email to clojure+u...@**googlegroups.com. 
> > For more options, visit 
> > https://groups.google.com/**grou**ps/opt_out.
> >  
>
> > 
> > 
>
>  -- 
 -- 
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clo...@googlegroups.com
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@**googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups "Clojure" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to clojure+u...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .
  
  

>>>
>>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googleg

Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
This won't work. Rewrite this example w/o using facts and try to understand
why it won't work.

David

On Thu, Mar 28, 2013 at 3:37 PM, JvJ  wrote:

> Here's what I'm trying...
>
> (facts a  [[1]
>  [2]
>  [3]
>  [4]])
> nil
> (facts b  [[3]
>  [4]
>  [5]
>  [6]])
>
> (run* [q]
> (a q)
> (fresh [x]
>(b x)
>(!= q x)))
> (1 1 2 1 1 2 2 2 3 4 3 3 4 4)
>
> So what the heck is this all about?
>
> On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:
>
>> negation is hard. This has come up several times. It may be possible to a
>> better form of negation as failure via delays, but this not high on my
>> current priority list. Patches to make it work are of course most welcome.
>>
>>
>> On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:
>>
>>> Thanks, but there's another aspect to this.
>>>
>>> Let's say I had two relations A and B, and I wanted all q such that
>>> (A q)
>>> (not (B q))
>>>
>>> How would that work?
>>>
>>>
>>> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>>>
 clojure.set/difference
 'membero' combined with its negated form?

 Jim

 On 28/03/13 18:47, JvJ wrote:
 > In core.logic, how do the following: "Give me everything that is a
 > member of list A and not a member of list B"?
 > --
 > --
 > You received this message because you are subscribed to the Google
 > Groups "Clojure" group.
 > To post to this group, send email to clo...@googlegroups.com
 > Note that posts from new members are moderated - please be patient
 > with your first post.
 > To unsubscribe from this group, send email to
 > clojure+u...@**googlegroups.com
 > For more options, visit this group at
 > http://groups.google.com/**group**/clojure?hl=en
 > ---
 > You received this message because you are subscribed to the Google
 > Groups "Clojure" group.
 > To unsubscribe from this group and stop receiving emails from it,
 send
 > an email to clojure+u...@**googlegroups.com.
 > For more options, visit 
 > https://groups.google.com/**grou**ps/opt_out.

 >
 >

  --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@**googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+u...@**googlegroups.com.
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Here's what I'm trying...

(facts a  [[1]
 [2]
 [3]
 [4]])
nil
(facts b  [[3]
 [4]
 [5]
 [6]])

(run* [q]
(a q)
(fresh [x]
   (b x)
   (!= q x)))
(1 1 2 1 1 2 2 2 3 4 3 3 4 4)

So what the heck is this all about?

On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote:
>
> negation is hard. This has come up several times. It may be possible to a 
> better form of negation as failure via delays, but this not high on my 
> current priority list. Patches to make it work are of course most welcome.
>
>
> On Thu, Mar 28, 2013 at 2:54 PM, JvJ >wrote:
>
>> Thanks, but there's another aspect to this.
>>
>> Let's say I had two relations A and B, and I wanted all q such that
>> (A q)
>> (not (B q))
>>
>> How would that work?
>>
>>
>> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>>
>>> clojure.set/difference 
>>> 'membero' combined with its negated form? 
>>>
>>> Jim 
>>>
>>> On 28/03/13 18:47, JvJ wrote: 
>>> > In core.logic, how do the following: "Give me everything that is a 
>>> > member of list A and not a member of list B"? 
>>> > -- 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> > Groups "Clojure" group. 
>>> > To post to this group, send email to clo...@googlegroups.com 
>>> > Note that posts from new members are moderated - please be patient 
>>> > with your first post. 
>>> > To unsubscribe from this group, send email to 
>>> > clojure+u...@**googlegroups.com 
>>> > For more options, visit this group at 
>>> > http://groups.google.com/**group/clojure?hl=en
>>> >  
>>> > --- 
>>> > You received this message because you are subscribed to the Google 
>>> > Groups "Clojure" group. 
>>> > To unsubscribe from this group and stop receiving emails from it, send 
>>> > an email to clojure+u...@**googlegroups.com. 
>>> > For more options, visit 
>>> > https://groups.google.com/**groups/opt_out.
>>> >  
>>>
>>> > 
>>> > 
>>>
>>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
negation is hard. This has come up several times. It may be possible to a
better form of negation as failure via delays, but this not high on my
current priority list. Patches to make it work are of course most welcome.


On Thu, Mar 28, 2013 at 2:54 PM, JvJ  wrote:

> Thanks, but there's another aspect to this.
>
> Let's say I had two relations A and B, and I wanted all q such that
> (A q)
> (not (B q))
>
> How would that work?
>
>
> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>
>> clojure.set/difference
>> 'membero' combined with its negated form?
>>
>> Jim
>>
>> On 28/03/13 18:47, JvJ wrote:
>> > In core.logic, how do the following: "Give me everything that is a
>> > member of list A and not a member of list B"?
>> > --
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clo...@googlegroups.com
>> > Note that posts from new members are moderated - please be patient
>> > with your first post.
>> > To unsubscribe from this group, send email to
>> > clojure+u...@**googlegroups.com
>> > For more options, visit this group at
>> > http://groups.google.com/**group/clojure?hl=en
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an email to clojure+u...@**googlegroups.com.
>> > For more options, visit 
>> > https://groups.google.com/**groups/opt_out.
>>
>> >
>> >
>>
>>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread Alex Baranosky
Jim,

No reason I left out loop/recur.  I just didn't get around to it.  Pull
requests accepted.

On Thu, Mar 28, 2013 at 12:07 PM, Alex Baranosky <
alexander.barano...@gmail.com> wrote:

> adrians,
>
> https://clojars.org/print-foo
>
> I've got to deploy it with proper signing.
>
>
> On Thu, Mar 28, 2013 at 11:59 AM, adrians  wrote:
>
>> Alex, print-foo *is* the correct artifact name, no? It seemed to be
>> pulled down fine by pomegranate.
>>
>>
>> On Thursday, March 28, 2013 2:35:31 PM UTC-4, Alex Baranosky wrote:
>>>
>>> Let me fix the README, the library should be required like this
>>> (:require [print.foo :refer :all])
>>>
>>  --
>> --
>> 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 post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread Alex Baranosky
adrians,

https://clojars.org/print-foo

I've got to deploy it with proper signing.

On Thu, Mar 28, 2013 at 11:59 AM, adrians  wrote:

> Alex, print-foo *is* the correct artifact name, no? It seemed to be
> pulled down fine by pomegranate.
>
>
> On Thursday, March 28, 2013 2:35:31 PM UTC-4, Alex Baranosky wrote:
>>
>> Let me fix the README, the library should be required like this (:require
>> [print.foo :refer :all])
>>
>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
You can express not member of list B with disequality. I could show you how
to do this, but you'd probably learn more by giving it a try yourself ;)


On Thu, Mar 28, 2013 at 2:47 PM, JvJ  wrote:

> In core.logic, how do the following: "Give me everything that is a member
> of list A and not a member of list B"?
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic: simple question

2013-03-28 Thread Moritz Ulrich
Can you please show your implementation of the other functions?

On Thu, Mar 28, 2013 at 1:11 AM, JvJ  wrote:
> The function i wrote below isn't working.  (is-drink q) returns all drinks
> (I tested it), but hates-drink, which should return all drinks that aren't
> liked, doesn't return anything
> what am I doing wrong?
>
> Thanks
>
> (defn hates-drink
>   [d]
>   (fresh [d2]
>  (is-drink d)
>  (likes-drink d2)
>  (!= d d2)))
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread adrians
Alex, print-foo *is* the correct artifact name, no? It seemed to be pulled 
down fine by pomegranate.

On Thursday, March 28, 2013 2:35:31 PM UTC-4, Alex Baranosky wrote:
>
> Let me fix the README, the library should be required like this (:require 
> [print.foo :refer :all])
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Actually, I found this post:

https://groups.google.com/forum/?fromgroups=#!topic/clojure/hz63yeQfiQE

But the not operator has to be used first to ensure that the term is 
ground.  It was a little confusing.

On Thursday, 28 March 2013 14:54:31 UTC-4, JvJ wrote:
>
> Thanks, but there's another aspect to this.
>
> Let's say I had two relations A and B, and I wanted all q such that
> (A q)
> (not (B q))
>
> How would that work?
>
> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>>
>> clojure.set/difference 
>> 'membero' combined with its negated form? 
>>
>> Jim 
>>
>> On 28/03/13 18:47, JvJ wrote: 
>> > In core.logic, how do the following: "Give me everything that is a 
>> > member of list A and not a member of list B"? 
>> > -- 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> > Groups "Clojure" group. 
>> > To post to this group, send email to clo...@googlegroups.com 
>> > Note that posts from new members are moderated - please be patient 
>> > with your first post. 
>> > To unsubscribe from this group, send email to 
>> > clojure+u...@googlegroups.com 
>> > For more options, visit this group at 
>> > http://groups.google.com/group/clojure?hl=en 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> > Groups "Clojure" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> > an email to clojure+u...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>> > 
>> > 
>>
>>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic: simple question

2013-03-28 Thread Moritz Ulrich
Expansion: Sorry, I seem to be wrong:

=> (doc !=)

clojure.core.logic/!=
([u v])
  Disequality constraint. Ensures that u and v will never
   unify. u and v can be complex terms.


On Thu, Mar 28, 2013 at 7:55 PM, Moritz Ulrich  wrote:
> I haven't played around with the new additions to core.logic, but it
> seems to me that != only works for values, not for lvars.
>
> On Thu, Mar 28, 2013 at 1:11 AM, JvJ  wrote:
>> The function i wrote below isn't working.  (is-drink q) returns all drinks
>> (I tested it), but hates-drink, which should return all drinks that aren't
>> liked, doesn't return anything
>> what am I doing wrong?
>>
>> Thanks
>>
>> (defn hates-drink
>>   [d]
>>   (fresh [d2]
>>  (is-drink d)
>>  (likes-drink d2)
>>  (!= d d2)))
>>
>> --
>> --
>> 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 post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic: simple question

2013-03-28 Thread Moritz Ulrich
I haven't played around with the new additions to core.logic, but it
seems to me that != only works for values, not for lvars.

On Thu, Mar 28, 2013 at 1:11 AM, JvJ  wrote:
> The function i wrote below isn't working.  (is-drink q) returns all drinks
> (I tested it), but hates-drink, which should return all drinks that aren't
> liked, doesn't return anything
> what am I doing wrong?
>
> Thanks
>
> (defn hates-drink
>   [d]
>   (fresh [d2]
>  (is-drink d)
>  (likes-drink d2)
>  (!= d d2)))
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Thanks, but there's another aspect to this.

Let's say I had two relations A and B, and I wanted all q such that
(A q)
(not (B q))

How would that work?

On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote:
>
> clojure.set/difference 
> 'membero' combined with its negated form? 
>
> Jim 
>
> On 28/03/13 18:47, JvJ wrote: 
> > In core.logic, how do the following: "Give me everything that is a 
> > member of list A and not a member of list B"? 
> > -- 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> > Note that posts from new members are moderated - please be patient 
> > with your first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com  
> > For more options, visit this group at 
> > http://groups.google.com/group/clojure?hl=en 
> > --- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to clojure+u...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




clojurescript memory management

2013-03-28 Thread Tyler Gillies
It seems like cljsbuild is ignoring my Xmx setting in my project.clj, 
 anyone have experience with controlling memory with cljsbuild?

I know the setting is correct because my normal clj repl is minding limit

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: core.logic : In one list but not in another

2013-03-28 Thread Jim - FooBar();

clojure.set/difference
'membero' combined with its negated form?

Jim

On 28/03/13 18:47, JvJ wrote:
In core.logic, how do the following: "Give me everything that is a 
member of list A and not a member of list B"?

--
--
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 post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
--
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Clojure" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread Jim - FooBar();

On 28/03/13 18:39, Alex Baranosky wrote:

Jim,

I'm interested in that idea definitely, but perhaps we should just 
create another open source project for time.foo?


Ok cool, I'll do that over the weekend and poke you sometime next week 
to have a look...also, have you deliberately left out 
print-loop/print-recur? was there a problem?


Jim

--
--
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Clojure" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




core.logic : In one list but not in another

2013-03-28 Thread JvJ
In core.logic, how do the following: "Give me everything that is a member 
of list A and not a member of list B"?

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread Alex Baranosky
Jim,

I'm interested in that idea definitely, but perhaps we should just create
another open source project for time.foo?

On Thu, Mar 28, 2013 at 11:35 AM, Alex Baranosky <
alexander.barano...@gmail.com> wrote:

> Let me fix the README, the library should be required like this (:require
> [print.foo :refer :all])
>
>
> On Thu, Mar 28, 2013 at 11:22 AM, adrians  wrote:
>
>> Looks useful, but I'm getting this:
>>
>> user=> (use 'print-foo)
>> FileNotFoundException Could not locate print_foo__init.class or
>> print_foo.clj on classpath:   clojure.lang.RT.load (RT.java:443)
>>
>> using lein 2.1.1
>>
>> Cheers
>>
>>
>> On Thursday, March 28, 2013 1:42:42 AM UTC-4, Alex Baranosky wrote:
>>>
>>> print-foo is a small library useful when debugging code, or at the REPL
>>> when writing your code.
>>>
>>> https://github.com/**AlexBaranosky/print-foo
>>>
>>> It is a collection of macros that mimic basic clojure macros like defn,
>>> let, or ->, but which prints the value of the code at each point in the
>>> transformation.  This is more convenient than printlning.  (See the readme
>>> for a complete list.)
>>>
>>> print-> is especially convenient.
>>>
>>> user=> (print-> 1 inc dec inc dec)1 1inc 2dec 1inc 2dec 11
>>>
>>>
>>> The only macro in the bunch that is not simply a clojure macro with
>>> "print-" appended is print-sexp which takes an arbitrary s-expression and
>>> prints out the values of every sub-sexp, like this:
>>>
>>> user=> (print-sexp (str (+ 3 4) (+ 5 (* 6 2)) 4))(+ 3 4) 7(* 6 2) 12(+ 5 (* 
>>> 6 2)) 17(str (+ 3 4) (+ 5 (* 6 2)) 4) "7174""7174"
>>>
>>> Enjoy :)
>>> Alex
>>>
>>  --
>> --
>> 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 post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Working with a huge graph - how can I make Clojure performant?

2013-03-28 Thread Alan Malloy
Have you looked at https://github.com/jordanlewis/data.union-find ? 
Personally, I'd prefer it to Christophe's implementation, since his blog 
post seems to start with "I dislike this algorithm"; I also helped out a 
bit in writing this version.

On Monday, March 11, 2013 10:37:39 AM UTC-7, Balint Erdi wrote:
>
> Hey,
>
>
> I got an assignment to implement an algorithm to calculate strongly 
> connected components in a graph (
> http://en.wikipedia.org/wiki/Kosaraju's_algorithm). The graph is rather 
> big, it has ~900.000 vertices.
>
>
> In its first pass, it needs to do a depth-first search on the graph and 
> calculate the finishing time for each node (the finishing time for a node 
> is a number from 0…V-1 where V is the number of vertices). Potentially 
> several depth-first search need to be launched (done in the finishing-times 
> function below) to discover all components.
>
>
> The version I pasted below is the most performant. It discovers ~600.000 
> vertices (2/3 of all vertices). However, on subsequent 
> dfs-by-finishing-times it becomes extremely slow (exploring a handful of 
> additional nodes/second) and I'm not sure why.
>
>
> Here are a few things I tried to speed up the algorithm:
>
>
> * rewrite to a recursive function (not tail-recursive) and use lazy-seqs
>
> * define dfs-by-finishing-times in finishing-times so that the whole graph 
> (G) does not have to be passed at each call.
>
> * use persistent data structures everywhere instead of transients (I know 
> this would only slow things down but it did not hurt to try)
>
> * use a profiler (VisualVM) to learn where the bottlenecks are. I'm not 
> very proficient with profilers but I could not extract any valuable 
> information
>
>
> Here are the code snippets in question:
>
> (I also pasted it here: 
> https://www.refheap.com/paste/3840cc772cc3a5b1d9c4f1db3 for better 
> readability)
>
> (defn dfs-by-finishing-times
>
>   ([G u]
>
>  (dfs-by-finishing-times G u #{}))
>
>   ([G u explored]
>
>  (loop [[v & vs :as stack] (list u), explored (transient explored), 
> lhalf [], rhalf [],  iter-cnt 0]
>
>  (if (seq stack)
>
>   (let [neighbors (persistent!
>
>(reduce
>
> (fn [c u] (if (explored u) c (conj! c u)))
>
> (transient [])
>
> (G v)))]
>
> (cond
>
>  (explored v) (recur vs explored lhalf rhalf (inc iter-cnt))
>
>  (empty? neighbors) (recur vs (conj! explored v) (conj lhalf 
> v) rhalf (inc iter-cnt))
>
>  :else (recur (reduce (fn [stack e] (cons e stack)) vs 
> neighbors)
>
>(conj! explored v)
>
>lhalf
>
>(cons v rhalf)
>
>(inc iter-cnt
>
>   (concat lhalf rhalf)))
>
>  ))
>
>
> (defn finishing-times [G vertices]
>
>   "The first pass of Kosaraju's algorithm.
>
>Scan the transpose graph of G, and mark the finishing time for each.
>
>G should already be the transposed graph"
>
>   (loop [[u & vs :as stack] (seq vertices)
>
>   explored #{},
>
>   finished []]
>
>  (if (nil? u)
>
>finished
>
>(let [path (dfs-by-finishing-times G u explored)
>
>  new-explored (into explored path)]
>
>  (recur (remove new-explored vs)
>
> new-explored
>
> (into finished path))
>
> Do you have any insights into what technique I could use to speed up my 
> algorithm? I'm pretty sure I'm missing a key point but I'm not sure 
> what. Presumably the whole algorithm runs under 10 seconds in C# on the 
> same graph so this is rather embarrassing :)
>
> Appreciate your help,
>
> Balint
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread Alex Baranosky
Let me fix the README, the library should be required like this (:require
[print.foo :refer :all])

On Thu, Mar 28, 2013 at 11:22 AM, adrians  wrote:

> Looks useful, but I'm getting this:
>
> user=> (use 'print-foo)
> FileNotFoundException Could not locate print_foo__init.class or
> print_foo.clj on classpath:   clojure.lang.RT.load (RT.java:443)
>
> using lein 2.1.1
>
> Cheers
>
>
> On Thursday, March 28, 2013 1:42:42 AM UTC-4, Alex Baranosky wrote:
>>
>> print-foo is a small library useful when debugging code, or at the REPL
>> when writing your code.
>>
>> https://github.com/**AlexBaranosky/print-foo
>>
>> It is a collection of macros that mimic basic clojure macros like defn,
>> let, or ->, but which prints the value of the code at each point in the
>> transformation.  This is more convenient than printlning.  (See the readme
>> for a complete list.)
>>
>> print-> is especially convenient.
>>
>> user=> (print-> 1 inc dec inc dec)1 1inc 2dec 1inc 2dec 11
>>
>>
>> The only macro in the bunch that is not simply a clojure macro with
>> "print-" appended is print-sexp which takes an arbitrary s-expression and
>> prints out the values of every sub-sexp, like this:
>>
>> user=> (print-sexp (str (+ 3 4) (+ 5 (* 6 2)) 4))(+ 3 4) 7(* 6 2) 12(+ 5 (* 
>> 6 2)) 17(str (+ 3 4) (+ 5 (* 6 2)) 4) "7174""7174"
>>
>> Enjoy :)
>> Alex
>>
>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread adrians
Looks useful, but I'm getting this:

user=> (use 'print-foo)
FileNotFoundException Could not locate print_foo__init.class or 
print_foo.clj on classpath:   clojure.lang.RT.load (RT.java:443)

using lein 2.1.1

Cheers

On Thursday, March 28, 2013 1:42:42 AM UTC-4, Alex Baranosky wrote:
>
> print-foo is a small library useful when debugging code, or at the REPL 
> when writing your code.  
>
> https://github.com/AlexBaranosky/print-foo
>
> It is a collection of macros that mimic basic clojure macros like defn, 
> let, or ->, but which prints the value of the code at each point in the 
> transformation.  This is more convenient than printlning.  (See the readme 
> for a complete list.) 
>
> print-> is especially convenient.  
>
> user=> (print-> 1 inc dec inc dec)1 1inc 2dec 1inc 2dec 11
>
>
> The only macro in the bunch that is not simply a clojure macro with 
> "print-" appended is print-sexp which takes an arbitrary s-expression and 
> prints out the values of every sub-sexp, like this:
>
> user=> (print-sexp (str (+ 3 4) (+ 5 (* 6 2)) 4))(+ 3 4) 7(* 6 2) 12(+ 5 (* 6 
> 2)) 17(str (+ 3 4) (+ 5 (* 6 2)) 4) "7174""7174"
>
> Enjoy :)
> Alex
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread Cedric Greevey
Why not generalize further then? Have a macro def-foo-let (actual name)
that takes a name and an operator (function or macro), so that

(defn print-out [x]
  (println x)
  x)

(def-foo-let print-let print-out)

will generate a print-let that prints each thing as it's computed, and

(def-foo-let time-let time)

will generate a time-let that times each thing, with expansions behaving as:

(let [a (second (print-out ['a (expr-computing-a)]))]
  body)

and

(let [b (second (time ['b (expr-computing-b)]))]
  body)

and the first one printing out things like

[pi 3.1415926535]

by way of illustration.



On Thu, Mar 28, 2013 at 1:14 PM, Jim - FooBar(); wrote:

>  Nice, thanks... :)
> I've started writing a very similar namespace but instead of printing, I'm
> timing...would you be interested in including a time-foo.clj following the
> same pattern (append 'time-') in your little library? I've only got
> 'time-let' which is the one I mostly use but I can imagine it shouldn't be
> too hard to do the same on the threading macros, cond etc. Also if I face
> any problems there is always your code to guide me...
>
> Jim
>
>
> On 28/03/13 05:42, Alex Baranosky wrote:
>
> print-foo is a small library useful when debugging code, or at the REPL
> when writing your code.
>
>  https://github.com/AlexBaranosky/print-foo
>
>  It is a collection of macros that mimic basic clojure macros like defn,
> let, or ->, but which prints the value of the code at each point in the
> transformation.  This is more convenient than printlning.  (See the readme
> for a complete list.)
>
>  print-> is especially convenient.
>
>  user=> (print-> 1 inc dec inc dec)1 1inc 2dec 1inc 2dec 11
>
>
>  The only macro in the bunch that is not simply a clojure macro with
> "print-" appended is print-sexp which takes an arbitrary s-expression and
> prints out the values of every sub-sexp, like this:
>
>  user=> (print-sexp (str (+ 3 4) (+ 5 (* 6 2)) 4))(+ 3 4) 7(* 6 2) 12(+ 5 (* 
> 6 2)) 17(str (+ 3 4) (+ 5 (* 6 2)) 4) "7174""7174"
>
> Enjoy :)
> Alex
>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Persistent Data Structures for Objective-C/LLVM

2013-03-28 Thread David Nolen
As far as I know the immutable Objective-C collections are not efficient to
update and likely perform terrible in this respect to Clojure collections.


On Thu, Mar 28, 2013 at 1:07 PM, Omer Iqbal  wrote:

> Most foundation objective c data structures are immutable (NSArray,
> NSDictionary, NSSet etc), and are most probably more performant than
> clojure counterparts, though terribly less elegant.
> However there's the clojure-scheme project (
> https://github.com/takeoutweight/clojure-scheme)  which compiles clojure
> to gambit scheme which can be compiled to C.
>
>
> On Fri, Mar 29, 2013 at 12:53 AM, Krukow  wrote:
>
>> Hi,
>> Kind of an unusual question, but is anyone in this group aware of a c,
>> objective-c or LLVM-based implementation of the Clojure persistent data
>> structures?
>>
>> - Karl
>>
>> --
>> --
>> 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 post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Persistent Data Structures for Objective-C/LLVM

2013-03-28 Thread Karl Krukow
On 28/03/2013, at 18.07, Omer Iqbal wrote:

> Most foundation objective c data structures are immutable (NSArray, 
> NSDictionary, NSSet etc), and are most probably more performant than clojure 
> counterparts, though terribly less elegant.
> However there's the clojure-scheme project 
> (https://github.com/takeoutweight/clojure-scheme)  which compiles clojure to 
> gambit scheme which can be compiled to C.

Thanks for your reply. However, I very much doubt that the objective c data 
structures use array-mapped hash tries which (I believe) is necessary for 
high-performance functional programming. Or am I wrong?

- Karl

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN: print-foo - a library of print debugging macros

2013-03-28 Thread Jim - FooBar();

Nice, thanks... :)
I've started writing a very similar namespace but instead of printing, 
I'm timing...would you be interested in including a time-foo.clj 
following the same pattern (append 'time-') in your little library? I've 
only got 'time-let' which is the one I mostly use but I can imagine it 
shouldn't be too hard to do the same on the threading macros, cond etc. 
Also if I face any problems there is always your code to guide me...


Jim


On 28/03/13 05:42, Alex Baranosky wrote:
print-foo is a small library useful when debugging code, or at the 
REPL when writing your code.


https://github.com/AlexBaranosky/print-foo

It is a collection of macros that mimic basic clojure macros like 
defn, let, or ->, but which prints the value of the code at each point 
in the transformation.  This is more convenient than printlning.  (See 
the readme for a complete list.)


print-> is especially convenient.

user=>  (print->  1  inc dec incdec)
1  1
inc2
dec1
inc2
dec1
1

The only macro in the bunch that is not simply a clojure macro with 
"print-" appended is print-sexp which takes an arbitrary s-expression 
and prints out the values of every sub-sexp, like this:


user=>  (print-sexp  (str(+3  4)  (+5  (*6  2))  4))
(+3  4)  7
(*6  2)  12
(+5  (*6  2))  17
(str(+3  4)  (+5  (*6  2))  4)  "7174"
"7174"
Enjoy :)
Alex
--
--
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 post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google 
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to clojure+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.




--
--
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups "Clojure" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Persistent Data Structures for Objective-C/LLVM

2013-03-28 Thread Omer Iqbal
Most foundation objective c data structures are immutable (NSArray,
NSDictionary, NSSet etc), and are most probably more performant than
clojure counterparts, though terribly less elegant.
However there's the clojure-scheme project (
https://github.com/takeoutweight/clojure-scheme)  which compiles clojure to
gambit scheme which can be compiled to C.


On Fri, Mar 29, 2013 at 12:53 AM, Krukow  wrote:

> Hi,
> Kind of an unusual question, but is anyone in this group aware of a c,
> objective-c or LLVM-based implementation of the Clojure persistent data
> structures?
>
> - Karl
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Persistent Data Structures for Objective-C/LLVM

2013-03-28 Thread Krukow
Hi,
Kind of an unusual question, but is anyone in this group aware of a c, 
objective-c or LLVM-based implementation of the Clojure persistent data 
structures?

- Karl

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure/West 2013 videos?

2013-03-28 Thread Cedric Greevey
Who?


On Mon, Mar 25, 2013 at 5:51 PM, gaz jones  wrote:

> I'm starting to miss Ken Wesson.
>
>
> On Mon, Mar 25, 2013 at 4:08 PM, Gary Trakhman wrote:
>
>> I've volunteered on the pycon AV team, in 2009, it's 1000x more work than
>> what you described further up in the thread, a minimum wage worker holding
>> something steady.  It requires a lot of coordination, and I think the cost
>> to the conference would be much higher than InfoQ as well.
>>
>> On Monday, March 25, 2013 1:05:51 PM UTC-4, Cedric Greevey wrote:
>>>
>>> On Mon, Mar 25, 2013 at 12:41 PM, Michael Klishin >> > wrote:
>>>

 2013/3/25 Cedric Greevey 

> Don't forget that Youtube has MILLIONS of visitors per month.
>
> Imagine the impact if the videos were available when demand for them
> was actually at its peak, rather than after half the people that had been
> interested have forgotten all about them.
>

 I challenge you to put together a technical videos channel that has
 millions of visitors per month.

>>>
>>> Another minute, another straw man. My point is that the needed video
>>> hosting capability already exists (and even has monetize options). Of
>>> *course* it will be expensive to go the "reinvent all needed wheels" route.
>>>
>>> I don't get it. The thread got complaints that the videos were being
>>> produced slowly and inefficiently, yet as soon as someone actually
>>> suggested ways to potentially make the process faster and more efficient,
>>> practically *everyone* leapt to the defense of those same slow and
>>> inefficient methods that they'd previously complained about. I guess
>>> abstract kvetching is okay, but concrete suggestions are frightening
>>> because they might *actually lead to change* or something. Although that
>>> still doesn't explain why someone then had the gall to criticize *me* for
>>> not making concrete and constructive suggestions, when that's exactly what
>>> I *did* do after *other people* had merely complained without making any
>>> suggestions.
>>>
>>> Of course, I don't really *need* to argue anymore, because someone else
>>> helpfully pointed out that an existing conference already does a better
>>> job: pycon. That completely disproves the entire class of arguments along
>>> the lines of "making *conference proceedings* videos is somehow some sort
>>> of a special case and it HAS to be slow and expensive!", of which we've
>>> seen several, sadly including some *after* pycon was first mentioned.
>>>
>>>  --
>> --
>> 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 post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread Brian Marick

On Mar 28, 2013, at 8:51 AM, Mark  wrote:

> In the course of writing about 30 lines of code last night, I accidentally 
> caused name collisions with two or three other existing functions in 
> clojure.core. Do other people have this problem? Am I just too uncreative? Am 
> I being too terse?

Old Smalltalk style was to use names like `a-string`, which would avoid 
collisions. I was never very fond of it. 


Looking for employment as a Clojure programmer
Latest book: /Functional Programming for the Object-Oriented Programmer/
https://leanpub.com/fp-oo

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure/West 2013 videos?

2013-03-28 Thread Cedric Greevey
On Mon, Mar 25, 2013 at 3:28 PM, Aaron Miller  wrote:

>
>> I have breaking news from 2008 or so for you: there are consumer video
>> cameras that shoot high definition. Also, Youtube supports high definition.
>>
>>
> I do think it's worth pointing out that *high definition* does not a
> watchable video make. There are camera phones that can shoot "high
> definition" video, and are frankly going to give you back unwatchable crap
> that only excels at taking up a lot more disk space. At the end of the day,
> recording a talk well means folks can *hear* the speaker and *see the
> presentation* and it doesn't really matter at all whether the video of
> the speakers themselves are captured in high fidelity at all.
>
> That's going to require more than finding a HD camcorder and sticking it
> on a tripod in the corner.
>

Yes. The zoom would also have to be set correctly, and the focus. Surely
only someone with a master's degree in engineering, or equivalent level of
professional expertise, could *possibly* manage *that*, though, right? :)

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Problem installing Pedestal libraries

2013-03-28 Thread Stuart Sierra
Pedestal is tested with Leiningen 2.0.0, final release. Try upgrading from 
a preview version.

You can also get more direct Pedestal support at 
https://groups.google.com/d/forum/pedestal-users

-S


On Tuesday, March 26, 2013 8:54:41 PM UTC-4, Jan Herich wrote:
>
> Hello,
>
> I have little problem with installing pedestal libraries via leiningen - i 
> downloaded the the project from github as zip, unzipped it and ran 'lein 
> sub install' inside unzipped directory, unfortunately, this leiningen task 
> ended with an exception, see the screenshot. Any clues ?
>
> Jan
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure/West 2013 videos?

2013-03-28 Thread gaz jones
I'm starting to miss Ken Wesson.


On Mon, Mar 25, 2013 at 4:08 PM, Gary Trakhman wrote:

> I've volunteered on the pycon AV team, in 2009, it's 1000x more work than
> what you described further up in the thread, a minimum wage worker holding
> something steady.  It requires a lot of coordination, and I think the cost
> to the conference would be much higher than InfoQ as well.
>
> On Monday, March 25, 2013 1:05:51 PM UTC-4, Cedric Greevey wrote:
>>
>> On Mon, Mar 25, 2013 at 12:41 PM, Michael Klishin 
>> wrote:
>>
>>>
>>> 2013/3/25 Cedric Greevey 
>>>
 Don't forget that Youtube has MILLIONS of visitors per month.

 Imagine the impact if the videos were available when demand for them
 was actually at its peak, rather than after half the people that had been
 interested have forgotten all about them.

>>>
>>> I challenge you to put together a technical videos channel that has
>>> millions of visitors per month.
>>>
>>
>> Another minute, another straw man. My point is that the needed video
>> hosting capability already exists (and even has monetize options). Of
>> *course* it will be expensive to go the "reinvent all needed wheels" route.
>>
>> I don't get it. The thread got complaints that the videos were being
>> produced slowly and inefficiently, yet as soon as someone actually
>> suggested ways to potentially make the process faster and more efficient,
>> practically *everyone* leapt to the defense of those same slow and
>> inefficient methods that they'd previously complained about. I guess
>> abstract kvetching is okay, but concrete suggestions are frightening
>> because they might *actually lead to change* or something. Although that
>> still doesn't explain why someone then had the gall to criticize *me* for
>> not making concrete and constructive suggestions, when that's exactly what
>> I *did* do after *other people* had merely complained without making any
>> suggestions.
>>
>> Of course, I don't really *need* to argue anymore, because someone else
>> helpfully pointed out that an existing conference already does a better
>> job: pycon. That completely disproves the entire class of arguments along
>> the lines of "making *conference proceedings* videos is somehow some sort
>> of a special case and it HAS to be slow and expensive!", of which we've
>> seen several, sadly including some *after* pycon was first mentioned.
>>
>>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread Mark Tomko
I definitely agree that nomenclature is often one of the hardest things to
handle well. I'm actually a professional software engineer in real life,
but I don't get to use Clojure at work. I suppose the names I suggested
were uninspired partially because I only get a few minutes at a time to
work on my hobby projects outside of work.

Thanks!


On Thu, Mar 28, 2013 at 11:21 AM, Gregg Reynolds  wrote:

> On Thursday, March 28, 2013 8:51:15 AM UTC-5, Mark wrote:
>>
>> I'm still just a Clojure hobbyist, but I have a question for folks who
>> are using Clojure professionally or for larger scale projects. Recently,
>> I've been finding that it's difficult to come up with names for variables
>> and functions that aren't already in the clojure.core namespace.
>>
>> If it's any consolation, I find that coming up with good names is one of
> the hardest (and least appreciated) aspects of programming.
>
>
>> For instance, I have a little toy project that digs through DNA sequence
>> data to extract some simple metrics. I obviously can't call a variable or
>> function "seq" because that's meaningful in clojure.core already. It turns
>> out, I also can't call it "bases", because that's a function in
>> clojure.core also. I could call it dna, but that's sort of undescriptive
>> (it's important to me that the name indicate the sequential nature of what
>> the binding refers to).
>>
>
> Think metaphorically - dozens of possibilities.  String, slab, run, flow,
> clip (of film = seq of frames), chain, train, parade, etc.  I find that
> sometimes digging through etymologies (www.etymonline.com) turns up new
> ideas.
>
> -Gregg
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/LIUAgA4GSB8/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread Mark
I definitely agree that nomenclature is often one of the hardest things to 
handle well. I'm actually a professional software engineer in real life, 
but I don't get to use Clojure at work. I suppose the names I suggested 
were uninspired partially because I only get a few minutes at a time to 
work on my hobby projects outside of work.

Thanks!

On Thursday, March 28, 2013 11:21:18 AM UTC-4, Gregg Reynolds wrote:
>
> On Thursday, March 28, 2013 8:51:15 AM UTC-5, Mark wrote:
>>
>> I'm still just a Clojure hobbyist, but I have a question for folks who 
>> are using Clojure professionally or for larger scale projects. Recently, 
>> I've been finding that it's difficult to come up with names for variables 
>> and functions that aren't already in the clojure.core namespace.
>>
>> If it's any consolation, I find that coming up with good names is one of 
> the hardest (and least appreciated) aspects of programming.
>  
>
>> For instance, I have a little toy project that digs through DNA sequence 
>> data to extract some simple metrics. I obviously can't call a variable or 
>> function "seq" because that's meaningful in clojure.core already. It turns 
>> out, I also can't call it "bases", because that's a function in 
>> clojure.core also. I could call it dna, but that's sort of undescriptive 
>> (it's important to me that the name indicate the sequential nature of what 
>> the binding refers to).
>>
>
> Think metaphorically - dozens of possibilities.  String, slab, run, flow, 
> clip (of film = seq of frames), chain, train, parade, etc.  I find that 
> sometimes digging through etymologies (www.etymonline.com) turns up new 
> ideas.
>
> -Gregg
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread Gregg Reynolds
On Thursday, March 28, 2013 8:51:15 AM UTC-5, Mark wrote:
>
> I'm still just a Clojure hobbyist, but I have a question for folks who are 
> using Clojure professionally or for larger scale projects. Recently, I've 
> been finding that it's difficult to come up with names for variables and 
> functions that aren't already in the clojure.core namespace.
>
> If it's any consolation, I find that coming up with good names is one of 
the hardest (and least appreciated) aspects of programming.
 

> For instance, I have a little toy project that digs through DNA sequence 
> data to extract some simple metrics. I obviously can't call a variable or 
> function "seq" because that's meaningful in clojure.core already. It turns 
> out, I also can't call it "bases", because that's a function in 
> clojure.core also. I could call it dna, but that's sort of undescriptive 
> (it's important to me that the name indicate the sequential nature of what 
> the binding refers to).
>

Think metaphorically - dozens of possibilities.  String, slab, run, flow, 
clip (of film = seq of frames), chain, train, parade, etc.  I find that 
sometimes digging through etymologies (www.etymonline.com) turns up new 
ideas.

-Gregg

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread Cedric Greevey
If there's a still-short, non-colliding, more descriptive name, why not use
that? In the example given in the original post, for instance, how about
"dna-seq" as the variable name? That makes it clear both that it's
sequential and what it's a sequence of, and shouldn't collide with any
other names you're likely to import.


On Thu, Mar 28, 2013 at 10:07 AM, Mark  wrote:

> Nice. I think in a couple of places I can safely do this. Thanks!
>
> On Thursday, March 28, 2013 9:53:19 AM UTC-4, Michael Klishin wrote:
>>
>>
>> 2013/3/28 Mark 
>>
>> Do other people have this problem? Am I just too uncreative? Am I being
>>> too terse?
>>
>>
>> Simply exclude some clojure.core functions in your namespace declaration
>> and use them as clojure.core/...
>> if you need them. It's perfectly fine to use names such as find,get and
>> so on in your own namespaces.
>>
>> http://clojure-doc.org/**articles/language/namespaces.**
>> html#the_referclojure_helper_**form
>>
>> --
>> MK
>>
>> http://github.com/**michaelklishin 
>> http://twitter.com/**michaelklishin 
>>
>  --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Working with a huge graph - how can I make Clojure performant?

2013-03-28 Thread Marko Topolnik
If you can't parallelize the work, the default persistent data structures 
are just an impediment. If, however, you could parallelize it, and adapt 
the algorithms towards a divide-and-conquer principle instead of the 
accumulator principle that is the best choice for single-threaded work, 
then the persistent structures are a real win. Unfortunately, in many areas 
there are only sequential well-known algorithms.

-marko


On Thursday, March 28, 2013 12:06:45 PM UTC+1, Balint Erdi wrote:
>
> Yes, that's definitely a good idea. I tried a few other things (including 
> that, I think) after I posted that but nothing really worked and it turned 
> out that the tail-recursive version even had a bug.
>
> I couldn't find a way to really keep the amount of copying of the data 
> structures (stack, finished above) very low and thus my algorithm was slow. 
> I know that the data structures are persistent and share structure but it 
> still was slow for that many elements.
>
> I finally solved the problem by implementing an imperative solution with 
> Java arrays and type hints. It ran in ~20-30 seconds.
>
> On Thursday, March 28, 2013 2:22:44 AM UTC+1, Stephen Compall wrote:
>>
>> On Mon, 2013-03-11 at 10:37 -0700, Balint Erdi wrote: 
>> >   (let [neighbors (persistent! 
>> >(reduce 
>> > (fn [c u] (if (explored u) c (conj! c u))) 
>> > (transient []) 
>> > (G v)))] 
>>
>> What happens if you do ^^^ *after* vvv? 
>>
>> >  (explored v) (recur vs explored lhalf rhalf (inc 
>> iter-cnt)) 
>>
>> -- 
>> Stephen Compall 
>> "^aCollection allSatisfy: [:each | aCondition]": less is better than 
>>
>>
>>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Working with a huge graph - how can I make Clojure performant?

2013-03-28 Thread Balint Erdi
In fact I did. At first glance it seemed like it would have the same issues 
as my algorithm for really large graphs. However, there is no certainty 
without actually trying so I might give it a go with the huge graph.

Thank you for bringing it up.

On Thursday, March 28, 2013 3:29:01 PM UTC+1, Niels van Klaveren wrote:
>
> Perhaps for inspiration have a look at Christophe Grand's implementation 
> of Tarjan's 
> algorithm(which
>  is a more efficient version of Kosaraju's).
>
> On Thursday, March 28, 2013 12:06:45 PM UTC+1, Balint Erdi wrote:
>>
>> Yes, that's definitely a good idea. I tried a few other things (including 
>> that, I think) after I posted that but nothing really worked and it turned 
>> out that the tail-recursive version even had a bug.
>>
>> I couldn't find a way to really keep the amount of copying of the data 
>> structures (stack, finished above) very low and thus my algorithm was slow. 
>> I know that the data structures are persistent and share structure but it 
>> still was slow for that many elements.
>>
>> I finally solved the problem by implementing an imperative solution with 
>> Java arrays and type hints. It ran in ~20-30 seconds.
>>
>> On Thursday, March 28, 2013 2:22:44 AM UTC+1, Stephen Compall wrote:
>>>
>>> On Mon, 2013-03-11 at 10:37 -0700, Balint Erdi wrote: 
>>> >   (let [neighbors (persistent! 
>>> >(reduce 
>>> > (fn [c u] (if (explored u) c (conj! c u))) 
>>> > (transient []) 
>>> > (G v)))] 
>>>
>>> What happens if you do ^^^ *after* vvv? 
>>>
>>> >  (explored v) (recur vs explored lhalf rhalf (inc 
>>> iter-cnt)) 
>>>
>>> -- 
>>> Stephen Compall 
>>> "^aCollection allSatisfy: [:each | aCondition]": less is better than 
>>>
>>>
>>>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Working with a huge graph - how can I make Clojure performant?

2013-03-28 Thread Niels van Klaveren
Perhaps for inspiration have a look at Christophe Grand's implementation of 
Tarjan's 
algorithm(which
 is a more efficient version of Kosaraju's).

On Thursday, March 28, 2013 12:06:45 PM UTC+1, Balint Erdi wrote:
>
> Yes, that's definitely a good idea. I tried a few other things (including 
> that, I think) after I posted that but nothing really worked and it turned 
> out that the tail-recursive version even had a bug.
>
> I couldn't find a way to really keep the amount of copying of the data 
> structures (stack, finished above) very low and thus my algorithm was slow. 
> I know that the data structures are persistent and share structure but it 
> still was slow for that many elements.
>
> I finally solved the problem by implementing an imperative solution with 
> Java arrays and type hints. It ran in ~20-30 seconds.
>
> On Thursday, March 28, 2013 2:22:44 AM UTC+1, Stephen Compall wrote:
>>
>> On Mon, 2013-03-11 at 10:37 -0700, Balint Erdi wrote: 
>> >   (let [neighbors (persistent! 
>> >(reduce 
>> > (fn [c u] (if (explored u) c (conj! c u))) 
>> > (transient []) 
>> > (G v)))] 
>>
>> What happens if you do ^^^ *after* vvv? 
>>
>> >  (explored v) (recur vs explored lhalf rhalf (inc 
>> iter-cnt)) 
>>
>> -- 
>> Stephen Compall 
>> "^aCollection allSatisfy: [:each | aCondition]": less is better than 
>>
>>
>>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread Mark
Nice. I think in a couple of places I can safely do this. Thanks!

On Thursday, March 28, 2013 9:53:19 AM UTC-4, Michael Klishin wrote:
>
>
> 2013/3/28 Mark >
>
>> Do other people have this problem? Am I just too uncreative? Am I being 
>> too terse?
>
>
> Simply exclude some clojure.core functions in your namespace declaration 
> and use them as clojure.core/... 
> if you need them. It's perfectly fine to use names such as find,get and so 
> on in your own namespaces.
>
>
> http://clojure-doc.org/articles/language/namespaces.html#the_referclojure_helper_form
>
> -- 
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>  

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread Mark
I thought about that, but I wasn't sure if it was a good idea. I suppose as 
long as my function definitions are short enough that anyone reading them 
can see both the name binding and all of its usages, then there's not so 
much confusion.

Thanks.

On Thursday, March 28, 2013 9:59:39 AM UTC-4, tbc++ wrote:
>
> Also notice that local scope overrides the global scope (unlike other 
> languages). So something like this is perfectly legal:
>
> (defn foo [x]
>  (let [seq (next x)]
>   seq))
>
> Now, if you need to use the function known as "seq" later on in your 
> function, you may run into issues. But I often use clojure.core names as 
> variables if it makes a given function cleaner. 
>
> Timothy
>
>
> On Thu, Mar 28, 2013 at 7:53 AM, Michael Klishin 
> 
> > wrote:
>
>>
>> 2013/3/28 Mark >
>>
>>> Do other people have this problem? Am I just too uncreative? Am I being 
>>> too terse?
>>
>>
>> Simply exclude some clojure.core functions in your namespace declaration 
>> and use them as clojure.core/... 
>> if you need them. It's perfectly fine to use names such as find,get and 
>> so on in your own namespaces.
>>
>>
>> http://clojure-doc.org/articles/language/namespaces.html#the_referclojure_helper_form
>>
>> -- 
>> MK
>>
>> http://github.com/michaelklishin
>> http://twitter.com/michaelklishin
>>  
>> -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread vemv
Yeah being able to reuse names is part of the point of namespaces :) it makes 
me sad when libraries use ugly names like megaref (for ref) or alter!! (for 
alter) instead of exploiting this fact.

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread Timothy Baldridge
Also notice that local scope overrides the global scope (unlike other
languages). So something like this is perfectly legal:

(defn foo [x]
 (let [seq (next x)]
  seq))

Now, if you need to use the function known as "seq" later on in your
function, you may run into issues. But I often use clojure.core names as
variables if it makes a given function cleaner.

Timothy


On Thu, Mar 28, 2013 at 7:53 AM, Michael Klishin <
michael.s.klis...@gmail.com> wrote:

>
> 2013/3/28 Mark 
>
>> Do other people have this problem? Am I just too uncreative? Am I being
>> too terse?
>
>
> Simply exclude some clojure.core functions in your namespace declaration
> and use them as clojure.core/...
> if you need them. It's perfectly fine to use names such as find,get and so
> on in your own namespaces.
>
>
> http://clojure-doc.org/articles/language/namespaces.html#the_referclojure_helper_form
>
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
> --
> --
> 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 post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Names and clojure.core

2013-03-28 Thread Michael Klishin
2013/3/28 Mark 

> Do other people have this problem? Am I just too uncreative? Am I being
> too terse?


Simply exclude some clojure.core functions in your namespace declaration
and use them as clojure.core/...
if you need them. It's perfectly fine to use names such as find,get and so
on in your own namespaces.

http://clojure-doc.org/articles/language/namespaces.html#the_referclojure_helper_form

-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Names and clojure.core

2013-03-28 Thread Mark
I'm still just a Clojure hobbyist, but I have a question for folks who are 
using Clojure professionally or for larger scale projects. Recently, I've 
been finding that it's difficult to come up with names for variables and 
functions that aren't already in the clojure.core namespace.

For instance, I have a little toy project that digs through DNA sequence 
data to extract some simple metrics. I obviously can't call a variable or 
function "seq" because that's meaningful in clojure.core already. It turns 
out, I also can't call it "bases", because that's a function in 
clojure.core also. I could call it dna, but that's sort of undescriptive 
(it's important to me that the name indicate the sequential nature of what 
the binding refers to). 

In the course of writing about 30 lines of code last night, I accidentally 
caused name collisions with two or three other existing functions in 
clojure.core. Do other people have this problem? Am I just too uncreative? 
Am I being too terse?

Mark

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




would FixedThreadPool-backed reducers make sense?

2013-03-28 Thread vemv
I recall from Rich's presentation on reducers (and it's intuitively true 
anyway) that FJ is not well suited to all workloads: uniform ones would do 
just fine with a fixed allocation of tasks to threads. I believe the 
tradeoff in that case is that one has to manage parallelism very explicitly.

Now, is it feasible to provide a reducers implementation backed by a fixed 
thead pool? How well would it perform (provided the workload is suitable)?

Similarly, I'd find tempting (just if a little crazy) to define clj's "seq 
library" (map, filter, reduce...) as a huge protocol, providing e.g. 
simple-lazy, chunked, FJ, and fixed-thread-pool implementations.

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Working with a huge graph - how can I make Clojure performant?

2013-03-28 Thread Balint Erdi
Yes, that's definitely a good idea. I tried a few other things (including 
that, I think) after I posted that but nothing really worked and it turned 
out that the tail-recursive version even had a bug.

I couldn't find a way to really keep the amount of copying of the data 
structures (stack, finished above) very low and thus my algorithm was slow. 
I know that the data structures are persistent and share structure but it 
still was slow for that many elements.

I finally solved the problem by implementing an imperative solution with 
Java arrays and type hints. It ran in ~20-30 seconds.

On Thursday, March 28, 2013 2:22:44 AM UTC+1, Stephen Compall wrote:
>
> On Mon, 2013-03-11 at 10:37 -0700, Balint Erdi wrote: 
> >   (let [neighbors (persistent! 
> >(reduce 
> > (fn [c u] (if (explored u) c (conj! c u))) 
> > (transient []) 
> > (G v)))] 
>
> What happens if you do ^^^ *after* vvv? 
>
> >  (explored v) (recur vs explored lhalf rhalf (inc iter-cnt)) 
>
> -- 
> Stephen Compall 
> "^aCollection allSatisfy: [:each | aCondition]": less is better than 
>
>
>

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




appengine-magic leiningen plugin and template

2013-03-28 Thread Gregg Reynolds
Hi,

People working with appengine--magic might be interested in a 
template-and-plugin pair I've put together over the past week.  This is my 
first crack at leiningen (and I'm fairly new to Clojure as well), so 
comments and suggests would be helpful.

The basic motivation was that although appengine-magic is a wonderful 
thing, the "Getting Started" part is pretty clunky and regularly fails for 
me on a missing saxon jar of some kind.  So I finally got to looking at the 
code and then looked into leiningen a little more closely and one thing 
lead to another.  I'm beginning to fall hard for Leiningen.  gaem basically 
splits all of the plugin functionality that is bundled into appengine-magic 
into an independent plugin+template pair. (I've not modified the 
appengine-magic codebase.)  So now to get started all you have to do is:

  $ lein new gaem myapp:gae-app-id /path/to/gae/sdk
  $ cd myapp
  $ lein gaem config
  $ lein repl  ;; launches myapp in the repl!
  ... edit gae app version number in project.clj
  $ lein gaem deploy  ;; "update" to cloud

It works for me but you're warned I've only tested it on a mac.  But the 
code is pretty simple in case you need to tweak it on e.g. windows.

The contraband may be found at https://github.com/greynolds/gaem-template 
and https://github.com/greynolds/gaem

Cheers,

Gregg Reynolds

-- 
-- 
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 post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.