Re: Port of simple Scala match to Clojure core.match

2015-07-16 Thread Jonathan Winandy
Hello ! I think, this branch (without :<< empty?)) (match [l prefix] *[_ ([] :seq)] true* ​is already checking that prefix is empty. ​Have a nice day, Jon On 16 July 2015 at 23:06, Rastko Soskic wrote: > Hi, I am getting familiar with Clojure's core.match and > simply starting with some

Re: 2 way transform in single definition ? unification ?

2015-07-13 Thread Jonathan Winandy
To me it's a very good option. Given you example : (./pull '[org.clojure/core.logic "0.8.10"]) (ns yo (:refer-clojure :exclude [==]) (:use [clojure.core.logic])) (defne a-to-b [x y] ([ {:a {:b b :c c}} [b [c]] ])) (run* [a] (a-to-b a [1 [2]])) ;#=> ({:a {:b 1, :c 2}}) On 13 July

Re: Is this the good way to write get-percentage

2015-02-14 Thread Jonathan Winandy
"Unable to resolve symbol: ​ in this " I get this error when I have a non-breaking space in my code : http://en.wikipedia.org/wiki/Non-breaking_space Jon On Sat, Feb 14, 2015 at 3:21 PM, Matching Socks wrote: > A Clojure fn is an Object, but Math's ceil method is not an Object. The > Java-Int

Re: Is this the good way to write get-percentage

2015-02-13 Thread Jonathan Winandy
Hi ! You could rewrite the code like that : (defn get-percentage ([place total-count] (get-percentage :normal place total-count)) ([mode place total-count] (let [mode-fn (case mode :highMath/ceil :low Math/floo

Re: Backslashes in Edn

2014-11-25 Thread Jonathan Winandy
​Hi Andy, ​ If I stick with Edn are there any other gotchas that should be sanitised ? The specs of String literals is a bit implicit : https://github.com/edn-format/edn#strings refers to https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.6 . I think there are no ways to per

Re: behaviour of map

2014-10-18 Thread Jonathan Winandy
nction used with "repeatedly" only prints once: > > (first (repeatedly 4 #(do (println "executed!") (inc 1 > > I guess because Clojure does not read-ahead in this scenario. Am I right? > > On Sat, Oct 18, 2014 at 1:41 PM, Jonathan Winandy < > jonathan

Re: behaviour of map

2014-10-18 Thread Jonathan Winandy
You can try in you repl with (take 1 (map (fn [_] (println "executed")) (vec (range 100 (take 32 (map (fn [_] (println "executed")) (vec (range 100 (take 33 (map (fn [_] (println "executed")) (vec (range 100 you will observe the 32 sized chunks. On Sat, Oct 18, 2014 at 7:36 PM,

Re: positional + keyword args

2014-07-21 Thread Jonathan Winandy
Hi, If I understand your pb correctly, and form what I have seen in the Scala world, there is maybe a simpler way to do it : (defn process-args [args fnkeys fndefault] (let [[positional-args named-args] (split-with (complement keyword?) args) named-args (into {} (map vec (partition

Re: OT: Github Alternatives

2014-07-01 Thread Jonathan Winandy
I am feeling the same thing about git, while having no problems using it. I used mercurial before, to me, the command were simpler, as well as the model. For example, a branch can have several heads in mercurial, and it separates more easily fetch and merge. You don't have a origin/master and yo

Re: How to iterate over maps and drop one specific element each time?

2014-06-11 Thread Jonathan Winandy
Hi ! If you want to keep certain entries, there is also select-keys : (map #(select-keys % [:v :b :z]) [{:op :e :v 1} {:op :n :b 2} {:op :m :z 2.3}]) On Wed, Jun 11, 2014 at 3:12 PM, Di Xu wrote: > (map #(dissoc % :op) [{:op :e :v 1} {:op :n :b 2} {:op :m :z 2.3}]) > > 2014-06-11 21:09 GM