lazy seq termination

2013-05-28 Thread mond
I have managed to create a function that will read an ATOM feed indefinitely and now need a way to stop it ;-) (defn fetch-atom-chunk "Returns an ATOM chunk from the feed-url" [feed-url] (:ATOM_FEED (:body (client/get feed-url {:as :json} (defn fetch-atom-feed "Returns a list of ATOM

keys maps ... gak

2013-05-31 Thread mond
Sometimes its just so frustrating when you know you are close but just cannot get that last little bit ... so I am appealing again for more newbie support I have a map for some names: user=> (def entity-names {:project "Project" :model "Model"}) Which I then reference in a set of maps: user=

Re: keys maps ... gak

2013-06-01 Thread mond
t", :main-query "select * from project where ..."}} > > > All the best, > Tj > > On Friday, May 31, 2013 10:18:09 PM UTC+2, mond wrote: >> >> Sometimes its just so frustrating when you know you are close but just >> cannot get that last little b

is it possible to join on lazy seqs?

2013-07-16 Thread mond
Sorry if this is a RTFM style question ... this is what I have in terms of types and was wondering if there is another form of join or another library / collection combination that can achieve the same relational join? Thanks in advance, Ray check-delta-feeds.core=> (def changed-records (map f

Re: is it possible to join on lazy seqs?

2013-07-16 Thread mond
* * On Tuesday, July 16, 2013 4:48:25 PM UTC+2, Michael Klishin wrote: > > 2013/7/16 mond > > >> check-delta-feeds.core=> (set/join changed-records feed-entries {:ID >> :dh-uuid}) >> ClassCastException clojure.lang.LazySeq cannot be cast to java.util.Map >

core.async | compojure ... odd error ... help!!

2014-09-26 Thread mond
My first core.async program ... all works outside of the web app but barfs once I put the functions inside a web container. I hope somebody in the group can point to my obvious mistake... The idea is that the function 'respond-within-sla' will give back a result or a come back later message aft

Re: core.async | compojure ... odd error ... help!!

2014-09-27 Thread mond
T ["/:brand/:country/:resource" :resource #".*"] [brand country > resource] ...) > > - James > > On 27 September 2014 00:14, mond > wrote: > >> My first core.async program ... all works outside of the web app but >> barfs once I put the functions inside

Re: Frustrations so far

2016-07-23 Thread mond
You are not alone - it's the number one frustration in the community https://www.reddit.com/r/Clojure/comments/433y02/state_of_clojure_2015_survey_results/ But also see the responses - maybe we will have some major improvements with 1.9. Spec looks like good infra to support those efforts for im

Re: Why is this not considered to be in a go block?

2016-08-26 Thread mond
The flood gates are open Timothy! and on the back of that, I'm gonna dump some code in here so pls excuse me - it's on GitHub too so maybe look there if it's too heavy for email. I have this code in the go-loop

Re: Why is this not considered to be in a go block?

2016-08-27 Thread mond
more embarrassing. It should have been kafka-ch (chan 1 (comp (filter #(matching-event client-filter (.key %))) (map sse-data)))] Doh! On Saturday, 27 August 2016 01:25:57 UTC+2, Moe Aboulkheir wrote: > > > > On Sat, Aug 27, 2016 at 12

Re: Multiple replacements in string using a map

2013-04-23 Thread mond
t; > On Tuesday, April 23, 2013 5:55:51 AM UTC+1, Mond Ray wrote: >> >> Man - you guys are good and *fast*. >> >> I was pootling around with a version that would directly replace >> "/a/:key/b" {:key "value"} with "/a/value/b" and a fai

n00b question on embedded defrecord

2012-12-09 Thread mond
; I have these records defined (defrecord Customer [firstName lastName emailAddress deliveryAddress invoiceAddress]) (defrecord Address [street number town postcode]) ; I have this small sample data (def customers { (->Customer "Drongo" "Bongo" "dro...@bongo.co" (->Address "Gongo" "3

Re: n00b question on embedded defrecord

2012-12-09 Thread mond
Thanks Jordan - I just couldn't quite get that magic combination :) On Sunday, December 9, 2012 11:38:50 PM UTC+1, Jordan wrote: > > > > > On Sun, Dec 9, 2012 at 4:45 PM, mond >wrote: > >> ; I have these records defined >> >> (defrecord Customer [fir

another n00b defrecord combination question

2012-12-15 Thread mond
I have defined these types of records for modelling a simple shopping cart: ; An item in the cart (defrecord Item [id name product quantity purchased]) ; The product that relates to the item in the cart (defrecord Product [id name description prices]) ; A price definition (defrecord Price [price

Re: another n00b defrecord combination question

2012-12-15 Thread mond
So does anyone have the last bit of syntax to help me take back a list of values from the inputs? Thanks ray On Saturday, December 15, 2012 5:25:59 PM UTC+1, mond wrote: > > I have defined these types of records for modelling a simple shopping cart: > > ; An item in the cart > (

Re: another n00b defrecord combination question

2012-12-15 Thread mond
, mond wrote: > > I think I am close to answering this myself (which is always nice!) > > I have done the necessary joins with map and I can return a product > description > > user=> (map (fn [item product] (= (:product item (:id product))) > (:description product)) items

Re: another n00b defrecord combination question

2012-12-15 Thread mond
Thanks for picking up the cudgels Ben! To be honest I am struggling to repeat your advice in the REPL. In any case, I decided to change the data structures in line with your advice and put the IDs into maps rather than the records. (defrecord Item [name product quantity purchased]) (defrecord

Re: another n00b defrecord combination question

2012-12-16 Thread mond
Great stuff Ben. Thanks. ray On Saturday, December 15, 2012 10:54:42 PM UTC+1, Benjamin R. Haskell wrote: > > On Sat, 15 Dec 2012, mond wrote: > > > Thanks for picking up the cudgels Ben! > > Ha. It's nice to have reached a point where I feel at-all confident >

Re: another n00b defrecord combination question

2012-12-16 Thread mond
in advance ray On Saturday, December 15, 2012 10:54:42 PM UTC+1, Benjamin R. Haskell wrote: > > On Sat, 15 Dec 2012, mond wrote: > > > Thanks for picking up the cudgels Ben! > > Ha. It's nice to have reached a point where I feel at-all confident > with any of this.

creating maps out of sql

2013-05-24 Thread Mond Ray
I am starting out to use Clojure to combine and verify data between DB2 on a Mainframe, SQL Server and an Atom Feed. Yes, it's such fun working in a start-up ;-) Database wise, all is connecting OK after some Leiningen shenanigans and I am now stuck on the mapping part ;-) The code is below.

Re: creating maps out of sql

2013-05-24 Thread Mond Ray
ere A2P_PROJECT_ID = ?" a2p-id)) > > (println (a2p-records-by-date "select project_id from PROJECT where > timestamp > ? and timestamp < ?" "2012-03-02" "2012-03-07" dh-sub-query)) > > > Of course, I haven't tested any of this, so plenty of opp

Re: creating maps out of sql

2013-05-24 Thread Mond Ray
the Atom > feed would require a bit more work but probably not too bad. > > On Friday, May 24, 2013 7:55:17 AM UTC-7, Mond Ray wrote: >> >> I am starting out to use Clojure to combine and verify data between DB2 >> on a Mainframe, SQL Server and an Atom Feed. Yes, it&

Re: creating maps out of sql

2013-05-24 Thread Mond Ray
table"] > (doall rs))) >sql (sql/with-connection db > (sql/with-query-results rs ["select fields from table"] > (doall rs)))] >(left-outer-join db2 sql :db2field :sqlfield)) > >

Re: creating maps out of sql

2013-05-25 Thread Mond Ray
of maps it's clear that there may be room for further compression but I want to wait until I get all of the queries and odd cases out of the way first. Thanks again for your help. Ray On Friday, 24 May 2013 23:20:11 UTC+2, Mond Ray wrote: > > Fantastic answer Marc - I had been fidd

filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
I am missing something obvious... I get a list of maps back from a function and I want to find the elements with nil (({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil}) ({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uu

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
p-id "3", :dh-uuid nil}) ({:a2p-id "1", :dh-uuid >> "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", >> :dh-uuid nil})) >> >> then especially note the double parentheses. That is a list

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
On the other hand ... does that mean that the sequence being filtered is not lazy? On Saturday, 25 May 2013 20:09:05 UTC+2, Mond Ray wrote: > > Bingo: > > user=> (filter (complement :dh-uuid) (apply concat (map find-records > query-parts))) > ({:a2p-id "3", :dh-u

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
It's as I presented it - a list of a list of maps On Saturday, 25 May 2013 13:27:45 UTC+2, atkaaz wrote: > > can you tell what this returns? > (map find-records query-parts) > > > On Sat, May 25, 2013 at 2:21 PM, Mond Ray > > wrote: > >> I am missing som

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
TC+2, sdegutis wrote: > > Wouldn't (remove :dh-uuid (apply concat (map find-records query-parts))) > be better? > > > On Sat, May 25, 2013 at 1:09 PM, Mond Ray > > wrote: > >> Bingo: >> >> user=> (filter (complement :dh-uuid) (apply concat (map find-rec

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
; {:a2p-id "3", :dh-uuid *false*})) > )) > (({:a2p-id "3", :dh-uuid nil}) ({:a2p-id "3", :dh-uuid *false*})) > > idiomatic clojure ftw :) > > > On Sat, May 25, 2013 at 9:38 PM, Mond Ray > > wrote: > >> This is my latest

lazy sequence termination

2013-05-28 Thread Mond Ray
Hi Clojurians, I have a program which generates a lazy sequence to read ATOM feed chunks. That part works OK but now I want to only take a limited number of the chunks based on some predicate. My predicate is currently returning an empty list so I think (hope!) I am missing something simple. H

Re: lazy sequence termination

2013-05-28 Thread Mond Ray
? Am I asking too much ... in other words I have got this far and I should be expected to know the answer (I really feel like I should too by the way!) Use of the term Clojurians? Something else? Thanks Ray On Tuesday, 28 May 2013 13:44:57 UTC+2, Mond Ray wrote: > > Hi Clojurians, &

Re: lazy sequence termination

2013-05-28 Thread Mond Ray
that comes > from and it would be helpful to run the code to see what happensno > guarantees though =) > > On May 28, 1:05 pm, Mond Ray wrote: > > Quite a few views but no bites ... what have I done wrong in asking this > > question? If you can't help with the p

Re: lazy sequence termination

2013-05-28 Thread Mond Ray
On Tuesday, 28 May 2013 23:46:34 UTC+2, Michael Gardner wrote: > > On May 28, 2013, at 15:05 , Mond Ray > > wrote: > > > Quite a few views but no bites ... what have I done wrong in asking this > question? If you can't help with the problem would you please take a

Re: [ANN] defn podcast ep.3 : A tour of REPLs feat. Mike Fikes :)

2016-06-16 Thread Mond Ray
Thanks for listening Jason and for taking the time to give us feedback. To echo Vijay's comments, we will be happy to have a 'follow-up' section in the podcast to correct mistakes and omissions. I really need to work on a defn related pun to end such emails but for now, I hope you keep on list

Re: [ANN] defn podcast ep.3 : A tour of REPLs feat. Mike Fikes :)

2016-06-16 Thread Mond Ray
Thanks Ashish. We will certainly add to the list of interesting subjects. To be transparent about our approach, we are starting with the (many) core concepts and technologies and will gradually fan out to specialist items. So items such as ML and other 'big data' related topics will be in our

Re: Two suggestions re: core.spec, `ns`, and clojure 1.9alpha11

2016-08-24 Thread Mond Ray
I agree Colin, this feels more like the beatings shall continue until morale improves ;-) More seriously, I understand the point of the musical instruments analogy to be a reminder to programmers that learning a language and understanding it in depth will increase your power and expressivity wi

Re: core.async top use cases

2016-09-18 Thread Mond Ray
Pushing asynchrony further into the stack is useful for reliability and fault tolerance. We can also use it as a basis for Complex Event Processing using time series windows. I wrote up a few examples in my blog

Re: [ANN] New Clojure Podcast: defn

2016-05-20 Thread Mond Ray
That's great feedback. We can (and will) definitely improve the notes along the lines you suggest. On Friday, 20 May 2016 12:19:17 UTC+2, Alan Forrester wrote: > > On 20 May 2016, at 10:32, Vijay Kiran > > wrote: > > > On Friday, May 20, 2016 at 9:29:29 AM UTC+2, Ashish Negi wrote: > >> One su

Re: [ANN] New Clojure Podcast: defn

2016-05-20 Thread Mond Ray
Thanks Ashish - that's really good feedback. We will improve the notes along the lines that you request. On Friday, 20 May 2016 12:02:05 UTC+2, Ashish Negi wrote: > > The notes has : > ``` > Credits: > > *Music:* Thanks to the very talented *ptzery* for the permitting us to > use his music on t

datomic + clojure + clojurescript examples

2013-02-23 Thread Mond Ray
My fellow Clojurians, I am having a trouble hunting down an example of the above stack for clojure applications. Can anyone point me in the right direction? Thanks Ray -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, sen

Re: Multiple replacements in string using a map

2013-04-19 Thread Mond Ray
Old thread but what the heck... it doesn't work in my REPL user=> (defn key-pattern #_=> "Create a regex Pattern of the form '|', the key names #_=> will be quoted in case they contain special regex characters" #_=> [m] #_=> (->> (keys m) #_=> (map #(java.util.regex.

Re: Multiple replacements in string using a map

2013-04-20 Thread Mond Ray
t; first, then copied and pasted those two function definitions, and did not > get the errors you are seeing. I don't have a good guess why you are > getting those errors. Did you do the require first? What version of > Clojure are you using? > > Andy > > > On Fri, A

Re: Multiple replacements in string using a map

2013-04-22 Thread Mond Ray
lassCastException clojure.lang.Keyword cannot be cast to java.lang.String user/key-pattern/fn--352 (NO_SOURCE_FILE:6) user=> You see my full REPL session. I reckon I must be doing something dumb wrong - any ideas on what's going on? Thanks Ray On Saturday, 20 April 2013 09:51:21 UTC

Re: Multiple replacements in string using a map

2013-04-22 Thread Mond Ray
attle, do you guys have any ideas (including that its not a good idea!)? Cheers Ray On Monday, 22 April 2013 23:19:16 UTC+2, Sean Corfield wrote: > > On Mon, Apr 22, 2013 at 1:45 PM, Mond Ray > > wrote: > > Something very odd going on here - one day it works the next day it > fail

newbie question regarding maps

2012-09-25 Thread Mond Ray
I am playing around with maps and using wish lists as a learning tool. I have a list of items in wish lists like this: user=> items [{:name "Item 1", :cost 20.0} {:name "Item 2", :cost 40.0}] user=> wiggle-items [{:name "Wiggle 1", :cost 20.0} {:name "Wiggle 2", :cost 40.0} [:name "Item 3" :cos

Re: newbie question regarding maps

2012-09-27 Thread Mond Ray
Thanks for the support and especially the examples. I will be back when I bump into the next level of complexity ;-) On Monday, 24 September 2012 12:04:42 UTC+2, Mond Ray wrote: > > I am playing around with maps and using wish lists as a learning tool. I > have a list of items in w