Re: getting enlive not to parse something

2015-02-14 Thread Sam Raker
I think the easiest solution for me is to just use clj-http to get the content of the "leaf" pages and then hit 'em with a regex. It's not pretty, but, then again, neither is the tagsoup documentation. On Saturday, February 14, 2015 at 1:03:23 PM UTC-5, Herwig Hochleitner wrote: > > Enlive by d

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Mikera
If you really care about performance then I would use a macro for code generation and do something the following: (defmacro appendfunc ([m keys sb] `(do (.append ~sb (~m ~(first keys))) ~@(for [k (next keys)] `(do (.append ~sb \,)

Re: Name of a function

2015-02-14 Thread Cecil Westerhof
2015-02-14 20:21 GMT+01:00 Jony Hudson : > Unless I'm mistaken, in the output you show: > > Exception ERROR: round [:high|:low|:normal] user/round > (repl-startup.clj:30)​ > > > "user/round" is the name of the function, as desired. > ​You are right: I was not looking correctly. :-( In a way it

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Michael Blume
Basically same way you profile java, I usually use jvisualvm, if you feel like shelling out for yourkit that can be nicer. On Sat Feb 14 2015 at 11:23:12 AM Ivan L wrote: > What is the best way to profile Clojure? I tried a reduce doto thing but > it was way slowe than apply str. would love to

Re: Name of a function

2015-02-14 Thread Shantanu Kumar
You can probably omit try and throw to achieve the same effect. (let [ste# (aget (.getStackTrace (Exception.)))] ..) Shantanu On Sunday, 15 February 2015 00:58:28 UTC+5:30, Shantanu Kumar wrote: > > See if you can put this to any use (implies no warranty) - applicable to > the JVM only: > > (

Re: Name of a function

2015-02-14 Thread Shantanu Kumar
See if you can put this to any use (implies no warranty) - applicable to the JVM only: (defmacro whereami [] `(try (throw (Exception.)) (catch Exception e# ;; (.printStackTrace e#) ; uncomment this line to inspect stack trace (let [ste# (aget (.getStackTrace e#) 0

[ANN] cqrs-server - An opinionated CQRS/ES implementation using Onyx, Datomic, DynamoDB, Kafka and Zookeeper.

2015-02-14 Thread Mike Haney
Deon, This is outstanding. I experimented with a similar approach last summer, but struggled with a couple of things. First was what to use for the event store. I considered a few options, like using Datomic for that as well (I.e. annotate transactions and treat the sequence of transactions

Re: Name of a function

2015-02-14 Thread Steve Miner
Clojure doesn't give you direct access to the name of the function you're defining. However, you could use a macro to get that. Here’s one way. This macro binds the strange symbol %0 to the symbol naming the current function. ;; %0 is bound to the function's symbolic name within the function

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Ivan L
What is the best way to profile Clojure? I tried a reduce doto thing but it was way slowe than apply str. would love to know why. -- 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

Re: Name of a function

2015-02-14 Thread Jony Hudson
Unless I'm mistaken, in the output you show: Exception ERROR: round [:high|:low|:normal] user/round (repl-startup.clj:30)​ "user/round" is the name of the function, as desired. Jony On Saturday, 14 February 2015 19:09:53 UTC, Cecil Westerhof wrote: > > 2015-02-14 20:03 GMT+01:00 Jony Huds

Re: Name of a function

2015-02-14 Thread Herwig Hochleitner
Well, one of the many reasons, that clojure is faster than bash is, that during compilation, code is divorced from the original source symbols. That means you can only access information about the original source that you, or some library code you use, put in there for you. Jony stated correctly,

Re: Name of a function

2015-02-14 Thread Cecil Westerhof
2015-02-14 20:03 GMT+01:00 Jony Hudson : > Ah, I see. I don't know how to do that. But, the function name should be > in the stack trace associated with the exception. Is there a particular > reason you also want to put it in the message? > ​Well if I enter in the REPL: (round :dummy 12.4) I

Re: Name of a function

2015-02-14 Thread Jony Hudson
Ah, I see. I don't know how to do that. But, the function name should be in the stack trace associated with the exception. Is there a particular reason you also want to put it in the message? Jony On Saturday, 14 February 2015 18:45:12 UTC, Cecil Westerhof wrote: > > > > 2015-02-14 18:58 GMT+

Re: Name of a function

2015-02-14 Thread Cecil Westerhof
2015-02-14 18:58 GMT+01:00 Jony Hudson : > There might be a neater way, but > > (name (:name (meta (var reduce > > => "reduce" > ​That is not what I meant. I have the following function: (defn round ([x] (round :normal x)) ([mode x] (let [fn (case mode

Re: [ANN] cqrs-server - An opinionated CQRS/ES implementation using Onyx, Datomic, DynamoDB, Kafka and Zookeeper.

2015-02-14 Thread Christopher Small
Good catch; Thanks for correcting me. On Fri, Feb 13, 2015 at 11:57 PM, Lucas Bradstreet < lucasbradstr...@gmail.com> wrote: > Just a small clarification: both Storm and Onyx both depend on Zookeeper. Onyx > is masterless as of 0.5.0, however it still requires Zookeeper IN order to > write an app

Re: getting enlive not to parse something

2015-02-14 Thread Herwig Hochleitner
Enlive by default uses tagsoup to parse html and can also use jsoup, so I'd start with parsing options for those. It can also be used with other parsers, provided you can get them to generate clojure's xml map format. 2015-02-13 18:55 GMT+01:00 Sam Raker : > I'm trying to parse some stuff with en

Re: Name of a function

2015-02-14 Thread Jony Hudson
There might be a neater way, but (name (:name (meta (var reduce => "reduce" Jony On Saturday, 14 February 2015 16:11:48 UTC, Cecil Westerhof wrote: > > In Bash I use the following construct: > printf "${FUNCNAME} needs an expression\n" > > In this way I do not have to change the print

Name of a function

2015-02-14 Thread Cecil Westerhof
In Bash I use the following construct: printf "${FUNCNAME} needs an expression\n" In this way I do not have to change the print statement when the name of the function changes. Is something like this also possible in clojure? -- Cecil Westerhof -- You received this message because you are

Re: Is this the good way to write get-percentage

2015-02-14 Thread Cecil Westerhof
2015-02-14 12:33 GMT+01:00 Cecil Westerhof : > > 2015-02-11 8:32 GMT+01:00 Cecil Westerhof : > >> >> I needed a function to get the percentage as an int. Input is place and >> total-count. >> I want the normal definition (which is the default) and a high and low >> variant. >> >> I came up with th

Re: Is this the good way to write get-percentage

2015-02-14 Thread Cecil Westerhof
2015-02-14 15:46 GMT+01:00 Jonathan Winandy : > "Unable to resolve symbol: ​ in this " > > I get this error when I have a non-breaking space in my code : > http://en.wikipedia.org/wiki/Non-breaking_space > ​It was not a non-breaking space (those I see), but something like it, with code #x200b. Af

Re: Is this the good way to write get-percentage

2015-02-14 Thread Jonathan Winandy
"Unable to resolve symbol: ​ in this " I get this error when I have a non-breaking space in my code : http://en.wikipedia.org/wiki/Non-breaking_space Jon On Sat, Feb 14, 2015 at 3:21 PM, Matching Socks wrote: > A Clojure fn is an Object, but Math's ceil method is not an Object. The > Java-Int

Re: Is this the good way to write get-percentage

2015-02-14 Thread Matching Socks
A Clojure fn is an Object, but Math's ceil method is not an Object. The Java-Interop notation for static methods, eg (Math/ceil...), papers over this difference. If you want to manipulate something like Math/ceil as a Clojure fn, you can wrap it in one such as your round-high. http://stackove

Re: Is this the good way to write get-percentage

2015-02-14 Thread Cecil Westerhof
2015-02-13 11:30 GMT+01:00 Jonathan Winandy : > (defn to-mode-fn [mode] > (if (keyword? mode) > (case mode :highMath/ceil >:low Math/floor >:normal Math/round > (throw (Exception. "ERROR: get-percentage [:high|:low|:normal] > "))) > mode))

Re: Is this the good way to write get-percentage

2015-02-14 Thread Cecil Westerhof
2015-02-11 8:32 GMT+01:00 Cecil Westerhof : > > I needed a function to get the percentage as an int. Input is place and > total-count. > I want the normal definition (which is the default) and a high and low > variant. > > I came up with the following code: > (defn get-percentage > ([pla

Roll up! Bodil on microKanren at Skills Matter London 3 March

2015-02-14 Thread Bruce Durling
Roll up! Roll up! Bodil Stokke will be speaking about microKanren at Skills Matter London on 3rd March Details and sign up here: https://skillsmatter.com/meetups/7025-kanren-running-the-little-things-backwards cheers, Bruce -- You received this message because you are subscribed to the Google

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Michael Blume
...Annoyingly, almost all the time for my version is spent in protocol dispatch, so there's probably a much faster way to do that. On Sat Feb 14 2015 at 12:21:11 AM Michael Blume wrote: > er, s/(comp val)/val > > On Sat Feb 14 2015 at 12:17:18 AM Michael Blume > wrote: > >> For minimal change t

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Michael Blume
er, s/(comp val)/val On Sat Feb 14 2015 at 12:17:18 AM Michael Blume wrote: > For minimal change to the presented code, what about > > (defprotocol appendable (append-to [this ^StringBuilder sb])) > > (extend-protocol appendable > String > (append-to [this ^StringBuilder sb] (.append sb this

Re: Performant string concatenation (of many, large strings)

2015-02-14 Thread Michael Blume
For minimal change to the presented code, what about (defprotocol appendable (append-to [this ^StringBuilder sb])) (extend-protocol appendable String (append-to [this ^StringBuilder sb] (.append sb this)) clojure.lang.IFn (append-to [this ^StringBuilder sb] (this sb)) Object (append-t