Inconsistency of dissoc on maps vs records?

2012-04-20 Thread Matthew Phillips
I've always liked the way assoc and dissoc return the original map instance 
when there's no change to be made. But this is not apparently true of 
records. e.g.:

 (def m {:a 1})
 (identical? m (dissoc m :x))
; true

 (def r a record with an a field)
 (identical? r (dissoc r :x))
; false

Does anyone know if there's a good reason for this?

Cheers,

Matthew.

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

Re: Inconsistency of dissoc on maps vs records?

2012-04-20 Thread David Jagoe
On 20 April 2012 07:08, Matthew Phillips mattp...@gmail.com wrote:

 I've always liked the way assoc and dissoc return the original map
 instance when there's no change to be made. But this is not apparently
 true of records. e.g.:


Out of curiosity, why is this useful to you?

I would imagine that the fact that it works like that for maps at the
moment is an implementation detail that you shouldn't rely upon.

dissoc[iate]. Returns a new map of the same (hashed/sorted) type,
that does not contain a mapping for key(s).

-- 
David Jagoe

davidja...@gmail.com
+447535268218

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

Re: Inconsistency of dissoc on maps vs records?

2012-04-20 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe davidja...@gmail.com wrote:


 Out of curiosity, why is this useful to you?


It certainly has performance benefits.

When things are tested for equality (e.g., to test against keys in a hash
map), identical things are the fastest to recognize as equal.  Also, saves
on memory consumption and thus garbage collection.

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

Re: Inconsistency of dissoc on maps vs records?

2012-04-20 Thread David Jagoe
On 20 April 2012 07:38, Mark Engelberg mark.engelb...@gmail.com wrote:

 On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe davidja...@gmail.comwrote:


 Out of curiosity, why is this useful to you?


 It certainly has performance benefits.

 When things are tested for equality (e.g., to test against keys in a hash
 map), identical things are the fastest to recognize as equal.  Also, saves
 on memory consumption and thus garbage collection.


Did you come across this implementation difference by noticing a
performance difference? Or because you're using identical? on the result
of dissoc? If the latter I would suggest that you may not want to rely on
the behavior for maps, and that the difference is an implementation detail
and not an inconsistency in (documented) interface. I can't really comment
on the performance angle but I would be surprised if it was a performance
problem in practice?


Cheers,
David


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




-- 
David Jagoe

davidja...@gmail.com
+447535268218

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

Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-20 Thread Evan Mezeske
Could you elaborate on what the differences are between your version 
(Greenberg) of paredit-vim and the original one written by Tamas Kovacs 
that it appears to be based on?

I'm a bit confused -- the latest Kovacs version that I've used is 0.9.3 
from November 2011.  The Greenberg version looks like it is based off a 
version that was forked off from Kovacs vesrion version 0.8.0 from April 
2011.

Have any of the differences between 0.8.0-0.9.3 been merged into this 
branch?

On Wednesday, April 18, 2012 9:41:05 PM UTC-7, dgrnbrg wrote:

 Paredit mode is a structural editor for Clojure code in Vim. It allows
 you to edit your code while keeping parenthesis matched, and providing
 shortcuts to manipulate (), {}, [], and  easily. Use :help paredit
 for details.

 I just implemented support for VimClojure repls and {} syntax. Please
 report any bugs to me. Don't forget to use Pathogen!

 https://github.com/dgrnbrg/paredit-vim

 https://github.com/tpope/vim-pathogen



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

Re: a library I'm working on for generating PDFs from Clojure

2012-04-20 Thread Patrick Wright
Dmitri,

you might look at delegating some of the effort to Flying Saucer, which can 
generate PDFs when given clean HTML and CSS. 
http://code.google.com/p/flying-saucer/

There is a blog somewhere (which is currently unreachable) of someone using 
FS from Clojure.


HTH,
Patrick

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

Re: question about a macro

2012-04-20 Thread Marc Limotte
Thomas,

Try this:

(defmacro my-macro2 [func  args] `(~func ~@(flatten (eval (vec args)


Marc

On Wed, Apr 18, 2012 at 4:57 PM, thomas kalbe
thomas.ka...@googlemail.comwrote:

 Hi,

 I'd like to write a macro which transforms

 (my-macro SomeClass. a b [x y] c [e f])

 into

 (SomeClass. a b x y c e f)

 (the order of collections and single values in the arguments should be
 arbitrary)

 The closest I came was

 (defmacro my-macro [func  args]
  `(~func ~@(flatten args)))

 This works for simple cases like

 (my-macro SomeClass. 1 2 [3 4] 5)

 but clearly breaks when I do

 (def a [1 2])
 (def b [3 4])
 (my-macro SomeClass. a b) :

 (macroexpand-1 '(my-macro SomeClass. a b))
 = (SomeClass. a b)

 flatten seems the wrong way to do that. But I somehow need to evaluate
 the forms in the args before the unqoute splice happens.
 How would I do that?
 Any ideas would be greatly appreciated.

 - thomas

 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en

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

[ANN] Finger trees in Clojurescript

2012-04-20 Thread Jozef Wagner
I've ported finger trees from Chouser's 
https://github.com/clojure/data.finger-tree to the Clojurescript

You can find them at https://github.com/wagjo/ftree

With finger tree, one can make a persistent collection with amortized 
constant time access to elements and O(log n) append and split 
(insert/remove).

Jozef Wagner

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

Re: question about a macro

2012-04-20 Thread nicolas.o...@gmail.com
Part of the problem is that you confuse compile time and runtime.

Macro are evaluated at compile-time.

So when you write:

(my-macro SomeClass. a b) , my-macro can't access the runtime value of a and b.

So if you want your second example to work, you need flatten to be
called at runtime and not macro-expansion time.

So, if you wanted to apply my-macro to a function, and not a
constructor, something like:

(defn my-macro [fun  args]
  (apply fun (flatten args)))

should work.

However, it probably don't work for SomeClass., which is not a function.

 One way to solve that is to define a function wrapping around
SomeClass. with the  right number of arguments.

Another way is to do a macro which use reflection to look at the
number of arguments of SomeClass. at compile time
and eta-expand it. (ie change (my-macro SomeClass.  args) into (apply
  (fn [ x1  xn ]  (SomeClass. x1 ... xn)) (flatten args)), where
n is computed using reflection).

If SomeClass. takes different possible number of arguments, then the
expansion is a bit more complex because you need to check the number
of arguments at runtime
and call the right constructor.

Best,

Nicolas.

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


Re: question about a macro

2012-04-20 Thread nicolas.o...@gmail.com
On Fri, Apr 20, 2012 at 11:14 AM, Marc Limotte mslimo...@gmail.com wrote:
 Thomas,

 Try this:

 (defmacro my-macro2 [func  args] `(~func ~@(flatten (eval (vec args)



This won't work for:

(let [a [2 3]] (my-macro2 SomeClass. a))

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


Re: question about a macro

2012-04-20 Thread Cedric Greevey
On Thu, Apr 19, 2012 at 7:28 AM, Thomas thomas.ka...@googlemail.com wrote:
 Hi,

 I'd like to write a macro which transforms

 (my-macro SomeClass. a b [x y] c [e f])

 into

 (SomeClass. a b x y c e f)

 (the order of collections and single values in the arguments should be
 arbitrary)

 The closest I came was

 (defmacro my-macro [func  args]
  `(~func ~@(flatten args)))

 This works for simple cases like

 (my-macro SomeClass. 1 2 [3 4] 5)

 but clearly breaks when I do

 (def a [1 2])
 (def b [3 4])
 (my-macro SomeClass. a b)

 since

 (macroexpand-1 '(my-macro SomeClass. a b))
 = (SomeClass. a b)

 flatten seems the wrong way to do that. But I somehow need to
 evaluate the forms in the args before the unqoute splice happens.
 How would I do that?

 An alternative would be to generate forms like

 (apply #(SomeClass. %1 %2 %3 %4 %5) (concat [1] [2] [3 4] [5]))

 but I don't have an idea how to do that plus it has one additional (un-
 necessary?) level of indirection

 Any hints would be greatly appreciated.

The proper approach is something close to the latter. Try:

(defn flatten-1
  Flattens a coll by one level only.
  ([coll]
(apply concat
  (map #(if (coll? %) (list %) %) coll

(defmacro wrap-in-fn [x]
  `(fn ([] (~x)) ([a1#] (~x a1#)) ([a1# a2#] (~x a1# a2#))
([a1# a2# a3#] (~x a1# a2# a3#))
([a1# a2# a3# a4#] (~x a1# a2# a3# a4#))
([a1# a2# a3# a4# a5#] (~x a1# a2# a3# a4# a5#))
([a1# a2# a3# a4# a5# a6#] (~x a1# a2# a3# a4# a5# a6#))
(comment ... and any higher arities you think you need ...)))

(defmacro my-macro [x  args]
  `(apply (wrap-in-fn ~x) (flatten-1 (list ~@args

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


Re: [ANN] Finger trees in Clojurescript

2012-04-20 Thread Chris Houser
Cool

--Chouser
Laboriously typed on my mobile device.

On Apr 20, 2012, at 6:17 AM, Jozef Wagner jozef.wag...@gmail.com wrote:

I've ported finger trees from Chouser's
https://github.com/clojure/data.finger-tree to the Clojurescript

You can find them at https://github.com/wagjo/ftree

With finger tree, one can make a persistent collection with amortized
constant time access to elements and O(log n) append and split
(insert/remove).

Jozef Wagner

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

Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread Matthew Rocklin
I felt like I was spending a large amount of time learning a specialized 
system. About half the time was learning how to pose problems in a new 
paradigm  and about half the time was dealing with 
language-specific idiosyncrasies. The first is necessary and good, the 
second was more frustrating. The manual and tutorials are quite good, it 
was frustrating how little resources there were otherwise - it is, for 
example, challenging to find a large quantity of well documented example 
code. Clojure doesn't have this problem.

I would feel much better about learning language-specific idiosyncrasies of 
a general purpose language that I'm likely to use in the future. If Clojure 
+ core.logic can easily be adapted to solve term rewriting problems then 
I'd much rather spend time on it. 

On Thursday, April 19, 2012 9:39:35 PM UTC-5, David Nolen wrote:

 What don't you like about Maude?

 On Wed, Apr 18, 2012 at 10:05 PM, Matthew Rocklin mrock...@gmail.comwrote:

 Hello, 

  As a disclaimer I know very little about this topic or about Clojure; 
 please be kind. 

 Background:
 I'm interested in implementing a small term rewriting system for a 
 specific application. I'm willing to spend some time learning a new 
 language/system in order to do this cleanly. I'm currently playing with the 
 Maude system but am finding it restrictive. I've heard good things about 
 Clojure's core.logic module and thought it might be a good case of a domain 
 specific sublanguage contained within a general purpose language. 

 Question:
 Are there examples of term rewriting systems written in Clojure? If not, 
 how difficult would this be? Are there suggested ideas or directions on 
 implementation? I suspect that core.logic's unification system can be 
 leveraged to perform much of the work. 

 Best,
 -Matthew Rocklin http://matthewrocklin.com

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

Re: [ANN] Finger trees in Clojurescript

2012-04-20 Thread Cedric Greevey
On Fri, Apr 20, 2012 at 8:13 AM, Chris Houser chou...@gmail.com wrote:
 Cool

 --Chouser
 Laboriously typed on my mobile device.

You really need a better mobile device if typing a four-letter
message is laborious. ;)

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


Re: Newbie question about rebinding local variables

2012-04-20 Thread Craig Ching
Thanks for the help to both of you!  Question, does it seem heavy handed to 
do it this way?  I mean, atoms are more for thread-safety, aren't they?  I 
don't have threads so it seems a bit much to use atoms for this.  Am I 
better off using recur and trying to loop?  Or is this considered an 
idiomatic way to handle mutable data in Clojure?  I always found wrapping 
up mutable data in a closure as we did in Scheme to be pretty elegant, but 
maybe something like that goes against the desire of Clojure to protect 
against concurrent modification, is that about right?

Thanks again!

On Thursday, April 19, 2012 10:01:23 PM UTC-5, Gaz wrote:

 to answer your question directly, you would need to do something like
 this to make it work the way your example is set up:

 (defn new-game []
   (let [board (atom (into [] (repeat 9 nil)))]
 (fn [n  [i]]
   (cond
(= n :x) (swap! board assoc i 'x)
(= n :o) (swap! board assoc i 'o)
(= n :print) (println @board)

 (def g1 (new-game))

 (g1 :x 0)
 (g1 :print)

 On Thu, Apr 19, 2012 at 9:58 PM, Armando Blancas abm221...@gmail.com 
 wrote:
  You could keep the board in an atom so it can mutate; then try to find 
 maybe
  two good places for mutation to happen, your move and the program's. With
  the rest being functional you'll avoid the problems of global state while
  not being forced to fit your logic into a loop of some re-binding that
  simulates mutation.
 
 
  On Thursday, April 19, 2012 3:21:56 PM UTC-7, Craig Ching wrote:
 
  Ok, I've read that what I want to do is a no no.  But this is the sort 
 of
  thing I did in Scheme about 20 years ago (and because of that I'm 
 probably
  misremembering ;-)).
 
  Basically I'm learning clojure and thought I'd write a tic tac toe game.
   But not any tic tac toe, I want to write one where I can have multiple
  games going simultaneously.  Something like:
 
  (def g1 (new-game))
  (def g2 (new-game))
 
  (g1 :x 0)
  (g1 :print)
  (g2 :x 5)
  (g2 :print)
 
  So the schemer in me (and probably the imperative programmer as well)
  thought I could return a clojure that encapsulates the board value,
  something like this:
 
  (defn new-game []
 
(let [board (into [] (repeat 9 nil))]
 
  (fn [n i]
 
(cond
 
  (= n :x)(set! board (assoc board i 'x))
 
  (= n :o)(set! board (assoc board i 'o))
 
  (= n :print) (println board)
 
 
  Of course I get an error saying I can't bind to the non-mutable board.
 
  I'm really new to Clojure, so apologies if this is really basic for this
  list.  Can I do what I want or can someone point me in the right 
 direction?
   I've seen some other tic tac toe implementations on github, but they 
 use
  recur to track state and I was hoping there was a cleaner idiomatic way 
 than
  that.
 
  Thanks!
 
  --
  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 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

Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread David Nolen
I don't know Maude so I can't speak to much on it - though I've heard good
things from many different people.

Clojure is fairly well documented - core.logic not so much. People are
doing interesting things with it but in order to get proficient it requires
quite a bit of reading and research into miniKanren and Prolog.

David

On Fri, Apr 20, 2012 at 8:43 AM, Matthew Rocklin mrock...@gmail.com wrote:

 I felt like I was spending a large amount of time learning a specialized
 system. About half the time was learning how to pose problems in a new
 paradigm  and about half the time was dealing with
 language-specific idiosyncrasies. The first is necessary and good, the
 second was more frustrating. The manual and tutorials are quite good, it
 was frustrating how little resources there were otherwise - it is, for
 example, challenging to find a large quantity of well documented example
 code. Clojure doesn't have this problem.

 I would feel much better about learning language-specific idiosyncrasies
 of a general purpose language that I'm likely to use in the future. If
 Clojure + core.logic can easily be adapted to solve term rewriting problems
 then I'd much rather spend time on it.


 On Thursday, April 19, 2012 9:39:35 PM UTC-5, David Nolen wrote:

 What don't you like about Maude?

 On Wed, Apr 18, 2012 at 10:05 PM, Matthew Rocklin mrock...@gmail.comwrote:

 Hello,

  As a disclaimer I know very little about this topic or about Clojure;
 please be kind. 

 Background:
 I'm interested in implementing a small term rewriting system for a
 specific application. I'm willing to spend some time learning a new
 language/system in order to do this cleanly. I'm currently playing with the
 Maude system but am finding it restrictive. I've heard good things about
 Clojure's core.logic module and thought it might be a good case of a domain
 specific sublanguage contained within a general purpose language.

 Question:
 Are there examples of term rewriting systems written in Clojure? If not,
 how difficult would this be? Are there suggested ideas or directions on
 implementation? I suspect that core.logic's unification system can be
 leveraged to perform much of the work.

 Best,
 -Matthew Rocklin http://matthewrocklin.com

 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en


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

Re: Inconsistency of dissoc on maps vs records?

2012-04-20 Thread David Nolen
Calls to = call identity? first.

On Fri, Apr 20, 2012 at 2:38 AM, Mark Engelberg mark.engelb...@gmail.comwrote:

 On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe davidja...@gmail.comwrote:


 Out of curiosity, why is this useful to you?


 It certainly has performance benefits.

 When things are tested for equality (e.g., to test against keys in a hash
 map), identical things are the fastest to recognize as equal.  Also, saves
 on memory consumption and thus garbage collection.

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

Re: Friend: an extensible authentication and authorization library for Clojure Ring webapps and services

2012-04-20 Thread Chas Emerick
Gert,

There is no declarative way to satisfy that requirement at the moment.  
Fine-grained authorization often falls out to imperative checks, though there 
are mostly-declarative approaches in other libraries/frameworks that I have yet 
to grok enough to have a feel for what Friend should do in this area.  (As an 
aside, I think something like trammel will prove to be very useful for 
fine-grained authorization.)

There is a function `cemerick.friend/throw-unauthorized` that will raise an 
unauthorized exception that the top level `authenticate` middleware will catch, 
and either redirect to your :login-uri if the user isn't logged in, or pass 
along to the :unauthorized-handler you provide if the user is logged in (the 
default simply returns an HTTP 401 with a plain text message).

So, assuming the user's :id is in the authentication map your credential fn is 
returning, you can do something like:

(POST /user/:id [id  params :as req]
  (let [identity (friend/identity req)]
(if-not (or (friend/authorized? #{admin} identity)
(and (friend/authorized? #{user} identity)
 (= id (:id (friend/current-authentication identity)
  (friend/throw-unauthorized identity)
  ;; actual implementation of POST /user/:id...
  )))

Of course, you can factor the above out into a function to apply generally to 
any route/function that has similar authorization requirements (and maybe 
applied as a hook, depending on personal taste).

Does that help?

FWIW, there's no reason for solutions to problems like these to come 
exclusively from Friend itself.  I'd love to have contributions addressing 
general-interest requirements (of which fine-grained, declarative authorization 
is an example), but especially for more esoteric security requirements, I hope 
I've made it possible for enterprising and informed hackers to independently 
build extensions and addons.

Cheers,

- Chas

--
http://cemerick.com
[Clojure Programming from O'Reilly](http://www.clojurebook.com)

On Apr 18, 2012, at 7:38 PM, Gert Verhoog wrote:

 That looks promising, good work!
 
 I read through the docs and browsed the sources, and (admittedly without 
 trying to code an example myself) it's not immediately obvious to me how 
 Friend would handle the following use case:
 
 Given:
 - three users: alice, bob, and admin. Alice and Bob have a user role, and 
 admin is admin
 - edit user account routes, such as
  (GET  /user/:id/edit [id] (show-edit-form))
  (POST /user/:id  [id  params] (update-user))
 
 How would I use Friend to ensure that these resources can only be accessed if:
 - you have the admin role, OR
 - you are a user AND your id matches the id in the url?
 
 
 cheers,
 gert
 
 
 
 
 On 12/04/2012, at 2:34 AM, Chas Emerick wrote:
 
 For your consideration, a new library:
 
 I’m hoping this can eventually be a warden/spring-security/everyauth 
 /omniauth for Clojure; that is, a common abstraction for authentication and 
 authorization mechanisms.  Clojure has been around long enough that adding 
 pedestrian things like form and HTTP Basic and $AUTH_METHOD_HERE to a Ring 
 application should be easy.  Right now, it’s not: either you’re pasting 
 together a bunch of different libraries that don’t necessarily compose well 
 together, or you get drawn into shaving the authentication and authorization 
 yaks for the fifth time in your life so you can sleep well at night.
 
 Hopefully Friend will make this a solved problem, or at least push things in 
 that direction.
 
 Read more here: http://wp.me/p10OJi-d6
 
 Cheers,
 
 - Chas
 
 --
 http://cemerick.com
 [Clojure Programming from O'Reilly](http://www.clojurebook.com)
 
 -- 
 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 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 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


Re: Newbie question about rebinding local variables

2012-04-20 Thread Walter van der Laan
You could start with pure functions to handle the game logic, e.g.:

(defn new-game []
  [[\- \- \-]
   [\- \- \-]
   [\- \- \-]])

(defn print-game [game]
  (doseq [row game]
(println (apply str row

(defn move [game mark pos]
  (assoc-in game pos mark))

(print-game (new-game))
(print-game (move (new-game) \x [1 1]))
(print-game (- (new-game) (move \x [1 1]) (move \o [0 2])))

On Friday, April 20, 2012 3:30:59 PM UTC+2, Craig Ching wrote:

 Thanks for the help to both of you!  Question, does it seem heavy handed 
 to do it this way?  I mean, atoms are more for thread-safety, aren't they? 
  I don't have threads so it seems a bit much to use atoms for this.  Am I 
 better off using recur and trying to loop?  Or is this considered an 
 idiomatic way to handle mutable data in Clojure?  I always found wrapping 
 up mutable data in a closure as we did in Scheme to be pretty elegant, but 
 maybe something like that goes against the desire of Clojure to protect 
 against concurrent modification, is that about right?

 Thanks again!

 On Thursday, April 19, 2012 10:01:23 PM UTC-5, Gaz wrote:

 to answer your question directly, you would need to do something like
 this to make it work the way your example is set up:

 (defn new-game []
   (let [board (atom (into [] (repeat 9 nil)))]
 (fn [n  [i]]
   (cond
(= n :x) (swap! board assoc i 'x)
(= n :o) (swap! board assoc i 'o)
(= n :print) (println @board)

 (def g1 (new-game))

 (g1 :x 0)
 (g1 :print)

 On Thu, Apr 19, 2012 at 9:58 PM, Armando Blancas abm221...@gmail.com 
 wrote:
  You could keep the board in an atom so it can mutate; then try to find 
 maybe
  two good places for mutation to happen, your move and the program's. 
 With
  the rest being functional you'll avoid the problems of global state 
 while
  not being forced to fit your logic into a loop of some re-binding that
  simulates mutation.
 
 
  On Thursday, April 19, 2012 3:21:56 PM UTC-7, Craig Ching wrote:
 
  Ok, I've read that what I want to do is a no no.  But this is the sort 
 of
  thing I did in Scheme about 20 years ago (and because of that I'm 
 probably
  misremembering ;-)).
 
  Basically I'm learning clojure and thought I'd write a tic tac toe 
 game.
   But not any tic tac toe, I want to write one where I can have multiple
  games going simultaneously.  Something like:
 
  (def g1 (new-game))
  (def g2 (new-game))
 
  (g1 :x 0)
  (g1 :print)
  (g2 :x 5)
  (g2 :print)
 
  So the schemer in me (and probably the imperative programmer as well)
  thought I could return a clojure that encapsulates the board value,
  something like this:
 
  (defn new-game []
 
(let [board (into [] (repeat 9 nil))]
 
  (fn [n i]
 
(cond
 
  (= n :x)(set! board (assoc board i 'x))
 
  (= n :o)(set! board (assoc board i 'o))
 
  (= n :print) (println board)
 
 
  Of course I get an error saying I can't bind to the non-mutable board.
 
  I'm really new to Clojure, so apologies if this is really basic for 
 this
  list.  Can I do what I want or can someone point me in the right 
 direction?
   I've seen some other tic tac toe implementations on github, but they 
 use
  recur to track state and I was hoping there was a cleaner idiomatic 
 way than
  that.
 
  Thanks!
 
  --
  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 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

Re: Newbie question about rebinding local variables

2012-04-20 Thread Craig Ching


On Friday, April 20, 2012 9:07:49 AM UTC-5, Walter van der Laan wrote:

 You could start with pure functions to handle the game logic, e.g.:

 (defn new-game []
   [[\- \- \-]
[\- \- \-]
[\- \- \-]])

 (defn print-game [game]
   (doseq [row game]
 (println (apply str row

 (defn move [game mark pos]
   (assoc-in game pos mark))

 (print-game (new-game))
 (print-game (move (new-game) \x [1 1]))
 (print-game (- (new-game) (move \x [1 1]) (move \o [0 2])))



Right, but then I'm having to keep track of the moves and reapply them on 
every game update, right?  I guess my question is more conceptual (so that 
I can gain an understanding of Clojure), I don't really care about tic tac 
toe, what I really care about is how to maintain mutable state.



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

Re: Newbie question about rebinding local variables

2012-04-20 Thread kurtharriger
By creating new game objects rather than mutating existing ones you could do 
things you wouldnt otherwise be able to do. Perhaps you have different solver 
strategies that you want to apply in parallel. Provided you can give each 
solver its own copy this is trivial, but if your datastructures require 
mutation this gets messy fast.  
When passing objects as parameters dependencies are more explicit, you can of 
course group related objects together and pass them as a single parameter and 
what not.. destructuring as needed.  In practice its not as bad as it seems. 
For values like configuration settings that are not usually changed you might 
consider dynamic vars to reduce number of parameters. 

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


Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread Matthew Rocklin
Maude is certainly quite interesting. I definitely hope that it takes off.
If there were people in my community who were more familiar with Maude I
think it would be a good choice for me.

Are you aware of any project that attempts to implement anything like a term
rewrite system http://en.wikipedia.org/wiki/Term_rewriting_system using
Clojure?



On Fri, Apr 20, 2012 at 8:46 AM, David Nolen dnolen.li...@gmail.com wrote:

 I don't know Maude so I can't speak to much on it - though I've heard good
 things from many different people.

 Clojure is fairly well documented - core.logic not so much. People are
 doing interesting things with it but in order to get proficient it requires
 quite a bit of reading and research into miniKanren and Prolog.

 David


 On Fri, Apr 20, 2012 at 8:43 AM, Matthew Rocklin mrock...@gmail.comwrote:

 I felt like I was spending a large amount of time learning a specialized
 system. About half the time was learning how to pose problems in a new
 paradigm  and about half the time was dealing with
 language-specific idiosyncrasies. The first is necessary and good, the
 second was more frustrating. The manual and tutorials are quite good, it
 was frustrating how little resources there were otherwise - it is, for
 example, challenging to find a large quantity of well documented example
 code. Clojure doesn't have this problem.

 I would feel much better about learning language-specific idiosyncrasies
 of a general purpose language that I'm likely to use in the future. If
 Clojure + core.logic can easily be adapted to solve term rewriting problems
 then I'd much rather spend time on it.


 On Thursday, April 19, 2012 9:39:35 PM UTC-5, David Nolen wrote:

 What don't you like about Maude?

 On Wed, Apr 18, 2012 at 10:05 PM, Matthew Rocklin mrock...@gmail.comwrote:

 Hello,

  As a disclaimer I know very little about this topic or about
 Clojure; please be kind. 

 Background:
 I'm interested in implementing a small term rewriting system for a
 specific application. I'm willing to spend some time learning a new
 language/system in order to do this cleanly. I'm currently playing with the
 Maude system but am finding it restrictive. I've heard good things about
 Clojure's core.logic module and thought it might be a good case of a domain
 specific sublanguage contained within a general purpose language.

 Question:
 Are there examples of term rewriting systems written in Clojure? If
 not, how difficult would this be? Are there suggested ideas or directions
 on implementation? I suspect that core.logic's unification system can be
 leveraged to perform much of the work.

 Best,
 -Matthew Rocklin http://matthewrocklin.com

 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en


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

Re: Newbie question about rebinding local variables

2012-04-20 Thread kurtharriger
And you just need to keep the resulting state, no need to reapply the moves.  
Your main method might use a reduce or loop recur.

(loop [game (new-game)]
  (if-not (complete? game) 
(recur (make-random-move game)))

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


Re: Newbie question about rebinding local variables

2012-04-20 Thread Craig Ching
Thanks for your input, I appreciate it.

On Friday, April 20, 2012 10:16:51 AM UTC-5, kurtharriger wrote:

 And you just need to keep the resulting state, no need to reapply the 
 moves.  
 Your main method might use a reduce or loop recur.

 (loop [game (new-game)]
   (if-not (complete? game) 
 (recur (make-random-move game)))


The problem I have with this is that it does encapsulate game state 
completely, including input (the moves), but I want to just encapsulate 
board state.  Imagine that the moves come from an external source, i.e. the 
web, my game state can't be stuck down in a function somewhere, the move is 
sent from the web, the game state is retrieved from somewhere (a session? 
 a database?), and updated with the incoming move.  I wasn't clear in 
stating my problem, but I want to decouple game state and board state for 
this reason.  And because that's where I'm headed, it might make sense for 
me to approach this using atoms as others have suggested.

I appreciate the different perspectives though, it's helping me understand! 

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

Re: Newbie question about rebinding local variables

2012-04-20 Thread Phil Hagelberg
On Fri, Apr 20, 2012 at 7:07 AM, Walter van der Laan
waltervanderl...@gmail.com wrote:
 You could start with pure functions to handle the game logic, e.g.:

We did this during swarm coding at ClojureWest on the game of Go, but
you could apply the same logic to any board game:

https://github.com/technomancy/swarm-go/blob/master/src/swarm/go.clj
(ignore the atom at the top; it's not used)

Basically it's implemented in terms of reduce where the accumulator is
the board state and the sequence is the list of moves. You can use the
reductions function to get access to each intermediate state lazily.

-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


Re: Newbie question about rebinding local variables

2012-04-20 Thread Walter van der Laan
You can save state in an atom like this:
(def state (atom (new-game))) ; initial state
(swap! state move \x [1 1]) ; make a move

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

Re: Newbie question about rebinding local variables

2012-04-20 Thread nicolas.o...@gmail.com
This is not the idiomatic way but you can stay quite close from your code by:

(defn game [ board ]
 (fn [n i]
  (cond
 (= n :x) (game (assoc board i 'x))
 ( = n :o) (game (assoc board i 'o))
 (= n :print) (println board

(defn (new-game (game (into [] (repeat 9 nil)

But this is still an encoding of message-passing OO, which is not very
idiomatic.

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


Twitter api?

2012-04-20 Thread labwork07

I see twitter-api and clojure-twitter in clojars. Which one do you use?

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

Twitter api?

2012-04-20 Thread labwork07

I see twitter-api and clojure-twitter in clojars. Which one do you use?

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

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread Michał Marczyk
Since the latest PHM patch has now been merged to master (thanks,
David!), I wanted to take this opportunity to note that porting all
that Java code (including the transient support for PHM -- a working
version of which is available for testing in its own ticket [1] -- and
now the PersistentTreeMap [2]) has been completely smooth sailing.
Some additions have been made to the implementation to improve
performance while maintaining clarity of the code (here some excellent
suggestions from David were very helpful), but the initial
implementation already worked without them and client code could
absolutely replicate them (by providing the requisite compiler macros
in its own namespace). It's not that I expected insurmountable
difficulties, but experiencing just how complete ClojureScript already
is in the context of this sort of non-trivial data structure
implementation task has been amazing.

For those interested in how PHM's performance compares to that of the
previously used ObjMap and HashMap copy-on-write implementations,
there are some jsPerf tests linked to from the ticket [3]. There's
also a TransientHM vs. PHM comparison linked to from [2].

Sincerely,
Michał


[1] http://dev.clojure.org/jira/browse/CLJS-181
[2] http://dev.clojure.org/jira/browse/CLJS-187
[3] http://dev.clojure.org/jira/browse/CLJS-178


On 16 April 2012 20:15, David Nolen dnolen.li...@gmail.com wrote:
 Thanks to Michal Marczyk we're closing in on PersistentHashMaps:

 http://jsperf.com/cljs-persistent-hash-map-tiny-assoc
 http://jsperf.com/cljs-persistent-hash-map-large-assoc
 http://jsperf.com/cljs-persistent-hash-map-access

 Performance is looking pretty good and, as usual, very stellar on V8.

 David

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

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


Re: Clojars security upgrade

2012-04-20 Thread Phil Hagelberg
On Fri, Mar 9, 2012 at 2:22 PM, Phil Hagelberg p...@hagelb.org wrote:
 Because we can't ensure that everyone will log in to re-hash their
 password, at some point in the future (probably 2-3 weeks out) we will
 WIPE all the old password hashes. Otherwise users who have stopped using
 Clojars or missed the announcement could have their passwords exposed in
 the event of a future break-in. I will be sure to send out a few more
 warnings before this happens, but even if your password has been wiped
 it's easy to reset it via the forgot password functionality.

Just a heads-up that I am planning on wiping the insecure hashes next
week. If you don't login in time your account will still be accessible
via the forgot password functionality.

-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


Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread David Nolen
Excellent work!

On Fri, Apr 20, 2012 at 1:38 PM, Michał Marczyk michal.marc...@gmail.comwrote:

 Since the latest PHM patch has now been merged to master (thanks,
 David!), I wanted to take this opportunity to note that porting all
 that Java code (including the transient support for PHM -- a working
 version of which is available for testing in its own ticket [1] -- and
 now the PersistentTreeMap [2]) has been completely smooth sailing.
 Some additions have been made to the implementation to improve
 performance while maintaining clarity of the code (here some excellent
 suggestions from David were very helpful), but the initial
 implementation already worked without them and client code could
 absolutely replicate them (by providing the requisite compiler macros
 in its own namespace). It's not that I expected insurmountable
 difficulties, but experiencing just how complete ClojureScript already
 is in the context of this sort of non-trivial data structure
 implementation task has been amazing.

 For those interested in how PHM's performance compares to that of the
 previously used ObjMap and HashMap copy-on-write implementations,
 there are some jsPerf tests linked to from the ticket [3]. There's
 also a TransientHM vs. PHM comparison linked to from [2].

 Sincerely,
 Michał


 [1] http://dev.clojure.org/jira/browse/CLJS-181
 [2] http://dev.clojure.org/jira/browse/CLJS-187
 [3] http://dev.clojure.org/jira/browse/CLJS-178


 On 16 April 2012 20:15, David Nolen dnolen.li...@gmail.com wrote:
  Thanks to Michal Marczyk we're closing in on PersistentHashMaps:
 
  http://jsperf.com/cljs-persistent-hash-map-tiny-assoc
  http://jsperf.com/cljs-persistent-hash-map-large-assoc
  http://jsperf.com/cljs-persistent-hash-map-access
 
  Performance is looking pretty good and, as usual, very stellar on V8.
 
  David
 
  --
  You received this message because you are subscribed to the Google Groups
  Clojure Dev group.
  To post to this group, send email to clojure-...@googlegroups.com.
  To unsubscribe from this group, send email to
  clojure-dev+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/clojure-dev?hl=en.

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



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

Re: Newbie question about rebinding local variables

2012-04-20 Thread kurtharriger


On Apr 20, 9:43 am, Craig Ching craigch...@gmail.com wrote:
 Thanks for your input, I appreciate it.

 On Friday, April 20, 2012 10:16:51 AM UTC-5, kurtharriger wrote:

  And you just need to keep the resulting state, no need to reapply the
  moves.
  Your main method might use a reduce or loop recur.

  (loop [game (new-game)]
    (if-not (complete? game)
      (recur (make-random-move game)))

 The problem I have with this is that it does encapsulate game state
 completely, including input (the moves), but I want to just encapsulate
 board state.  Imagine that the moves come from an external source, i.e. the
 web, my game state can't be stuck down in a function somewhere, the move is
 sent from the web, the game state is retrieved from somewhere (a session?
  a database?), and updated with the incoming move.  I wasn't clear in
 stating my problem, but I want to decouple game state and board state for
 this reason.  And because that's where I'm headed, it might make sense for
 me to approach this using atoms as others have suggested.

 I appreciate the different perspectives though, it's helping me understand!

Game state does not have to be a map, it could be any datastructure
you want, perhaps a protocol that is implemented by a concrete class
in another JVM language.  However, I avoid encapsulation unless there
is a compelling reason reason to add it.  More often then not the
result of encapsulation is that the entire library of useful functions
like map, reduce, get-in, update-in, etc... are no longer useable with
this custom data structure.

It is also not strictly required that all your functions be pure, you
could load or save game state to a database or external service as
necessary. There are very few applications that are strictly pure.
However, it is recommended that you make as much of your program pure
as possible.  If each time you made a game move the state was written
to a database then you might have difficulty trying to run multiple
solver strategies in parallel as these side-effects would continuously
clobber the others database state.

The general idea is that pure functions are easily composed and easy
to test, so use them whenever possible.  Impure functions that write
to external services are often much more difficult to compose and
test, so keep them as small as possible. Think twice about calling an
impure function from a pure function as this makes it impure... main
will almost certainly be impure, but that does not mean that
everything else also needs to be impure.

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


Re: Twitter api?

2012-04-20 Thread Pooya Razavian
I've used clojure-twitter. Worked as advertised and very smooth. I was 
curious if anyone tired using the spring social framework.

On Friday, April 20, 2012 6:09:07 PM UTC+1, melipone wrote:

 I see twitter-api and clojure-twitter in clojars. Which one do you use?

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

Converting project.clj to maven's pom.xml

2012-04-20 Thread Murtaza Husain
Hi,

Is there any way to convert project.clj to pom.xml.

I was looking at jelastic which is a cloud provider for java, and they 
allow deploying projects from git repos which are compatible with maven 3. 
It will download the code and build it based on the maven config.

Anyway we can leverage that? 

Thanks,
Murtaza

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

Re:Converting project.clj to maven's pom.xml

2012-04-20 Thread Baishampayan Ghose
$ lein pom

Sent from phone, please excuse brevity.
On Apr 20, 2012 11:59 PM, Murtaza Husain murtaza.hus...@sevenolives.com
wrote:

 Hi,

 Is there any way to convert project.clj to pom.xml.

 I was looking at jelastic which is a cloud provider for java, and they
 allow deploying projects from git repos which are compatible with maven 3.
 It will download the code and build it based on the maven config.

 Anyway we can leverage that?

 Thanks,
 Murtaza

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

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread Brent Millare
Quick question, so does this mean we have clojure's persistent data 
structures implemented in clojurescript or js? This would mean we are one 
more step closer to C-in-C right?

On Friday, April 20, 2012 1:38:17 PM UTC-4, Michał Marczyk wrote:

 Since the latest PHM patch has now been merged to master (thanks,
 David!), I wanted to take this opportunity to note that porting all
 that Java code (including the transient support for PHM -- a working
 version of which is available for testing in its own ticket [1] -- and
 now the PersistentTreeMap [2]) has been completely smooth sailing.
 Some additions have been made to the implementation to improve
 performance while maintaining clarity of the code (here some excellent
 suggestions from David were very helpful), but the initial
 implementation already worked without them and client code could
 absolutely replicate them (by providing the requisite compiler macros
 in its own namespace). It's not that I expected insurmountable
 difficulties, but experiencing just how complete ClojureScript already
 is in the context of this sort of non-trivial data structure
 implementation task has been amazing.

 For those interested in how PHM's performance compares to that of the
 previously used ObjMap and HashMap copy-on-write implementations,
 there are some jsPerf tests linked to from the ticket [3]. There's
 also a TransientHM vs. PHM comparison linked to from [2].

 Sincerely,
 Michał


 [1] http://dev.clojure.org/jira/browse/CLJS-181
 [2] http://dev.clojure.org/jira/browse/CLJS-187
 [3] http://dev.clojure.org/jira/browse/CLJS-178



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

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread David Nolen
On Fri, Apr 20, 2012 at 2:32 PM, Brent Millare brent.mill...@gmail.comwrote:

 Quick question, so does this mean we have clojure's persistent data
 structures implemented in clojurescript or js? This would mean we are one
 more step closer to C-in-C right?


The persistent data structures are implemented in ClojureScript - so yes :D

David

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

Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread Michał Marczyk
It's pure ClojureScript. Hopefully a step towards CinC, yes. :-)

Sincerely,
Michał


On 20 April 2012 20:32, Brent Millare brent.mill...@gmail.com wrote:
 Quick question, so does this mean we have clojure's persistent data
 structures implemented in clojurescript or js? This would mean we are one
 more step closer to C-in-C right?

 On Friday, April 20, 2012 1:38:17 PM UTC-4, Michał Marczyk wrote:

 Since the latest PHM patch has now been merged to master (thanks,
 David!), I wanted to take this opportunity to note that porting all
 that Java code (including the transient support for PHM -- a working
 version of which is available for testing in its own ticket [1] -- and
 now the PersistentTreeMap [2]) has been completely smooth sailing.
 Some additions have been made to the implementation to improve
 performance while maintaining clarity of the code (here some excellent
 suggestions from David were very helpful), but the initial
 implementation already worked without them and client code could
 absolutely replicate them (by providing the requisite compiler macros
 in its own namespace). It's not that I expected insurmountable
 difficulties, but experiencing just how complete ClojureScript already
 is in the context of this sort of non-trivial data structure
 implementation task has been amazing.

 For those interested in how PHM's performance compares to that of the
 previously used ObjMap and HashMap copy-on-write implementations,
 there are some jsPerf tests linked to from the ticket [3]. There's
 also a TransientHM vs. PHM comparison linked to from [2].

 Sincerely,
 Michał


 [1] http://dev.clojure.org/jira/browse/CLJS-181
 [2] http://dev.clojure.org/jira/browse/CLJS-187
 [3] http://dev.clojure.org/jira/browse/CLJS-178

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


Re: PersistentHashMaps coming to ClojureScript

2012-04-20 Thread Baishampayan Ghose
The data-structures are written in ClojureScript.

Check the source and witness the beauty :-)

Sent from phone, please excuse brevity.
On Apr 21, 2012 12:02 AM, Brent Millare brent.mill...@gmail.com wrote:

 Quick question, so does this mean we have clojure's persistent data
 structures implemented in clojurescript or js? This would mean we are one
 more step closer to C-in-C right?

 On Friday, April 20, 2012 1:38:17 PM UTC-4, Michał Marczyk wrote:

 Since the latest PHM patch has now been merged to master (thanks,
 David!), I wanted to take this opportunity to note that porting all
 that Java code (including the transient support for PHM -- a working
 version of which is available for testing in its own ticket [1] -- and
 now the PersistentTreeMap [2]) has been completely smooth sailing.
 Some additions have been made to the implementation to improve
 performance while maintaining clarity of the code (here some excellent
 suggestions from David were very helpful), but the initial
 implementation already worked without them and client code could
 absolutely replicate them (by providing the requisite compiler macros
 in its own namespace). It's not that I expected insurmountable
 difficulties, but experiencing just how complete ClojureScript already
 is in the context of this sort of non-trivial data structure
 implementation task has been amazing.

 For those interested in how PHM's performance compares to that of the
 previously used ObjMap and HashMap copy-on-write implementations,
 there are some jsPerf tests linked to from the ticket [3]. There's
 also a TransientHM vs. PHM comparison linked to from [2].

 Sincerely,
 Michał


 [1] 
 http://dev.clojure.org/jira/**browse/CLJS-181http://dev.clojure.org/jira/browse/CLJS-181
 [2] 
 http://dev.clojure.org/jira/**browse/CLJS-187http://dev.clojure.org/jira/browse/CLJS-187
 [3] 
 http://dev.clojure.org/jira/**browse/CLJS-178http://dev.clojure.org/jira/browse/CLJS-178

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

Re: a library I'm working on for generating PDFs from Clojure

2012-04-20 Thread Tim Robinson
Also, wkhtmltopdf  has worked well for me.

http://code.google.com/p/wkhtmltopdf/

On Apr 20, 4:06 am, Patrick Wright pdoubl...@gmail.com wrote:
 Dmitri,

 you might look at delegating some of the effort to Flying Saucer, which can
 generate PDFs when given clean HTML and 
 CSS.http://code.google.com/p/flying-saucer/

 There is a blog somewhere (which is currently unreachable) of someone using
 FS from Clojure.

 HTH,
 Patrick

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


[ANN] Typed Clojure 0.1-alpha2

2012-04-20 Thread Ambrose Bonnaire-Sergeant
Hi,

I know there are a few people interested in trying Typed Clojure,
so I've cut an early alpha release to give a taste.

These are *very* early days, but looking through the readme will
give you some hints as to what works in this release. Don't
expect too much.

https://github.com/frenchy64/typed-clojure

Please give it a whirl, feedback welcome!

Thanks,
Ambrose

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

Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Timothy Baldridge
Try

lein pom
On Apr 20, 2012 1:29 PM, Murtaza Husain murtaza.hus...@sevenolives.com
wrote:

 Hi,

 Is there any way to convert project.clj to pom.xml.

 I was looking at jelastic which is a cloud provider for java, and they
 allow deploying projects from git repos which are compatible with maven 3.
 It will download the code and build it based on the maven config.

 Anyway we can leverage that?

 Thanks,
 Murtaza

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

Re: Newbie question about rebinding local variables

2012-04-20 Thread Craig Ching


On Friday, April 20, 2012 1:15:11 PM UTC-5, kurtharriger wrote:


 Game state does not have to be a map, it could be any datastructure 
 you want, perhaps a protocol that is implemented by a concrete class 
 in another JVM language.  However, I avoid encapsulation unless there 
 is a compelling reason reason to add it.  More often then not the 
 result of encapsulation is that the entire library of useful functions 
 like map, reduce, get-in, update-in, etc... are no longer useable with 
 this custom data structure. 

 It is also not strictly required that all your functions be pure, you 
 could load or save game state to a database or external service as 
 necessary. There are very few applications that are strictly pure. 
 However, it is recommended that you make as much of your program pure 
 as possible.  If each time you made a game move the state was written 
 to a database then you might have difficulty trying to run multiple 
 solver strategies in parallel as these side-effects would continuously 
 clobber the others database state. 

 The general idea is that pure functions are easily composed and easy 
 to test, so use them whenever possible.  Impure functions that write 
 to external services are often much more difficult to compose and 
 test, so keep them as small as possible. Think twice about calling an 
 impure function from a pure function as this makes it impure... main 
 will almost certainly be impure, but that does not mean that 
 everything else also needs to be impure. 


I think that gives me a lot to ruminate on.  Thanks, I appreciate the 
detailed advice. 

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

Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Ben Smith-Mannschott
lein pom may not do all you need. It depends on what you are trying
to accomplish.

It will generate a pom.xml which identifies your project (artifactId,
groupId, version, packaging) and lists its dependencies. This pom is
suitable for publishing your artifacts to some Maven repository for
others to consume. (That appears to be stated purpose of 'lein pom':
Write a pom.xml file to disk for Maven interoperability.)

It does't configure clojure-maven-plugin, so executing 'mvn package'
with the resulting pom will not produce a useful result.

// ben

On Fri, Apr 20, 2012 at 21:19, Timothy Baldridge tbaldri...@gmail.com wrote:
 Try

 lein pom

 On Apr 20, 2012 1:29 PM, Murtaza Husain murtaza.hus...@sevenolives.com
 wrote:

 Hi,

 Is there any way to convert project.clj to pom.xml.

 I was looking at jelastic which is a cloud provider for java, and they
 allow deploying projects from git repos which are compatible with maven 3.
 It will download the code and build it based on the maven config.

 Anyway we can leverage that?

 Thanks,
 Murtaza

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


Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Phil Hagelberg
On Fri, Apr 20, 2012 at 1:46 PM, Ben Smith-Mannschott
bsmith.o...@gmail.com wrote:
 It will generate a pom.xml which identifies your project (artifactId,
 groupId, version, packaging) and lists its dependencies. This pom is
 suitable for publishing your artifacts to some Maven repository for
 others to consume. (That appears to be stated purpose of 'lein pom':
 Write a pom.xml file to disk for Maven interoperability.)

 It does't configure clojure-maven-plugin, so executing 'mvn package'
 with the resulting pom will not produce a useful result.

We are discussing adding the ability to specify other things like plugins:

https://github.com/technomancy/leiningen/pull/454

Feel free to weigh in or spike out an implementation if this is
something you're interested in.

-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


Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread David Nolen
A quick perusal of Google and I can see that term rewrite systems  Lisp
have a very long history. I'm not familiar with any specific Clojure
projects, but it seems like a rich field and there's a lot of literature to
back you up.

David

On Fri, Apr 20, 2012 at 11:08 AM, Matthew Rocklin mrock...@gmail.comwrote:

 Maude is certainly quite interesting. I definitely hope that it takes off.
 If there were people in my community who were more familiar with Maude I
 think it would be a good choice for me.

 Are you aware of any project that attempts to implement anything like a term
 rewrite system http://en.wikipedia.org/wiki/Term_rewriting_system using
 Clojure?



 On Fri, Apr 20, 2012 at 8:46 AM, David Nolen dnolen.li...@gmail.comwrote:

 I don't know Maude so I can't speak to much on it - though I've heard
 good things from many different people.

 Clojure is fairly well documented - core.logic not so much. People are
 doing interesting things with it but in order to get proficient it requires
 quite a bit of reading and research into miniKanren and Prolog.

 David


 On Fri, Apr 20, 2012 at 8:43 AM, Matthew Rocklin mrock...@gmail.comwrote:

 I felt like I was spending a large amount of time learning a specialized
 system. About half the time was learning how to pose problems in a new
 paradigm  and about half the time was dealing with
 language-specific idiosyncrasies. The first is necessary and good, the
 second was more frustrating. The manual and tutorials are quite good, it
 was frustrating how little resources there were otherwise - it is, for
 example, challenging to find a large quantity of well documented example
 code. Clojure doesn't have this problem.

 I would feel much better about learning language-specific idiosyncrasies
 of a general purpose language that I'm likely to use in the future. If
 Clojure + core.logic can easily be adapted to solve term rewriting problems
 then I'd much rather spend time on it.


 On Thursday, April 19, 2012 9:39:35 PM UTC-5, David Nolen wrote:

 What don't you like about Maude?

 On Wed, Apr 18, 2012 at 10:05 PM, Matthew Rocklin 
 mrock...@gmail.comwrote:

 Hello,

  As a disclaimer I know very little about this topic or about
 Clojure; please be kind. 

 Background:
 I'm interested in implementing a small term rewriting system for a
 specific application. I'm willing to spend some time learning a new
 language/system in order to do this cleanly. I'm currently playing with 
 the
 Maude system but am finding it restrictive. I've heard good things about
 Clojure's core.logic module and thought it might be a good case of a 
 domain
 specific sublanguage contained within a general purpose language.

 Question:
 Are there examples of term rewriting systems written in Clojure? If
 not, how difficult would this be? Are there suggested ideas or directions
 on implementation? I suspect that core.logic's unification system can be
 leveraged to perform much of the work.

 Best,
 -Matthew Rocklin http://matthewrocklin.com

 --
 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+unsubscribe@**googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en


  --
 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 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 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be 

Re: [ANN] Typed Clojure 0.1-alpha2

2012-04-20 Thread Raoul Duke
On Fri, Apr 20, 2012 at 11:50 AM, Ambrose Bonnaire-Sergeant
abonnaireserge...@gmail.com wrote:

 https://github.com/frenchy64/typed-clojure

very cool. fun to give Typed Racket a race!

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


Re: Twitter api?

2012-04-20 Thread Devin Walters
I've been using twitter-api FWIW. 

'(Devin Walters)


On Friday, April 20, 2012 at 1:16 PM, Pooya Razavian wrote:

 I've used clojure-twitter. Worked as advertised and very smooth. I was 
 curious if anyone tired using the spring social framework.
 
 On Friday, April 20, 2012 6:09:07 PM UTC+1, melipone wrote:
  I see twitter-api and clojure-twitter in clojars. Which one do you use?
 
 
 
 -- 
 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 
 (mailto: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 
 (mailto: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 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


Re: Term rewriting systems implemented in Clojure

2012-04-20 Thread Michael Fogus
I have a bit of a rewrite system built on core.unify at
https://github.com/fogus/unifycle, but it's far from comprehensive.

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


Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Murtaza Husain

Hi,

Thanks for the answers, they are quite helpful.

What I would like to do is this -

1) Use leiningen for development purposes. 

2) Gnenerate a pom while pushing to git.

3) Th pom should be good enough so that it can be used by cloud evironments 
( http://jelastic.com/docs/maven-cloud-hosting-in-jelastic) for building 
and deploying as a war. 

So is the above scenario possible if I just execute lein pom before pushing 
into git ? Or would using the clojure-maven plugin reolve this? If so is 
there a way to interop between both lein and clojure-maven, so that I can 
develop in one and deploy in another ?

Thanks,
Murtaza

On Saturday, April 21, 2012 2:18:22 AM UTC+5:30, Phil Hagelberg wrote:

 On Fri, Apr 20, 2012 at 1:46 PM, Ben Smith-Mannschott 
 bsmith.o...@gmail.com wrote: 
  It will generate a pom.xml which identifies your project (artifactId, 
  groupId, version, packaging) and lists its dependencies. This pom is 
  suitable for publishing your artifacts to some Maven repository for 
  others to consume. (That appears to be stated purpose of 'lein pom': 
  Write a pom.xml file to disk for Maven interoperability.) 
  
  It does't configure clojure-maven-plugin, so executing 'mvn package' 
  with the resulting pom will not produce a useful result. 

 We are discussing adding the ability to specify other things like plugins: 

 https://github.com/technomancy/leiningen/pull/454 

 Feel free to weigh in or spike out an implementation if this is 
 something you're interested in. 

 -Phil 


On Saturday, April 21, 2012 2:18:22 AM UTC+5:30, Phil Hagelberg wrote:

 On Fri, Apr 20, 2012 at 1:46 PM, Ben Smith-Mannschott 
 bsmith.o...@gmail.com wrote: 
  It will generate a pom.xml which identifies your project (artifactId, 
  groupId, version, packaging) and lists its dependencies. This pom is 
  suitable for publishing your artifacts to some Maven repository for 
  others to consume. (That appears to be stated purpose of 'lein pom': 
  Write a pom.xml file to disk for Maven interoperability.) 
  
  It does't configure clojure-maven-plugin, so executing 'mvn package' 
  with the resulting pom will not produce a useful result. 

 We are discussing adding the ability to specify other things like plugins: 

 https://github.com/technomancy/leiningen/pull/454 

 Feel free to weigh in or spike out an implementation if this is 
 something you're interested in. 

 -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

Re: Converting project.clj to maven's pom.xml

2012-04-20 Thread Phil Hagelberg
On Fri, Apr 20, 2012 at 6:52 PM, Murtaza Husain
murtaza.hus...@sevenolives.com wrote:
 3) Th pom should be good enough so that it can be used by cloud evironments
 ( http://jelastic.com/docs/maven-cloud-hosting-in-jelastic) for building and
 deploying as a war.

 So is the above scenario possible if I just execute lein pom before pushing
 into git?

It might work once Leiningen's issue #454 is fixed, but it's hard to
say without knowing the specifics of what jelastic requires in the
pom.

-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