Re: Generate static methods at runtime?

2013-03-17 Thread Marko Topolnik
gen-class can emit static methods, but one cannot leverage its functionality at runtime. But since compile-time is also a kind of runtime in Clojure, shouldnt't you be able to dynamically create an appropriate .clj file with the ns form and main- form, and have it compiled? -- -- You

Re: Cannot access a public static volatile field

2013-03-17 Thread Marko Topolnik
On Sunday, March 17, 2013 6:02:07 AM UTC+1, vemv wrote: Ahhh I tracked it down - the class was not public. I thought .java files had to define at least (and at most) *one* public class/enum/interface. How much sense can it make to define a private class in its own file? :( It makes perfect

Re: Generate static methods at runtime?

2013-03-17 Thread Víctor M . Valenzuela
Yeah I guess it could work, did you have in mind something like programmatically running `lein compile`? Can the JVM handle .class files written on the fly? Anyway, for my particular problem I don't need runtime-compiled static methods anymore. On Sun, Mar 17, 2013 at 7:34 AM, Marko Topolnik

Constructing java classes from a string containing the class name

2013-03-17 Thread Dave Snowdon
I need the ability to create one of a number of java classes which have constructors taking a known list of parameters. There are a large enough number of classes that having a set of conditions testing for each class name would be unmanageable. The classes are from a third-party jar file so I

Laziness in filter

2013-03-17 Thread bruce li
Hello, everyone. I'm writing some code that utilizes the lazy sequence. But I found something strange. Here is how: The code is like: (first (filter some-expensive-io urls)) The code is aimed to find the first result of the operations on the urls that is not nil. However, it seems that the io

Re: Laziness in filter

2013-03-17 Thread Evan Mezeske
I'd guess that what you're seeing is related to chunked sequences: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ . On Sunday, March 17, 2013 1:12:17 AM UTC-7, bruce li wrote: Hello, everyone. I'm writing some code that utilizes the lazy sequence. But I found something

Re: Imported Java lib can't find classes compiled on the fly

2013-03-17 Thread dennis zhuang
You can make the clojure class loader by yourself: (import '(clojure.lang RT)) (def class-loader (RT/makeClassLoader)) user= (.loadClass class-loader user.Foo) user.Foo 2013/3/17 vemv v...@vemv.net Most definitely :) But that something is hard/confusing should'nt be enough reason to give

Re: Generate static methods at runtime?

2013-03-17 Thread Marko Topolnik
On Sunday, March 17, 2013 8:31:24 AM UTC+1, vemv wrote: Yeah I guess it could work, did you have in mind something like programmatically running `lein compile`? Yes, just about, but even simpler: you just call *compile*, *load, load-file * or similar while binding *compile-files* to true

Re: Laziness in filter

2013-03-17 Thread dennis zhuang
Yep,it's chunked sequence,just like batch processing. You can use the seq1 function in fogus blog. 2013/3/17 Evan Mezeske emeze...@gmail.com I'd guess that what you're seeing is related to chunked sequences: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ . On Sunday,

Re: Laziness in filter

2013-03-17 Thread Marko Topolnik
This is one of the most frequenly-asked questions and a source of surprise to practically every new Clojure user. An update to the official documentation on lazy sequences would surely help a lot here. -marko On Sunday, March 17, 2013 9:18:05 AM UTC+1, Evan Mezeske wrote: I'd guess that what

Re: Imported Java lib can't find classes compiled on the fly

2013-03-17 Thread Marko Topolnik
No built-in Java mechanism (such as Class/forName) relies on the context classloader, that's just a mechanism that was supposed to help other frameworks manage class loading. Every such framework would have to explicitly getContextClassLoader to use it. On Sunday, March 17, 2013 4:05:51 AM

Re: Constructing java classes from a string containing the class name

2013-03-17 Thread Dave Snowdon
Great! Many thanks. Dave On Sunday, 17 March 2013 08:18:27 UTC, dennis wrote: Sorry,it's getDeclaredConstructor: (- klassname (Class/forName) (. getDeclaredConstructor String int) (.newInstance host port)) 2013/3/17 dennis zhuang killm...@gmail.com javascript: You can get the

Re: Laziness in filter

2013-03-17 Thread bruce li
Ah, it works. It is really chunked sequences. Thanks. Having been using clojure for half a year, it keeps really bringing me surprise and fun :) 2013/3/17 Marko Topolnik marko.topol...@gmail.com This is one of the most frequenly-asked questions and a source of surprise to practically every

Re: Imported Java lib can't find classes compiled on the fly

2013-03-17 Thread Víctor M . Valenzuela
There's the alternative signature Class.forName(String, boolean, ClassLoader). I got the Java side to use that instead of a plain Class.forName, passing it a custom ClassLoader (see my immediately previous reply). On Sun, Mar 17, 2013 at 12:38 PM, Marko Topolnik marko.topol...@gmail.comwrote:

Can I get a string like :cities as a keyword without getting the double ::?

2013-03-17 Thread larry google groups
I have been doing stuff like (str type-as-keyword) to push values into HTML forms, which leaves me with a string like :cities when the HTML forms are submitted. I might fetch them like: (let [this-item (get-in request [:params answers])) If I then do: this-item-as-keyword (keyword

Re: Can I get a string like :cities as a keyword without getting the double ::?

2013-03-17 Thread Jim - FooBar();
On 17/03/13 18:42, larry google groups wrote: (st/replace (str (:name item)) #: ) #(apply str (next %)) Jim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new

Re: Can I get a string like :cities as a keyword without getting the double ::?

2013-03-17 Thread JvJ
Use read-string. user (read-string :cities) :cities On Sunday, 17 March 2013 14:42:38 UTC-4, larry google groups wrote: I have been doing stuff like (str type-as-keyword) to push values into HTML forms, which leaves me with a string like :cities when the HTML forms are submitted. I might

Re: Can I get a string like :cities as a keyword without getting the double ::?

2013-03-17 Thread Jim - FooBar();
aaa of course, if you do want to *read* the keyword in, use read-string...there is no point in getting rid of the ':' and then essentially re-inserting it! Jim On 17/03/13 18:51, JvJ wrote: Use read-string. user (read-string :cities) :cities On Sunday, 17 March 2013 14:42:38 UTC-4, larry

Re: Can I get a string like :cities as a keyword without getting the double ::?

2013-03-17 Thread Michael Klishin
2013/3/17 JvJ kfjwhee...@gmail.com Use read-string. user (read-string :cities) :cities And if the input may be coming from untrusted sources, please use clojure.edn/read-string (Clojure 1.5+). -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- -- You received

ANN: core.logic 0.8.0

2013-03-17 Thread David Nolen
I'm happy to announce the release of core.logic 0.8.0. There are far too changes, bug fixes, and enhancements to cover here. For the most part the miniKanren portion of core.logic has been left unchanged from the standpoint of the user. The biggest change is the inclusion of extensible constraint

Re: FYI - Light Rail notes for Portland (fix)

2013-03-17 Thread Charlie Griefer
On Mar 16, 2013, at 9:24 PM, Rich Morin r...@cfcl.com wrote: The cost of a taxi from Portland Intl. Airport (PDX) to the Clojure/West hotel (Courtyard by Marriott) is listed (by the hotel) as about $35 one way. To save money, you can take the (TriMet) light rail: * Walk to the Portland

Re: [ClojureScript] Re: Moving ClojureScript to Clojure 1.5.0 data.json dependency

2013-03-17 Thread David Nolen
Done! On Sun, Mar 17, 2013 at 4:49 PM, Darrick Wiebe d...@xnlogic.com wrote: On Friday, 1 March 2013 11:41:26 UTC-8, David Nolen wrote: Now that Clojure 1.5.0 is out the door I'd like to make ClojureScript depend on it. This would allow me to merge in the source map branch which is a work

Re: clojure.core/format localization problems

2013-03-17 Thread dabd
I'm having this problem again. I start the repl with nrepl-jack-in. Also starting it on the command line with 'lein repl' shows the same problem. What is causing the JVM to lose the default locale settings (at least in regard to number formatting)? Thanks. On Sunday, March 10, 2013 12:39:57

Re: Can I get a string like :cities as a keyword without getting the double ::?

2013-03-17 Thread larry google groups
Thanks all. read-string seems obvious now that you all suggest it. On Sunday, March 17, 2013 3:01:14 PM UTC-4, Michael Klishin wrote: 2013/3/17 JvJ kfjwh...@gmail.com javascript: Use read-string. user (read-string :cities) :cities And if the input may be coming from untrusted

Re: clojure.core/format localization problems

2013-03-17 Thread dabd
It seems like 1.7 changed how default Locales are read from the host: http://stackoverflow.com/questions/7107972/java-7-default-locale http://blog.ej-technologies.com/2011/12/default-locale-changes-in-java-7.html On Sunday, March 17, 2013 10:40:19 PM UTC, dabd wrote: I'm having this problem

Re: Raw strings

2013-03-17 Thread vemv
Python has a notation for raw strings Python also has multiple inheritance :) what I want to mean is that some features have dubious value, regardless of whether they made it to language X or Y. I'm working on a project right now where the lack of raw strings is killing me. Do

Re: ANN: core.logic 0.8.0

2013-03-17 Thread David Nolen
Hot on the heels of 0.8.0, 0.8.1! This is mostly to push out some nice catches from Jonas Enlund (who works on the Clojure linter Kibit). One cool addition is that featurec is now recursive so you can constrain extract features of out nested maps with ease.

Re: ANN: core.logic 0.8.0

2013-03-17 Thread Ambrose Bonnaire-Sergeant
This is epic, and a long time coming! Thanks for the hard work David and congrats to the other contributors, especially Nada and Jonas! Thanks, Ambrose On Mon, Mar 18, 2013 at 3:50 AM, David Nolen dnolen.li...@gmail.com wrote: I'm happy to announce the release of core.logic 0.8.0. There are

[ANN] Termito - a term rewriting library

2013-03-17 Thread Jonas
Hi I'm happy to announce the first release of termito[1]. Termito is a term rewriting library inspired by the kibit rule system. With termito you can write declarative term rewriting rules like (defrules zero-rules [(* 0 ?x) 0]) (defrules identity-rules [(* 1 ?x) ?x]

Re: Raw strings

2013-03-17 Thread Mark Engelberg
On Sun, Mar 17, 2013 at 6:07 PM, vemv v...@vemv.net wrote: Reading a raw string stored in a file is already trivial :) I'm aware that one can store a raw string in a file. But in many instances, this would be absurd. For the kind of rapid interactive development we have in Clojure, we don't