re 1.3.
3) Use other libraries derived from contrib 1.2.
When we're trying to port large sources of clojure 1.2 for clojure 1.3, I
guess we should take 2).
But I want to know what should we do with new developments after now.
Best regards,
Yoshinori Kohyama (@kohyama <https://twitter.com/#!/ko
Baishampayan,
Thank you for your informatioin.
The page "Where Did Clojure.Contrib Go" tells me much.
O.K. Now I see that what we should do is depend on the namespace in contrib
1.2.
Thank you again.
Best regards,
Yoshinori Kohyama (@kohyama <https://twitter.com/#!/kohyam
Sun,
Thank you for your information.
If I want to use the "contrib compiled against 1.3" with Leiningen, does
anyone know what entry I should specify at :dependencies in project.clj?
Regards,
Yoshinori Kohyama
--
You received this message because you are subscribed to the Goo
Sean, Thank you!
Yoshinori Kohyama
--
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 u
e-in (into {} (map #(vector (:id %) %) v))
[1 :emails "a...@mail.com"]
inc)
HTH,
with regards,
Yoshinori Kohyama
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to cloj
One more solution.
user=> (mapcat (fn [[x y] z] [x y z]) (partition 2 '(:x1 :y1 :x2 :y2 :x3
:y3)) '(:z1 :z2 :z3))
(:x1 :y1 :z1 :x2 :y2 :z2 :x3 :y3 :z3)
Y. Kohyama
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To p
Hi Laurent,
How about a macro like below?
(defmacro tt
([x] x)
([x ts tr & more] `(tt (if (~ts ~x) (~tr ~x) ~x) ~@more)))
To use this,
(tt x test1 transform1 test2 transform2 test3 transform3)
This doesn't work even number of arguments as you see.
HTH,
Y.Kohyama
--
--
You recei
Hi Colin,
One more solution, with example data in the process commented
*(let [f #(range 1 (inc %))*
* coll '(1 2 3)]*
* (->>*
**(for [*x coll*; x = 1, 2, 3
* y *(*f x*)]* *; y = 1 (where x = 1),
**; 1, 2(where x = 2),
*
{:a {:b 9 :c 16} :d 25}))
(is (= (mapf #(+ (* %1 %1) %2) {:a {:b 3 :c 4} :d 5} 1)
{:a {:b 10 :c 17} :d 26})))
https://gist.github.com/kohyama/6089899
Thank you in advance.
Y.Kohyama
--
--
You received this message because you are subscribed to the Google
Groups "Clojure&q
Thank you Gary.
There's no reason why this need to be a macro.
It has rewritten as a function.
And I'd still like to hear any response about the same three questions.
(require '[clojure.test :refer (with-test is run-tests)])
(with-test
(defn mapf [f m & args]
((fn g [n]
(if (map?
. Kohyama
--
--
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,
Thank you, Dave.
Yes, I'm thinking of a nested map as a sort of tree.
Then, what I do may be called 'map-leaves', as you say.
Is there an existing function named like that?
Or did you say that just as 'an abstraction name'?
Y.Kohyama
2013年7月27日土曜日 10時02分17秒 UTC+9 Dave Sann:
>
> if you are think
er seen a name for that.
>>>> 2) not in core. I'm sure it's been written 50 times in various helper
>>>> libs.
>>>> 3) I'd probably write it like below, but I'm not convinced it's any
>>>> better.
>>>>
>>&g
Thank you, Jason.
The 'map-leaves' does the same as my 'mapf' and simpler.
Its name and implementation is very sophisticated with other functions doing
similar but different things.
Thanks the information.
Regards,
Y.Kohyama
2013年7月27日土曜日 13時31分28秒 UTC+9 Jason Wolfe:
>
> This is 'map-leaves' in
Thanks Ben, for very useful informations!
2013年7月27日土曜日 13時31分41秒 UTC+9 Ben:
>
> if you want to use that fmap (or, I'd think, the fmaps provided by either
> morph or fluokitten) with uneven depths, you'd have to wrap them in a
> defrecord or deftype, I'd expect.
>
I see.
2013年7月27日土曜日 13時37分28
I can refer only some specific symbols.
(ns foo (:require [bar :refer (baz qux)]))
Can I refer all but specific symbols?
I'm doing
(ns foo (:require bar))
(refer 'bar :exclude '(quux))
or
(ns foo)
(require 'bar)
(refer 'bar :exclude '(quux))
for n
Carlo,
Works fine. Thank you!
Y. Kohyama
--
--
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
firs
requires 'char[]'.
* What is the valid char value to send a byte 0x80?
* How can I make the char value from 0x80 int?
* How are things about read.
* Does character encoding environment affect? (I use -Dfile.encoding=UTF-8)
Thank you in advance.
Yoshinori Kohyama
--
--
You received thi
uf, int off, int len)
.
Does anyone have any information?
Thanks in advance.
Yoshinori Kohyama
--
--
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
.flush os)))
sent [0x00, 0x01, 0x7f, 0x80, 0xff] to my test server.
Thank you, Armando and all.
Regards,
Yoshinori Kohyama
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.
Hi, Charles and all.
Here is my definition of prime numbers:
https://gist.github.com/kohyama/8e599b2e765ad4256f32
HTH.
Yoshinori Kohyama
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@google
s o.k. that we can assume at least one argument.
Yoshinori Kohyama
--
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 patie
ncat
(keep (fn [[k v]] (g (conj kv k) v)) n))
(if-let [fna (apply f n args)]
[[kv fna]])))
[] m)))
https://gist.github.com/kohyama/6789280 (with examples as tests)
Regards,
Yoshinori Kohyama
--
--
You received this message because you are subscribe
Smart! That's just what I want to do.
Thanks, Leif and the author of Prismimatic.
Best Regards,
Yoshinori Kohyama
--
--
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
expression which I can use instead of `(drop ~d a#) and
`a# in the first expression in the example above.
Thank you in advance.
Regards,
Yoshinori Kohyama
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send em
Meikel,
I see! Thanks a lot.
Best regards,
Yoshinori Kohyama
--
--
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 pa
~d ~a)
a 3)
(clojure.core/fn [foo20] (clojure.core/drop 3 foo20))
user=> ((fn [d] (let [a (gensym "foo")] `(fn [~a] ~(if d `(drop ~d ~a)
a nil)
(clojure.core/fn [foo25] foo25)
Thank you.
Best Regards,
Yoshinori Kohyama
--
--
You received this message because you are subsc
Hello caffe and Yang Dong.
Here is my fold-right.
(defn fold-right [f s coll]
((reduce (fn [acc x] #(acc (f x %))) identity coll) s))
; (fold-right - 1 '(3 1 4))
; -> ((fn [y3]
; ((fn [y2]
; ((fn [y1] (identity (- 3 y1)))
;(- 1 y2)))
; (- 4 y3)))
; 1)
27;reduce1' and commented "Not lazy".
https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L865
The source of 'reduce1' says it uses 'chunk-seq?', '.reduce', 'chunk-first'
and 'chunk-next'.
What are these?
And i
Hi O. Masanori and all,
Thank you so much for your kindly explanation.
Sure that 'fold-right' itself is strict as you say.
But I think that various right-folded-type loops, which can be stopped
middle of a list, can be lazy.
The continuation, which should be calculated in the later steps, shoul
Hi all.
Sorry for mere my continued report.
Instead of reversing operands, I tried accumulating operators and reversing
and applying it when stopping.
https://gist.github.com/2896939
It doesn't consume stack. (but heap...)
Regards,
Yoshinori Kohyama
--
You received this message becaus
of partial functions is expensive as you say.
May it be that 'conj'ing an element at the last of a collection still takes
much cost than 'cons'ing
an element at the head of it and reversing?
I'll keep thinking and trying.
Regards,
Yoshinori Kohyama
--
You rec
Hi Meikel,
Thank you for pointing it out that 'comp' calls 'reverse' internally.
I've been calling 'reverse' twice.
Appreciate you so much.
I'll try 'comp'ing the accumulated functions manually without 'reverse'.
Regards,
Yosh
f the function
instead of sequencial tests of multiple versions of a function in one
runtime.
Or do sequencial tests of multiple versions of a function in the reverse
order.
Regards,
Yoshinori Kohyama
--
You received this message because you are subscribed to the Google
Groups "Clojure"
very faster.
Still need little bit of heap.
Regards,
Yoshinori Kohyama
--
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 pa
:*
https://gist.github.com/2896939
3) Related function *unfold*: https://gist.github.com/2901487
They no longer need a large heap.
Regards,
Yoshinori Kohyama
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email
returned
[[1 :a] [2 :b] [3 :c] {4 :d 5 :e} {1 :a 2 :b 3 :c 4 :d 5 :e}]
.
Or isn't it good that you can write operations for a map like
(loop [[[k v :as x] & xs] m acc '()]
(if x
(recur xs (cons acc (some-operation-for k v)))
acc))
?
Please let me hear opi
ing
'seq', 'first', 'next', 'loop' and 'recur' like 'nthnext' or 'my-nth' in
the first post.
https://github.com/clojure/clojure/blob/d0c380d9809fd242bec688c7134e900f0bbedcac/src/clj/clojure/core.clj#L2747
Note that the example above is done without a loop, I
f x
(recur xs (conj acc (assoc v :id k)))
acc))
[{:name "Alice", :id 0} {:name "Bob", :id 1} {:name "Charlie", :id 2}]
I'm sorry for all the fuss.
By the by, to get the same result as the example above, what to do is
(appl
duce #(if (< (count %2) (count %)) % %2) [])
))
https://gist.github.com/2928234
Regards,
Yoshinori Kohyama
--
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 p
he loader gotten with .getContextClassLoader is an instance
of clojure.lang.DynamicClassLoader,
the latter is an sun.misc.Launcher$AppClassLoader.
How can I get an clojure.lang.DynamicClassLoader?
Or am I wrong with something?
Please teach me any information about this.
Regards,
Yoshinori Kohyam
Hello programmers,
Hi, Sierra. Thank you replying.
O.K. I can not always contol the classloader of the whole JVM.
Then, how can I get the dynamic classloader for my current code/thread?
Or can't I?
Regards,
Yoshinori Kohyama
--
You received this message because you are subscribed t
eed two or more pairs of 2s, do
(defn has222 [coll] (< 1 (count (filter #(= % [2 2]) (partition 2 1
coll)
(has222 [1 2 3 4]) -> false
(has222 [1 2 2 4]) -> false
(has222 [1 2 2 2]) -> true
Regards,
Yoshinori Kohyama
--
You received this message because you are subscribed to the
Hi Sierra,
Thank you for your kind and quick answers to my questions.
I see.
I'll read the page you referred.
Regards,
Yoshinori Kohyama
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@g
/currentThread)))
Details reported below.
Regards,
Yoshinori Kohyama
$ cat project.clj
(defproject dce "0.0.1"
:description "Dynamic Compling And Execution"
:dependencies [[org.clojure/clojure "1.3.0"]]
:main dce.core)
$ cat src/dce/core.clj
(ns dc
I forgot to show foo/core.clj
$ cat samples/src/foo/core.clj
(ns foo.core)
(defn -main [& args]
(loop []
(println "Foo: " (apply str (interpose " " args)))
(Thread/sleep 1000)
(recur)))
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
Hi Nicolas,
The technique, using throw an Exception when succeeded in searching,
strikes me!
Not idiomatic but very practical.
It's like a break in a loop of imperatives.
I may use it somewhere.
Thank you.
Regards,
Yoshinori Kohyama
--
You received this message because you are subscrib
ing a throwable object is a good alternative for me.
Thank you again.
Regards,
Yoshinori Kohyama
--
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 mod
created for each procedure,
* which version of procedure is used and
* when an inline version of procedure is used, if the class file is loaded?
https://gist.github.com/4255602
Please teach me any information around these things.
Best regards,
Yoshinori Kohyama
--
You received this message because
Hi Vladimir and Alex,
Thank you for very useful informations.
With regards,
Yoshinori Kohyama
--
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 m
+1
2012年11月4日日曜日 7時27分24秒 UTC+9 CGAT:
>
> It would be nice if clojure.core/conj had a unary implementation
>
>([coll] coll)
>
> The motivating use case is when one is conjoining sequences of
> items to a collection all at once:
>
>(apply conj coll seqable)
>
> such as (apply conj #
Mr. @athos0220 gave me a great help via twitter.
https://twitter.com/athos0220/status/278439357126418432 (in Japanese)
http://ideone.com/8mBm5N
https://gist.github.com/4255602
Now I can write macros without class files.
Thank you.
With regards,
Yoshinori Kohyama
--
You received this message
52 matches
Mail list logo