Re: ? stateful-map ?

2022-12-09 Thread Steve Miner
See also https://github.com/cgrand/xforms for a transducer version of reductions. The argument f must have a nullary arity. (You could probably create your own variant if you want an explicit init value.) I think something like this should work: (require '[net.cgrand.xforms :as x]) (defn xs

Re: Cognitect joins Nubank!

2020-07-23 Thread Steve Miner
Parabéns -- 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, send emai

Re: [ANN] tarantella 1.1.1

2019-07-31 Thread Steve Miner
My original benchmarks were for Eight Queens. I ran some more tests with larger N and found that at N=14, the Tarantella version is the clear performance winner on my machine. > On Jul 30, 2019, at 7:03 PM, Mark Engelberg wrote: > > Thanks for writing the n-queens code and the blog post. It's

Re: [ANN] tarantella 1.1.1

2019-07-30 Thread Steve Miner
Thanks for updated Tarantella. I also enjoyed re-watching your talk. I just wrote a blog post to cover a simple solution to the Eight Queens problem using Tarantella. http://conjobble.velisco.com/2019/07/30/tarantella-queens.html

[ANN] Stu: a lib for understanding CLJS builds via CI

2018-04-29 Thread Steve Buikhuizen
It's the first version so lots more work to do: https://github.com/stevebuik/Stu It's also a good example of how to use "react-faux-dom" with D3 in CLJS. It's a useful technique. Comments and contributions are welcome. -- You received this message because you are subscribed to the Google Grou

[ANN] com.walmartlabs/schematic 1.1.0

2018-03-30 Thread Steve Ashton
Schematic is a Clojure library which aids in assembling Component systems from configuration data. * Expects components to implement the Component/Lifecycle protocol * Prefers pure data for declaring dependencies * Provides a simple mechanism for assembling/starting just a subset of Components

Generative testing of Ring web apps

2017-09-26 Thread Steve Buikhuizen
Hi all, in case this is useful to the community, I thought I'd share the repo I used in a talk at Clojure Sydney last night. https://github.com/stevebuik/stateful-generative-tests Enjoy! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to th

Re: [ANN] tools.deps.alpha

2017-07-26 Thread Steve Miner
would be good enough if you provided an option to turn off rlwrap so I could wrap your script with my own. I can file bugs and provide patches if you want. Steve Miner stevemi...@gmail.com <mailto:stevemi...@gmail.com> > On Jul 25, 2017, at 10:19 AM, Alex Miller wrote: > > t

Re: Data expansion alternatives and idioms

2017-06-25 Thread Steve Buikhuizen
After thinking this technique through, I realised that Datomic schema is a great candidate for s/conform. Here's an example https://gist.github.com/stevebuik/17ed50824f1bb814fab9e556a37cf18a Happy to hear feedback... -- You received this message because you are subscribed to the Google Group

Re: Spec without global registry?

2017-06-12 Thread Steve Buikhuizen
I can think of a use-case in support of Mark's position. If you are building a hosted ETL web service (like Mulesoft) and you want users to be able to use spec to validate records flowing through it. One customer wants :org/postcode to be integer (i.e. US) and another wants it to be string (i.

Re: Data expansion alternatives and idioms

2017-05-23 Thread Steve Buikhuizen
> > I wanted to understand the techniques used for DSL expansion so I did a > talk at the Sydney Clojure Meetup on it. Slides are here if you are > interested. > http://tiny.cc/data-macros -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post t

Data expansion alternatives and idioms

2017-05-09 Thread Steve Buikhuizen
In various projects and presentations there are "terse" data structures being expanded into full forms. Examples are: - Pedestal "terse" routes : using protocols called ExpandableRoutes - Vase schema literals : EDN reader literals - Yada routes : I haven't used it so unsure of the techni

Re: [ANN] Clojure 1.9 / clojure.spec split

2017-05-04 Thread Steve Miner
> On May 3, 2017, at 7:37 PM, Alex Miller wrote: > > A newer version (0.1.108) of spec.alpha is available that fixes the issue. > Note that this kind of update is exactly why the jars are split - you can > update the libs more frequently than the Clojure version. Thanks. The updated spec.alph

Re: [ANN] Clojure 1.9 / clojure.spec split

2017-05-03 Thread Steve Miner
7] [clojure.lang.AFn applyToHelper "AFn.java" 152] [clojure.lang.RestFn applyTo "RestFn.java" 132] [clojure.lang.Var applyTo "Var.java" 702] [clojure.main main "main.java" 37]]} I think it would be nice to have an inclusive jar as before.

Re: Combinatorics partitions that preserves adjacency?

2017-03-17 Thread Steve Miner
map (fn [splits] (map (fn [start end] (subvec v start end)) (conj splits 0) (concat splits (list cnt (sized-subsets (range 1 cnt) smin smax Steve Miner > On Mar 16, 2017, at 12:59 PM, Paul Gowder wrote: > > For sake of completeness/if this i

Could not locate clojure/tools/namespace/find__init.class or clojure/tools/namespace/find.clj on classpath.

2017-03-04 Thread Steve Murphy
Hello-- Heard interesting things about clojure, thought I'd play with it, so I downloaded the clojure-1.8.0 zip file, exploded it, and tried to build it with ant... all this on my ubuntu 16.04 workstation. I discovered my java installation is a bit incomplete for this... I installed the openjd

Re: clojure.spec bug?

2017-01-02 Thread Steve Miner
> On Jan 1, 2017, at 7:13 PM, John Schmidt wrote: > > Steve: both ::game3 and ::game4 from your suggestions result in the same > error. > Sorry for my mistaken conjecture. My issue with the macroexpansion looks like a red herring. I guess I confused myself with quick te

Re: Wrapping a string as-is

2017-01-01 Thread Steve Miner
Use clojure.edn/read-string. Note the clojure.edn namespace. clojure.core/read-string can execute code (controlled by *read-eval*), and as such should be used only with trusted sources. > On Jan 1, 2017, at 10:07 AM, Yehonathan Sharvit wrote: > > I’d like to write a function `foo` that recei

Re: clojure.spec bug?

2016-12-31 Thread Steve Miner
> On Dec 30, 2016, at 9:42 AM, John Schmidt wrote: > > (s/def ::game1 #(satisfies? Game %)) > (s/def ::game2 (partial satisfies? Game)) > > (s/explain ::game2 (spec-test.foo/->Foo)) > val: #spec_test.foo.Foo{} fails spec: :spec-test.core/game2 predicate: > (partial satisfies? Game) < W

Re: Help me understand what part of this code is slow, and how to make it faster?

2016-11-22 Thread Steve Miner
> On Nov 21, 2016, at 8:03 PM, Didier wrote: > > @miner: Doesn't using the flag (set! *unchecked-math* :warn-on-boxed) gives > me unchecked math automatically? I was under the impression that +, -, /, * > etc. would all now perform in an equal way to unchecked-add, etc. If not, > what is the

Re: Help me understand what part of this code is slow, and how to make it faster?

2016-11-21 Thread Steve Miner
> On Nov 21, 2016, at 3:05 PM, Didier wrote: > > I experimented with this a lot, and took everyone's advice, and this is the > fastest I got, even faster then Michael Gardner's answer. > > (deftype point5 [^long i ^long j] > Object > (equals [this that] (and (= (.i this) (.i ^point5 that))

Re: Just quick review - "idiomaticy" check (Selection sort)

2016-10-10 Thread Steve Miner
> On Oct 10, 2016, at 6:50 AM, Rastko Soskic wrote: > > I am specially interested in better way for processing input which shrinks > after each step. Vectors have some nice properties if your action is mostly at the end. The peek and pop functions are useful for “shrinking” a vector. Also,

Re: core.logic with 1.9.0-alpha12

2016-09-13 Thread Steve Miner
Filed LOGIC-180 bug with patch. http://dev.clojure.org/jira/browse/LOGIC-180 -- 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

Re: grouping and mapping

2016-08-14 Thread Steve Miner
Sorry, I got the semantics of the grouping-fn wrong. My code assumes that the key is always first in the elements and my grouping is more like a merging-fn. > On Aug 14, 2016, at 2:53 PM, miner wrote: > > If your data elements are essentially map-entries (key-value pairs), I'd use > reduce.

Re: How does clojure.core quote function work for keyword?

2016-07-26 Thread Steve Miner
It’s working as expected. The :: notation is expanded by the reader, before evaluation. As keywords are basically constants (like numbers or strings), you rarely see them quoted. > On Jul 26, 2016, at 8:52 AM, Mamun wrote: > > Hi > > How does clojure.core quote function work for keyword?

Re: meaning of spec/and ?

2016-07-21 Thread Steve Miner
It looks like you’ve got your #s misplaced. I think you want something like this: (s/and #(> % 0.0) #(< % 1.0)) Of course, the first predicate expression could be replaced by `pos?`. The `s/and` returns a single spec that combines multiple specs. Of course, `clojure.core/and` is basically th

Re: Enhance spec/double-in to handle open and half-open intervals?

2016-07-21 Thread Steve Miner
> (s/and (s/double-in :min 0.0 :max 1.0) #(not= 0.0 %)) > > should be the same as > > (s/double-in :min Double/MIN_VALUE :max 1.0) I should have mentioned that Double/MIN_VALUE is the smallest positive double (just greater than 0.0), not a large negative value. It’s easy to get confused

Re: Enhance spec/double-in to handle open and half-open intervals?

2016-07-21 Thread Steve Miner
With a little help from Java, you can make equivalent open intervals for the desired bounds. For example, (s/and (s/double-in :min 0.0 :max 1.0) #(not= 0.0 %)) should be the same as (s/double-in :min Double/MIN_VALUE :max 1.0) Also, you can use java.lang.Math/nextUp and nextAfter to get a

Re: Clojure for the Brave and True - infix notation exercise

2016-06-24 Thread Steve Miner
Not exactly the same problem, but you might like to see an infix implementation from “The Joy of Clojure” by Fogus and Chouser. http://fogus.me/fun/unfix/infix-src.html The “Joy” code makes intermediate calculations as it goes. I tweaked it a bit to make a data-reader that only does the infix

Re: clojure.spec

2016-05-24 Thread Steve Miner
> On May 24, 2016, at 8:10 AM, Alex Miller wrote: > > The first use is a namespace alias and the second is a var - they don't > overlap in usage. Right, but it’s still a potential source of confusion. The explanation distracts from the point of the example which is to demonstrate the new spe

Re: Possible bug with (keys some-container) in a try-catch?

2016-04-23 Thread Steve Riley
t forced, so no errors. > > On 04/22/2016 01:28 PM, Steve Riley wrote: > > I am trying to determine if a container, x, passed to a function, is a > > map or not. > > > > If I evaluation (keys x) at a REPL prompt, and, x is instantiated list, > > vector or set

Possible bug with (keys some-container) in a try-catch?

2016-04-22 Thread Steve Riley
I am trying to determine if a container, x, passed to a function, is a map or not. If I evaluation (keys x) at a REPL prompt, and, x is instantiated list, vector or set, I will get a java.lang.ClassCastException that some item in x cannot be cast to java.util.Map$Entry. On the other hand, if I

Re: Clojure as first language

2016-02-26 Thread Steve Miner
> On Feb 26, 2016, at 9:53 AM, Lee Spector wrote: > > But sometimes it does matter, e.g. (str '(1 2 3 4 5 6 7 8 9 10)) => "(1 2 3 4 > 5 6 7 8 9 10)", whereas (str (map inc (range 10))) => > "clojure.lang.LazySeq@c5d38b66" There’s a bit of subtlety around `str` vs. `pr-str`. In many case, pr-

Re: Kicking off a process in Compojure Defroutes / http-kit runserver

2016-02-01 Thread Steve Ashton
This sounds like a good candidate for using Component (https://github.com/stuartsierra/component). I would think you could create a component which starts the async process. That component could then be provided to your ring handlers, to be used during web request processing. On Monday, Febru

Re: A call for an idiomatic rendering of Clojure EDN in info/error messages

2015-11-13 Thread Steve Miner
For what it’s worth, I like to use matching `backquotes` as a meta-syntax. (defn expected [exp was] (format "Expected `%s` but was `%s`" (pr-str exp) (pr-str was))) (println (expected 2 "2")) ;=> Expected `2` but was `"2"` > On Nov 13, 2015, at 6:55 AM, Colin Yates wrote: > > Hi all, > >

Re: lazyseq?

2015-10-19 Thread Steve Miner
I’ll second what Timothy Baldridge wrote. By the way, you have to make sure you’re dealing with some sort of clojure.lang.IPending before you call realized? on it. I prefer to test against interfaces rather than concrete classes so I would try something like this (minimally tested): (defn

Re: partition-when?

2015-08-20 Thread Steve Miner
If you’re interested in a transducer version of partition-when, here’s my code from https://github.com/miner/transmuters ;; collection version by Frank on mailing list ;; SEM added transducer version, adapted from partition-by (defn partition-when "Applies f to each value in coll, starting a

Re: How to include ... in project.clj

2015-06-03 Thread Steve Ashton
Try: :repositories [["..." "url"]] -Steve -- 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 pat

Re: Opinion on take-while for stateful transducers

2015-05-11 Thread Steve Miner
#{} (complement contains?)) '(1 2 3 4 2 5 6)) ;;=> [1 2 3 4] ;; dedupe (into [] (take-while-accumulating (fn [r x] x) ::void not=) '(1 2 1 3 4 4 5 6)) ;;=> [1 2 1 3 4] ;; monotonically increasing (into [] (take-while-accumulating max 0 <=) '(1 2 3 4 4 1 5 6)) [1 2 3 4

Re: What is "best practice" regarding transducers

2015-05-10 Thread Steve Miner
xempty is a transducer that just returns an empty result, essentially ignoring the input. The thought was that a degenerate transducer might be useful in a complex chain if you want to stop processing. I haven’t actually used it for anything, just experimenting. > On May 10, 2015, at 3:12 PM,

Re: What is "best practice" regarding transducers

2015-05-08 Thread Steve Miner
was a fun experiment for me. Steve Miner stevemi...@gmail.com > On May 6, 2015, at 11:15 AM, larry google groups > wrote: > > I would like to write a detailed blog post about how developers are actually > using transducers. If you have a public project on Github that is using

Re: Transducers: sequence versus eduction

2015-04-03 Thread Steve Miner
forms. There must be a better reason than mechanical rewriting. Wouldn't a macro make more sense? (defmacro educe->> [coll & xfs] `(->Eduction (comp ~@xfs) ~coll)) So the rewrite could be just educe->> for ->>, without having to wrap the xforms at all. (educe->

map-in

2015-03-24 Thread Steve Ashton
ustomers [{:name "Alice" :address {:city "Raleigh" :state "NC"}} {:name "Bob" :address {:city "Seattle" :state "WA"}}]) (map-in customers [:address :state] #(-> % clojure.string/lower-case keyword)) => (:nc :wa)

Re: partition-when

2015-03-05 Thread Steve Miner
[f coll] (lazy-seq (when-let [s (seq coll)] (let [fst (first s) run (cons fst (take-while #(not (f %)) (next s)))] (cons run (partition-when f (seq (drop (count run) s) — Steve > On Mar 5, 2015, at 12:11 PM, Andy- wrote: > > Tried myself an

Re: printf does not always generate output

2015-02-27 Thread Steve Miner
Try adding (flush) at the end. > On Feb 27, 2015, at 2:12 PM, Cecil Westerhof wrote: > > My core.clj ends with: > (println (format "Started: %s (println)" (java.util.Date.))) > (printf "Started: %s (printf)\n" (java.util.Date.)) > > I do not see the output from the printf when I run 'le

Re: Can someone offer refactoring suggestions for my protocol example?

2015-02-24 Thread Steve Miner
It’s probably fine to do a linear search with .indexOf for small vectors, but I’ll just say as a matter of style I prefer to use a couple of maps to hold previous and next items. The maps are callable like functions, which I think reads very nicely. Using your example data for ranks: ;; helpe

Re: should edn recognise defrecord?

2015-02-24 Thread Steve Miner
The edn format does not include records. The transit README gives an example of how to write a transit handler for a record. See the section on extensibility. https://github.com/cognitect/transit-format#extensibility Before transit

Re: Lucky Numbers again

2015-02-19 Thread Steve Miner
I found a better data structure for calculating lucky numbers. The contrib library data.avl (from Michał Marczyk) has a persistent sorted-set that supports nth. This runs much faster than my previous attempts. (require '[clojure.data.avl :as avl]) (defn lucky-avl ([max] (lucky-avl 1 (apply a

Re: Lucky Numbers again

2015-02-18 Thread Steve Miner
One more try. This time using the int-map contrib library. (Thanks to Zack Tellman.) Warning: I'm assuming that the int-set seq is automagically sorted so I can reliably turn it back into a vector without sorting. It seems to be stable at least. I wanted a vector for fast nth access. (Nth

Re: Lucky numbers

2015-02-17 Thread Steve Miner
> On Feb 17, 2015, at 4:39 PM, Colin Jones wrote: > > Sounds almost like a mirror image of `clojure.core/take-nth`, so something > like this is kind of fun: > > (defn drop-nth [n coll] > (lazy-seq > (when-let [s (seq coll)] > (concat (take (dec n) s) (drop-nth n (drop n s))

Re: Name of a function

2015-02-14 Thread Steve Miner
Clojure doesn't give you direct access to the name of the function you're defining. However, you could use a macro to get that. Here’s one way. This macro binds the strange symbol %0 to the symbol naming the current function. ;; %0 is bound to the function's symbolic name within the function

Re: Help needed with Component library

2015-02-10 Thread Steve Ashton
In main.clj, it looks like you aren't keeping a reference to the started app. So when you call stop, you are actually stopping the version of the system which doesn't have the jetty server set. Try changing this: (defn -main [& args] (component/start app) (component/stop app)) to this: (de

Re: Combining reloaded workflow in web dev with dynamic var approach

2015-02-09 Thread Steve Ashton
I've had the same question. What I've come up with is to introduce a new middleware in the the dev-system, which wraps the both the creation of the app handler and calling the handler with the request map. The prod-system would still refer directly to a single instance of the app handler. Now i

Re: print-table bug?

2015-02-02 Thread Steve Miner
In any case, it would be nice if (str ()) returned “()”. By the way, (str {}) returns "{}" and (str []) returns "[]” as I would expect. I just filed CLJ-1653.Seems like the simple fix is to add a toString() method for PersistentList.EmptyList. -- You received this message because you are

Re: print-table bug?

2015-02-02 Thread Steve Miner
Looks like a bug in clojure.pprint/print-table. Probably should be use `pr-str` instead of `str`. user=> (str ()) "clojure.lang.PersistentList$EmptyList@1" user=> (pr-str ()) "()" > On Feb 2, 2015, at 3:10 PM, John Lawrence Aspden > wrote: > > These behave differently in 1.6 with respect t

Re: [ANN] dformat 0.1.0

2015-01-15 Thread Steve Miner
Clever. The doc-strings for dformatter and dformat could use a little work. Remember, people will use (doc whatever) in the REPL so “same as above” isn’t very useful. Also, the dformatter doc implies more arguments than it actually takes. The order of arguments to dformat seems backwards to

Re: [ANN] Clojure 1.7.0-alpha5 now available

2015-01-15 Thread Steve Miner
Alpha5 works for me. I noticed that the doc-string for *unchecked-math* doesn't mention the :warn-on-boxed behavior. Suggestion: "While bound to true, compilations of +, -, *, inc, dec and the coercions will be done without overflow checks. While bound to :warn-on-boxed, a warning will

Better update function

2014-12-21 Thread Steve Ashton
I'm trying to figure out if there is a better / more concise / more generic way to write an update function. The data I have is a vector of maps containing vectors of maps. For example: [{:values [{:y 1 :x 4}{:y 2 :x 7}]}{:values [{:y 5 :x 8}]}] The goal is to update all the :y values or all

Re: testing platform , midje or specjl ?

2014-11-15 Thread Steve Ford
olutely love is midje's autotest. I love writing out my editor and having the tests run immediately in another window. No more bugs of the form, "Oh, this is just a simple, obvious change; no need to re-run tests." Is there anything like that which could be done with clojure

Re: better way to group consecutive numbers in a vector?

2014-11-06 Thread Steve Miner
I would try to avoid last and but-last as they work in linear time. How about something like this? (defn congeal-consecutives [coll] (when (seq coll) (let [[_ group res] (reduce (fn [[succ group res] n] (if (== succ n)

Re: Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-30 Thread Steve Shogren
0.8-snapshot. > > — > Cheers, > Bozhidar > > On October 29, 2014 at 5:43:56 PM, Steve Shogren (steve.a...@gmail.com > ) wrote: > > Supposedly that was fixed in nrepl 0.2.6, which is the version I am using. > Still nothing. > > On Wednesday, October 29, 2014 10:15:34 A

Re: Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-30 Thread Steve Shogren
-9b16-c89f818ed326")) On Wednesday, October 29, 2014 1:12:14 PM UTC-4, Bozhidar Batsov wrote: > > I’d suggest filing the a ticket with output from *nrepl-messages* so we > can have an idea what’s going on. > You can also try the 0.8-snapshot. > > — > Cheers, > Bozh

Re: Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-29 Thread Steve Shogren
ssues/785 > > — > Cheers, > Bozhidar > > On October 29, 2014 at 2:41:02 PM, Steve Shogren (steve.a...@gmail.com > ) wrote: > > I cannot seem to see the results of "println", "print", or > "clojure.tools.trace/trace" when running my si

Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-29 Thread Steve Shogren
I cannot seem to see the results of "println", "print", or "clojure.tools.trace/trace" when running my site, per my setup here: http://stackoverflow.com/questions/22365741/missing-out-in-clojure-with-lein-and-ring?lq=1 The one comment suggested trying (.println System/out msg) which prints as

"lein midje :autotest" problem - fast re-init?

2014-09-28 Thread Steve Ford
ot; error. Any suggestions besides killing and restarting "lein midje :autotest" from time to time? (To be avoided given the long delay starting it.) Thanks. Steve -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Clojure REPL startup code

2014-09-15 Thread Steve Ford
I think. I'm kinda new to all this... Is there a different way to auto-load the tools? Maybe something not specific to lein? Steve -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goog

Re: Is this behavior with recur and pre/post a bug?

2014-07-26 Thread Steve Miner
I tried the latest patch from Ambrose for CLJ-1475. Looks good to me. Well done. -- 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 b

Re: Is this behavior with recur and pre/post a bug?

2014-07-26 Thread Steve Miner
I'm giving up on this bug. My approach was adding too much complexity to handle an edge case. Hacking the fn macro is not as easy as it looks. :-) I recommend the loop work-around if you run into this problem. Or refactor the recursive code into a separate function and call it from another fu

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Steve Miner
nction call and never during a recur. Any other opinions? On Jul 25, 2014, at 10:57 AM, Steve Miner wrote: > Ticket CLJ-1475 with my patch. > > http://dev.clojure.org/jira/browse/CLJ-1475 -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Steve Miner
Ticket CLJ-1475 with my patch. http://dev.clojure.org/jira/browse/CLJ-1475 -- 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 patien

Re: Is this behavior with recur and pre/post a bug?

2014-07-25 Thread Steve Miner
I will call it a bug. It's definitely surprising to the user, and therefore worthy of a ticket. On first glance, it seems that the fix isn't too hard. In core.clj where the macro fn is redefined, we just need to wrap the section that handles the post condition either with a loop* or a fn* so t

Re: Critiques of "my-flatten" which uses CPS

2014-07-17 Thread Steve Miner
Slightly off-topic from original poster's question, but if you're interested in another implementation of flatten, I suggest you take a look at the reducers library. clojure.core/flatten is elegant but a bit slow. The reducers version is very fast as part of a reduce/fold operation. The whol

Re: Clojure on iOS devices - Swift as a host?

2014-06-24 Thread Steve Tickle
In the upcoming IOS8, UIWebView has the same (JITed) performance as the Safari, the distinction has been removed due to using the new inter-app communication mechanism. This allows the remote application (Safari/JavascriptCore/UIWebView) to display a view into another process, thus bypassing the no

Re: How to take a subsequence out of an infinite lazy sequence?

2014-06-15 Thread Steve Miner
On Jun 15, 2014, at 9:42 AM, Yehonathan Sharvit wrote: > I have a infinite lazy sequence and I would like to create a lazy sub > sequence with all the elements whose indices are between 100 and 1000. You can use `drop` and `take` with infinite sequences. Something like this should work: (

Re: [ANN] clojure.test.check 0.5.8

2014-05-15 Thread Steve Miner
On May 15, 2014, at 1:03 PM, Reid Draper wrote: > Sorry you ran into an issue, Steve. I like your idea of including more > information in the ex-info data. Is there a specific generator you're having > trouble writing without such-that? In general, I've found that it'

Re: [ANN] clojure.test.check 0.5.8

2014-05-14 Thread Steve Miner
nfo data. By the way, it turns out 25 was a sufficient number of retries for my test. Works fine now. Steve Miner -- 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 po

Re: Thoughts on a curly-infix reader macro?

2014-04-04 Thread Steve Miner
The desire (and rejection) of infix notation for Lisp is as old as the hills. "Therefore we expect future generations of Lisp programmers to continue to reinvent Algol-style syntax for Lisp, over and over and over again, and we are equally confident that they will continue, after an initial peri

Re: Clojure 1.6.0-RC1 - LAST CHANCE, PLEASE TEST

2014-03-19 Thread Steve Miner
I just tried to build master locally with the new JDK 1.8 on a Mac. I'm getting a build test failure. Sorry, I don't have time to look into it at the moment. JDK 1.7 worked fine for me. [java] clojure.test-clojure.reflect [java] [java] java.lang.IllegalArgumentException [

Re: Function that "weaves" two collections together - looking for feedback

2014-02-19 Thread Steve Miner
On Feb 19, 2014, at 12:28 AM, Laurent Droin wrote: > Ah, thank you. "interleave" is what I was looking for. I looked for "weave", > "zip", "map", "concat", and all the "see also" but did not find "interleave". > Interleave will of course not handle the last value in the categories > collection

Philadelphia SICP Study Group starting Feb 5th

2013-12-17 Thread Steve Shogren
Quite a few in the Philadelphia area expressed interest in having a study group around the excellent book Structure and Interpretation of Computer Programs, and so here it is! http://www.meetup.com/Clojadelphia/events/155920672/ But, SICP is in Scheme, right? What does that have to do with Cloj

Re: Function to Generate EDN :readers Map for Namespace Records?

2013-12-06 Thread Steve Miner
I use a default reader to do something like what you're asking for in my 'tagged' library. You could hack a similar default reader that restricted itself just to your favorite namespaces. That way you don't have to explicitly track all your defrecord classes. https://github.com/miner/tagged

Re: [ANN] Counterclockwise - Clojure plugin for Eclipse

2013-10-11 Thread Steve Buikhuizen
Laurent, you rock! Auto-formatting is already saving my fingers a lot of travelling. Thanks for the great work. -- -- 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 ne

Re: Detecting login and logout using friend

2013-08-30 Thread Steve Buikhuizen
I had to do this again in another project so I tried Chas' suggestion. It is much simpler than my earlier solution. For anyone else doing this in the future, here's how you can write it: (defn check-workflow-result "check if the response contains and auth-map. If so, notify the event bus"

Clojure Macro Tutorial

2013-08-19 Thread Steve Shogren
! Steve -- -- 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 g

Deft: A Typeshaping Library

2013-08-12 Thread Steve Shogren
considered that typeshape. Any suggestions as to my implementation or pull requests are totally welcome. Thanks! Steve -- -- 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 t

REPL sessions crash Windows

2013-08-06 Thread Steve J
I am new to Clojure programming and have been running REPL sessions from the Command Prompt. At some unpredictable time, either during the session or after it is ended, Windows will crash (the computer not responding and with a frozen pattern on the screen). I have tried several things, such as

Re: Detecting login and logout using friend

2013-06-28 Thread Steve Buikhuizen
Thanks Chas, since my current solution "ain't broke" I'll leave it as is for now. However, the moment I need to change it, I'll try your suggestion and will post the code here as well. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: Detecting login and logout using friend

2013-06-28 Thread Steve Buikhuizen
I'll answer my own question here for future reference value. I found a much cleaner way was to create a wrapper type (deftype) for the ring session store impl. It is a simple delegating wrapper but it sees the correct cookies, regardless of the servlet container. It has the disadvantage of not

Detecting login and logout using friend

2013-06-25 Thread Steve Buikhuizen
Hi all, I'm using Friend https://github.com/cemerick/friend for auth on my webapp and I'm measuring how many people login and use the app etc. In order to do this I need to detect the login and logout events as well as the session-id cookie (I need a unique id for session) from the container.

Re: ClassNotFoundException when using fetch RPC from cljs

2013-03-28 Thread Steve Buikhuizen
Sadly, this was not the end of the story. I discovered that my fix posted above did not work properly so I decided to bite the bullet and move to shoreleave. This held the promise of using an edn reader. A couple of things were tricky in making this migration, I'll list them here for any future

Re: ClassNotFoundException when using fetch RPC from cljs

2013-03-21 Thread Steve Buikhuizen
Thanks for the support gents. Ever since Noir was deprecated I've been planning to switch to compojure and shoreleave. However I'm still in prototype mode and "it ain't broke" so I'm delaying that work until I need the next level of stability. Nice to know I'm on the right track though. -- --

Re: ClassNotFoundException when using fetch RPC from cljs

2013-03-21 Thread Steve Buikhuizen
I found the solution and it's a bit of a noob mistake. Because I'm using fetch, the server side of the RPC is defined in a noir host page. I added a :require of the view model ns to that page so that the classes are loaded above read-string call in the stack. This made it work immediately. Do

ClassNotFoundException when using fetch RPC from cljs

2013-03-20 Thread Steve Buikhuizen
tances in the namespace on load 3/ importing and requiring all classes in the ns where I to the read-string None of these seem to work. Does anybody have an understanding of the read-string class-loading behaviour that would explain this? Any suggestion would be much appreciated. Steve -- --

Re: Clojure 1.5 RC 14

2013-02-09 Thread Steve Miner
Maybe the registry has caught up with the updates yet. Leiningen found RC 14. % lein deps Retrieving org/clojure/clojure/1.5.0-RC14/clojure-1.5.0-RC14.pom from sonatype-oss-public Retrieving org/clojure/clojure/1.5.0-RC14/clojure-1.5.0-RC14.jar from sonatype-oss-public On Feb 9, 2013, at 3:29

Re: Nilsafe operators from clojure.core.contrib fail when not referred

2013-01-30 Thread Steve Miner
In Clojure 1.5 pre-releases, there's a new macro called some-> . The source looks like it would work fine in earlier versions of Clojure. At this point, I don't think it's a good idea to keep slightly different versions in contrib. -- -- You received this message because you are subscribed t

Re: *read-eval* vulnerability

2013-01-30 Thread Steve Miner
I would prefer that *read-eval* default to false. In this case, security is more important than backwards compatibility. However, I want to point out that there is an issue with backwards compatibility, especially for users of *print-dup* (default false). In many cases, with *print-dup* tru

Re: What's the current status of Clojure-in-Clojure?

2013-01-09 Thread Steve Miner
I think you're looking for: https://github.com/kanaka/clojurescript I just saw a tweet about a talk be accepted for ClojureWest: https://twitter.com/bus_kanaka/status/289037484787118080 On Jan 8, 2013, at 6:44 PM, Thor wrote: > I think this would be a fun project to contribute to, but a few s

Re: clojure defining a var with a dot in the name is accepted in clojure 1.5-RC1, but probably shouldn't?

2012-12-22 Thread Steve Miner
It looks like Clojure 1.4 does the same thing so it's probably been hiding for a while. The fully qualified var works. user=> (def foo1. 2) #'user/foo1. user=> foo1. CompilerException java.lang.ClassNotFoundException: foo1., compiling:(NO_SOURCE_PATH:0) user=> user/foo1. 2 On Dec 22, 2012, at

Re: reader literal , tagged literal

2012-12-22 Thread Steve Miner
I'd say that "tagged literal" is the preferred term for expressions like #inst "2012". The term "reader literal" might perhaps refer to any literal (number, string, etc.) that doesn't need any further evaluation, although I think people use it loosely to mean the same thing as "tagged literal".

Re: Default random in Clojure doesn't seem to fit fp paradigm

2012-12-05 Thread Steve Miner
You should treat rand and friends like i/o. Don't bury them deep in your code. Write your pure functions so that they take a seed value (or sequence). Generate the random values from outside of the important functions, maybe providing a convenience wrapper function around your main logic. (

  1   2   3   >