keyword arguments

2011-11-27 Thread Razvan Rotaru
Hi, This may be a question without hope, but I'm thinking that asking never hurts. So here goes: The closest thing to keyword arguments that I have found is destructuring with a map: (defn myfun [ {:keys [arg1 arg2 arg3] :or {arg1 default-value} :as args}] ...) When I

Re: Drift 1.4.0 released.

2011-11-27 Thread Edmund
Sadly, there is no improvement. I've made a minimal project to demonstrate. Literally - lein new tdrift - modify project.clj - add migration-config.clj - add appropriate migration directory - lein deps - lein create-migration I've put it up on github (https://github.com/ejackson/tdrift).

Re: Drift 1.4.0 released.

2011-11-27 Thread Chris Perkins
My guess would be a clojure version mismatch, based on the stacktrace. Have you tried changing your project to use clojure 1.2.1? - Chris -- 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

Re: Drift 1.4.0 released.

2011-11-27 Thread Edmund
Bingo! Thanks for that, version 1.3.0 incompatibility it is. On 27/11/2011 13:41, Chris Perkins wrote: My guess would be a clojure version mismatch, based on the stacktrace. Have you tried changing your project to use clojure 1.2.1? - Chris -- You received this message because you are

Re: Drift 1.4.0 released.

2011-11-27 Thread Matt
I just sent you a pull request to fix the Clojure 1.3 incompatibility. Also, you may want to use the current-version and update-version functions in drift-db.migrate instead of your own home grown functions. Though you would have to create your own initialize function to initialize the drift-db

Re: keyword arguments

2011-11-27 Thread Mark Rathwell
You can use the :pre and :post assertions on functions. Something like the following would do what you are asking: (defn myfun [ {:keys [arg1 arg2 arg3] :or {arg1 default-value} :as args}] {:pre [(every? #{:arg1 :arg2 :arg3} (keys args))]} (println arg1 arg2 arg3 args: args)) Also,

[lein] Depending on tools.jar

2011-11-27 Thread David Powell
Is there any way in Leiningen to add a dependency on the JDK's tools.jar? Apparently it is possible with maven [1] I was thinking of porting my liverepl[2] utility over to leiningen to make it a bit easier to install, and easier to run without scripts, it uses the JDK's Attach API from tools.jar

Re: [lein] Depending on tools.jar

2011-11-27 Thread Phil Hagelberg
On Sun, Nov 27, 2011 at 10:47 AM, David Powell djpow...@djpowell.net wrote: Is there any way in Leiningen to add a dependency on the JDK's tools.jar? Apparently it is possible with maven [1] I was thinking of porting my liverepl[2] utility over to leiningen to make it a bit easier to install,

Better way to do this ? deep-merge-with-keys

2011-11-27 Thread Paul Mooser
For a project I'm working on, I wanted some variants of merge-with and deep-merge-with that would also provide information about the keys where collisions were occurring. I have (based on minimal testing) a working implementation, but it feels like there should be a simpler way to do this - I

Re: keyword arguments

2011-11-27 Thread Alan Malloy
On Nov 27, 8:43 am, Mark Rathwell mark.rathw...@gmail.com wrote: Also, another way to take keyword arguments is: (defn foo [ opts]   (let [opts (apply hash-map opts)]     (println opts))) This is what already happens internally with the {:keys ...} notation. You can actually be rather more

Re: keyword arguments

2011-11-27 Thread Mark Rathwell
Yeah, laziness on my part, I was just trying to show that everything after '' comes in as a list, and you can be creative if you need to be. I use this on occasion for macros with multiple different types of optional arguments. On Sun, Nov 27, 2011 at 6:45 PM, Alan Malloy a...@malloys.org wrote:

Re: clojure-jsr223 and shibboleth ScriptedAttributeDefinition

2011-11-27 Thread Francesco
Thank you very much, it works! The correct script is: resolver:AttributeDefinition id=cljattr xsi:type=Script language=Clojure xmlns=urn:mace:shibboleth:2.0:resolver:ad resolver:AttributeEncoder xsi:type=SAML1String xmlns=urn:mace:shibboleth:2.0:attribute:encoder

Want some books or issues about ClojureCLR

2011-11-27 Thread * 巫云**Adam
I am learning Clojure and I use the CLR version. But I can not find a book about Clojure CLR, just for Clojure and java. I want someone give me suggestions about the book or issues of Clojure CLR. Thanks a lot. -- You received this message because you are subscribed to the Google Groups Clojure

Re: Lookup on a symbol?

2011-11-27 Thread Bill Caputo
On Nov 24, 2011, at 12:32 AM, Sean Corfield wrote: @lloyda2 posted on Twitter: (reduce 'and '(false true)) = true ...Huh? I must admit, it looked odd to me... but I realized (after some REPL experimentation) this seems to be equivalent to ('some-symbol :some-key :some-default) I saw the

ANN: template based web v0.1.0

2011-11-27 Thread jongwon.choi
Hello I've just released the first RC1 of my first Clojure toy project[1]. This is basically old style put tags in HTML and process such tags in your code. I copied the idea from html-template[2]. Because this is my first Clojure coding effort, there might be mistakes. Any comment and

Re: Clojure on PyPy

2011-11-27 Thread Alexander Kellett
On Thursday, November 17, 2011 5:09:49 PM UTC+1, tbc++ wrote: I also felt that sticking with the official Java implementation of Clojure would be more practical. It would certainly be fun to put Clojure on PyPy, though. There is one insanely off-the-wall idea I've been thinking about

Re: ClojureScript new branches - feedback please

2011-11-27 Thread Alexander Kellett
'prop-lookup'++. First thing that really tricked me up with ClojureScript is (goog.net.XhrIo/send uri #(.getResponseJson (.target %))) blowing up in my face as it isn't using getResponseJson() but rather returning the function. Ended up using (.getResponseJson (...) nil) to work around it.

Head holding issue

2011-11-27 Thread Gerrard McNulty
Hi, I have the following code that I'm trying to use to split a sequence of strings into files of approx. x-size (defn split-file ([path strs split-size] (loop [ss (seq strs), part 0] (when-let [more (split-file path ss split-size part)] (recur more (inc part) ([path

Re: [core.logic] Incorporating a database as a source of facts

2011-11-27 Thread David Nolen
As Mark said you can avoid the graph issue with tabling. core.logic has tabling. If you look at the tabling section here - https://github.com/clojure/core.logic, you should see something related to your problem. While defrel/facts are neat - they are really intended for people who don't already

Re: examples of using protocols for extending functionality of existing classes?

2011-11-27 Thread ru
Thank you very much, Tassilo! Are Graph and Vertex classes from the public API? On 24 ноя, 13:02, Tassilo Horn tass...@member.fsf.org wrote: ru soro...@oogis.ru writes: Can anybody point out good (idiomatic) examples of using protocols for extending functionality of existing classes?

Re: [core.logic] Incorporating a database as a source of facts

2011-11-27 Thread David Nolen
By examining to-stream https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L1413and extend-rel https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L1527you should be able to see how to turn any Clojure sequence into a

Re: examples of using protocols for extending functionality of existing classes?

2011-11-27 Thread ru
Thank you very much, Tassilo! Are Graph and Vertex classes from the public API? On 24 ноя, 12:02, Tassilo Horn tass...@member.fsf.org wrote: ru soro...@oogis.ru writes: Can anybody point out good (idiomatic) examples of using protocols for extending functionality of existing classes?

Re: Lookup on a symbol?

2011-11-27 Thread jongwon.choi
No that doesn't make any sense, but I (think I) know what is going on there. (:a 1 2) === (get 1 :a 2) Jong-won On Nov 25, 1:35 pm, jaime xiejianm...@gmail.com wrote: But we still don't know why it behaves like this and for what reason. does (:a 1 2) returns 2 make any sense?? -- You

Re: Lookup on a symbol?

2011-11-27 Thread jongwon.choi
I'd expect the same, but in the code (https://github.com/clojure/ clojure/blob/master/src/jvm/clojure/lang/RT.java) get and getFrom do not raise any error. On Nov 24, 6:30 pm, Sean Corfield seancorfi...@gmail.com wrote: (:a 1 2) yields 2 which surprises me a bit... I'd expect an error because

How can we Laucnh REPL from java Swing application?

2011-11-27 Thread vikbehal
Instead of typing java -cp clojure.jar clojure.main on Cygwin/ console to run some Clojure Script, Is it possible to make a GUI which should show us REPL as myREPL=. There we should be able to write commands and execute. -- You received this message because you are subscribed to the Google

Clojure 1.3 head holding bug

2011-11-27 Thread Gerrard McNulty
Hi, I've a head holding problem that I believe is a bug in clojure 1.3. I wrote the following function to split a a lazy seq of strings across files of x size: (defn split-file ([path strs size] (trampoline split-file path (seq strs) size 0)) ([path strs size part] (with-open [f

Using Clojure on a Mac

2011-11-27 Thread Clojure NewB
Hi, I've just installed Clojure 1.3 on a MBP, OSX 10.6.8. After unzipping the download, I'm left with a directory with a few .jar files and two subdirectories. (I'm also a Java newb too) How do I run Clojure? Thanks -- You received this message because you are subscribed to the Google

Error running Clojure 1.3 on OSX 10.6.8

2011-11-27 Thread Clojure NewB
When I launch Clojure, the following is displayed java -cp clojure.jar clojure.main Exception in thread main java.lang.NoClassDefFoundError: clojure/main Caused by: java.lang.ClassNotFoundException: clojure.main at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at

Re: Using Clojure on a Mac

2011-11-27 Thread Sean Corfield
On Sat, Nov 26, 2011 at 10:15 PM, Clojure NewB cappy2...@gmail.com wrote: I've just installed Clojure 1.3 on a MBP, OSX  10.6.8. ... How do I run Clojure? The best way to get Clojure up and running is to use Leiningen so you don't have to deal with classpaths etc.

Re: Error running Clojure 1.3 on OSX 10.6.8

2011-11-27 Thread Sean Corfield
On Sat, Nov 26, 2011 at 10:30 PM, Clojure NewB cappy2...@gmail.com wrote: When I launch Clojure, the following is displayed ... Would someone explain what happened? I've followed the directions here http://clojure.org/getting_started See my other reply: don't worry about the bare Clojure

Re: [core.logic] Incorporating a database as a source of facts

2011-11-27 Thread Tassilo Horn
David Nolen dnolen.li...@gmail.com writes: Hi David, As Mark said you can avoid the graph issue with tabling. core.logic has tabling. If you look at the tabling section here - https://github.com/clojure/core.logic, you should see something related to your problem. Thanks, I'll have a look.