Re: Writing a text adventure in Clojure

2018-04-02 Thread Mikhail Gusarov
Hello Will. You can simplify it further: 1. Define a multimethod always dispatching by room id. 2. Create a :default implementation. It will be called for non- fancy rooms.3. Create an implementation for :fancy-room. It will be preferred over :default for it. If you ever have a group of ro

Re: [?] Adding my own function to clojure.core namespace

2018-02-25 Thread Mikhail Gusarov
Hello Philos, > For example , I wrote debux ( https://github.com/philoskim/debux )  > library. I want to use it only in development, not in production. If I > 'require' debux in source code to use it in development, I have to > remove it in the source code manually in production. Do you intend

Re: [?] Adding my own function to clojure.core namespace

2018-02-24 Thread Mikhail Gusarov
Hello Philos, It's no different to adding a function to any other namespace: % clj Clojure 1.9.0 user=> (ns clojure.core) nil clojure.core=> (defn foobar [x] (str "foobar " x)) #'clojure.core/foobar clojure.core=> (ns user) nil user=> (foobar "12") "foobar 12" user=> foobar #object[clojure.core$f

Re: If Clojure is to blame for the majority of the startup time, why doesn't ClojureScript proportionally slow down the JavaScript startup time also?

2018-01-25 Thread Mikhail Gusarov
cljs vars are not reified. On Thu, 25 Jan 2018, at 18:24, Didier wrote: > Based on the profiling performed here > http://clojure-goes-fast.com/blog/clojures-slow-start/ on 1.9, > > It looks like clojure/core__init.load is the slowest bit with load and > requiring spending the most time on, as w

Re: Understanding remove-ns and require

2017-12-22 Thread Mikhail Gusarov
On Fri, 22 Dec 2017, at 18:41, Stuart Sierra wrote: > Also be aware that AOT-compilation[1] causes all sorts of havoc with > namespace reloading, because AOT-compiled .class files get read by a > different ClassLoader.> Is there any place explaining how exactly Clojure compiles and loads the co

Re: Unexpected behaviour of transient map

2017-11-25 Thread Mikhail Gusarov
Hello. The reader of any particular docstring cannot be expected to magically know that there is another, better, piece of documentation. Regards, Mikhail On Sat, 25 Nov 2017, at 02:10, Timothy Baldridge wrote: > But this behavior is already documented in the official transients > overview at htt

Re: Doc strings for complex cases?

2017-11-09 Thread Mikhail Gusarov
Hello. > Should any breaking changes occur in Clojure core, Why should they? Regards, Mikhail. -- 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 modera

Re: Clojure.spec, maps, restrict valid keywords, easier way?

2017-02-02 Thread Mikhail Gusarov
Hello Alex, The idea is (as I understand it) that every function should accept any map and pick keys which it understands. If some keys are critical, then they should be marked as such in the spec. Function might iterate over keys and raise an error if there are keys which belong to the namespac