Clojure Dev Environment

2015-10-05 Thread Miguel Ping
Hi Guys, I've been doing some personal clj for a while, but I never quite grokked the whole REPL thing. I normally use Lighttable and/or Cursive as editors, I can set up breakpoints and debug the code, but for web I'd like to know how seasoned developers work. AFAIK people fire up the repl and

Generate all possible teams

2015-10-05 Thread andrea crotti
Hi everyone, I was trying for fun to solve the following problem: given a list of football players with some defined skills, find out which team selection would be balanced. For example given just 4 players A, B, C, D there would be the following team selections: - (A, B) vs (C, D) - (A, C) vs

Re: Clojure Dev Environment

2015-10-05 Thread Robin Heggelund Hansen
Basically, I use stuart sierra's tools.namespace and component libraries to write an application that can be easily reloaded. So I write my code in regular files, then i tell the repl to reload my application with the latest changes from disk. I can also test the application while it's running,

Re: Generate all possible teams

2015-10-05 Thread Franklin M. Siler
On Oct 5, 2015, at 0545, andrea crotti wrote: > Any idea how to make this faster? > Other advices on the code are welcome as well.. Why not generate the the possible left-hand teams and then cartesian product with the leftover players? E.g., if you want to match 2 on 2 and have players A B C

Re: Generate all possible teams

2015-10-05 Thread Mark Engelberg
Are there an even number of players? Are all players assigned to teams? Are the two teams necessarily of equal sizes? On Mon, Oct 5, 2015 at 3:45 AM, andrea crotti wrote: > Hi everyone, > > I was trying for fun to solve the following problem: > > given a list of football players with some define

Re: Generate all possible teams

2015-10-05 Thread 'Alan Forrester' via Clojure
On 5 Oct 2015, at 11:45, andrea crotti wrote: > Hi everyone, > > I was trying for fun to solve the following problem: > > given a list of football players with some defined skills, find out which > team selection would be balanced. > > For example given just 4 players A, B, C, D there would be

Re: Generate all possible teams

2015-10-05 Thread Mark Engelberg
Sample input data would also be useful, including some examples that are too large for you to currently solve with your existing approach. On Mon, Oct 5, 2015 at 4:36 AM, 'Alan Forrester' via Clojure < clojure@googlegroups.com> wrote: > On 5 Oct 2015, at 11:45, andrea crotti wrote: > > > Hi ever

Re: Generate all possible teams

2015-10-05 Thread andrea crotti
Yes so well for example the rankings can be defined in this way [{:name "P1" :skills {:control 3 :speed 3 :tackle 4 :dribbling 10 :shoot 4} :position :attack} {:name "P2" :skills {:control 3 :speed 3 :tackle 4 :dr

Re: Generate all possible teams

2015-10-05 Thread andrea crotti
1. it could be odd in case we don't manage, the first solution I did was just a greedy algorithm, but that only worked with even number of players 2. yes well now I pass the rankings and the list of players separately, but yeah every player will be part of a team 3. this looks the same as 1), and s

Re: Generate all possible teams

2015-10-05 Thread andrea crotti
Yes this could actually work thanks, I only need to iterate over all the possible permutations of the first partition and combine it, still certainly a lot less stuff to compute. 2015-10-05 12:08 GMT+01:00 Franklin M. Siler : > On Oct 5, 2015, at 0545, andrea crotti wrote: > >> Any idea how to ma

Re: cond->: Using of threading expression in tests?

2015-10-05 Thread ru
Thank you very much, Sean and Oliver! condas-> really awesome! пятница, 2 октября 2015 г., 17:49:28 UTC+3 пользователь ru написал: > > Hi, > > Can I use in tests threading expression of cond->, and how? > > Thanx in advance, > Ru > -- You received this message because you are subscribed to th

[ANN] Shrubbery 0.3.0, a stubbing, spying, and mocking library for Clojure protocols

2015-10-05 Thread Brian Guthrie
Clojure protocols are a great way to encapsulate operations with side effects, but suffer from a lack of general test tooling. Shrubbery provides a small set of basic building blocks for working with them: * stub, which accepts a variable list of protocols and a optional hashmap of simple value i

newbie Q: where is isSymbolicLink function and how to access it ?

2015-10-05 Thread hpwei01
In the clojure.java.io there are these two functions: isDirectory isFile But there is no isSymbolicLink (for unix, linux). (1) Could someone tell me where I can find such a function ? In another library not listed on clojure,org ?? (2) What do I need to do in order to use it ? Th

Re: [ANN] Shrubbery 0.3.0, a stubbing, spying, and mocking library for Clojure protocols

2015-10-05 Thread James Reeves
Very nice. I was looking for something like this. - James On 5 October 2015 at 15:14, Brian Guthrie wrote: > Clojure protocols are a great way to encapsulate operations with side > effects, but suffer from a lack of general test tooling. Shrubbery provides > a small set of basic building blocks

Re: newbie Q: where is isSymbolicLink function and how to access it ?

2015-10-05 Thread Ray Miller
You need Java interop for this: (import 'java.nio,file.Files) (Files/isSymbolicLink (.toPath (io/file "/some/path"))) See http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html for the other methods provided by this class. On 5 October 2015 at 16:47, wrote: > > In the clojure.java.

Changing font size in IntelliJ IDEA / Cursive

2015-10-05 Thread Alan Thompson
I came across this super-handy blog posting just now on how to globally set the font size/type in IntelliJ. It is very non-intuitive! - from: http://www.tilcode.com/how-to-globally-change-the-font-size-in-intellij-idea/ How to globally change the font size in

Re: Changing font size in IntelliJ IDEA / Cursive

2015-10-05 Thread Alan Thompson
Here is the IDEA doc page: https://www.jetbrains.com/idea/help/configuring-colors-and-fonts.html On Mon, Oct 5, 2015 at 9:39 AM, Alan Thompson wrote: > I came across this super-handy blog posting just now on how to globally > set the font size/type in IntelliJ. It is very non-intuitive! > > --

Re: Clojure Dev Environment

2015-10-05 Thread Erik Price
vim-fireplace lets you compile individual S-expressions into an existing nREPL (one in which the rest of your code is typically also loaded and available), so I typically make all my code changes right in the editor against the actual file I'm working on. Then I just compile the function I'm editin

Re: Clojure Dev Environment

2015-10-05 Thread Nelson Morris
http://www.parens-of-the-dead.com/ is a screencast series that shows a nice emacs/cider workflow with some additional usage of figwheel for the cljs frontend development. No showing off of the debugger yet though. Cursive should be able to do something similar with keybindings for running tests and

Re: Generate all possible teams

2015-10-05 Thread Mark Engelberg
You're not using the combinatorics library as efficiently as you could be. Here's the best strategy for generating all the team combinations with the same number of players: Case 1: Even number of players. Let's call the first player "A". "A" is going to be assigned to a team. To avoid duplicatio

Re: Generate all possible teams

2015-10-05 Thread Fluid Dynamics
On Monday, October 5, 2015 at 2:33:50 PM UTC-4, puzzler wrote: > > You're not using the combinatorics library as efficiently as you could > be. Here's the best strategy for generating all the team combinations with > the same number of players: > Is a combinatorics library even needed for this?

Re: Clojure Dev Environment

2015-10-05 Thread Sean Corfield
Miguel Ping wrote on Monday, October 5, 2015 at 3:00 AM: - do you code functions in the repl and copy them to respective files? I use Emacs/CIDER and code functions in a file, then use C-M-x to evaluate each one into the running REPL. I usually keep the REPL in the user namespace and require in

Library suggestions requested for clojure-toolbox.com

2015-10-05 Thread James Reeves
If you've written or know about a Clojure or ClojureScript library, and it's not already on clojure-toolbox.com , I'd like to hear about it. Post the name and URL (and an optional category) as reply to this message, and I'll add it to the site. - James -- You rec

Re: Generate all possible teams

2015-10-05 Thread andrea crotti
2015-10-05 19:33 GMT+01:00 Mark Engelberg : > You're not using the combinatorics library as efficiently as you could be. > Here's the best strategy for generating all the team combinations with the > same number of players: > > Case 1: Even number of players. > Let's call the first player "A". "A"

Re: newbie Q: how to tweak file-seq (original: how to selectively iterate through a tree of directories) ?

2015-10-05 Thread Andy-
Try to adapt my code: https://gist.github.com/rauhs/63054a06631c0be598d3 where you change your accept function to incorporate: http://stackoverflow.com/questions/813710/java-1-6-determine-symbolic-links HTH On Saturday, October 3, 2015 at 5:14:51 PM UTC-4, hpw...@gmail.com wrote: > > The direc

Re: Library suggestions requested for clojure-toolbox.com

2015-10-05 Thread Jony Hudson
Not exactly a library, but Gorilla REPL could fit in there. http://gorilla-repl.org . Maybe in the REPL category, although it's not really quite that. Probably a bit much to have its own 'notebook' category though! Jony On Monday, 5 October 2015 20:41:11 UTC+1, James Reeves wrote: > > If you

Re: Library suggestions requested for clojure-toolbox.com

2015-10-05 Thread Sean Grove
Talaria https://github.com/dwwoelfel/talaria [client/server messaging] "Messaging library for real-time client/server communication over websockets with fallback to ajax long-polling" On Mon, Oct 5, 2015 at 4:35 PM, Jony Hudson wrote: > Not exactly a library, but Gorilla REPL could fit in there.

Re: Library suggestions requested for clojure-toolbox.com

2015-10-05 Thread Max Countryman
Hi James, I’m not sure if it’s worth mentioning, but I wrote a port of Boundary’s Flake k-ordered unique ID generator for Clojure: https://github.com/maxcountryman/flake Max > On Oct 5, 2015, at 12:40, James Reeves wrote: > > If you've written or kno

Re: Generate all possible teams

2015-10-05 Thread Mark Engelberg
On Mon, Oct 5, 2015 at 1:08 PM, andrea crotti wrote: > Yes I came up with the same idea in the end, this is the code that does > that. > > (defn list-teams-combo [players] > "List all the possible team combinations" > (let [players-count (count players) > size (/ (combo/count-combinat

Re: Library suggestions requested for clojure-toolbox.com

2015-10-05 Thread William la Forge
{:name "aatree", :URL "https://github.com/laforge49/aatree";, :category "Data Structures"} On Monday, October 5, 2015 at 3:41:11 PM UTC-4, James Reeves wrote: > > If you've written or know about a Clojure or ClojureScript library, and > it's not already on clojure-toolbox.com

Re: Library suggestions requested for clojure-toolbox.com

2015-10-05 Thread James Reeves
On 6 October 2015 at 01:15, William la Forge wrote: > {:name "aatree", > :URL "https://github.com/laforge49/aatree";, > :category "Data Structures"} > Where is this library deployed to? I can't see it on Clojars and there aren't any other Maven repositories listed in the project file or README

Re: [ANN] Shrubbery 0.3.0, a stubbing, spying, and mocking library for Clojure protocols

2015-10-05 Thread Brian Guthrie
Great to hear! Let me know if there are any questions I can answer. Feedback gratefully accepted. Cheers, Brian On Mon, Oct 5, 2015 at 11:56 AM, James Reeves wrote: > Very nice. I was looking for something like this. > > - James > > On 5 October 2015 at 15:14, Brian Guthrie wrote: > >> Clojur

Re: Library suggestions requested for clojure-toolbox.com

2015-10-05 Thread Chris Murphy
I found imagez (with same name: imagez) to be useful for getting and setting pixels and changing the size of a raster image. It would go under the Graphics category. ~ Chris On Tuesday, 6 October 2015 06:41:11 UTC+11, James Reeves wrote: > > If you've written

Generate all possible teams

2015-10-05 Thread Alan Moore
Not sure it would be a lot more efficient but you could try using logic/relational programming with core.match, a datalog library or even a rule engine such as Clara. With the later you can use heuristics to trim the search space as another poster suggested. Good luck. Alan -- You received t