Re: Benefits to partial functions.

2019-10-22 Thread b w
When I was putting together lessons to teach Clojure, I was analyzing texts from Gutenberg and doing things like counting the number of words, and the frequency and distribution of words, and things like that, and "partial" was noticeably slower. FWIW. On Sun, Oct 20, 2019 at 11:23 PM Alex Engelbe

Re: [JOB] CLJ/CLJS Developer(FL/Remote) - Swarmify putting an end to video buffering

2017-03-09 Thread Nate B
// , I have an acquaintance who has done some prototyping and dynamic applications with Heroku, Clojure, and ClojureScript if you're interested. His name's Jason, and he's pretty active on his Github: https://github.com/rjb25?tab=repositories If you have a specific pain point you can aim him

Re: What I'm missing in my Instaparse rules?

2016-06-13 Thread Hussein B.
Oh my ... You saved my hair! :) Thanks a lot for your help and time. On Monday, June 13, 2016 at 12:03:54 PM UTC+2, puzzler wrote: > > Looks like you left off a + in your regular expression for String. > > On Mon, Jun 13, 2016 at 2:59 AM, Hussein B. > wrote: > >> Thank

Re: What I'm missing in my Instaparse rules?

2016-06-13 Thread Hussein B.
requirement. > > => (re-seq #"[^\"]+" "Harden }") > ("Harden }") > > A solution would be to make the regex for ITEM more restrictive. > > On Sun, Jun 12, 2016 at 12:52 PM, Hussein B. > wrote: > >> He

What I'm missing in my Instaparse rules?

2016-06-12 Thread Hussein B.
Hello, I'm playing around Instaparse library, starting very simple. For input like : { player } I created the following parser: (def ast (ist/parser "TEST = OBJECT = <#'\\s+'> = <'{'> = <'}'> ITEM = #'[^\"]+' OBJECT = CURLY_OPEN WHITESPACE* ITEM WHITESPACE* CURLY_C

Re: Interest in a Full Featured Clojure Blog Engine

2016-03-23 Thread Nate B
// , What ended up happening with this? My company and I could really use a full featured blogging engine in Clojure. https://groups.google.com/forum/#!topic/clojure/rCmPYa0Vw-4 On Thursday, July 18, 2013 at 7:24:06 AM UTC-7, frye wrote: > > Hello, > > I'm thinking of how to build a composa

Re: ANN: ClojureScript 1.7.170, Enhanced Build Pipeline

2015-11-06 Thread Nathan B
Just some early results on our builds show a roughly 30% decrease in compile time when using cljsbuild auto. That helps a lot during development. Awesome work as usual, thanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, s

Re: ANN: ClojureScript 1.7.145

2015-10-13 Thread Nathan B
On Tuesday, October 13, 2015 at 8:02:07 AM UTC-7, David Nolen wrote: > ClojureScript, the Clojure compiler that emits JavaScript source code. > > > README and source code: https://github.com/clojure/clojurescript > > > Leiningen dependency information: > > >     [org.clojure/clojurescript "1.

Re: My Zipper isn't deleting what I thought is going to delete

2015-08-27 Thread Hussein B.
ion: > > (z/zipper #(get % "children") #(get % "children") (fn [p c] (assoc p > "children" c)) {"children" z}) > > looks like it'll do the right thing here. > > Take care, > Moe > > On Thu, Aug 27, 2015 at 11:03 AM, Hus

Re: My Zipper isn't deleting what I thought is going to delete

2015-08-27 Thread Hussein B.
The modify function (defn modify [loc] (-> loc z/remove)) On Thursday, August 27, 2015 at 11:58:31 AM UTC+2, Hussein B. wrote: > > Hi, > > I'm trying to remove an element from nested data structure (nesting in > unknown, so I'm trying to come up with a g

My Zipper isn't deleting what I thought is going to delete

2015-08-27 Thread Hussein B.
Hi, I'm trying to remove an element from nested data structure (nesting in unknown, so I'm trying to come up with a generic solution: (def z [ {"a" {"b" 1 "c" 2} "children" [{"a" {"b" 3 "

How to move an element within a vector?

2015-08-25 Thread Hussein B.
Hi, For a vector like [A B C D E], how to remove an element to a specific location? For example [A D B C E] ? I thought about converting the vector into array but I would feel bad if I did that. What would be the idiomatic way to do that in Clojure? Thanks for help and time. -- You

Re: Why I'm getting NPE with zipper/next?

2015-08-24 Thread Hussein B.
Thanks a lot for your time and your helpful answers. Now I started to understand zippers, thanks to you. On Monday, August 24, 2015 at 7:36:17 PM UTC+2, Moe Aboulkheir wrote: > > Hussein, > > > On Mon, Aug 24, 2015 at 5:40 PM, Hussein B. > wrote: > > > But n

Re: Why I'm getting NPE with zipper/next?

2015-08-24 Thread Hussein B.
The result now is as desired: ({"a" {"b" 1, "c" 2}, "children" [{"a" {"b" 3, "c" 4}, "children" []}]} {"a" {"b" 5, "c" 6}, "children" []} {"a" {"b" 7, &q

Re: Why I'm getting NPE with zipper/next?

2015-08-24 Thread Hussein B.
x) {"children" z})) On Monday, August 24, 2015 at 4:08:17 PM UTC+2, Moe Aboulkheir wrote: > > Went off half-cocked there. The remainder: > > (edit-parents > #(= 10 (get-in % ["a" "b"])) > #(update % "children" reverse), > data-z

Re: Why I'm getting NPE with zipper/next?

2015-08-24 Thread Hussein B.
loc)) (defn predicate [x] (and (vector? x) (some #(= 10 (get-in % ["a" "b"])) x))) (defn operation [x] (update x "children" reverse)) (edit-parents predicate operation (z/seq-zip {"children" z})) But I'm still getting the same data.

Re: Why I'm getting NPE with zipper/next?

2015-08-24 Thread Hussein B.
Hi Moe, I have this structure: [{"a" {"b" 1 "c" 2} "children" [{"a" {"b" 3 "c" 4} "children" []}]} {"a" {"b" 5 "c" 6} "children" []} {"a" {"b" 7

Re: Why I'm getting NPE with zipper/next?

2015-08-21 Thread Hussein B.
a zipper you omitted from your post, zipping over maps, > in particular, may not be as convenient as you're imagining. > https://clojuredocs.org/clojure.zip/zipper has helpful examples in it. > > Take care, > Moe > > On Fri, Aug 21, 2015 at 5:06 PM, Hus

Re: Why I'm getting NPE with zipper/next?

2015-08-21 Thread Hussein B.
> > On Fri, Aug 21, 2015 at 4:35 PM, Hussein B. > wrote: > > Hi, > > > > I have this structure: > > > > (def s [{"n" {"id" "a"} "d" 2 "children" [{"n" {"id" "c"} "d"

Why I'm getting NPE with zipper/next?

2015-08-21 Thread Hussein B.
Hi, I have this structure: (def s [{"n" {"id" "a"} "d" 2 "children" [{"n" {"id" "c"} "d" 4 "children" []}]} {"n" {"id" "b"} "d" 3 "children" [

Re: How can find something inside heavily nested data structure ?

2015-08-21 Thread Hussein B.
Yes, that does the job. Thanks for your help and time. On Thursday, August 20, 2015 at 12:21:47 AM UTC+2, Alan Forrester wrote: > > On 19 Aug 2015, at 18:08, Hussein B. > > wrote: > > > Here is more concrete example > > > > (def s [{"n" {"

Re: How can find something inside heavily nested data structure ?

2015-08-19 Thread Hussein B.
Here is more concrete example (def s [{"n" {"id" "a"} "d" 2 "children" [{"n" {"id" "c"} "d" 4 "children" nil}]} {"n" {"id" "b"} "d" 3 "children"

Re: How can find something inside heavily nested data structure ?

2015-08-19 Thread Hussein B.
tween your conceptual nodes and your data structures (vectors and > maps)? > > On 19 August 2015 at 17:26, Andy- > > wrote: > > I have yet to evaluate it myself but this might do help you: > > > > https://github.com/nathanmarz/specter > > &g

How can find something inside heavily nested data structure ?

2015-08-19 Thread Hussein B.
Hi, I have transformed JSON response into the equivalent data structure using Cheshire library. The result is a huge nested data structure , mostly vectors and maps. It is actually a tree. How to find a property that is nested deep inside the tree ? For example I'm search for the node that ha

How to transform this structure idiomaticlly in Clojure?

2015-08-18 Thread Hussein B.
Hi, I have the following structure. Node has a string properly and a vector nodes and of course, each node has a string a property and a vector of nodes. So I created the following record: (defrecord Node [title childs]) And I have the following JSON response: node string [ node1 [ nn1

Streaming Media East NYC Mini-Meetup 5/10

2015-05-02 Thread Nathan B
If any Clojurians will be at Streaming Media East or just local to NYC and would like to do a mini-meetup at the New York Hilton Midtown on 5/10 in the evening let me know. Would be nice to meet up and have a few drinks and talk Clojure. I can organize if there is some interest. -- You receive

Re: Current state of automatic generation of externs file for CLJS Advanced Compilation?

2015-03-24 Thread Nathan B
We use https://github.com/ejlo/lein-externs for this and it seems to work pretty well for our purposes. On Monday, March 23, 2015 at 10:42:40 PM UTC-4, james borden wrote: > > Is there a way to automatically generate externs files for js libraries > for use with the cljs advanced compilation mod

As framework creator, how would you get user defined specific functions/macros?

2014-11-20 Thread Hussein B.
Hi, Lets say that you are framework creator and to use your framework, you defined a macro called defcontroller where the users of your framework add their logic. You -as framework creator- how would you load user defined source code files and collect their defcontroller definitions? Thanks f

Re: Understanding how a collection reduce itself

2014-10-09 Thread Hussein B.
me as ((comp f g) x): > > ((comp (filterer even?) (mapper inc)) conj)) > > Now we can can finally create our efficient map/filter in a clean way: > > (let [f (comp (filterer even?) > (mapper inc))] > (reduce (f conj) [] xs)) > > The reducer library goes one

Re: Understanding how a collection reduce itself

2014-09-24 Thread Hussein B.
To elaborate more, I know that with reducers, map for example isn't going to create the resulting sequence by using cons. That is clear to me. But, if the collections is going to call cons while reducing itself, then I'm not sure what is the benefit of reducers (besides it makes sense and makes

Re: Understanding how a collection reduce itself

2014-09-24 Thread Hussein B.
When the collection is reducing itself, it is going to create a sequence and call cons, conj or something like. If this is true, then I'm not sure what reducers is bringing to the table. Because according to what I read, by using reducers, map/filter functions aren't going to create and allocate

Understanding how a collection reduce itself

2014-09-23 Thread Hussein B.
Hi, I spent a considerable time trying to understand reducers. I got the concept of how the map/filter function will return a function and it is not going to iterate over a sequence and it is not going to create a new sequence. The missing part though, who is creating the sequence? They say a

How to tackle this concurrency problem?

2014-06-20 Thread Hussein B.
Hi, I have a ref that saves the ID of last processed event. Of course, I'm using Clojure STM facility. The problem now is I can't control the value of the ref. Due massive concurrency, it is updated and my logic is broken. How to guard, and really guard the update of that ref? Should I do (lo

How to know if an agent throw an exception?

2014-06-20 Thread Hussein B.
Hi, When using send-off of an Agent, how to know if any exception is happened? Since AFAIK, agents are executed in different thread. Currently, I'm calling (agent-error) but nothing is logged. Maybe nothing went wrong but some how I'm sure something went wrong. Thank you. -- You received thi

When to use (ensue) ?

2014-06-19 Thread Hussein B.
Hi, When dealing with Clojure ref types, when to use (ensure) ? 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

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Hussein B.
difference in terms of how it looks from STM. > > 2 agents will have 2 independent queues, even though they might share > threadpools, if you want to guarantee order, you need one queue. > > > On Tue, Jun 17, 2014 at 5:54 PM, Hussein B. > wrote: > >> I think sen

Re: Doing Socket IO inside STM transaction

2014-06-17 Thread Hussein B.
June 17, 2014 11:45:52 PM UTC+2, Gary Trakhman wrote: > > Agent send operations inside a transaction get queued up and don't > actually get sent until the transaction commits, that's probably what you > want, it's meant for side-effects. > > > On Tue, Jun

Doing Socket IO inside STM transaction

2014-06-17 Thread Hussein B.
Hi, I have a ServerSocket that stores the client ID and the client socket object into a ref type. And I also have a thread that is running in the background that checks if a specific condition is met, then it will start send notifications to the clients (it will use the client-id-ref and messa

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
Nice! :) Thanks all for help. On Tuesday, June 17, 2014 9:00:06 PM UTC+2, Thomas Heller wrote: > > > > On Tuesday, June 17, 2014 8:16:36 PM UTC+2, Hussein B. wrote: >> >> Oh, this works >> >> (dosync (alter v #(update-in %1 [1] (fnil conj [ ]) %2) 33)) >

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
Oh, this works (dosync (alter v #(update-in %1 [1] (fnil conj [ ]) %2) 33)) On Tuesday, June 17, 2014 8:05:10 PM UTC+2, Hussein B. wrote: > > Thanks, it works. > > In case, my initial map is a ref type > > (def m (ref { } )) > > Why this isn't working? > > (

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
Thanks, it works. In case, my initial map is a ref type (def m (ref { } )) Why this isn't working? (dosync (alter m #(update-in @v [1] (fnil conj [ ])) 11)) On Tuesday, June 17, 2014 7:55:14 PM UTC+2, Mauricio Aldazosa wrote: > > For updating the value of a map given a key you can use upd

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
s, then add the value to the existing vector. On Tuesday, June 17, 2014 7:21:43 PM UTC+2, Hussein B. wrote: > > Hi, > > This is a very basic question, so be patient please! :) > > I have an empty map where key is an integer and the value is a vector. > > How I can add an

How to add elements to a vector that is the value of a map key?

2014-06-17 Thread Hussein B.
Hi, This is a very basic question, so be patient please! :) I have an empty map where key is an integer and the value is a vector. How I can add an element to the vector of a specific key? For example: {1 [11]} Then {1 [ 11 22]} Thanks for help and time. -- You received this message becau

Re: Clojure:Lisp :: LSD:Meditation

2014-06-12 Thread Hussein B.
Thanks. Now, I have a clue how to skip some posts here. On Thursday, June 12, 2014 3:41:13 PM UTC+2, Divyansh Prakash wrote: > > I compare Clojure to acid in this > > rant. > -- You received this message because you ar

How to unit test (defn-) functions?

2014-06-12 Thread Hussein B.
Hi, I like to use (defn-) when it comes to internal implementation functions. But since they aren't exposed, how to unit test them? Of course, I'm using Lein and clojure.test Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Clojure on iOS devices - Swift as a host?

2014-06-11 Thread Hussein B.
The idea of having lisp on iOS (and OS X) is really awesome but there is a huge downside: That won't integrate with Xcode "Interface Builder" out of the box. That would be the deal breaker. On Wednesday, June 4, 2014 3:20:22 PM UTC+2, Greg Knapp wrote: > > The recent release of Swift made me re

How to iterate over maps and drop one specific element each time?

2014-06-11 Thread Hussein B.
Hi, I have a seq of maps: [ {:op :e :v 1} {:op :n :b 2} {:op :m :z 2.3} ] How to iterate over the sequence and extracting only the non-op entries? Desired result is: [ {:v 1} {:b 2} {:z 2.3} ] Thanks for help and time. -- You received this message because you are subscribed to the Google

What is going wrong in my code?

2014-05-11 Thread Hussein B.
Hi, I'm trying to learn how to make DSL in Clojure and Korma project is a really good place to learn from. I'm trying this very simple stuff (inspired by Korma, not Korma code): (def predicates {'and :and 'or :or 'not :not '> :gt

Re: How to convert this list into map?

2014-05-10 Thread Hussein B.
That is beautiful! Thanks a lot! On Sunday, May 11, 2014 12:33:51 AM UTC+2, Mike Fikes wrote: > > Here is how you can derive that expression: > > {:op :=, :language "Clojure"} > > is the same as > > (hash-map :op := :language "Clojure") > > > which is the same as > > (apply hash-map '(:op := :lang

How to convert this list into map?

2014-05-10 Thread Hussein B.
Hi, I have this list: (:= :language "Clojure") And I want to convert it to the following map data structure: {:op := , :language "Clojure"} I can't really think of a clear way how to do it. Would you please help? Thanks for help and time. -- You received this message because you are subscr

In Lein, is it possible to run a specific test suite?

2014-05-06 Thread Hussein B.
Hi, I'm using clojure.test and Lein. Is it possible to run a specific test suit ? I don't want to run the whole test each time. Thanks for help and time. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@g

Re: (eval `(def ~(symbol varname) lineseq)

2014-04-28 Thread Peter B. West
On 28 Apr 2014, at 10:57 am, Carlo Zancanaro wrote: > ... > There are other ways to manage resource scope, though. For instance, you > could have your "lazy-lines" function return a lazy-sequence which will > close the file on completely reading the stream: > > (defn lazy-lines [resource] >

Re: (eval `(def ~(symbol varname) lineseq)

2014-04-28 Thread Peter B. West
Thanks Mark, I'll keep that in mind. At this stage I'm just exploring. Peter On 28 Apr 2014, at 1:03 pm, Marc Limotte wrote: > I don't know the details of your particular use, but for a general solution > to the resource management problem, maybe Stuart Sierra's component system > would work

Re: (eval `(def ~(symbol varname) lineseq)

2014-04-27 Thread Peter B. West
On 27 Apr 2014, at 7:40 pm, Carlo Zancanaro wrote: > I'm struggling to understand the problem that you're actually trying to > solve. The solution that you are proposing doesn't seem like an elegant > solution to any problem, so could you elaborate on what you're trying to > do? > http://dev.c

Idiomatic Clojure for iterating all items of a map

2014-04-21 Thread Hussein B.
Hi, For a data structure such as: (def langs {:langs [ {:lang "Clojure" :version 1.6} {:lang "Erlang" :version 17} ] } ) How to iterate all the items of the maps? I tried this but it is too imperative to me: (doseq [lang (:langs langs) (doseq [k (keys lang)]

Why this Clojure part is working in Korma and no exception is thrown?

2014-04-21 Thread Hussein B.
Hi, I'm trying to study the source code of Korma project. (insert users (values {:first "john" :last "doe"})) This will resolve to (defmacro insert) https://github.com/korma/Korma/blob/master/src/korma/core.clj#L143 Will call (defn- make-query-then-execute) https://github.com/korma/Korma/

Dealing with edn for the first time

2014-04-20 Thread Hussein B.
Hi, I want to save the configuration of my application in edn file. Lein is used (of course). I want to pub my config.edn under /resources directory. But honestly, I don't know the format of edn. I tried to google it, but I didn't get anything helpful. The format is in its early stages. So, m

Re: Is there a prettify command in emacs for clojure?

2014-02-08 Thread Rodrigo B. de Oliveira
emacs-live has a live-paredit-reindent-defun bound to M-q that gets very close. On Friday, February 7, 2014 8:20:58 PM UTC-2, Taylor Sando wrote: > > Let us say you had this: > > (defn create-new-canvas-text [inputs] > (let [{text-selected-id :new} (dataflow/old-and-new inputs [:design > :pa

Why (eval (list (quote (println "Clojure")))) is throwing a Null Pointer Exception?

2013-08-24 Thread Hussein B.
Hi, Why the following snippet: (eval (list (quote (println "Clojure" is throwing a null pointer exception? Thanks for help and time. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: Help to morph this imperative snippet into a functional one

2013-08-18 Thread Hussein B.
it in Clojure. On Sunday, August 18, 2013 4:27:43 PM UTC+2, Chris Ford wrote: > > Can you explain what the code is supposed to do in English? Java is a > little hard to read. :-) > > Are you doing Huffman coding or similar? > > > On 18 August 2013 16:51, Hussein B. >w

Help to morph this imperative snippet into a functional one

2013-08-18 Thread Hussein B.
Hi! Would you please help me transforming this imperative code into functional one? The code is a typical snippet in imperative style. A lot of mutations that I don't even know how to start morphing it to Clojure. class Container { Map children; String letter; List value; } void insert(

Re: Entwined STM V1.0

2013-08-18 Thread Hussein B.
Great ! Congratulations! How it does compare with Clojure's builtin STM? Thanks. On Sunday, August 18, 2013 10:24:48 AM UTC+2, Ivan Koblik wrote: > > Hi All, > > Almost 4 years ago I developed STM with semantic concurrency control for > my project at CERN. Main feature of this STM is the Transa

Help to start creating this DSL in Clojure

2013-08-17 Thread Hussein B.
Hi, I'm trying to create this Domain Specific Language: (query "clojure" (directory "/usr/texts") (group-by :creation-date)) What it should do is to search for all files in a specific directory using a regexp and then group the result by some of files attributes. The idea is t

Re: [ANN] Pedestal-app Tutorial has been released

2013-07-09 Thread Hussein B.
O, Yeah! Thanks! On Tuesday, July 9, 2013 6:03:58 PM UTC+2, Ryan Neufeld wrote: > > Hey there, Clojurians/Pedestallions! > > I'm pleased to announce the release of a comprehensive tutorial for > pedestal-app: http://bit.ly/pedestal-app-tutorial. In this tutorial we > finally *dive deep* int

How core.async compares to agents, future and promise?

2013-07-04 Thread Hussein B.
Hi, How core.async compares to agents, future and promise? When to use core.async and when to use agents, future and promise? Thanks for help and time. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure

How to implement a distributed and concurrent system in Clojure?

2013-07-03 Thread Hussein B.
Hi, I read recently on the internet that Clojure concurrency tools make it easy to implement a highly concurrent system but on a single machine. But how to implement a highly concurrent system that runs on a multiple machines? Erlang, Elixir and Scala have the Actors model. Please correct me

Is it possible to parameterize proxy macro with defmacro?

2013-06-23 Thread Hussein B.
Hi, After I got your help last week to get my Macro working :) I tried to expand it more: I'm trying to parameterizing my object creation (I'm using clojure.core.match). Source class offers multiple constructors: (defmacro source [source-name constructor-args & meths] (match [constructor-args

Re: Clojure in production

2013-06-19 Thread Hussein B.
I mentioned that! :D On Wednesday, June 19, 2013 9:40:57 AM UTC+2, Florian Over wrote: > > Hi, > we at doo.net are using clojure and clojurescript for all our backend and > web development. > We are also still in need for clojure developers. :) > > Florian > > > 2013/6/19 Nikita Prokopov > > >> W

Re: Clojure in production

2013-06-18 Thread Hussein B.
According to their "Jobs" page, Doo is using Clojure to implement their backend and web application: https://doo.net/en/ On Monday, June 10, 2013 11:47:25 PM UTC+2, Plinio Balduino wrote: > > Hi there > > I'm writing a talk about Clojure in the real world and I would like to > know, if possible

Re: What the recommended way now to create an instance and override its methods?

2013-06-18 Thread Hussein B.
Hmm, then why Clojure docs http://clojuredocs.org/clojure_core/clojure.core/reify mentions 'object': protocol-or-interface-or-Object (methodName [args+] body)* On Tuesday, June 18, 2013 1:41:57 PM UTC+2, Jim foo.bar wrote: > > On 18/06/13 12:34, Hussein B. wrote: > >

Re: What the recommended way now to create an instance and override its methods?

2013-06-18 Thread Hussein B.
08:45, Hussein B. wrote: > > I know we usually use 'proxy' macro when we want to create an instance > > of a concrete class and override some of its methods. But do we have > > now a recommended approach? > > 'proxy' is the recommended approach unless y

Re: First day with Macros

2013-06-18 Thread Hussein B.
gt; Macros certainly take some getting used to. > > > On Tue, Jun 18, 2013 at 8:12 AM, Hussein B. > > wrote: > >> Here is my fourth attempt: >> >> (defmacro servlet [servlet-name & meths] >> `(reify Servlet >> (for [meth ~m

What the recommended way now to create an instance and override its methods?

2013-06-18 Thread Hussein B.
Hi, I know we usually use 'proxy' macro when we want to create an instance of a concrete class and override some of its methods. But do we have now a recommended approach? AFAIK, reify only works with protocols and interfaces, can't be used to create an instance and override its methods. I'

Re: First day with Macros

2013-06-17 Thread Hussein B.
, reify isn't going to work if you need a named class to actually wire > up your servlet, for example with a web.xml. Also, consider that you'll > need some AOT compilation for the container to actually see the servlet > class. > > > On Mon, Jun 17, 2013 at 4:38 PM, Huss

First day with Macros

2013-06-17 Thread Hussein B.
Hi, My target is to have something like this: (servlet "ArticlesServlet" (do-get [this request response] (println "Get Request")) (do-post [this request response] (println "Post Request"))) I started with this: (defmacro servlet [servlet-name meths] `(reify Servlet (for [met

Re: nrepl-ritz setup (missing dependency "dynapath")

2013-02-18 Thread Dima B
I confirm that the issue is fixed. Thank you, guys! On Monday, February 18, 2013 3:39:37 PM UTC-8, Hugo Duncan wrote: > > Toby Crawley > writes: > > > Hugo Duncan writes: > >> > >> The latter is fine by me. It is about time we had another ritz release > for > >> nrepl.el 1.6 anyway. > >

Re: nrepl-ritz setup (missing dependency "dynapath")

2013-02-18 Thread Dima B
Duncan wrote: > > Dima B > writes: > > > I've been going through all the instruction on the nrepl-ritz page > > (https://github.com/pallet/ritz/tree/develop/nrepl) as well as > nrepl-ritz > > threads and I can't seem to get it working due to a mysterious &

nrepl-ritz setup (missing dependency "dynapath")

2013-02-18 Thread Dima B
Hi, I've been going through all the instruction on the nrepl-ritz page (https://github.com/pallet/ritz/tree/develop/nrepl) as well as nrepl-ritz threads and I can't seem to get it working due to a mysterious dependency problem on dynapath. M-x nrepl-ritz-jack-in results in Starting nREPL ritz

Re: How to write this in idiomatic Clojure code?

2012-11-16 Thread Hussein B.
ov. 2012 à 00:13, "Hussein B." > > a écrit : > > Yes true. > > If it is leaf , do process-some-class-instance > > If it is not, then it could hold a collection of nodes and leafs (a > mixture) > > Actually , I'm checking tree-seq but I don't kn

Re: How to write this in idiomatic Clojure code?

2012-11-15 Thread Hussein B.
: > > Am I right in guessing that your input is some kind of tree where > Someclass instances are leafs and non-leaf nodes are represented by maps > having a :children key? > > Sent from a smartphone, please excuse the brevity/typos. > > Le 15 nov. 2012 à 23:33, "Husse

Re: How to write this in idiomatic Clojure code?

2012-11-15 Thread Hussein B.
> (defmethod crazy SomeClass [input] > (seq (process-some-class-instance input)) > > (defmethod crazy :default [{:keys [children]}] > (map crazy children)) > > On Thu, Nov 15, 2012 at 5:33 PM, Hussein B. > > wrote: > > Hi, > > > > Would you pl

How to write this in idiomatic Clojure code?

2012-11-15 Thread Hussein B.
Hi, Would you please help me to morph this to an idiomatic Clojure ? (defn crazy [input] (if (instance? SomeClass input) (seq (process-some-class-instance input)) (map crazy (:children input Thanks for help and time. -- You received this message because you are subsc

Re: Understanding clojure.core.cache TTL cache

2012-10-23 Thread Hussein B.
lot! On Tuesday, October 23, 2012 1:42:28 AM UTC+3, Sean Corfield wrote: > > On Mon, Oct 22, 2012 at 3:30 PM, Hussein B. > > wrote: > > So we need to call evict explicitly if we want to remove an entry? no > > automatic deletion after expiring? > > The cache is imm

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
Thank you, I understand it :) And thank you Mr. Fogus. What a great pleasure! On Tuesday, October 23, 2012 1:42:28 AM UTC+3, Sean Corfield wrote: > > On Mon, Oct 22, 2012 at 3:30 PM, Hussein B. > > wrote: > > So we need to call evict explicitly if we want to remove an entry?

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
I see, it works now. So we need to call evict explicitly if we want to remove an entry? no automatic deletion after expiring? On Tuesday, October 23, 2012 1:21:54 AM UTC+3, Sean Corfield wrote: > > On Mon, Oct 22, 2012 at 3:08 PM, Hussein B. > > wrote: > > I tried this: >

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
out there?). > > Sean > > On Mon, Oct 22, 2012 at 2:31 PM, Sean Corfield > > > wrote: > > On Mon, Oct 22, 2012 at 1:50 PM, Hussein B. > > > > wrote: > >> c3 holds a map containing {:a 1} that will lives for two minutes. > > > &g

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
I see. But I didn't really grasp the whole concept firmly . c3 holds a map containing {:a 1} that will lives for two minutes. After two minutes, requesting :a is generating false since it reached its TTL but it will still live in map until it is removed explicitly by invoking evict. Correct? Als

Re: Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
Wow, What an honor to get a reply from my idol and mentor !! Thanks a lot. I really appreciate to hear your opinion regarding this: http://stackoverflow.com/questions/13015906/is-it-safe-to-use-a-clojure-core-cache-guarded-by-ref-type Every thing started with this issue. Appreciate your precious ti

Understanding clojure.core.cache TTL cache

2012-10-22 Thread Hussein B.
Hi, I created this: (def c3 (cache/ttl-cache-factory {:a 1} :ttl 2)) user=> c3 {:a 1} user=> (cache/has? c3 :a) true user=> (cache/has? c3 :a) false user=> c3 {:a 1} user=> (cache/evict c3 :a) {} user=> c3 {:a 1} After TTL, cache doesn't has :a entry but printing the var shows the map conta

Re: Starting a new ClojureScript project, where to start?

2012-09-30 Thread Dima B
Hi Daniel, CljsBuild is a good starting point https://github.com/emezeske/lein-cljsbuild It automatically sets up environment with latest cljs version and gives complete framework with compilation, auto-compilation, support of multiple projects, sharing code between clj and cljs. Also take a l

ClojureScript: catching all javascript exceptions

2012-09-28 Thread Dima B
Hi, I came to the point where I need to be able to catch all javascript exceptions, log them down and swallow. I've been trying to achieve this by (try ... (catch Exception e ...)) (try ... (catch nil e ...)) (try ... (catch js/object e ...)) and nothing seems to do the trick. Could you please

Would you please help in migrating this code from Bishop to Liberator?

2012-09-19 Thread Hussein B.
Hi, I want to migrate this code written in Bishop REST framework to Liberator REST framework: (bishop/defresource ticket { "text/html" (fn [request] (let [request-method (:request-method request)] (case request-method :get (list-all-tickets request) :

Re: Why Clojure map literal creates an instance of array map?

2012-08-10 Thread Hussein B.
; becomes more useful to do use a more complicated tree structure which uses > structural sharing so that assoc doesn't copy the entire map. Copying a > small 5 element map isn't a big deal, but copying one with several thousand > elements is. > > On Fri, Aug 10, 2012 at 5:

How to measure pieces of Clojure code?

2012-08-10 Thread Hussein B.
Hi, I want to measure how much space an algorithm is taking and then trying to change some aspects to see how things are going to differ. I also want to measure how much time it takes to complete an operation. What tools can I use? Thanks. -- You received this message because you are subscribe

Why Clojure map literal creates an instance of array map?

2012-08-10 Thread Hussein B.
Hi, Why Clojure map literal creates an instance of array map but not hash map? What are the advantages of array map over hash map? 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 No

Better ideas how to collect analytics data

2012-08-10 Thread Hussein B.
Hi, I'm collecting analytics data. I used a master map that holds many other nested maps. Considering maps are immutable, many new maps are going to be allocated. (Yes, that is efficient in Clojure). Basic operation that I'm using is update-in , very convenient. Do you have a better idea how to c

Re: Immutability rules when it comes to Ref type

2012-08-10 Thread Hussein B.
mmutable map, to pointing at a different immutable map. > Neither of the two maps becomes mutable as a result of this. > > Andy > > On Aug 10, 2012, at 9:21 AM, Hussein B. wrote: > > > Hi, > > I have a ref type that wraps a map, this map is going to embed many

Immutability rules when it comes to Ref type

2012-08-10 Thread Hussein B.
Hi, I have a ref type that wraps a map, this map is going to embed many nested other maps. According to immutability rules, what happens when: A new nested map is updated (entry is removed or update) or even a new nested map is added to the master map that is wrapped by ref type? Thanks for help

Re: ANN: Noir 1.2.0 released

2011-10-02 Thread Michal B
I like your website design. -- 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 thi

Re: Libraries and build management hell

2011-07-30 Thread Michal B
On Saturday, July 30, 2011 6:24:50 PM UTC+3, puzzler wrote: > > The issue I have with the build tools is that they all presume > you want to *build* something. 95% of the time, I just want to open a > file, write some Clojure code, and interactively test it in a REPL. > Exactly what I'm talking ab

  1   2   3   >