Natural Language Datalog

2017-12-23 Thread Dennis Heihoff
Alex Warth from HARC (Human Advancement Research Center) wrote a natural language datalog engine. It's is used to represent facts and queries in Bret Victor's https://dynamicland.org/ Could it work with Datomic? Demo: http://alexwarth.com/projects/nl-datalog/ Repo:

Re: [ANN] faster-multimethods

2017-10-12 Thread dennis zhuang
why not merge it to clojure.core multimethods? I think it's a valuable work, you can create a patch to make clojure better. See https://clojure.org/community/contributing 2017-10-13 8:13 GMT+08:00 John Alan McDonald : > Beta release (0.1.0) of faster-multimethods,

Re: The performance of plain map vs. defrecord

2017-10-09 Thread dennis zhuang
In fact they are symbols, but print as keywords: user=> (symbol ":a") :a user=> (symbol? (symbol (str :a))) true 2017-10-09 16:26 GMT+08:00 Peter Hull : > Slightly off-topic, but why doesn't using the 'incorrect' alphabet-macro > give an error? If I try and define a

Re: The performance of plain map vs. defrecord

2017-10-08 Thread dennis zhuang
First, the alphabet-macro is wrong, it should use name instead of str in comp: user=> (macroexpand-1 '(alphabet-macro)) (do (clojure.core/defrecord Alphabet [:a :b :c :d :e :f :g :h :i :j :k :l :m :n :o :p :q :r :s :t :u :w :v :x :y :z]) (def dummy-record (Alphabet. 0 1 2 3 4 5 6 7 8 9 10 11 12

Re: Starting Clojure again

2017-09-06 Thread dennis zhuang
1.Maybe you can use :pre metadata: (defn create-pin ([] (create-pin 8)) ([n] {:pre [(<= n 16) (>= n 4)]} (let [chars (map char (range (int \0) (inc (int \9] (reduce str (repeatedly n #(rand-nth chars)) (create-pin 3) AssertionError Assert failed: (>= n 4)

Re: Clojure rookie vs parsing

2017-08-15 Thread dennis zhuang
In my experience, instaparse + defun is a good choice. https://github.com/Engelberg/instaparse https://github.com/killme2008/defun/ 2017-08-15 22:02 GMT+08:00 Gary Trakhman : > I enjoyed working with clj-antlr recently, it's a wrapper over a java > library, but gives

Re: Java object in eval

2017-03-30 Thread dennis zhuang
You should quote the binding vector: (let [v '[D (LocalDate/of 2017 03 30)] f '(.getYear D)] (eval `(let ~v ~f))) 2017-03-30 16:04 GMT+08:00 'Burt' via Clojure : > Hi, > > I want to pass Java objects to a piece of code via let and then get it > evaluated with

Re: New to Clojure

2017-01-09 Thread Dennis Roberts
SLs for generating SQL statements. I've tried http://sqlkorma.com/ and https://github.com/jkk/honeysql, and I've had fairly good luck with both of them. Dennis On Monday, January 9, 2017 at 4:06:30 PM UTC-7, (hash-map :new "to clojure" :need "assistance") wrote: > > Hi al

Re: {ANN}} Carmine-sentinel: connect redis by sentinel, make carmine to support sentinel.

2016-10-17 Thread dennis zhuang
lave? true}) (defmacro wcars* [& body] `(cs/wcar slave-conn ~@body)) (wcars* (car/set "key" 1)) ;; ExceptionInfo READONLY You can't write against a read only slave More info please visit https://github.com/killme2008/carmine-sentinel 2016-10-13 19:43 GMT+08:00 dennis zhuang <killme2...@g

{ANN}} Carmine-sentinel: connect redis by sentinel, make carmine to support sentinel.

2016-10-13 Thread dennis zhuang
Hi, all I wrote a library to make carmine support redis sentinel : https://github.com/killme2008/carmine-sentinel Someone may want to try it if you are interested. It's a beta release, feedback is welcome. -- 庄晓丹 Email:

Re: apply madness

2016-05-12 Thread dennis zhuang
A try: (let [raw (list :a 1 :b 2 :c 3)] (->> raw (partition 2) (filter #(even? (second %))) (map vec) (into {}) (merge {:raw raw}))) => {:b 2, :raw (:a 1 :b 2 :c 3)} 2016-05-12 15:46 GMT+08:00 hiskennyness : > This does what I want

Re: which GC optimizations work better with Clojure?

2016-04-29 Thread dennis zhuang
It depends. CMS or G1 would be better in common cases as you said, clojure runtime has many short-lived objects. We are using G1 in your production. But sometimes you would prefer system throughput rather than GC pause time, you may try Parallel GC. 2016-04-29 19:02 GMT+08:00 Camilo Roca

Re: Why do map/get and similar return nil if not found?

2016-01-12 Thread Dennis Haupt
i agree with the fast fail camp if a value is nil but is not supposed to be, i want the program to immediately tell me about that instead of telling me later and force me to trace it back. in scala, this is solved by providing 2 methods. one that gives you a result or crashes, one that maybe

Re: Largest Clojure codebases?

2015-11-15 Thread dennis zhuang
I use cloc(http://cloc.sourceforge.net/) to counting the LOC of our projects, it's total about 41025 lines of Clojure code. 2015-11-16 7:22 GMT+08:00 Colin Yates : > Exactly this. I couldn’t find a reliable way of counting LOC but my > (Clojure/ClojureSciprt) src

Re: Locking non-local variable inside macro

2015-11-15 Thread dennis zhuang
I think the reason is in macroexpand-1 result: user=> (macroexpand-1 '(mac1 1)) (clojure.core/locking # 1) It's not a valid form to be read and eval by clojure reader,the object form can't be parsed. If define obj to be a map {}, it works fine: user=> (def obj {}) #'user/obj user=> (mac1 1) 1

Re: how to speedup lein uberjar?

2015-10-27 Thread dennis zhuang
Recommend to use libdir plugin: https://github.com/djpowell/lein-libdir Run lein libdir to copy all the dependencies to lib directory, and just run lein jar to package the project. Then you can rsync or copy the project jar with all dependent jars instead of compiling all dependent namespaces

{{ANN}} defun 0.3.0-alapha: supports clojurescript

2015-10-24 Thread dennis zhuang
defun is a macro to define clojure functions with parameter pattern matching just like erlang or elixir based on core.match. https://github.com/killme2008/defun Thanks to sander dijkhuis , it supports clojurescript right now. You

Re: Calling object members with symbols

2015-10-18 Thread dennis zhuang
In such case you have to use `eval`, another post https://groups.google.com/forum/#!topic/clojure/YJNRnGXLr2I 2015-10-19 9:10 GMT+08:00 James Reeves : > On 18 October 2015 at 23:54, Timur wrote: > >> Hi all, >> >> Is there anyway to call an object

Re: Calling object members with symbols

2015-10-18 Thread dennis zhuang
You may have to use macro: user=> (defmacro invoke [obj sym] `(. ~obj ~sym)) #'user/invoke user=> (invoke 1 toString) "1" 2015-10-19 6:54 GMT+08:00 Timur : > Hi all, > > Is there anyway to call an object member using its symbol? > > For instance we have an object o, we get

Re: Bug in DynamicClassLoader?

2015-09-16 Thread dennis zhuang
I don't think it's a bug. Indeed, the class loader will invoke loadClass, and the loadClass method will checking the parent class loader for the requested class, if it is not found,then invoke findClass of current class loader implementation to find the requested class as describe in loadClass

Re: Just found out about Elixirs function argument pattern matching...

2015-09-07 Thread dennis zhuang
Thanks for your benchmark. I will upgrade all the dependencies and release 0.2.0 We are using defun with instparse in a DSL implementation, the performance is acceptable, but the code is much more readable. 2015-09-06 4:33 GMT+08:00 Rob Lally : > Out of interest, I ran

Re: numbers, why?

2015-09-04 Thread dennis zhuang
Because the literal is readed as BigInt: user=> (class 6546546546546546546850348954895480584039545804 ) clojure.lang.BigInt 2015-09-04 22:48 GMT+08:00 Ali M : > why? > > > user=> (+ 6546546546546546546850348954895480584039545804 >

{{ANN}} clj-rate-limiter: rate limiter for clojure backed by memory or redis.

2015-08-17 Thread dennis zhuang
clj-rate-limiter is a rate limiter for clojure,that supports a rolling window, either in-memory or backed by redis. https://github.com/killme2008/clj-rate-limiter Hope it can help someone. -- 庄晓丹 Email:killme2...@gmail.com xzhu...@avos.com Site: http://fnil.net Twitter:

Re: [ANN] sniper, emacs assistant for deleting dead code

2015-07-29 Thread dennis zhuang
Cool work. But missing installation or user guide in readme.md? I don't know how to use it in my project. I want to try it. 2015-07-30 13:26 GMT+08:00 benedek fazekas benedek.faze...@gmail.com: hi, I wonder if you tried clj-refactor which has find usages listing all the usages of your

{ANN} clj-archaius releases: wrapper for netflix archaius

2015-07-02 Thread dennis zhuang
Hi,all I create a new project https://github.com/leancloud/clj-archaius that wraps netflix https://github.com/Netflix/archaius archaius https://github.com/Netflix/archaius library for configuration management. It's really simple to use in your project,i hope it can help someone that is using

Re: Prevayler in Clojure

2015-06-09 Thread Dennis van den Berg
Nice job, so much in a few lines of code. Thanks, Dennis Op zaterdag 30 mei 2015 22:58:23 UTC+2 schreef Klaus Wuestefeld: Prevalence is the fastest possible and third simplest ACID persistence technique, combining the two simplest ones. https://github.com/klauswuestefeld/prevayler-clj

Re: PersistentTreeMap, seqFrom, subseq and range queries

2015-06-09 Thread Dennis van den Berg
I think the subset and submap would be a nice addition! Op maandag 15 februari 2010 16:23:22 UTC+1 schreef Rich Hickey: On Mon, Feb 15, 2010 at 8:45 AM, George . cloju...@gmail.com javascript: wrote: Currently, if you want to perform a range query on a sorted-seq (AKA PersistentTreeMap),

Re: DSL in RTL (Right to Left) languages.

2015-01-14 Thread Dennis Haupt
i encountered a german progamming language once. it was terrible. everybody should stick to english when it comes ot programming - you have to do it anyway, and there is no reason not to go ahead and learn a language since that is what brains are built for 2015-01-14 17:11 GMT+01:00 Jesse Alama

Re: Considering dropping Eclipse 3.x support for counterclockwise

2014-12-04 Thread Dennis Haupt
yuno 2014-12-04 11:45 GMT+01:00 Laurent PETIT laurent.pe...@gmail.com: The following Eclipse names are 3.x based : Indigo, Helios, Galileo The following are 4.x based : Juno, Kepler, Luna 2014-12-04 11:17 GMT+01:00 Laurent PETIT laurent.pe...@gmail.com: Hello, Eclipse 4.x has been

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-26 Thread dennis zhuang
I will add supporting for clojurescript this weekend.Thanks for your suggestion. 2014-09-26 1:09 GMT+08:00 Ivan L ivan.laza...@gmail.com: Is this clojurescript ready? This looks amazing, I would also love to have it in core. On Sunday, September 14, 2014 2:47:28 AM UTC-4, dennis wrote

Re: How do I track down a painfully long pause in a small web app?

2014-09-24 Thread dennis zhuang
You can use jstat -gcutil pid 2000 to print the GC statistics every 2 seconds, http://docs.oracle.com/javase/1.5.0/docs/tooldocs/share/jstat.html It the long pause is from GC, the columns FGCT/FGC values would be large. If you think it's a swap issue, you may want to use vmstat 1 1

Re: [ANN] Monroe 0.1.0 - nrepl client for Emacs

2014-09-24 Thread dennis zhuang
Looks great.But it doesn't support code completion? 2014-09-25 0:50 GMT+08:00 Sanel Zukan san...@gmail.com: Hi everyone, Here https://github.com/sanel/monroe is initial release for Monroe, a new Clojure nREPL client for Emacs. The main idea behind Monroe is to be simple, easy to install

Re: keywords

2014-09-15 Thread dennis zhuang
Clojure's keyword is using a soft reference cache, they would be garbage collected when used memory reaches threshold. 2014-09-15 18:36 GMT+08:00 Paweł Sabat noni...@gmail.com: Hi. How many :keywords can I create in Clojure? Is there any limited number of them? I know of such limitation of

{ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
Hi , i am pleased to introduce defun https://github.com/killme2008/defun: a beautiful macro to define clojure functions with pattern match. Some examples: (defun say-hi ([:dennis] Hi,good morning, dennis.) ([:catty] Hi, catty, what time is it?) ([:green] Hi,green, what a good day

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
Released 0.1.0-RC, defun collect :arglists metadata, another recursive function example: (defun accum ([0 ret] ret) ([n ret] (recur (dec n) (+ n ret))) ([n] (recur n 0))) (accum 100) ;; the result is 5050 2014-09-14 14:46 GMT+08:00 dennis zhuang killme2...@gmail.com

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
) [[n ret]] (do (recur (vector (dec n) (+ n ret [[n]] (do (recur (vector n 0) The core procedure is at https://github.com/killme2008/defun/blob/master/src/defun.clj#L97-107 2014-09-15 0:15 GMT+08:00 Herwig Hochleitner hhochleit...@gmail.com: Hi Dennis, marrying core.match

Re: {ANN} defun: A beautiful macro to define clojure functions with pattern match.

2014-09-14 Thread dennis zhuang
dennis zhuang killme2...@gmail.com: Hi Herwig Actually,defun just define a variadic arguments function,so it doesn't have different arities. And when using defun macro ,it walk through the body forms, find 'recur' forms and replace them with (recur (vector ...arguments)) instead

Re: [ANN] Clojure 1.7.0-alpha2

2014-09-11 Thread dennis zhuang
May be the LongAdder in Java8 can beat AtomicLong :D http://blog.palominolabs.com/2014/02/10/java-8-performance-improvements-longadder-vs-atomiclong/ 2014-09-11 17:30 GMT+08:00 Linus Ericsson oscarlinuserics...@gmail.com: The volatile construct seems very useful in some particular cases! I

Re: Clojure production environment

2014-08-20 Thread dennis zhuang
jetty + lein jar + lein libdir,and used fabric to deploy applications.Uses nginx as load balancer. 2014-08-20 16:55 GMT+08:00 Max Penet m...@qbits.cc: For web stuff we use jetty (9) apps as uberjar, behind nginx, deployed and CC via ansible, hosted on DigitalOcean as well. Ansible is super

Re: Supplied-p parameter in clojure similar to lisp lambda lists

2014-08-18 Thread dennis zhuang
I created a ticket http://dev.clojure.org/jira/browse/CLJ-1508 2014-08-18 11:02 GMT+08:00 dennis zhuang killme2...@gmail.com: I think that adding a :p option to destructuring would be great: (let [ {:keys [a b c] :p {a a-p}} params] (if a-p (println a) (println

Re: Supplied-p parameter in clojure similar to lisp lambda lists

2014-08-18 Thread dennis zhuang
feature is necessary, since all you need to do to emulate it is a (:baz all-keys) to know if the user explicitly specified it. I.e. I think the capability is already present in adequate form but the documentation on map destructuring could be improved. On Sun, Aug 17, 2014 at 11:02 PM, dennis

Re: Supplied-p parameter in clojure similar to lisp lambda lists

2014-08-17 Thread dennis zhuang
I think that adding a :p option to destructuring would be great: (let [ {:keys [a b c] :p {a a-p}} params] (if a-p (println a) (println a is not exists.))) 2014-08-17 20:05 GMT+08:00 Dave Tenny dave.te...@gmail.com: Well, it took me a while to perhaps get what you were

CtorReader bug?

2014-08-16 Thread dennis zhuang
user= #java.lang.String[hello world] hello world user= #java.lang.String[(byte-array) utf8] IllegalArgumentException No matching ctor found for class java.lang.String clojure.lang.Reflector.invokeConstructor (Reflector.java:183) It seems that the CtorReader

Re: CtorReader bug?

2014-08-16 Thread dennis zhuang
Sorry,the error example must be: user= #java.lang.String[(byte-array 10) utf8] IllegalArgumentException No matching ctor found for class java.lang.String clojure.lang.Reflector.invokeConstructor (Reflector.java:183) 2014-08-16 19:59 GMT+08:00 dennis zhuang killme2...@gmail.com: user

Re: CtorReader bug?

2014-08-16 Thread dennis zhuang
Got it. Thanks for your quick reply. 2014-08-16 20:14 GMT+08:00 Nicola Mometto brobro...@gmail.com: It's by design, see the section on ctor literals http://clojure.org/reader#toc1 The elements in the vector part are passed unevaluated to the relevant constructor. Nicola dennis zhuang

{ANN} clj.qrgen and securen-rand : generate QRCode and secure random in clojure

2014-06-22 Thread dennis zhuang
*clj.qrgen*: https://github.com/killme2008/clj.qrgen Generate QRCode in clojure: (as-file (from hello world)) *secure-rand*: https://github.com/killme2008/secure-rand Secure version for clojure.core/rand etc. (ns test (:refer-clojure :exclude [rand rand-int rand-nth]) (:use

Re: Effective Clojure book?

2014-06-04 Thread dennis zhuang
《The joy of clojure》 ? 2014-06-05 9:30 GMT+08:00 Mike Fikes mikefi...@me.com: Are there any books yet that prescribe best practices for Clojure, à la Meyers or Bloch? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

{{ANN} clj-xmemcached release 0.2.4

2014-04-27 Thread dennis zhuang
An opensource memcached client for clojure,it wraps xmemcached. 0.2.4 releases, main highlights: - Upgrade xmemcached to 2.0.0https://github.com/killme2008/xmemcached/releases/tag/xmemcached-2.0.0, 10% performance improved for text protocol and fixed some issues. - Added

Re: [ANN] core.rrb-vector 0.0.11 -- Clojure 1.6 compatibility and bug fixes

2014-03-30 Thread dennis zhuang
I can't find any performance benchmark in the home page.Any links?Thanks. 2014-03-31 2:01 GMT+08:00 Michał Marczyk michal.marc...@gmail.com: Hi, I am pleased to announce the 0.0.11 release of core.rrb-vector, a Clojure Contrib library extending the Clojure vector API with logarithmic-time

Re: shenandoah

2014-03-13 Thread Dennis Haupt
i also did an asteroid game in clojure. i don't think you can ever achieve the performance of hackedyhack-mutablility with pure functional algorithms - my approach to get the best performance while staying as clean as possible would be to keep two copies of the game world, using one as source data

Re: Do I have to have knowlegde about Lisp

2014-03-10 Thread Dennis Haupt
you can learn clojure without learning lisp first :) 2014-03-10 15:41 GMT+01:00 Roelof Wobben rwob...@hotmail.com: Hello, I like the idea of Clojure but I wonder if I have to know a lot of Lisp to work with Clojure. What is the best way to go from a absolute beginner to someone who can

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
The String a=i+another word; is also compiled into using StringBuilder, see the byte code by javap -v: Code: stack=5, locals=5, args_size=1 0: invokestatic #2 // Method java/lang/System.nanoTime:()J 3: lstore_1 4: iconst_0 5:

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
I forgot to note hat i test the java sample and clojure sample code with the same jvm options '-server'. 2014-03-01 20:03 GMT+08:00 dennis zhuang killme2...@gmail.com: The String a=i+another word; is also compiled into using StringBuilder, see the byte code by javap -v: Code

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
20:07 GMT+08:00 dennis zhuang killme2...@gmail.com: I forgot to note hat i test the java sample and clojure sample code with the same jvm options '-server'. 2014-03-01 20:03 GMT+08:00 dennis zhuang killme2...@gmail.com: The String a=i+another word; is also compiled into using

Re: Clojure performance question

2014-03-01 Thread dennis zhuang
) instruments. 2014-03-01 21:00 GMT+08:00 Jozef Wagner jozef.wag...@gmail.com: Clojure math functions compile down to the same JVM 'instruction' as from java. See http://galdolber.tumblr.com/post/77153377251/clojure-intrinsics On Sat, Mar 1, 2014 at 1:23 PM, dennis zhuang killme2

Re: JRE/JVM for development

2014-01-29 Thread Dennis Haupt
my vm starts up within a second or so, what's the problem for you? 2014-01-29 ton...@gmail.com Are there any Java VMs strictly for development use that could be started up quicker, use less memory or compile clojure during execution? Alternatively can OpenJDK or similar be configured to do

Re: equality

2014-01-27 Thread Dennis Haupt
one does not simply compare floating point numbers for equality 2014-01-27 Eric Le Goff eleg...@gmail.com Newbie question : user= (= 42 42) true user= (= 42 42.0) false I did not expect last result. I understand that underlying classes are not the same i.e user= (class 42)

Re: JAVA_OPTS not accessible in my Clojure project

2014-01-12 Thread dennis zhuang
Tried System/getenv ? 2014/1/12 aidy lewis aidy.le...@gmail.com Hi Phil, M-x cider-jack-in, but the JAVA_OPT properties are also nil if I do a lein run. Thanks Aidy On 12 January 2014 05:25, Matching Socks phill.w...@gmail.com wrote: How did you start the Emacs Cider REPL? --

Re: How to indent clojure code in Emacs

2014-01-03 Thread dennis zhuang
use the 'indent-region' function.You can define a function to indent the whole buffer: (defun indent-buffer () Indent whole buffer (interactive) (indent-region (point-min) (point-max)) (message format successfully)) Then bind the function to a key, i bound it to F7 for me:

Re: Read Microsoft Word .doc files in Clojure

2014-01-02 Thread Dennis Haupt
use apache poi and write a small wrapper or something this is what i did 2014/1/2 Joshua Mendoza joshua.m...@gmail.com Hi!, I've been looking for libraries or resources to read MS .doc files in Clojure, but found none. Does anyone have tried, used, encountered or witnessed such a thing to

some clojure experience

2013-12-31 Thread Dennis Haupt
i solved a few little thingy with clojure now, including some euler problems, java interop and an asteroids clone. my summary would be: * very nice to write +1. i used clojure's collections for a lot of things, and they made a good impression * you need to plan far ahead compared to java. in

Re: Is Clojure right for me?

2013-12-26 Thread Dennis Haupt
exactly which part of OOP is missing in clojure that you would like to use? if you took my java code and ported it to clojure, the main difference would be (a b) instead of b.a , but the main design would be similar 2013/12/26 Massimiliano Tomassoli kiuhn...@gmail.com On Thursday, December 26,

Re: How to go about 'proving' why dynamically typed languages are better.

2013-12-20 Thread Dennis Haupt
in my mental world, there is a pure human, and a 4 armed human would probably be a 95% human or something, just like a hobbit would be. the other way round, a human would be a 95% hobbit. an elephant would be 4% hobbit on that scale. this model is flexible, covers everything, and is not really

Re: get fn and not-found

2013-10-27 Thread dennis zhuang
The function's arguments will be evaluated before calling it. So the (my-foo) will be called before 'get'. 2013/10/28 Ryan arekand...@gmail.com Hello, I am trying to understanding why is this happening: (defn my-foo [] (println Why do I get printed?)) #'sandbox4724/my-foo (get {:b 1}

Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-09 Thread Dennis Haupt
let's see... really used: sql java javascript basic pascal/delphi scala experimented with: logo (some old language intended to teach people to make their first steps) haskell kotlin clojure seen in action: php groovy still prefer smart static typing :D 2013/10/9 Nando Breiter

Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-09 Thread Dennis Haupt
especially haskell scala are missing in your list :) as long as you haven't at least seen haskell, you haven't seen the creme de la creme of statically typed languages 2013/10/9 Softaddicts lprefonta...@softaddicts.ca Let's see: strong data typing: Fortran Cobol Pl/1 Pascal C/C++

Re: How to go about 'proving' why dynamically typed languages are better.

2013-10-08 Thread Dennis Haupt
while i can see the strengths of both sides, the ideal solution is imho this: everything is statically typed. always. but you *never* have to write the type explicitly. you *can* do it, but it is always optional. i made good experiences with both scala and haskell (although i just wrote minor

Re: too circular?

2013-08-29 Thread Dennis Haupt
thx again 2013/8/30 Bruno Kim Medeiros Cesar brunokim...@gmail.com This exact use case is covered by letfn, which creates a named fn accessible to all function definitions and the body. That even allows mutual recursive definitions without declare. Your example would be (defn fib-n [n]

Re: too circular?

2013-08-27 Thread Dennis Haupt
thx 2013/8/26 Marshall Bockrath-Vandegrift llas...@gmail.com Dennis Haupt d.haup...@gmail.com writes: (defn fib-n [n] (let [fib (fn [a b] (cons a (lazy-seq (fib b (+ b a)] (take n (fib 1 1 can't i do a recursion here? how can i achieve this without doing an outer defn

Re: profiler?

2013-08-27 Thread Dennis Haupt
yep, yourkit 2013/8/27 Jay Fields j...@jayfields.com What are you all using these days? I've been using YourKit and I'm fairly happy with it. Just making sure I'm not missing out on some new hotness. Cheers, Jay -- -- You received this message because you are subscribed to the Google

too circular?

2013-08-26 Thread Dennis Haupt
(defn fib-n [n] (let [fib (fn [a b] (cons a (lazy-seq (fib b (+ b a)] (take n (fib 1 1 can't i do a recursion here? how can i achieve this without doing an outer defn? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Entwined STM V1.0

2013-08-18 Thread dennis zhuang
That's really cool. Do you have any performance benchmark between TransactionalMap and java.util.concurrent.ConcurrentHashMap? When should i use these collections instead of java.util.concurrent.* collections? 2013/8/18 Ivan Koblik ivankob...@gmail.com Hi All, Almost 4 years ago I

Re: Can we please deprecate the :use directive ?

2013-07-24 Thread dennis zhuang
I am using ':use' for my own namespaces.I know it's discouraged, but if i can control my own code,why not? Compiler can give me warnings and i process all warnings carefully. 2013/7/25 Steven Degutis sbdegu...@gmail.com If our votes count for anything, then I'd like to add +1 for getting rid

{{ANN} clj-xmemcached release 0.2.3

2013-07-19 Thread dennis zhuang
An opensource memcached client for clojure,it wraps xmemcached. 0.2.3 releases, main highlights: 1.Supports delete with CAS value in binary protocol ;;delete with CAS (xm/delete num (:cas (gets num))) 2.Supports lighweight distribution lock with try-lock macro: (def counter (atom

Re: core.async

2013-07-06 Thread dennis zhuang
It's so cool,great job! But i don't find any way to do io blocking operations such as socket.read in 'go'. Is there a roadmap to make alts! working with java NIO selector that waits on socket channels? Then we can read/write data with socket/file channel in go without blocking. Thanks,it's really

Re: reset! and merge for (transient {})

2013-07-02 Thread dennis zhuang
Maybe he means clear? 2013/7/2 Jim jimpil1...@gmail.com No merge will not work with transients because it uses conj instead of conj! If you absolutely have to do this define your own 'merge!' that uses conj!. I'm not sure what you mean by reset! for transients...reset! is an operation on

Re: reset! and merge for (transient {})

2013-07-02 Thread dennis zhuang
Clear the collection. user= (doc empty) - clojure.core/empty ([coll]) Returns an empty collection of the same category as coll, or nil nil 2013/7/2 Jim jimpil1...@gmail.com what is 'clear' ? cannot find it anywhere... Jim On 02/07/13 12:03, dennis zhuang wrote

{ANN} clj-xmemacched release 0.2.2

2013-06-24 Thread dennis zhuang
An opensource memcached client for clojure wrapping xmemcachedhttp://code.google.com/p/xmemcached/.It released 0.2.2, added 'clj-json-transcoder' that encode/decode values using clojure.data.json. https://github.com/killme2008/clj-xmemcached -- 庄晓丹 Email:killme2...@gmail.com

multimethods for non constant values?

2013-06-23 Thread Dennis Haupt
i found example that i can do (defmethod x 5 [y] (do stuff)) but can i do (defmethod #( % 10) [y] (do stuff)) somehow? like in a pattern match of haskell/scala? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: multimethods for non constant values?

2013-06-23 Thread Dennis Haupt
)) ;; dispatch on the dispatch values (defmethod x :less-then-10 [x] (do )) Hope it helps Las 2013/6/23 Dennis Haupt d.haup...@gmail.com i found example that i can do (defmethod x 5 [y] (do stuff)) but can i do (defmethod #( % 10) [y] (do stuff)) somehow? like in a pattern match

Re: can't compile anything except def

2013-06-23 Thread Dennis Haupt
problems with it. On 23 June 2013 02:29, Dennis Haupt d.haup...@gmail.com mailto:d.haup...@gmail.com wrote: it happens with both clojure 1.5.1 and 1.4.0. when intellij tries to compile clojure files, something strange happens. if i remove the option to compile the files

multimethod noob question

2013-06-22 Thread Dennis Haupt
hi, i was taking a look at multimethods: (defmulti fac int) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n this works however, this also works: (defmulti fac print) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n what exactly is int or

can't compile anything except def

2013-06-22 Thread Dennis Haupt
hi, i'm trying to compiler a clojure file using intellij. the error i get is: Clojure Compiler: java.io.IOException: The system cannot find the path specified, compiling:(D:\cloj\MultiMethod.clj:3) where the line number is pointing at a line that contains something that is declared in core.clr

Re: can't compile anything except def

2013-06-22 Thread Dennis Haupt
i don't know what properly set up the environment means exactly, but i can run my script in the repl 2013/6/22 Jim - FooBar(); jimpil1...@gmail.com On 22/06/13 15:09, Dennis Haupt wrote: where the line number is pointing at a line that contains something that is declared in core.clr

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
user= (fac 1) 10-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-until stackoverflow 2013/6/22 Chris Bilson cbil...@pobox.com Dennis Haupt d.haup...@gmail.com writes: i was taking a look at multimethods: (defmulti fac int) (defmethod fac 1 [_] 1) (defmethod

Re: can't compile anything except def

2013-06-22 Thread Dennis Haupt
clojure jvm, intellij's repl. i'll try to run the file via commandline and see what happens 2013/6/22 Jim - FooBar(); jimpil1...@gmail.com On 22/06/13 15:16, Dennis Haupt wrote: i don't know what properly set up the environment means exactly, but i can run my script in the repl what repl

Re: can't compile anything except def

2013-06-22 Thread Dennis Haupt
running the file works (from inside intellij), just intellijs compilation seems to be broken i can ignore the problem for now 2013/6/22 Dennis Haupt d.haup...@gmail.com clojure jvm, intellij's repl. i'll try to run the file via commandline and see what happens 2013/6/22 Jim

Re: can't compile anything except def

2013-06-22 Thread Dennis Haupt
15:21, Dennis Haupt wrote: clojure jvm, intellij's repl. i'll try to run the file via commandline and see what happens where did core.clr come from then? can you somehow see what version of clojure your intelliJ is using? I've got no experience with intelliJ really...it's just that your

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
yes. all glory to the repl that makes me figure out the internals via experiments :D is there a way to just pass the given value along? 2013/6/22 Chris Bilson cbil...@pobox.com Dennis Haupt d.haup...@gmail.com writes: i am not trying anything, i just want to figure out what happens

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
and stuff2 is the complete set of original arguments? can you provide an example where stuff2 has more information than stuff? for fac, both are equal thx :D 2013/6/22 Dennis Haupt d.haup...@gmail.com yes. all glory to the repl that makes me figure out the internals via experiments :D

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
identity :) 2013/6/22 Chris Bilson cbil...@pobox.com Dennis Haupt d.haup...@gmail.com writes: yes. all glory to the repl that makes me figure out the internals via experiments :D is there a way to just pass the given value along? Yes, that's what I meant by my inspect method in my

Re: Clojure in production

2013-06-18 Thread Dennis Roberts
Hi Plínio, We're using clojure for most of our back-end services at iPlant (http://www.iplantcollaborative.org). You can find our source code at https://github.com/organizations/iPlantCollaborativeOpenSource. Dennis On Monday, June 10, 2013 2:47:25 PM UTC-7, Plinio Balduino wrote: Hi

{ANN} A clojure macro and ruby script to profile clojure program.

2013-06-08 Thread dennis zhuang
A macro named `p` to log data, and a ruby script to parse log file,and it will give the statistics result of a clojure program: Parsing log file test.log ... Prowl profile results: Labels: Label:logic count:1 Method: method2mean: 10.81 min: 10.81

Re: clojure diffs

2013-06-07 Thread Dennis Haupt
intellij can do exactly what you want 2013/6/7 Moocar anthony.mar...@gmail.com Hi all, Diffs for clojure code (and lisps in general) can be hard to read. Every time we wrap a form, any lines below are indented. The resulting diff just shows that you've deleted lines and added lines, even

sorted-map-by issue?

2013-06-06 Thread dennis zhuang
user= (sorted-map-by (constantly 1) :b 1 :a 2) {:b 1, :a 2} user= (:a (sorted-map-by (constantly 1) :b 1 :a 2)) nil user= (keys (sorted-map-by (constantly 1) :b 1 :a 2)) (:b :a) user= (count (sorted-map-by (constantly 1) :b 1 :a 2)) 2 user= (:a (sorted-map-by (constantly 1) :b 1 :a 2)) nil It

Re: sorted-map-by issue?

2013-06-06 Thread dennis zhuang
-map-by #(if (= %1 %2) 0 1) :b 1 :a 2)) 2 user= (:b (sorted-map-by #(if (= %1 %2) 0 1) :b 1 :a 2)) 1 2013/6/6 dennis zhuang killme2...@gmail.com user= (sorted-map-by (constantly 1) :b 1 :a 2) {:b 1, :a 2} user= (:a (sorted-map-by (constantly 1) :b 1 :a 2)) nil user= (keys (sorted-map

Re: sorted-map-by issue?

2013-06-06 Thread dennis zhuang
hope to return correct results given such an inconsistent comparator. More examples and discussion at the link below, if you are interested: https://github.com/jafingerhut/thalia/blob/master/doc/other-topics/comparators.md Andy On Thu, Jun 6, 2013 at 4:19 AM, dennis zhuang killme2

Re: Use of io!

2013-05-30 Thread dennis zhuang
Yep,wrap code that has side effects, prevent it to be evaluated in STM transaction. 2013/5/30 Maik Schünemann maikschuenem...@gmail.com I think It stops other code to wrap around the code with the explicit io! call. Its declarative way of saying: I am doing io! DONT USE me inside a dosync.

Re: Do you know which language the clojure is written by?

2013-04-22 Thread dennis zhuang
Java. But there is some clojure version written in ruby,python,c# and javascript. 2013/4/22 ljcppu...@gmail.com Hi, Do you know which language the clojure is written by? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Imported Java lib can't find classes compiled on the fly

2013-03-17 Thread dennis zhuang
You can make the clojure class loader by yourself: (import '(clojure.lang RT)) (def class-loader (RT/makeClassLoader)) user= (.loadClass class-loader user.Foo) user.Foo 2013/3/17 vemv v...@vemv.net Most definitely :) But that something is hard/confusing should'nt be enough reason to give

  1   2   3   >