Reading Clojure expressions

2015-09-11 Thread Huey Petersen
Hello, I'm not sure the proper terminology -- reading might be wrong. The idea is I'd like to mimic behavior in most Clojure development environments where given a buffer and a position you can find related expressions. e.g. previous expression, enclosing expression, etc. Preferably the resu

core.async -- lazy evaluation on take

2015-02-16 Thread Huey Petersen
Hello, I was playing around with having a lazy sequence abstracting over a paged http request. First off, maybe this is dumb, I dunno, lemme know ;p So (resources "url") returns a seq and no http request is made, but (take 1 (resources "url")) makes a request and (take 50 (resources "url")) ma

alternatives to component (like) systems

2015-01-27 Thread Huey Petersen
Hello, I just started writing my first non-toy clojure program and I'm curious how people handle global resources without component (or component like) systems. I plan to make use of component but I'm trying to add new concepts one by one. As an example I have a scheduler (quartzile): (def s

Re: style questions -- clojure newbie

2013-04-23 Thread Huey Petersen
I'll definitely take a look but mostly just to see style :). It is a toy app purely for learning so I can get away with duplicating a bit of effort. Plus I only use read only end points that don't require user auth so the api code is really short (8 lines). -- -- You received this message b

Re: style questions -- clojure newbie

2013-04-23 Thread Huey Petersen
ure.set/rename-keys { :image :images }))) > > (defn search [term] > (let [albums (-> (api/get {:method "album.search" :album term}) > (get-in [:results :albummatches :album] []) > (vector))] > {:albums (map transform-album albums)

style questions -- clojure newbie

2013-04-23 Thread Huey Petersen
Howdy, I'm a clojure fan but quite new to writing clojure. I'm writing my first app and had a few style questions. I'm doing a web service call to the lastfm api. It returns some json like: { "results": { "albummatches": { "album": [ {

limit keys from client JSON (select-keys but nested?)

2012-12-30 Thread Huey Petersen
Hello, I have client providing JSON data that is read into a map. What I'm wondering is what is the best way to limit the data to only keys I white list. { :user { :first "John" :last "Doe" :role "admin" } } In this example I wouldn't want to read the role key. I can do `(select-keys user [

Re: newb question about idioms, and meta: where should i ask noob questions?

2012-03-27 Thread Huey Petersen
I'm also very new but would add that 'filter' also returns a lazy sequence. So 'for' isn't special in that regard (if I understand your comment). I do 'filter' into 'map' a lot and seeing this question makes me realize 'for' can handle that case nicer so thanks for asking. On Sunday, March 25,

Re: usage examples in clojure api docs

2010-07-03 Thread Huey
It could also be be helpful to have links to mailing list discussions or blog postings discussing the reasons for including a method in Clojure or the tradeoffs in using one method vs. another. A few examples: seq?, sequential? http://groups.google.com/group/clojure/browse_thread/thread/9dbaff59e