Re: bots in closure

2017-07-10 Thread Alex Walker
Hi Frank, Chatbot is a bit of a loaded term, so could you please give a bit of clarification? 1. Are you expecting natural language (spoken or text), or rigid/regex-based commands for user input? - If NL, - do you want to leverage an existing service for intent c

Re: Clojure beginner: angst about "doing things right"

2014-09-22 Thread Alex Walker
For a "do it with (map)" mindset, think in terms of list processing or a conveyer belt, where a series of pure functions transforms a value in a small but significant way. 1. Imho, the clojure-way is to apply the set of principles outlined by Rich and FP using the idioms established by the co

Re: Clojure beginner: angst about "doing things right"

2014-09-22 Thread Alex Walker
For a "do it with (map)" mindset, think in terms of list processing or a conveyer belt, where a series of pure functions transforms a value in a small but significant way. 1. Imho, the clojure-way is to apply the set of principles outlined by Rich and FP using the idioms established by the co

Re: create vectors for each key/value pair

2014-07-22 Thread Alex Walker
First, the fn sorted-map is variable argument and expects to be given (sorted-map :z 1, :b 2, :a 3) and not (sorted-map my-map). To use sorted-map, you'll need to do something like: (apply sorted-map (mapcat identity my-map)) Se

Re: Search seqs in seqs

2014-06-12 Thread Alex Walker
9 11 12]) '((1 2) (3 5 6) (7 8) (9 11 12))) ;; Case: compare using a mix of fns and values (= (partition-by-seq [odd? 10] [1 10 2 10 3 10 4 10 5 10 6]) '((1 10) (2 10) (3 10) (4 10) (5 10) (6))) On Sunday, June 8, 2014 11:27:12 AM UTC-5, Alex Walker wrote: >

Re: a data conversion question

2014-06-08 Thread Alex Walker
(mapcat (fn [[k coll]] (map vector (repeat k) coll)) [[:a [1 2]] [:b [3 4]]]) => '([:a 1] [:a 2] [:b 3] [:b 4]) On Sunday, June 8, 2014 2:12:19 PM UTC-5, boz wrote: > > Is there a better way to take this... > > [[:a [1 2]] > [:b [3 4]]] > > and convert it to this... > > [[:a 1] >

Re: Search seqs in seqs

2014-06-08 Thread Alex Walker
une 8, 2014 8:52:09 AM UTC-5, Alex Walker wrote: > > Err, this was bugging me all day when I went afk. I wrote it too quickly > and am missing the case where the sub-seq starts right after seeing the > first val, [:b :b :c]. > > Will fix it if I have time today, but may

Re: Search seqs in seqs

2014-06-08 Thread Alex Walker
, June 7, 2014 2:31:04 PM UTC-5, Alex Walker wrote: > > Here's a solution based on your description that behaves like core > partition fns, taking liberty to presume your example should've matched the > output below. > > (defn partition-by-seq > [sub-se

Re: Search seqs in seqs

2014-06-07 Thread Alex Walker
Here's a solution based on your description that behaves like core partition fns, taking liberty to presume your example should've matched the output below. (defn partition-by-seq [sub-seq coll] (letfn [(step [coll] (when-let [coll (seq coll)] (let [[run more] (spli

Re: Best way to pass parameters?

2014-05-19 Thread Alex Walker
I'd prefer to combine #1 with a validation layer, similar to prismatic's schema but with a few tweaks. Something* that filtered the param keys based on the allowed columns and ensured the values were sane. Then, hopefully write generic sql helper fns to create the parameterized SET stmt strin

Re: how to convert current time to format i need?

2014-05-01 Thread Alex Walker
https://github.com/mbossenbroek/simple-time (require '[simple-time.core :as t]) (t/format (t/now) "dd:MM: HH:mm:ss") => "01:05:2014 21:16:27" On Tuesday, April 29, 2014 5:03:01 AM UTC-5, sindhu hosamane wrote: > > How to convert the current date and time to the format i need ? for > examp

Re: [ANN] Clojure 1.6.0-beta1

2014-02-16 Thread Alex Walker
Part of Rich's objection to not-nil? variants could be that they are a double negative, "not-(no value)?", which can decrease clarity and require more coffee. >- nil Means 'nothing/no-value'- represents Java null and tests logical >false [clojure.org/reader] > > To compete with some? v

Re: Using macro to generate boilerplate keywords

2014-01-17 Thread Alex Walker
Is a macro necessary? https://gist.github.com/alexpw/8476780 On Friday, January 17, 2014 10:21:52 AM UTC-6, Kashyap CK wrote: > > Hi, > > I am exploring javax.sound.midi using clojure and while creating keywords > for notes I wonder if I could use macros to generate the keywords - > > (defn note

Re: Why is this so difficult?

2013-02-14 Thread Alex Walker
The easiest, when anything becomes a road block, is simply tryclj.comcombined with 4clojure.com. Those two alone can give you enough to work with and chew on while you become more familiar with clojure and setup a proper environment (including Leiningen). Another simplification is to use lei

Re: core/group-by with optional value-mapper function

2012-12-20 Thread Alex Walker
;], :dog ["LESSIE" "DINGO" "REX"]} On Thursday, December 20, 2012 11:19:01 AM UTC-6, Alex Walker wrote: > > I like the idea of it being built-in and might prefer that approach, > however, I wanted to share an alternative. > > https://gist.github.com/4346395 &

Re: core/group-by with optional value-mapper function

2012-12-20 Thread Alex Walker
I like the idea of it being built-in and might prefer that approach, however, I wanted to share an alternative. https://gist.github.com/4346395 I needed to take a denormalized table of config data and create a nested lookup map, so that I wouldn't need to repeatedly filter the dataset while us

Re: Code retreat exercices where Clojure could shine?

2012-09-02 Thread Alex Walker
If the audience is largely Java, then http://www.infoq.com/presentations/Clojure-Java-Interop ; The isBlank refactoring starting at about 13:50 is worth considering as a starting point. On Thursday, August 30, 2012 8:53:16 AM UTC-5, Denis Labaye wrote: > > > > On Thu, Aug 30, 2012 at 12:20 AM,