Thread-local with-redefs: Help with reviewing the implementation

2019-04-01 Thread Mourjo Sen
Hi every one, I wrote this tiny utility as an alternative to with-redefs such that the redefinition is done only on that thread and not others (ie, the global definition remains the same and redefinitions are per-thread). This is a fork from @gfredericks’s original solution https://gist.githu

Re: Help with strange test output when deftest used inside a macro

2017-10-10 Thread Matt Grimm
Excellent, thanks! The actual macro is indeed a little more complicated, but the test assertions are limited to (is (= ...)), so replacing = with ~'= works perfectly. On Tuesday, October 10, 2017 at 3:10:37 AM UTC-6, Gary Verhaegen wrote: > > is is looking for specific patterns and, if it can't

Re: Help with strange test output when deftest used inside a macro

2017-10-10 Thread Gary Verhaegen
is is looking for specific patterns and, if it can't find a known one, defaults to assuming its argument is a random predicate and prints that. So what's happening here is the syntax quote expands (resolves) = to clojure.core/= and thus it doesn't match the pattern for = anymore. So you'd need

Re: Help with strange test output when deftest used inside a macro

2017-10-09 Thread Timothy Baldridge
The problem isn't the macro, it's your use of syntax quoting. `(= x y) gets expanded at read-time into `(clojure.core/= x y)`. Not much you can do about that. Although I'd suggest perhaps changing your code a bit to not require macros. deftest mostly just creates a defn with some extra metadata an

Help with strange test output when deftest used inside a macro

2017-10-09 Thread Matt Grimm
Hello, I'm generating deftest's using a helper macro that takes a variety of test parameters and though the tests function correctly, the output of a failed test is not exactly right. The expect value is shown as the un-evaluated test form, and the actual value is shown as the result of evaluat

Re: Help with using spec

2016-10-18 Thread 'Jason Courcoux' via Clojure
Hi Alex, Thanks very much for this, makes sense and has solved my issue. After a trying a few things, it appears that the ArityException was thrown because I would have needed to wrap my regex with s/spec i,e, (s/fdef my-function :args (s/cat :board (s/spec ::board))) So I think this all makes

Re: Help with using spec

2016-10-17 Thread Alex Miller
I would back way up to the beginning and reconsider your ::board spec. Generally for any data where the structures are homogenous, you're probably better off using one of the collection specs like coll-of (or map-of, every, every-kv) rather than a regex, which should primarily be used when you

Help with using spec

2016-10-17 Thread 'Jason Courcoux' via Clojure
Hi. I've been experimenting with clojure spec and a game of life problem, and have been trying to spec a rectangular board of unknown size made up of a collection of rows, each of which contain an equal number of cells. My initial attempt was:- (def cell? #{0 1}) (s/def ::row (s/coll-of cell? :m

Re: Can anyone help with a jug problem in clojure

2016-02-01 Thread Dmitry Lipovoi
This is not a clojure related question rather algorithmic one. And real challenge here is to find 3 different solutions that lay in different CS-related topics. I'm pretty sure authors didn't mean three similar variations of a single solution here. As pointed above, one way to solve it, and proba

Re: Can anyone help with a jug problem in clojure

2016-01-26 Thread gianluca torta
Hi Steve, this lookslike a typical problem that requires "artificial intelligence" (AI) search: http://www.tutorialspoint.com/artificial_intelligence/artificial_intelligence_popular_search_algorithms.htm once you have a general strategy based on the above algos in mind, a quite orthogonal probl

Can anyone help with a jug problem in clojure

2016-01-26 Thread stevegarrid1234
Hi, i am completely new to clojure and i have been given the task of finding 3 different ways of solving the problem here: https://uva.onlinejudge.org/external/5/571.html Im hoping that if someone can point me in right direction of a solution hopefully ill be able to figure out the other 2 solu

Re: help with clojure

2015-11-14 Thread James Reeves
Okay, so: (defn evaltree [tree] (cons (eval tree) (rest tree))) That evaluates the tree, assuming that (rest tree) only contains numbers. (eval-tree '(+ 3 9)) However, we also want to evaluate the arguments in the same way. The arguments are a list, and when we want to do somethin

Re: help with clojure

2015-11-14 Thread Eric Normand
Hey there, > Congratulations on getting this far. It took me a long time too to be able to do something this complicated. I think it's cool that you're thinking about this kind of problem. This is essentially a small recursive interpreter, which is a neat problem. How do you drop the first ele

Re: help with clojure

2015-11-14 Thread stevegarrid1234
Ok by starting with the basic (Def a '(+ 3 9)) I have (Defn evaltree [tree] (Cons (eval tree) tree)) But I can't seem to get it to work or drop the plus from the list. I'm really struggling with this Thanks for your help -- You received this message because you are subscribed to the Goo

Re: help with clojure

2015-11-14 Thread James Reeves
So start with something like: (def a '(+ 3 9)) Then write a function where: (evaltree a) => (12 3 9) Don't worry about recursion to start with. Just get the simplest case working first. - James On 14 November 2015 at 17:46, wrote: > Sorry I'm a complete rookie at this that didn'

Re: help with clojure

2015-11-14 Thread stevegarrid1234
Sorry I'm a complete rookie at this that didn't make a bit of sense to me. So far I have this: (def a '(* (+ 5 (* 3 7)) (- 6 8)) ) (defn evaltree [tree] (cons (eval (first (rest tree))) tree)) all i have so far which evals the first part of list but doesn't recurse through to do the rest

Re: help with clojure

2015-11-14 Thread James Reeves
When thinking about trees, I find it's often best to start with the most basic case. So in your case, begin by writing a function that deals with a single operator and two numerical arguments: (f '(* 4 9)) => (36 4 9) (f '(- 6 10)) => (-4 6 10) Next, consider the case where you have two p

help with clojure

2015-11-14 Thread stevegarrid1234
I have recently started learning lisp and completed some simple exercises that are available to me, unfortunately I have got stuck & after spending hours it seems I don't seem to be getting any closer to a decent solution. I am trying to produce a function which takes the expression 'tree' as

Re: Help with idiomatic clojure.

2015-11-13 Thread Colin Yates
Another tip when using seq then: cljs.user=> (or (seq [1 2 3]) false) (1 2 3) cljs.user=> (or (seq []) false) false cljs.user=> > On 13 Nov 2015, at 14:09, Brian wrote: > > I think I like 'seq' better than 'empty?'.I'm sure my opinions will firm > up after writing some more clojure. >

Re: Help with idiomatic clojure.

2015-11-13 Thread Brian
I think I like 'seq' better than 'empty?'.I'm sure my opinions will firm up after writing some more clojure. > Also, in no-errors branch you probably want to return status: 200? I picked the function where I knew there was a better way. This validation function is called from this bit code.

Re: Help with idiomatic clojure.

2015-11-13 Thread Colin Yates
Doh - I obviously hadn’t had enough coffee that early in the morning :-). > On 13 Nov 2015, at 01:47, Chris Murphy wrote: > > > I think true and false should be swapped around, because seq and empty? are > opposites, seq meaning it is not empty. > > On 13/11/2015 8:08 AM, Colin Yates wrote: >

Re: Help with idiomatic clojure.

2015-11-12 Thread Chris Murphy
I think true and false should be swapped around, because seq and empty? are opposites, seq meaning it is not empty. On 13/11/2015 8:08 AM, Colin Yates wrote: One other minor point (if (seq some-sequence) true false) is preferred by some (I won’t say more idiomatic) than (if (empty? some-seque

Re: Help with idiomatic clojure.

2015-11-12 Thread Alex Baranosky
The main thing to note is to not use atoms for things like this. Colin's cond-> approach is a good idea. On Thu, Nov 12, 2015 at 4:08 PM, Colin Yates wrote: > One other minor point (if (seq some-sequence) true false) is preferred by > some (I won’t say more idiomatic) than (if (empty? some-seque

Re: Help with idiomatic clojure.

2015-11-12 Thread Colin Yates
One other minor point (if (seq some-sequence) true false) is preferred by some (I won’t say more idiomatic) than (if (empty? some-sequence) true false). Also, in no-errors branch you probably want to return status: 200? > On 12 Nov 2015, at 19:44, Brian wrote: > > Thanks Colin, Thanks Erik >

Re: Help with idiomatic clojure.

2015-11-12 Thread Brian
Thanks Colin, Thanks Erik Exactly what I was looking for. I've updated the gist with Colin's suggestion and a bit of destructuring. If this project gets any bigger I will definitely look at vlad and Prismatic Schema . BDF. On

Re: Help with idiomatic clojure.

2015-11-12 Thread Erik Assum
There is also https://github.com/logaan/vlad which helps with validation. Erik. -- i farta > Den 12. nov. 2015 kl. 17.12 skrev Colin Yates : > > A nicer equivalent form would be: > > (cond-> [] > this-error? (conj “It failed with this error”) > that-error? (conj “It failed with that erro

Re: Help with idiomatic clojure.

2015-11-12 Thread Colin Yates
A nicer equivalent form would be: (cond-> [] this-error? (conj “It failed with this error”) that-error? (conj “It failed with that error”)) However, purely for validation there are a few utilities out there already. Checkout the ‘Validation’ section on http://www.clojure-toolbox.com

Help with idiomatic clojure.

2015-11-12 Thread Brian Forester
I'm writing a very small REST application in clojure using compojure and ring. One problem is that I don't have anyone who can review my work or provide feedback. I've written a small function to validate a simple JSON request. I'm validating the three values that are in the post and colle

Re: Help with decisions in threading macros

2015-11-05 Thread Oliver Hine
See also cond-> (Clojure core) and even condas-> (http://blog.juxt.pro/posts/condas.html) Oliy -- 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 moderat

Re: Help with decisions in threading macros

2015-11-04 Thread Timur Sungur
Thanks!! On Tue, Nov 3, 2015 at 7:38 PM Erik Assum wrote: > some->> > > Erik. > -- > i farta > > Den 3. nov. 2015 kl. 17.05 skrev Timur : > > Hi all, > > Often I need to make decisions in simple threading macros, for instance > consider the following code > > (->> m >:vector >(fi

Re: Help with decisions in threading macros

2015-11-03 Thread Erik Assum
some->> Erik. -- i farta > Den 3. nov. 2015 kl. 17.05 skrev Timur : > > Hi all, > > Often I need to make decisions in simple threading macros, for instance > consider the following code > > (->> m >:vector >(filterv #(= (:id %) (:id m))) >(reduce #(and %1 %2))) > >

Re: Help with decisions in threading macros

2015-11-03 Thread Atamert Ölçgen
Perhaps you can replace (reduce ...) with (every? true?), which works with empty collections. On Tue, Nov 3, 2015 at 6:05 PM, Timur wrote: > Hi all, > > Often I need to make decisions in simple threading macros, for instance > consider the following code > > (->> m >:vector >(fil

Help with decisions in threading macros

2015-11-03 Thread Timur
Hi all, Often I need to make decisions in simple threading macros, for instance consider the following code (->> m :vector (filterv #(= (:id %) (:id m))) (reduce #(and %1 %2))) In this case, if the result of filter is empty reduce throws an exception as it expects some val

Re: Lazy fold-right, help with Scala translation

2015-10-08 Thread Elango Cheran
Hi Rastko, I was about to respond with the reverse + reduce answer, but it seems that it was already covered here: https://groups.google.com/forum/#!topic/clojure/MizwTxHwLE4 But there is a more detailed answer about short-circuiting reduce that you might also be interested in (using the function

Re: Lazy fold-right, help with Scala translation

2015-10-08 Thread Rastko Soskic
Posted before finishing :) Thanks in advance for any tip/suggestion. Cheers, R. -- 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

Lazy fold-right, help with Scala translation

2015-10-08 Thread Rastko Soskic
Hi, I have come up this implementation of fold-right in Scala: def foldRight[B](z: => B)(f: (A, => B) => B): B = // Here, arrow => in front of argument means it is arg by name (lazy) and won't be evaluated until required // z - init, f - combining f, and target sequence is this match {

Re: Help with macro.

2015-10-04 Thread gianluca torta
> > Yes, your solution works, but only on clojure. ClojureScript doesn't have > `resolve`. It there any portable solution? > > I'm not sure if and how you can do it in ClojureScript... have you tried: https://groups.google.com/forum/#!forum/clojurescript cheers, Gianluca -- You received this

Re: Help with macro.

2015-10-03 Thread Andrey Antukh
On Sat, Oct 3, 2015 at 5:24 PM, gianluca torta wrote: > Hi, > > the behavior you describe is not specific to macros, but is due to the use > of aliases > > after: > (require '[foo.bar :as b]) > > this will give you false: > (= 'foo.bar/x (first '(b/x))) > > while this will give you true: > (= 'fo

Re: Help with macro.

2015-10-03 Thread gianluca torta
Hi, the behavior you describe is not specific to macros, but is due to the use of aliases after: (require '[foo.bar :as b]) this will give you false: (= 'foo.bar/x (first '(b/x))) while this will give you true: (= 'foo.bar/x (first '(foo.bar/x))) one way to solve it, is comparing the resolved

Help with macro.

2015-10-03 Thread Andrey Antukh
Hi! I have a little trouble writing a macro because I'm getting unexpected (for me) behavior. Let see some code: (ns foo.bar) (defn debug [x] (println "debug:" x) x) (defn debug-expr? [expr] (and (seq? expr) (symbol? (first expr)) *(= 'foo.bar/debug (first expr))*)) (

Re: core.logic: Help with insertion sort

2015-08-02 Thread Tassilo Horn
fail ; acc is already long as sl, let's stop here > s#)) > > We have to first check that sl is ground (not an lvar) so we can take > its count. Oh, that's great. >> Too bad that lazy sequences aren't printed in a readable way. > > I used this slightly

Re: core.logic: Help with insertion sort

2015-08-01 Thread Nicolás Berger
and nl are unified, no? Yes, I understand they are unified, but I'm not sure why. > > Too bad that lazy sequences aren't printed in a readable way. I used this slightly different version of trace-lvar which calls pr-str to help with this: (defn trace-lvar [a lvar] `(println (fo

Re: core.logic: Help with insertion sort

2015-07-30 Thread Tassilo Horn
Nicolás Berger writes: Hi Nicolás, > Sounds interesting :). I hope I get some time to take a look into it > soon. I appreciate your feedback! > In the meantime, have you tried playing with the log and trace > "goals"? I mean log, trace-s and trace-lvar. They might be of help > in trying to d

Re: core.logic: Help with insertion sort

2015-07-29 Thread Nicolás Berger
Hi, Sounds interesting :). I hope I get some time to take a look into it soon. In the meantime, have you tried playing with the log and trace "goals"? I mean log, trace-s and trace-lvar. They might be of help in trying to discover where it's going that makes it hang. El 29/07/2015 11:40, "Tassilo

core.logic: Help with insertion sort

2015-07-29 Thread Tassilo Horn
Hi all, I've just implemented insertion sort with core.logic: --8<---cut here---start->8--- (declare inserto) (defn isorto "A relation where sl is a sorted version of the list l." ([l sl] (isorto l () sl)) ([l acc sl] (conde [(== l ()) (== acc s

Re: Help with data structure transformation

2015-06-07 Thread gianluca torta
see also this page: http://clojure.org/sequences where for is listed among the seq library functions HTH Gianluca -- 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: Help with data structure transformation

2015-06-06 Thread Erik Assum
(for [[x y z] {:a "aa" :b "bb" :c "cc"}] [x y z]) ([:c "cc" nil] [:b "bb" nil] [:a "aa" nil]);; WTF? So her, I guess, your taking each entry in the map and destructuring them into the three vars x, y, and z. Since each map entry is a pair, the third var z will be nil. Erik. -- i farta

Re: Help with data structure transformation

2015-06-06 Thread Daniel Kersten
x and y are destructured into the key and value of each map entry. Z is nil. The second example uses seq to convert the map into a sequence of map entries and then it destructures the seq (not the map entries themselves). The third example does destructure the map entries. (let [[a b c] [1 2]] [a

Re: Help with data structure transformation

2015-06-06 Thread gvim
On 06/06/2015 05:01, Sean Corfield wrote: Page 84 is where it shows that maps are a sequence of pairs. The destructuring in James's code is on vectors -- the pairs in the sequence. Hope that helps? Sean Page 84 describes the sequence abstraction in general but it's the implicit seq in for

Re: Help with data structure transformation

2015-06-05 Thread Sean Corfield
Page 84 is where it shows that maps are a sequence of pairs. The destructuring in James's code is on vectors -- the pairs in the sequence. Hope that helps? Sean On Fri, Jun 5, 2015 at 8:11 PM, gvim wrote: > Yes, I'm fine with the concept. Just can't remember coming across it in > the textbook

Re: Help with data structure transformation

2015-06-05 Thread gvim
Yes, I'm fine with the concept. Just can't remember coming across it in the textbooks but maybe I wasn't paying attention :) gvim On 06/06/2015 04:08, Sean Corfield wrote: It’s because if you treat a hash map as a sequence — as `for` does — you get a sequence of pairs (key/value — map entrie

Re: Help with data structure transformation

2015-06-05 Thread Sean Corfield
It’s because if you treat a hash map as a sequence — as `for` does — you get a sequence of pairs (key/value — map entries): (seq {:a 1 :b 2}) ;;=> ([:a 1] [:b 2]) Does that help? Sean > On Jun 5, 2015, at 7:41 PM, gvim wrote: > > I must re-read "Clojure Programming" (O'Reilly

Re: Help with data structure transformation

2015-06-05 Thread gvim
I must re-read "Clojure Programming" (O'Reilly) in that case as I don't recall the authors mentioning this kind of destructuring. gvim On 06/06/2015 03:33, Fluid Dynamics wrote: On Friday, June 5, 2015 at 10:07:05 PM UTC-4, g vim wrote: That works but I missed this possibility because I'

Re: Help with data structure transformation

2015-06-05 Thread Fluid Dynamics
On Friday, June 5, 2015 at 10:07:05 PM UTC-4, g vim wrote: > > That works but I missed this possibility because I'm still not clear how: > > (group-by :email signs) > > which produces a map of the form: > > {"a...@gmail.com " > [{:email "a...@gmail.com ", :sign "Cancer", :planet > "M

Re: Help with data structure transformation

2015-06-05 Thread gvim
That works but I missed this possibility because I'm still not clear how: (group-by :email signs) which produces a map of the form: {"a...@gmail.com" [{:email "a...@gmail.com", :sign "Cancer", :planet "Mars", :surname "Blogs", :first_name "Joe"} . ]} can be destructured

Re: Help with data structure transformation

2015-06-05 Thread James Reeves
Perhaps something like: (defn planet-sign-map [signs] (into {} (map (juxt :planet :sign) signs))) (defn extract-planet-signs [signs] (for [[email signs] (group-by :email signs)] {:email email, :signs (planet-sign-map signs)})) (defn find-planet-signs [emails] (extract-planet-signs (get

Help with data structure transformation

2015-06-05 Thread gvim
I have a YeSQL query: (get-signs {:em emails}) ;; emails is a vector of email address strings ... which produces this list of maps: ( {:email "a...@gmail.com", :sign "Scorpio", :planet "Mercury", :surname "Blogs", :first_name "Joe"} {:email "a...@gmail.com", :sign "Leo", :planet "Moon", :surn

Re: Help with async operations

2015-05-25 Thread Oleg Dashevskii
Hi Rangel, thanks! works perfectly! понедельник, 18 мая 2015 г., 4:07:53 UTC+6 пользователь Rangel Spasov написал: > > You can checkout the new pipeline stuff, I think it fits what you're > looking for nicely: > > https://gist.github.com/raspasov/7c9d8f2872d6065b2145 > > -- You received this

Re: Help with async operations

2015-05-17 Thread Oleg Dashevskii
Hi Atamert, воскресенье, 17 мая 2015 г., 19:35:57 UTC+6 пользователь Atamert Ölçgen написал: > > I’m new to Clojure async operations (while have a good understanding of >> other things) and want to get a bit of advice. Atoms & agents still confuse >> me. >> >> What I’m implementing is a small R

Re: Help with async operations

2015-05-17 Thread Rangel Spasov
You can checkout the new pipeline stuff, I think it fits what you're looking for nicely: https://gist.github.com/raspasov/7c9d8f2872d6065b2145 On Saturday, May 16, 2015 at 10:54:16 PM UTC-7, Oleg Dashevskii wrote: > > Hi, > > I’m new to Clojure async operations (while have a good understanding

Re: Help with async operations

2015-05-17 Thread Atamert Ölçgen
Hi Oleg, On Sun, May 17, 2015 at 6:48 AM, Oleg Dashevskii wrote: > Hi, > > I’m new to Clojure async operations (while have a good understanding of > other things) and want to get a bit of advice. Atoms & agents still confuse > me. > > What I’m implementing is a small REST webservice with custom

Re: Help with timestamp with timezone in YeSQL

2015-05-17 Thread gvim
'Turns out I was looking in the wrong place. YeSQL relieves you of all the clj-time formatting as you can simply add the PostgreSQL cast directly to your placeholder so this: -- name: add-birth On Sunday, 17 May 2015 01:46:14 UTC+10, g vim wrote: (c/to-timestamp "1967-07-31 06:30:

Help with async operations

2015-05-16 Thread Oleg Dashevskii
Hi, I’m new to Clojure async operations (while have a good understanding of other things) and want to get a bit of advice. Atoms & agents still confuse me. What I’m implementing is a small REST webservice with custom in-memory database. Database is indexed by unique key, basically it’s a map (

Re: Help with timestamp with timezone in YeSQL

2015-05-16 Thread Sam Roberton
On Sunday, 17 May 2015 01:46:14 UTC+10, g vim wrote: > > > > (c/to-timestamp "1967-07-31 06:30:00 America/Caracas") > > evaluates to nil. However: > > (c/to-timestamp "1967-07-31 06:30:00") > > gives me an: #inst "1967-07-31T06:30:00.0-00:00" , > whatever that is, so I che

Help with timestamp with timezone in YeSQL

2015-05-16 Thread Michael Cramm
Out of curiosity have you tried clj-time.coerce/to-sqs-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.com Note that posts from new members are moderated - please be patient with your

Help with timestamp with timezone in YeSQL

2015-05-16 Thread gvim
I have a YeSQL query: -- name: add-birthINSERT INTO births (date_time) VALUES ('1967-07-31 06:30:00 America/Caracas') ... and all is well but my defquery equivalent: (add-birth fails because the date_time string is passed to PostgreSQL as a varchar, not a timestamp with timezone. So, t

Re: [ANN] Phoenix 0.1.0 - help with structuring & configuring Component-based systems

2015-04-04 Thread James Henderson
Just released 0.1.1 - bug when using Schema in Phoenix apps due to Phoenix's overly-enthusiastic AOT'ing. Thanks to @whodidthis for flagging the issue! James On Sunday, 29 March 2015 20:44:04 UTC+1, James Henderson wrote: > > A link would have been really helpful, I'm guessing! Here it is: > >

Re: [ANN] Phoenix 0.1.0 - help with structuring & configuring Component-based systems

2015-04-01 Thread Fluid Dynamics
On Tuesday, March 31, 2015 at 7:49:52 AM UTC-4, Jeroen van Dijk wrote: > > Thanks for sharing James! I'll have a look. > > As a side note, I see in the example code that you are dissoc-ing on the > component. This can lead to unexpected behaviour as I have > experienced (mostly in repl cases), a

Re: [ANN] Phoenix 0.1.0 - help with structuring & configuring Component-based systems

2015-03-31 Thread James Henderson
Thanks Jeroen - I'd not spotted that! Yes, definitely a better idea - will update the examples. James On 31/03/15 12:49, Jeroen van Dijk wrote: Thanks for sharing James! I'll have a look. As a side note, I see in the example code that you are dissoc-ing on the component. This can lead to une

Re: [ANN] Phoenix 0.1.0 - help with structuring & configuring Component-based systems

2015-03-31 Thread Jeroen van Dijk
Thanks for sharing James! I'll have a look. As a side note, I see in the example code that you are dissoc-ing on the component. This can lead to unexpected behaviour as I have experienced (mostly in repl cases), as this will return a map instead of a record when the field is not part of the record

[ANN] Phoenix 0.1.0 - help with structuring & configuring Component-based systems

2015-03-29 Thread James Henderson
Hi all, I've just released v0.1.0 of Phoenix - a 'batteries included, but removable' library to wire up and configure Component-based systems. If you've ever wondered whether you really have to copy and paste 'system.clj', 'dev.clj' and 'user.clj' from one Component project to the next, it's w

Re: [ANN] Phoenix 0.1.0 - help with structuring & configuring Component-based systems

2015-03-29 Thread James Henderson
A link would have been really helpful, I'm guessing! Here it is: https://github.com/james-henderson/phoenix James On Sunday, 29 March 2015 20:42:06 UTC+1, James Henderson wrote: > > Hi all, > > I've just released v0.1.0 of Phoenix - a 'batteries included, but > removable' library to wire up and

Re: Macro Help with Symbols and Evaluation

2015-03-19 Thread Ambrose Bonnaire-Sergeant
If there are a unknown number of layouts you can just define a map from keywords to layouts: {:x_axis BoxLayout/x_axis ..} Otherwise using java reflection is another option. Thanks, Ambrose On Thu, Mar 19, 2015 at 4:34 PM, Mark Bastian wrote: > To provide a little more context, the problem I a

Re: Macro Help with Symbols and Evaluation

2015-03-19 Thread Mark Bastian
To provide a little more context, the problem I am trying to solve is this: Often in Java I see constructors that have a pattern of (ClassName. X) where X is some static integer value. For example, in Swing you build a Box like so (Box. BoxLayout/X_AXIS). I want to simplify this by doing somethi

Re: Macro Help with Symbols and Evaluation

2015-03-19 Thread Ambrose Bonnaire-Sergeant
What problem are you trying to solve? On Thu, Mar 19, 2015 at 12:49 PM, Mark Bastian wrote: > Hi All, > > I am trying to write a simple macro to resolve local symbols and I just > can't seem to figure out the right invocation. Here are some commands you > can type/paste in a repl: > > (def ONE 1

Re: Macro Help with Symbols and Evaluation

2015-03-19 Thread Colin Yates
I don't have the answer (as I too am in the still-going-blind phase) but the following might help: - deref symbols to get their value - http://learnxinyminutes.com/docs/clojure-macros/ (short and very helpful) - http://www.braveclojure.com/writing-macros/ (long and very helpful) - https://prag

Macro Help with Symbols and Evaluation

2015-03-19 Thread Mark Bastian
Hi All, I am trying to write a simple macro to resolve local symbols and I just can't seem to figure out the right invocation. Here are some commands you can type/paste in a repl: (def ONE 1) ;define one (def s1 (symbol "ONE")) ;get the symbol (eval s1) ;evaluates to 1, no surprise ;My goal i

Re: Help with Liberator POST route

2015-02-19 Thread Sam Ritchie
Specifying POST tells Compojure that you only want to pass POST requests on to your liberator resource. That part worked. Liberator then received the request and passed it through its workflow. At the "allowed-method?" decision point, liberator checked your declaration and saw only the default

Re: Help with Liberator POST route

2015-02-19 Thread gvim
On 19/02/2015 16:20, Sam Ritchie wrote: Try adding :allowed-methods [:get :post] to your resource. You'll want to use "ANY" for all liberator routes, since they manage the responses for incorrect content types internally. If you specify GET or POST, it's up to you to return the proper response

Re: Help with Liberator POST route

2015-02-19 Thread Sam Ritchie
Try adding :allowed-methods [:get :post] to your resource. You'll want to use "ANY" for all liberator routes, since they manage the responses for incorrect content types internally. If you specify GET or POST, it's up to you to return the proper responses if the methods aren't supported (sin

Re: Help with Liberator POST route

2015-02-19 Thread gvim
On 19/02/2015 12:56, Jonathan Barber wrote: Replace "min" with "minute" in the route (or change "minute" in the curl POST to "min"). Because the field names don't agree, the compojure destructing doesn't match and you end up trying to parseInt nil. Cheers Thanks for spotting that one :). Sti

Re: Help with Liberator POST route

2015-02-19 Thread Jonathan Barber
On 18 February 2015 at 22:35, gvim wrote: > On 18/02/2015 15:32, Andy- wrote: > >> Without having tested it: I think you're "curl -d" format is wrong. It's >> not semicolon separated: >> http://superuser.com/questions/149329/what-is-the- >> curl-command-line-syntax-to-do-a-post-request >> >> HTH

Re: Help with Liberator POST route

2015-02-18 Thread gvim
On 18/02/2015 15:32, Andy- wrote: Without having tested it: I think you're "curl -d" format is wrong. It's not semicolon separated: http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request HTH That solved the curl data submission problem but I'm still ge

Re: Help with Liberator POST route

2015-02-18 Thread Andy-
Without having tested it: I think you're "curl -d" format is wrong. It's not semicolon separated: http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request HTH On Wednesday, February 18, 2015 at 7:09:19 AM UTC-5, g vim wrote: > > I have a Liberator app which

Help with Liberator POST route

2015-02-18 Thread gvim
I have a Liberator app which works with this: (defresource user [day month year hour min region location] :available-media-types ["application/json"] :handle-ok (generate-string (clc/calc day month year hour min 0 (str region "/" location (defroutes app-routes (GET "/user/:day/:month

Re: Help with Incanter and Emacs

2015-01-13 Thread Sam Raker
For something that's been "deprecated" for a while now, `use` sure still shows up in A LOT of docs/tutorials/books/etc. On Monday, January 12, 2015 at 7:48:44 PM UTC-5, Robert Berger wrote: > > Wish this was in the Incanter docs and in the Readme > > On Tuesday, August 13, 2013 at 12:09:20 PM UTC

Re: Help with Incanter and Emacs

2015-01-12 Thread Robert Berger
Wish this was in the Incanter docs and in the Readme On Tuesday, August 13, 2013 at 12:09:20 PM UTC-7, Tim Visher wrote: > > LOL. I just realized I'd been missing that all along. > > It seems like the community is more and more leaning to something like > this, just FYI. > > (ns default.core >

Need help with Undertow Server availability over wireless

2015-01-09 Thread Joshua Aroke
Please my question is straight forward. I want to make undertow server to be available over wireless such that every thing that I can access using localhost or any other ip can also be accessed from another machine(laptops, phones, tablet) connected over wireless. -- You received this message

Re: help with my inefficient instaparse grammar

2014-12-03 Thread Zack Maril
Use :optimize :memory maybe? Section 10 here seems like your use case: https://github.com/Engelberg/instaparse/blob/master/docs/Performance.md Watch htop and see if you have a process that is hitting swap without the optimization. -Zack On Wednesday, December 3, 2014 1:29:23 AM UTC-5, Sunil Nand

Re: help with my inefficient instaparse grammar

2014-12-02 Thread Sunil S Nandihalli
The file I tried it on is here On Wed, Dec 3, 2014 at 10:28 AM, Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: > Hi Everybody, > https://gist.github.com/cced1cf377ed49005704 *instaparse_question.clj* >

help with my inefficient instaparse grammar

2014-12-02 Thread Sunil S Nandihalli
Hi Everybody, https://gist.github.com/cced1cf377ed49005704 *instaparse_question.clj* Raw

Re: help with tools.emitter.jvm

2014-10-17 Thread Francesco Bellomi
Of course you're right, I was using t.emitter with the last t.analyzer (0.6.1) thanks, Francesco On Friday, October 17, 2014 3:41:05 PM UTC+2, Nicola Mometto wrote: > > > Hi Francesco, > I just tried evaluating `(println "a")` with c.t.e.jvm using both -beta5 > and -SNAPSHOT and it works as ex

Re: help with tools.emitter.jvm

2014-10-17 Thread Nicola Mometto
Hi Francesco, I just tried evaluating `(println "a")` with c.t.e.jvm using both -beta5 and -SNAPSHOT and it works as expected for me. Are you by any chance using a different tools.analyzer.jvm version than the one -beta5 requires? (0.5.2) If so, that's why it's failing for you. If you need to us

help with tools.emitter.jvm

2014-10-17 Thread Francesco Bellomi
Hi all, I'm a newbie with tools.emitter.jvm, so there must be something obvious I'm missing, but I can't make this simple example work: (in-ns 'user) => # (require '[clojure.tools.emitter.jvm :as e]) => nil (e/eval '(println "a") {:debug? true}) // class version 50.0 (50) // access flags 0x31

Re: help with sequence, "seq", Seq, and `seq`

2014-10-09 Thread John Gabriele
On Thursday, October 9, 2014 10:38:42 AM UTC-4, Gary Verhaegen wrote: > > I have not checked the second edition yet, but when I read JoC, my > understanding was that seq is used specifically for an object that > implements ISeq and is used as such (i.e. by calling first and rest on it) > while s

Re: help with sequence, "seq", Seq, and `seq`

2014-10-09 Thread James Reeves
On 9 October 2014 15:38, Gary Verhaegen wrote: > I have not checked the second edition yet, but when I read JoC, my > understanding was that seq is used specifically for an object that > implements ISeq and is used as such (i.e. by calling first and rest on it) > while sequence denotes any ordere

Re: help with sequence, "seq", Seq, and `seq`

2014-10-09 Thread Gary Verhaegen
I have not checked the second edition yet, but when I read JoC, my understanding was that seq is used specifically for an object that implements ISeq and is used as such (i.e. by calling first and rest on it) while sequence denotes any ordered collection. Under this interpretation, they are not in

Re: help with sequence, "seq", Seq, and `seq`

2014-10-09 Thread James Reeves
On 9 October 2014 03:55, John Gabriele wrote: > > > * (when calling `seq` on a coll) "...In either case, if the collection > is empty, `seq` returns nil and never an empty sequence. Functions that > promise to return seqs (not sequences), such as `next`, work the same way." > > Hm. "seqs (not se

Re: help with sequence, "seq", Seq, and `seq`

2014-10-09 Thread John Gabriele
On Thursday, October 9, 2014 12:51:47 AM UTC-4, Ambrose Bonnaire-Sergeant wrote: > > On Wed, Oct 8, 2014 at 10:55 PM, John Gabriele > wrote: > >> * (when calling `seq` on a coll) "...In either case, if the collection >> is empty, `seq` returns nil and never an empty sequence. Functions that >

Re: help with sequence, "seq", Seq, and `seq`

2014-10-08 Thread Ambrose Bonnaire-Sergeant
On Wed, Oct 8, 2014 at 10:55 PM, John Gabriele wrote: > * (when calling `seq` on a coll) "...In either case, if the collection > is empty, `seq` returns nil and never an empty sequence. Functions that > promise to return seqs (not sequences), such as `next`, work the same way." > > I think that

  1   2   3   4   5   >