Contrib for Clojure 1.3

2012-01-31 Thread kohyama
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

Re: Contrib for Clojure 1.3

2012-01-31 Thread kohyama
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

Re: Contrib for Clojure 1.3

2012-02-01 Thread kohyama
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

Re: Contrib for Clojure 1.3

2012-02-02 Thread kohyama
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

Re: alter a map in a vector (reference)

2013-06-11 Thread Yoshinori Kohyama
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

Re: Interleaving

2013-06-27 Thread Yoshinori Kohyama
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

Re: Sequential conditional transforms of an argument

2013-07-07 Thread Yoshinori Kohyama
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

Re: group-by replacement when an item has many groups?

2013-07-08 Thread Yoshinori Kohyama
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), *

Does this abstraction have any existing name?

2013-07-26 Thread Yoshinori Kohyama
{: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

Re: Does this abstraction have any existing name?

2013-07-26 Thread Yoshinori Kohyama
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?

Re: Does this abstraction have any existing name?

2013-07-26 Thread Yoshinori Kohyama
. 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,

Re: Does this abstraction have any existing name?

2013-07-26 Thread Yoshinori Kohyama
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

Re: Does this abstraction have any existing name?

2013-07-26 Thread Yoshinori Kohyama
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

Re: Does this abstraction have any existing name?

2013-07-26 Thread Yoshinori Kohyama
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

Re: Does this abstraction have any existing name?

2013-07-26 Thread Yoshinori Kohyama
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

Can I refer all but specified symbols with 'ns' macro?

2013-08-01 Thread Yoshinori Kohyama
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

Re: Can I refer all but specified symbols with 'ns' macro?

2013-08-01 Thread Yoshinori Kohyama
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

To read and write bytes via Socket

2013-08-28 Thread Yoshinori Kohyama
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

Re: To read and write bytes via Socket

2013-08-28 Thread Yoshinori Kohyama
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

Re: To read and write bytes via Socket

2013-08-28 Thread Yoshinori Kohyama
.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.

Re: Lazy Sequence Results in Stack Overflow

2015-09-27 Thread Yoshinori Kohyama
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

Re: A generalization of iterate

2015-09-28 Thread Yoshinori Kohyama
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

How to generalize these functions

2013-10-01 Thread Yoshinori Kohyama
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

Re: How to generalize these functions

2013-10-02 Thread Yoshinori Kohyama
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

To refer an auto-gensymed symbol in an internal unquoted expression?

2013-11-27 Thread Yoshinori Kohyama
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

Re: To refer an auto-gensymed symbol in an internal unquoted expression?

2013-11-27 Thread Yoshinori Kohyama
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

Re: To refer an auto-gensymed symbol in an internal unquoted expression?

2013-11-27 Thread Yoshinori Kohyama
~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

Re: Why isn't there a fold-right?

2012-06-08 Thread Yoshinori Kohyama
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)

Re: Why isn't there a fold-right?

2012-06-10 Thread Yoshinori Kohyama
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

Re: Why isn't there a fold-right?

2012-06-10 Thread Yoshinori Kohyama
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

Re: Why isn't there a fold-right?

2012-06-10 Thread Yoshinori Kohyama
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

Re: Why isn't there a fold-right?

2012-06-11 Thread Yoshinori Kohyama
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

Re: Why isn't there a fold-right?

2012-06-11 Thread Yoshinori Kohyama
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

Re: Why isn't there a fold-right?

2012-06-11 Thread Yoshinori Kohyama
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"

Re: Why isn't there a fold-right?

2012-06-11 Thread Yoshinori Kohyama
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

Re: Why isn't there a fold-right?

2012-06-11 Thread Yoshinori Kohyama
:* 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

How about 'nth' accepts maps?

2012-06-12 Thread Yoshinori Kohyama
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

Re: How about 'nth' accepts maps?

2012-06-12 Thread Yoshinori Kohyama
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

Re: How about 'nth' accepts maps?

2012-06-13 Thread Yoshinori Kohyama
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

Re: so why it has to be so complicated / Longest Increasing Sub-Seq

2012-06-13 Thread Yoshinori Kohyama
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

How to add an URL into the classpath?

2012-07-27 Thread Yoshinori Kohyama
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

Re: How to add an URL into the classpath?

2012-07-29 Thread Yoshinori Kohyama
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

Re:

2012-07-29 Thread Yoshinori Kohyama
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

Re: How to add an URL into the classpath?

2012-07-29 Thread Yoshinori Kohyama
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

Re: How to add an URL into the classpath?

2012-07-29 Thread Yoshinori Kohyama
/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

Re: How to add an URL into the classpath?

2012-07-29 Thread Yoshinori Kohyama
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.

Re:

2012-07-30 Thread Yoshinori Kohyama
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

Re:

2012-07-31 Thread Yoshinori Kohyama
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

How things are going about expansion, class creation and loading of procedures

2012-12-10 Thread Yoshinori Kohyama
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

Re: How to add an URL into the classpath?

2012-12-10 Thread Yoshinori Kohyama
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

Re: Proposal/request: Give clojure.core/conj a unary implementation

2012-12-10 Thread Yoshinori Kohyama
+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 #

Re: How things are going about expansion, class creation and loading of procedures

2012-12-11 Thread Yoshinori Kohyama
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