Hi,
If I were a programming teacher, I would have students re-realize what one
can achieve with programing in general at the start because people's action
always come from their inner motivation.
To enumerate concrete benefits and success story like TV shopping may be
effective.
Without motivation
Hi Ye,
> or at least *Do Not Use *those standard names*.*
The following guide suggests the opposite.
http://dev.clojure.org/display/community/Library+Coding+Standards
> Use good names, and don't be afraid to collide with names in other
namespaces. That's what the flexible namespace support is t
I think clojure.walk is suited to this purpose.
https://github.com/clojure/clojure/blob/master/src/clj/clojure/walk.clj
See keywordize-keys as an example.
On Saturday, July 27, 2013 2:31:21 AM UTC+9, Yoshinori Kohyama wrote:
>
> Thank you Gary.
> There's no reason why this need to be a macro.
> It
> I hate it mainly in blogs, where they explain some new API. They :use
like 3 namespaces and you have to guess which fn is from which ns :)
Agree.
Code is read much more often than it is written, so omitting a few
character is not effective time-saving.
I also don't like :refer :all.
I think it
Shen, Thank you for your announcement.
2013/5/6 Shen, Feng
> Hi,
>
> It's a bug fix release. *If using the WebSocket support, please upgrade.
> All older version has this bug.*
>
> The bug is "Large websocket requests get corrupted". Detail:
> https://github.com/http-kit/http-kit/issues/47. And
Thanks for amazing work!
I want to know how typical CRUD application is implemented.
Do you use single gigantic graph with lazy-compile or separated graph
for each operation?
How do you handle validation and error?
Will almost all x->y function disappear?
On Jan 30, 3:46 am, Aria Haghighi wrote:
Hi Bruce,
Try `into` instead of `concat`.
Applying concat to growing data is like "Schlemiel the Painter's
algorithm".
Cheers.
On 2月1日, 午後4:19, bruce li wrote:
> Hello, everyone. I'm experience some performance issue when using clojure.
> The scenario is as follows:
>
> I have a huge list of xls
As more and more projects are using edn format for config,
communication and etc, I think that default value of *read-eval*,
which is true, is source of vulnerability such as recently reported
ring issue [1].
And I don't understand why read-string depends on *read-eval* instead
of argument.
I belie
Paul, Raoul, David, Mimmo, JvJ,
Thanks for use cases. I have better understanding now.
Cheers,
- Takahiro
On Nov 14, 12:56 am, Paul deGrandis wrote:
> Here's one use case:
>
> Let's say you want to develop a library that monitors system behavior and
> resources while functions are executed (or w
> Metadata is a really useful feature, and it's been helping me a lot.
Could you show me concrete example?
I still don't understand the value of metadata and rarely use it
except type hint.
I saw active using metadata on some project(e.g. postal[1]), but I
think regular hashmap instead of metadata
> :require :as is always good and generally preferred over :refer or :use
:only.
I think we all agree with this, but in reality :use with/without :only is
very widely used in a number of real project I've seen on github.
:use (especially without :only) makes code reading painful and usually
read
Hi Gregorius,
I recommend for you to watch "Brian Will" channel on youtube.
http://www.youtube.com/user/briantwill/videos?flow=grid&view=1
There are several introduction of programming language: Clojure, Java,
Python, JavaScript, C etc..
After watching all part.1 of each introduction, then you m
Hi,
Ducttape.cljs is a ClojureScript micro MVC framework/library.
https://github.com/hozumi/ducttape.cljs
Here's a list of benefits:
* Clear structure
* Super thin
* No original event system
* Use functions and atoms as building blocks
* Don't force to use specific library
Check it ou
emcached, RabbitMQ, or cron, for example. And for
> others, I would recommend an app server.
>
> As always, it depends on the requirements of the application and the
> capabilities of the organization to support it.
>
> Thanks,
> Jim
>
>
>
>
>
>
>
> On Tu
Hi,
Forgive my ignorance, although I think the project must be useful, but
I still don't understand what is the benefit of using application
server.
What is the difference between using a particular library(e.g.
HornetQ) with JBoss AS7 and using the same one without JBoss AS7?
Cheers,
- Takahiro
owser-repl frequently because I refresh the
browser in a short time interval.
> - same problem with multimethods as JVM Clojure ?
Sorry, I don't understand what this means.
Anyway I don't recommend using multimethods in cljs because it is not
fast.
Cheers,
- Takahiro
On Sep 11, 4:
Hi,
I refresh browser every time I change cljs files.
> "Using the REPL as the main way to deliver code to the browser means
never having to refresh the page. One could theoretically build an entire
application without a single page refresh. If you find yourself refreshing
the page after every
one considered generally more readable? I think the following
> is clearer while still not having as much noise as the first filter example:
>
> (filter (partial not nil?) coll)
>
> On Sun, Aug 12, 2012 at 1:35 PM, Takahiro Hozumi
>
> > wrote:
>
>> Hi,
>>
Hi,
I would like to know common technics that make code succinct.
For example:
(or (:b {:a 1}) 0)
(:b {:a 1} 0)
(if-not x 1 2)
(if x 2 1)
(filter #(not (nil? %)) coll)
(filter identity coll) ;; nearly equal
Please let me know any tips you found.
Cheers,
Takahiro.
--
You received this message
Hi Aaron,
Thank you for the interesting post.
I guess we all here have quite similar experience as code size shrink.
> I found myself digging around in github repos to actual read code instead
of documentation a lot more than I ever did with Python.
Agreed. In fact, for emacs/swank-clojure users
> Instead of calling the ExceptionInfo ctor & .getData directly,
it's better to use ex-info & ex-data instead.
Baishampayan
Thank you for the information. I agree with you.
On Friday, July 27, 2012 6:39:29 PM UTC+9, Baishampayan Ghose wrote:
>
> On Thu, Jul 26, 2012 at 10:
If you build simple json API, combining validation function which return
validation error as a map and clojure.lang.ExceptionInfo can
reduce intermediate error handling code.
(when-let [m (validate params)]
(throw (clojure.lang.ExceptionInfo. "validation error" m)))
(defn wrap-validation-ex
Baishampayan
I didn't know `map->Foo`. Thank you for the infomation!
On Monday, July 23, 2012 2:11:45 PM UTC+9, Baishampayan Ghose wrote:
>
> On Mon, Jul 23, 2012 at 10:37 AM, Takahiro Hozumi
> wrote:
> > 2. The construction of record depends on an order of arguments.
I think defrecord has 5 downsides compared to regular map.
1. The literal of regular map is eye-friendly and portable.
However I still don't know how helpful instant literals added in clojure
1.4 is for records.
2. The construction of record depends on an order of arguments.
Sometimes, I feel th
Hi,
I found that assoc can be slow in ClojureScript.
This is my app profile.
http://twitpic.com/8kbupv/full
I think the cause is that entire clone happen when assoc is called.
https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L2284
Is this design choice intended for som
Hi,
I want to make a sequence from string as follows.
input: "hello >>1 world >>2"
output: ("hello " [">>1"] " world " [">>2"])
What is efficient way to achieve this in ClojureScript?
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post t
If you need scalability, two phase connect might be necessary.
1. Resolve a server name which client should be connected to.
If a client need to be connected to specific resource (chat room etc)
consistent hashing is useful.
http://nakkaya.com/2010/05/05/consistent-hashing-with-clojure/
2. Connect.
Thank you for your response.
The reasons why I didn't use protocols are following.
1.
Currently ClojureScript doesn't have `extend`, which makes inheritance
easy.
http://david-mcneil.com/post/1475458103/implementation-inheritance-in-clojure
2.
I think an entity which is created by deftype or defr
I've experienced rewriting my ClojureScript code into multimethods
base.
I'd share my results.
Initially I implemented polymorphism behavior as simple hashmap like
this:
(def parent
{:foo (fn [x] ...)
:bar (fn [x] ...)})
(def child
(merge parent {:foo (fn [x] ...)}))
For some reason
Hi,
I found that ::keyword doesn't have correct namespace in
ClojureScript.
If this is not only my environemnt problem, I will create an issue.
(.log js/console ::mykeyword)
Evaluate this in file, not repl.
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Cl
Hi,
In my browser repl, which follows the ClojureScript wiki[1], I must
specify variables with namespace even if `in-ns` is used, but I
noticed that I don't have to do in the repl of ClojureScript One[2].
Am I the only one who cannot access variables without namespace?
What makes the diffirence?
Hi,
I want to set a default behavior on a protocol.
The following article describes how to implement inheritance in
Clojure by using `extend`, but `extend` doesn't exist in
ClojureScript.
Is there a way to set a default behavior on a protocol in
ClojureScript?
(david-mcneil.com :blog), Implementat
I've created an issue about this.
http://dev.clojure.org/jira/browse/CLJS-120
Thanks.
On Jan 10, 5:31 am, Stuart Sierra wrote:
> I would like to have NodeList be seqable. Please file a ticket with a
> patch. Perhaps someone else can shed light on why Opera doesn't work.
> -S
--
You received th
Hi,
Following code cause an error, because NodeList doesn't extend
ISeqable.
(doseq [u (goog.dom/getElementsByClass "myclass")]
...)
Uncaught Error: No protocol method ISeqable.-seq defined for type
object: [object NodeList]
So I implemented ISeqable for NodeList.
(extend-type js/NodeList
> ($ (css ))> > could wire an atom to a css (or
> other) dom attribute, by placing a> watcher on the atom and automatically
> updating the dom on change.Interesting idea!
On 1月7日, 午前5:02, kovas boguta wrote:
> Great, looking forward to see what Chris has come up with. I'm not
> enough of a JS
In MVC pattern, Model should take responsibility for business logic.
Therefore I write validate function for creating in the model.
If creating a instance of the model should be safe, I must validate a
parameter in the create function.
My problem is that a controller have to validate a parameter tw
Hi,
In order to manipulate dom, I often want to bind elements into
variable through def, but we cannot manipulate it until load event.
So I wrapped all def into a load event handler in the following way.
https://gist.github.com/1521051
I don't use let, because many elements cause deep nested let,
a
Hi,
I'd like to use core.match with java.util.HashMap without converting
into {}.
The core.match doesn't support it as below.
(let [m (java.util.HashMap. {"a" 1})]
(match m
{"a" 1} true))
;=> nil
Is it difficult?
Thanks.
--
You received this message because you are subscribe
Hi,
To avoid peeking same element of a queue, I think PersistentQueue must
be stored in ref not atom.
Is this correct?
;;Ref: safe
(dosync
(let [item (peek @r)]
(alter r pop)
item))
;Atom: unsafe
(let [item (peek @a)]
(swap! a pop)
item))
Thanks.
--
You received this message bec
C in S-expression approach might be helpful, if you just want to write
C in Clojure syntax.
The advantage of this pure translator approach is you can fully
recognize what you do.
Such implementation already exist in Scheme.
http://practical-scheme.net/gauche/man/gauche-refe_76.html
I think transla
Hi,
I'm interested in useful utility which you create.
Please show me your favorite utility.
For example, _-> is that for me.
_-> is like ->, but it can insert expression in arbitrary place by
marking underscore.
(_-> :a (assoc {} _ 1))
;=> {:a 1}
Therefore It can unify -> and ->> behavior.
https:
o
> determine whether the sequence is empty you would have to call seq on
> it.
>
> On Mar 23, 6:23 pm, Takahiro Hozumi wrote:
>
>
>
>
>
>
>
> > Hi,
> > I think destructure should not produce nthnext, because it realize an
> > element of sequence mor
Hi,
I think destructure should not produce nthnext, because it realize an
element of sequence more than needed.
For example:
(defn inc-seq [i]
(iterate #(let [x (inc %)] (println "realize:" x) x) i))
;=> #'user/inc-seq
(take 1 (inc-seq 0))
;=> (0)
(take 1 (let [[x & xs] (inc-seq 0)] (cons x xs
Hi,
Please bump up my JIRA membership level to make edits and I will fix
this bug.
I have an account named Takahiro Hozumi on dev.clojure.org already.
CA is also already sent.
Thanks.
On 3月11日, 午後10:55, Stuart Sierra wrote:
> > (require '[clojure.string :as str])
> > (str/repla
Hi,
I have two questions about clojure.string/replace-first.
1.
Is this expected behavior of replace-first?
(require '[clojure.string :as str])
(str/replace-first "abc def" #"ghi" (fn [a] (str a a)))
=> nil
I don't think so, because string / string argument version returns
original string when m
I had same problem.
Add following line in your project.cjj.
:warn-on-reflection true
On Feb 26, 9:11 am, Seth wrote:
> Has any gotten the warn-on-reflection to work in slime when compiling
> a buffer? Warning occur when i paste a function into the repl, but no
> reflections occur when i compile
Hi,
Thank you for the introduction. Here is my little feed back:
1. I want to see a example using callbacks.
2. Is RequestBuilderWrapper.java necessary? Why not simply use
RequestBuilder?
3. I prefer reify or defrecord to proxy for performance reason, when
implement interface.
4. I think hash-map i
ter *counts*
(fn [m]
(let [n (m key)]
(if (< 1 n)
(assoc m key (dec n))
(dissoc m key)))
I think former style is normal, but latter is easy to replace ref with
atom.
Thanks.
--
Takahiro Hozumi
--
You received this message becau
Hi All,
I've released conversion tool for hiccup.
http://github.com/hozumi/hiccup-bridge
Hiccup-bridge is aims for collaboration between programmers and
designers.
You can easily use this through leiningen.
% lein hicv 2html
% lein hicv 2hic
I welcome any comments or suggestions.
T
Hi Nicolas,
That is a nice idea! Thanks.
--
Takahiro Hozumi
--
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
If you use emacs, incremental back search is handy.
Typing "C-r defn", you may jump to the defnition of a function.
Next time, you need to type only "C-r C-r".
-- Takahiro Hozumi
On 9月19日, 午前6:39, Sean Corfield wrote:
> OK, this feels like a really dumb question...
>
&
in O(thread^2) means that refs should not
be used to store the data that is aletered by too many threads like
big ant colony map or newral network nodes.
If modifying the data by too many threads is planned, instead of refs,
are agents best way to store it?
Any other solution?
Thanks.
Takahiro H
g the
> elements out in the right order. Mathematical vectors are orderful things
> and should be represented in an orderful data structure. Clojure vectors are
> ordered. Hashmaps are unordered.
>
> That's the conclusion I have come to, at any rate.
>
> Garth
>
Hi,all
Although there is no right answer, vector seem to be preferred in many
cases.
Which do you prefer map or vector?
Thanks!
--
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 pos
a function. clojure is not scheme.
> clojure's def (which defn uses) is not lexical or scoped in anyway, it
> always operates on global names. if you want lexical scope please use
> one of clojure's lexical scoping constructs, let or letfn.
>
>
>
>
>
> On Wed, F
Hi all.
Is it not recommended to use defn within defn?
Normal function is faster than the function which has inner function
which actually doesn't run.
--
(defn aaa1 []
(defn bbb [] 1)
1)
(defn aaa2 [] 1)
user> (time
56 matches
Mail list logo