Re: Can I use reduce here?

2014-12-12 Thread Jarrod Swart
Mathias, I wrote a short article about building more complex reduce functions here[1]. I wrote it mostly to reinforce my own knowledge. The bottom section will be most relevant to you. Hope it helps, Jarrod [1]: http://jarrodswart.com/articles/clojure-tutorial-reduce-functions On Friday,

Re: System/getenv can't read env vars?

2014-07-08 Thread Jarrod Swart
James, It appears Sean and yourself have identified the issue. The tmux scripts that launch my dev environment don't pull in the necessary environment. I have seen your environ library and I was to thank you for all your contributions. Sean too! While I have you James do you have a good

Re: System/getenv can't read env vars?

2014-07-08 Thread Jarrod Swart
Awesome thank you! -- 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 this group,

System/getenv can't read env vars?

2014-07-07 Thread Jarrod Swart
If I call: (System/getenv MY_VAR) ;= nil From bash set | grep MY_VAR ;= foo echo $MY_VAR' ;= foo I can do this from bash, as well as my tmux session. I use tmuxinator to launch a repl and vim, thus my repl process is running inside TMUX. That said, I can see the env var in other tmux

Re: System/getenv can't read env vars?

2014-07-07 Thread Jarrod Swart
Yep I ran export MY_VAR=foo and all subsequent calls to get or print the env var on the CLI work fine. I set the var and restarted all repl processes. I'll try setting it in .bashrc as well. -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Re: System/getenv can't read env vars?

2014-07-07 Thread Jarrod Swart
Sean, Thanks for the input. There is a good chance you are right. The process is launched from tmuxinator a tool that opens multiple processes and joins them all to a tmux session. I suppose I'll have to investigate that but it seems odd that if I type echo $MY_VAR I get the expected value

Re: Hosting Providers

2014-05-01 Thread Jarrod Swart
As Richard said most places that run Java, will run your Clojure. Google App Engine and Engine Yard appear to take a WAR file. lein ring uberwar (in your project dir) While heroku pushes your code to the server and then does its magic. git push git of project_name If you run on your own

Re: Ring + Compojure new route recognition

2014-04-28 Thread Jarrod Swart
Thank you. The compojure-app template does something similar, and I was using that from LightTable, evaling a (start-server) var. This was good info and reminded me what I was doing and how to apply it to the new environment. -- You received this message because you are subscribed to the

Ring + Compojure new route recognition

2014-04-27 Thread Jarrod Swart
I've noticed that when using Ring + Compojure w/ LightTable the following process will get me access to any newly added routes. 1. Add a route 2. Eval the route NS 3. Eval the handler NS 4. Check route in browser 5. Success Recently I've begun using Vim + Fireplace. I cd to my project dir and

One app, multiple mains \ processes -- heroku style architecture

2014-04-15 Thread Jarrod Swart
I've been reading about Heroku's process model and their approach to web app architecture. I'm curious how you could recreate something like this: https://devcenter.heroku.com/articles/getting-started-with-clojure#one-off-scripts Using an uberjar in environments other than heroku. Would it

Re: How did you learn Clojure?

2014-03-21 Thread Jarrod Swart
A tip if you are completely stuck on 4clojure: Often the 4clojure problem will say you can't use a particular function. The first thing I would do is go look at the source code for that function, then I would try to find other functions with similar functionality. Much like learning to paint

Re: How to update an atom return the change?

2014-03-21 Thread Jarrod Swart
Just to add to this because I ran across this reading some code a few days ago: https://github.com/overtone/at-at/blob/master/src/overtone/at_at.clj#L43-51 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Help a Startup use Clojure!

2014-03-13 Thread Jarrod Swart
Oh wow, thanks for all the responses! I'm certainly not making it a PHP vs. Clojure all or nothing debate. Anything other than PHP would be helpful, not simply because I want to bad mouth PHP. After 2 years working with it I know firsthand its shortcomings for building actual applications.

Re: Help a Startup use Clojure!

2014-03-12 Thread Jarrod Swart
David, Awesome thanks for sharing! I hope it works out for you! -- 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

Re: Help a Startup use Clojure!

2014-03-12 Thread Jarrod Swart
Alan, Thanks for your input! ClojureScript is something I have wanted to try more but it seems even more cutting edge than Clojure. It might be too much effort to try and tackle that now. I do agree though that Clojure+Ring is a great back-end setup for connecting to with JavaScript.

Re: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-11 Thread Jarrod Swart
No edit button so I have to post again, that first example should end with ;; (make-profile-url John Smith) = /John-Smith And to reiterate you decide what your url will look like in your template: a href=http://myapp.com/JohnSmith;View John Smith's Profile/a or a

Help a Startup use Clojure!

2014-03-11 Thread Jarrod Swart
I'm about to be an early employee at a small startup. I will be the first technical hire and am a competent but not extraordinarily experienced developer. The founders know this and hired me based on soft as well as technical skills. I don't want to be the first technical employee and make

Re: Help a Startup use Clojure!

2014-03-11 Thread Jarrod Swart
Gary, Thanks for your observations. I agree it doesn't necessarily have to be all or nothing. I'm hoping to get as much as possible insight before I present to the founders. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: Help a Startup use Clojure!

2014-03-11 Thread Jarrod Swart
Christopher, Absolutely I agree. I enjoyed that book very much. I think I misstated my question a bit in that I don't need to be convinced of the value, but rather how best to relay Clojure's benefits to non-technical business types. Thanks for your input. -- You received this message

Re: Question about importing java classes to Clojure

2014-03-11 Thread Jarrod Swart
Hey Brandon, I had a really simple blog post about reading a directory of files that I never published, I updated it and hopefully it can help: http://jarrodswart.com/clojure-like-im-five-working-with-files/ Best, Jarrod -- You received this message because you are subscribed to the Google

Re: Help a Startup use Clojure!

2014-03-11 Thread Jarrod Swart
Sean, Thanks for the reply and insight. I completely agree on your points. We will be in a 12 week accelerator program so it is quite possible that this code business could fail. Our work is likely going to be more back-end API centric as a point of integration for other businesses rather

Re: Help a Startup use Clojure!

2014-03-11 Thread Jarrod Swart
Sean, Oops I didn't realize you were asking these questions: - What are you building? - An application for businesses to help leverage the power of crowds in non-traditional crowdsource environments. - The main use-case for many will be that of integration with-in

Re: Question about importing java classes to Clojure

2014-03-11 Thread Jarrod Swart
No problem, happy to help. Here is one way you might write the above with fs. I didn't check this I just typed it out so there may be a few tiny bugs. (defn jar? [filename] (if (= (fs/extension filename) jar) true false)) (defn list-paths [path-str] (println Files in path-str)

Re: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-10 Thread Jarrod Swart
+ where my username is Jarrod Swart but my profile url is: plus.google.com/+JarrodSwart Hopefully this helps, or perhaps I misread the thread. -- 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

Re: I'm trying to make proper urls, but I seem to be failing at it.

2014-03-10 Thread Jarrod Swart
Right, either way the compojure route would be the same. (GET /:profile-name [profile-name] ...). You don't need an extra column in your DB unless you want to do so. The route/compojure is simply responding to the URL you write out in your template, or that is requested by some other

Re: [ANN] Stasis - not another static site framework

2014-03-09 Thread Jarrod Swart
Awesome, thanks for bringing these great libraries to my attention! -- 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

Re: Clojure performance question

2014-03-05 Thread Jarrod Swart
Thanks for the elaboration, I just wanted to make sure I understood. -- 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

Re: Accumulate results without state?

2014-03-04 Thread Jarrod Swart
I do something very similar to this where I parse large CSVs and keep/discard rows of the CSV based on the values of columns. Like you I had a hard time getting how to use reduce beyond trivial implementations. I spent some time messing with reduce and learning how to construct more advanced

Re: [ANN] Stasis - not another static site framework

2014-03-04 Thread Jarrod Swart
This is a cool project. I primarily use static site generators to build the front-end for sites that I will use enlive to template inside my app. I currently use: http://harpjs.com for this purpose because it allows easy integration of LESS and Jade which are auto recompiled watched by the

Re: Clojure performance question

2014-03-04 Thread Jarrod Swart
On Monday, March 3, 2014 11:35:58 AM UTC-5, Mikera wrote: Obviously, there are cases where allocating a sequence will be slower than iterative techniques. But that's *easy enough to fix by just using iterations in those cases* use the right tool for the job and all that. I follow

Question about best pattern for side-effecting function with a return value

2014-02-10 Thread Jarrod Swart
I'm having a hard time coming up with a satisfactory way to implement the following: 1. Call an API with a map from the DB containing various endpoint data like URL, etc. 2. If the response has an HTTP 200, update the map-from-db and then write response body to a file. 3. If

Re: Question about best pattern for side-effecting function with a return value

2014-02-10 Thread Jarrod Swart
just call api-call-pipeline! with the database entity. This lets you test each of these steps in isolation. Hope that helps! Shaun On Monday, February 10, 2014 3:07:22 PM UTC-7, Jarrod Swart wrote: I'm having a hard time coming up with a satisfactory way to implement the following

Re: Question about best pattern for side-effecting function with a return value

2014-02-10 Thread Jarrod Swart
, but it seems like you don't have any need for the results, you just want the side effects of updating the DB and storing the file, so I'd just use doseq. I hope that helps! Shaun On Monday, February 10, 2014 7:15:05 PM UTC-7, Jarrod Swart wrote: Shaun, Thanks a lot for your response

Re: Java interoperability

2014-01-27 Thread Jarrod Swart
taking the wrong approach. Is the Clojure way to put the JSON in Clojure data structures and manipulate it with filters etc? Many Thanks Paul On Mon, Jan 27, 2014 at 3:35 PM, Jarrod Swart jcs...@gmail.comjavascript: wrote: It looks like the method exists to me: https://github.com/jayway

Re: Web App structure on server?

2014-01-25 Thread Jarrod Swart
On Saturday, January 25, 2014 at 7:40, Jarrod Swart wrote: I appreciate your outlook, and yes I have definitely discussed the pros of Clojure. They are apprehensive in the event they have to outsource development work, and I don't blame them. I'm just going to be a lot happier and more

Re: Clojure memory usage

2014-01-25 Thread Jarrod Swart
This was talked about here: https://groups.google.com/forum/#!searchin/clojure/user$3A$20g$20vim/clojure/XqPGnX5aSAI/PoLYaydgX3cJ TLDR: The JVM carves out its own chunk of memory from the OS. It then uses very advanced and finely tuned means to manage said memory. So even though the app

Re: Rename file uploaded

2014-01-25 Thread Jarrod Swart
Nothing sticks out, but a NullPointerException is something I most commonly get as a result of an incorrect file path. Things I would do: 1. Make sure that (gallery-path) actually exists or is writable. 2. I would do (POST /upload [file] (println file) (handle-upload file))), to inspect what

Re: Helping newcomers get involved in Clojure projects

2014-01-25 Thread Jarrod Swart
I have been spending a lot of time thinking about the Clojure newcomer perspective lately, and I'd like to work on some things that help smooth that path. I've been thinking about this as well, and I would love to hear your thoughts. Please elaborate! On Saturday, January 25, 2014

Re: Clojure development laptop battery usage

2014-01-25 Thread Jarrod Swart
MBP -- Mac Book Pro MBA -- Mac Book Air Best, Jarrod On Saturday, January 25, 2014 11:12:37 PM UTC-5, greybird wrote: In case it helps, I've also seen this CPU eating problem. I'm using: REPL-y 0.1.9 Clojure 1.5.1. I don't know what you guys mean by MBP and MBA. --mark -- -- You

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
The reason you can't get this to work is that r/map returns a reducible not a coll for reduce to operate on. I'm not sure of a solution because I'm not familiar with core.reducers. But reading this: http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
Ah cool, thanks for posting your solution! On Friday, January 24, 2014 3:29:49 PM UTC-5, Tassilo Horn wrote: Jarrod Swart jcs...@gmail.com javascript: writes: The reason you can't get this to work is that r/map returns a reducible not a coll for reduce to operate on. Ah, indeed. I

Re: Rename file uploaded

2014-01-24 Thread Jarrod Swart
It works for me. I am guessing you are not passing in a string when you are calling (add-timstamp filename). Which is to say that your param 'filename' is a map not a string. If you are passing in a map of the upload information you need to grab the filename for your let: (let [ext-postion

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
at this time, even though (union) returns an empty set object, the identity element for the union operation. On Fri, Jan 24, 2014 at 3:34 PM, Jarrod Swart jcs...@gmail.comjavascript: wrote: Ah cool, thanks for posting your solution! On Friday, January 24, 2014 3:29:49 PM UTC-5, Tassilo Horn

Re: clojure debugging repl

2014-01-24 Thread Jarrod Swart
The second version of The Joy of Clojure talks about building a debugging repl that allows insertion of breakpoints into code. Perhaps something similar could be done here. On Friday, January 24, 2014 4:38:59 PM UTC-5, t x wrote: Found it, apparently it's debug-repl = swank-clojure = CDT =

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
three sets. So it's actually perfectly well-founded for use with reducers, at least in principle, and intersecting A B C D can be parallelized sensibly by parallel intersecting A B and C D and then intersecting the two resulting sets. On Fri, Jan 24, 2014 at 6:43 PM, Jarrod Swart jcs

Re: clojure.core/reduce calls (f) if given a reducible coll and no init value

2014-01-24 Thread Jarrod Swart
, as (intersection A Everything) = A no matter what A is. On Fri, Jan 24, 2014 at 7:38 PM, Jarrod Swart jcs...@gmail.comjavascript: wrote: Good points. But the identity thing is still what gets me. What is the identity of an intersection? Like you said it can't be #{}. If you seed an intersection

Web App structure on server?

2014-01-24 Thread Jarrod Swart
I have a general question about application architecture as it relates to deploying to the server. Most of my previous development work involved python/php/ruby so we typically had: 1. One massive framework / application complection nightmare 2. Background scripts run by crons At

Re: Rename file uploaded

2014-01-24 Thread Jarrod Swart
Well that isn't quite what I meant. In that case you are just casting what is likely the map of upload data to a string. Try this: (defn handle-upload [filename] (str filename)) Why? This will show you what type of data you receiving on upload. My guess is that it is a map containing

Re: clojure debugging repl

2014-01-24 Thread Jarrod Swart
. However, looking at http://www.manning.com/fogus2/ I can't seem to find it. Which chapter is it? On Fri, Jan 24, 2014 at 3:46 PM, Jarrod Swart jcs...@gmail.comjavascript: wrote: The second version of The Joy of Clojure talks about building a debugging repl that allows insertion of breakpoints

Re: Web App structure on server?

2014-01-24 Thread Jarrod Swart
within the server - hacking at the command line = hacking with the REPL On Saturday, 25 January 2014 12:58:03 UTC+8, Jarrod Swart wrote: I have a general question about application architecture as it relates to deploying to the server. Most of my previous development work involved python

Re: Rename file uploaded

2014-01-24 Thread Jarrod Swart
image/jpeg, :filename AngryBaby4.jpg} How can feed it just the :filename portion of the map as string to the add-timestamp function? Checking that link right now. On Friday, January 24, 2014 9:05:35 PM UTC-8, Jarrod Swart wrote: Well that isn't quite what I meant. In that case you are just

Re: Rename file uploaded

2014-01-24 Thread Jarrod Swart
:05:35 PM UTC-8, Jarrod Swart wrote: Well that isn't quite what I meant. In that case you are just casting what is likely the map of upload data to a string. Try this: (defn handle-upload [filename] (str filename)) Why? This will show you what type of data you receiving on upload. My

Re: [Large File Processing] What am I doing wrong?

2014-01-21 Thread Jarrod Swart
20, 2014 11:55:00 PM UTC-7, Jarrod Swart wrote: I'm processing a large csv with Clojure, honestly not even that big (~18k rows, 11mb). I have a list of exported data from a client and I am de-duplicating URLs within the list. My final output is a series of vectors: [url url-hash

Re: [Large File Processing] What am I doing wrong?

2014-01-21 Thread Jarrod Swart
Jim, Thanks for the idioms, I appreciate it! And thanks everyone for the help! On Tuesday, January 21, 2014 8:43:40 AM UTC-5, Jim foo.bar wrote: On 21/01/14 13:11, Chris Perkins wrote: This part: (some #{hashed} already-seen) is doing a linear lookup in `already-seen`. Try (contains?

Re: core.async count in a channel

2014-01-21 Thread Jarrod Swart
I have not used core.async much but I did use Go a fair bit and I concur with what Aaron said. The missing piece for you Paul is that goblocks\channels are not just a way to do concurrent work, but also a control flow mechanism. What Aaron is saying is that by using channels to control various

[Large File Processing] What am I doing wrong?

2014-01-20 Thread Jarrod Swart
I'm processing a large csv with Clojure, honestly not even that big (~18k rows, 11mb). I have a list of exported data from a client and I am de-duplicating URLs within the list. My final output is a series of vectors: [url url-hash]. The odd thing is how slow it seems to be going. I have

Re: HttpKit, Enlive (html retrieval and parsing)

2014-01-13 Thread Jarrod Swart
This is exactly what I do and it works great! On Saturday, January 11, 2014 7:00:22 PM UTC-5, Jan Herich wrote: I don't recommend using java's built in HTTP retrieval (by passing java.net.URL object to enlive html-resource function). Not only is it significantly slower then using clj-http

Re: Do web apps need Clojure?

2013-11-18 Thread Jarrod Swart
PM, Jarrod Swart jcs...@gmail.com javascript: wrote: I think the more interesting question is: *do web developers need Clojure? *If performance were the sole concern then everyone would still code web apps in C or assembler. There is great power in abstraction. I like this talk by Uncle

Re: 2013 State of Clojure ClojureScript survey results

2013-11-18 Thread Jarrod Swart
I will second http://clojure-toolbox.com and I also recently found: http://www.clojuresphere.com/ On Monday, November 18, 2013 4:01:27 PM UTC-5, Brian Craft wrote: Wow, this result is shocking to me: In short, Clojure libraries are easy to find, their maintainers are receptive to feedback

Re: Do web apps need Clojure?

2013-11-16 Thread Jarrod Swart
I think the more interesting question is: *do web developers need Clojure? *If performance were the sole concern then everyone would still code web apps in C or assembler. There is great power in abstraction. I like this talk by Uncle Bob: