Re: [ANN] Opencv bindings for clojure

2018-10-30 Thread Nicolas Modrzyk
Hi Chris, Great work! Sorry to jump in. I had already been working on an auto-generated wrapper directly for opencv. (not javacv though) It's called origami and is on github: https://github.com/hellonico/origami/tree/master I just ported origami to OpenCV4-beta. Maybe there is some work or

[ANN] Reactive with ClojureScript Recipes (book)

2017-10-11 Thread Nicolas Modrzyk
ook on Clojure, I really had a blast writing it. Hopefully, it will spark new ideas and makes readers try out many new things. For beginners, it should also be quite coherent and easy to pick up. Feedback very welcome. Nicolas, -- You received this message because you are subscribed to the Google Gro

[ANN] Clojure Programming Cookbook

2016-11-14 Thread Nicolas Modrzyk
Enjoy! Nicolas & Makoto, all the way from Japan -- 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

Re: Largest Clojure codebases?

2015-11-24 Thread Nicolas Herry
0 days). I confess I've never configured sloccount (actually, I have no idea whether this is possible at all) and have always relied on the stock, default execution. I'm genuinely interested in knowing whether sloccount can be used as a serious cost estimator. Nicolas -BEGIN PGP SIG

Re: [ANN] - New Clojure Instant Answer on DuckDuckGo

2015-08-25 Thread Nicolas Herry
! Very handy, thanks ! Nicolas. -- 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

Re: Reviewers needed for new Clojure book!

2015-08-25 Thread Nicolas Modrzyk
Hi, I have reviewed other IT books before and also using clojure on an everyday basis. I would really love to be able to review this new Clojure book. Nico On Monday, August 24, 2015 at 3:46:06 PM UTC+9, Akhil Wali wrote: If anyone is interested in being a reviewer for a new book

Re: awful performance on Windows 7 compared to anything else

2015-07-05 Thread Nicolas Modrzyk
Hi Colin, Would you have a subset of your app as a project on github/bitbucket so we can help finding out ? I am not sure it is related but the call to fsync in clojure http://dev.clojure.org/jira/browse/CLJ-703 looks slightly similar to what other people are seeing.

Re: [ANN] 美味しいClojure

2013-10-01 Thread Nicolas Modrzyk
The whole text has also been written in English, so I guess there could be a chance to put it out there. But we have had no contacts with US/UK publishers so far. On Tuesday, October 1, 2013 9:43:00 PM UTC+9, Jim foo.bar wrote: also, is this only going to be published in Japanese? Jim

Re: [ANN] 美味しいClojure

2013-10-01 Thread Nicolas Modrzyk
yes, the ebook should be on sale in the next few weeks. On Tuesday, October 1, 2013 9:41:10 PM UTC+9, sailor...@gmail.com wrote: Is there any E-book to buy ? The shipping cost of Amazon.jp is high. -- -- You received this message because you are subscribed to the Google Groups Clojure

Re: Why cannot last be fast on vector?

2012-06-29 Thread Nicolas
views. Regards, Nicolas Bousquet. On 29 juin, 01:32, Warren Lynn wrn.l...@gmail.com wrote: This is an off-shoot subject from my last post General subsequence function. I found people had similar questions before (one year ago):http://groups.google.com/group/clojure/browse_thread/thread

Should I better use a state monad (and how)?

2012-04-15 Thread Nicolas Buduroi
I'm working on a turn-based game and I'm looking for a good way to manage states. In the game each turn is composed of multiple phases. I started by using atoms for the phases field (this is a sequence of functions) in a record and realized that it wouldn't be ideal to keep track of states in

Re: Should I better use a state monad (and how)?

2012-04-15 Thread Nicolas Buduroi
On Monday, April 16, 2012 12:08:30 AM UTC-4, kovasb wrote: You can try using the in-memory version of Datomic. Besides keeping track of the state at every point, it can help with the reasoning about what should happen next for each state change. Hum, I hadn't though about using a service

Re: Should I better use a state monad (and how)?

2012-04-15 Thread Nicolas Buduroi
first key))) ( (start-phase state Now, I'd need to find better names! On Sunday, April 15, 2012 11:25:21 PM UTC-4, Nicolas Buduroi wrote: I'm working on a turn-based game and I'm looking for a good way to manage states. In the game each turn is composed of multiple phases. I started

Logic puzzle: send more money performance

2012-04-12 Thread Nicolas Buduroi
Hi, I translated[1]the solution to the send more money logic puzzle from the cKanren paper in core.logic and I was wondering about its expected performance. I wasn't patient enough to run it without giving it some clues, giving it the S E N D digits make it run in around 36s on my machine, but

A simple (and naive) online whiteboard using Aleph ClojureScript

2012-03-31 Thread Nicolas Buduroi
Hi everyone, I've been experimenting with ClojureScript and Aleph lately and made this sample application. It's a naive implementation of an online whiteboard. It's under a hundred line of code so it's a quick read: https://github.com/budu/board The Clojure web development story is getting

Re: A simple (and naive) online whiteboard using Aleph ClojureScript

2012-03-31 Thread Nicolas Buduroi
On Saturday, March 31, 2012 7:35:03 PM UTC-4, jun lin wrote: Maybe you can create an online demo site? Yes good idea, I'll try to get it running on Heroku tomorrow. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

Tutorial: Clojure applications in Eclipse with Counterclockwise and Maven

2012-03-22 Thread Nicolas Duchenne
Hi Everyone, I wrote an extensive tutorial in two parts about developing Clojure applications with Maven and Counterclockwise in Eclipse: Clojure in Eclipse, Part 1: Mavenhttp://chaomancy.squarespace.com/blog/clojure-in-eclipse-part-1-maven.html: Develop, test and deploy a Clojure app in

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-09 Thread Nicolas
Well maybe the problem of the let? macro is that it is not standard. If you use standard constructs and I'am proeficient with clojure I'll understand your code fast. I'll concentrate on understanding your code relevant for your application and domain. But just adding a few new constructs specific

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-09 Thread Nicolas
(Sorry for split post). So I'am not against let? macro of whatever you might need. That why we have a lisp here. But be sure you really need it/use it. And it is designed to be intuitive as possible. On 9 mar, 23:05, Nicolas bousque...@gmail.com wrote: Well maybe the problem of the let? macro

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-08 Thread Nicolas
be interesting to see and experiment on. Have a nice day, all! Nicolas. On 8 mar, 08:37, Sean Corfield seancorfi...@gmail.com wrote: On Wed, Mar 7, 2012 at 5:10 PM, Mark Engelberg mark.engelb...@gmail.com wrote: * introducing variables creates new indenting level, making code creep to the right

Re: Bret Victor - Inventing on Principle

2012-03-02 Thread Nicolas
The talk was really enligthing... but I would say it is still research. While I can trust you can make, say an intuitive and reactive UI for flash like animations, I think there are still problems to take care of for the program example. Here this is just a simple algorithm without long calls

Re: Question about this little method I wrote

2012-02-29 Thread Nicolas Duchenne
Hi Mike, If I understood your aim correctly, and if you accept changing the output of (combinations [[1 2]]) to ((1) (2)) instead of (1 2), which I think makes more sense,then the reduce function does the job in one line for you. (defn combinations [items] (reduce #(for [l % i %2] (conj l i))

Re: clojure-opennlp

2012-02-12 Thread Nicolas Buduroi
Just for the record, it seems this issue has been fixed today: https://github.com/dakrone/clojure-opennlp/commit/887add29a1fbc3b4aac7d12f5cbc52c43c6a7dcd Try out the the new 0.1.8 version. On Feb 11, 9:20 am, Jim foo.bar jimpil1...@gmail.com wrote: HI everyone, I was just wondering whether

Re: Need help to translate a simple java program into Clojure program

2012-01-10 Thread Nicolas Garcin
Thanks a lot to all of you. Regards, Nicolas On 10 jan, 08:14, Brian Mosley brian.d.mos...@gmail.com wrote: Oops. A possible solution might look something like that... -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: Need help to translate a simple java program into Clojure program

2012-01-10 Thread Nicolas Garcin
Hi, Finally I managed to write my program, see below. It is probably not optimized at all (I had some issues with vector concatenation..) but at least it does the same as my java program. Thanks again! Regards, Nicolas (defrecord Pos [name value]   Object   (toString [this]         (str Name

Need help to translate a simple java program into Clojure program

2012-01-09 Thread Nicolas Garcin
to write the equivalent program in Clojure. Could someone please help me? Below is the java program that I'd like to translate. Thanks a lot, Regards, Nicolas // first file (these are the elements of my lists): public class Pos { public String name; public int value; public Pos(String

Clojure/ClojureScript code and refs

2011-12-20 Thread Nicolas Buduroi
I'm thinking about writing some code that would better be transactional and thus use refs in a multi-threaded environment like Clojure. But then it would also be nice to be able to run that code as ClojureScript code (which obviously doesn't support refs) so I'm wondering if anybody has worked on

Re: Proposal: libraries should have type hints

2011-11-22 Thread Nicolas
in performance. And if you need this boost. I think then that's the library author responsability and own right to figure by himself where ultimate performance is needed or instead where greater flexibility is to be prefered. Bye, Nicolas. On Nov 21, 5:12 pm, Tassilo Horn tass...@member.fsf.org

What is the cost of calling require for something that already have been loaded?

2011-11-12 Thread Nicolas Buduroi
I'm using a function in Lobos to automatically load the backend code associated to a specific database and wonder if I should track what is loaded to avoid repeatedly calling `require`? This isn't an issue currently as performance isn't a problem for this library, but this might change in the

question about cons function

2011-11-08 Thread Nicolas Garcin
Hello, I'm a new Closure user and I'm wondering why the 'cons' function applied on a vector returns a list. Ex: user= (def v1 [:one :two]) #'user/v1 user= (cons :three v1) (:three :one :two) user= Thanks for your help, Regards, Nicolas -- You received this message because you are subscribed

Re: Lazy behavior

2011-11-02 Thread Nicolas
Hi, I'am not really sure on your explanation here. For me if the processor, JVM or clojure compiler cannot prove it doesn't change the semantics, the optimization will not be applyed. readLine behing a java method call, it can perform any operations and thus clojure compiler will not change the

Re: Lazy behavior

2011-11-01 Thread Nicolas
on the first for the lazy sequence. Any insights? Best Regards, Nicolas On 1 nov, 01:09, nchurch nchubr...@gmail.com wrote: The problem you're having doesn't have anything to do with file reads.  Every time you call (take 5 data), you're calling it on the same item 'data'; your variable 'data

Re: Trickiness with protocols and extends (1.3.0)

2011-10-28 Thread Nicolas
, extending cascade.Asset work because it is considered as a java interface, and is supported for interoperability. But this is likely not what you really want to do as Asset is still not a clojure type. Hope this help, Nicolas On 28 oct, 19:46, Howard Lewis Ship hls...@gmail.com wrote: I'm

Re: repl output for list seems inconsistent and a holdover from yesteryear

2011-10-27 Thread Nicolas
Hi! Well [1 2 3] is just a syntaxic sugar for (vector 1 2 3): =(vector 1 2 3) [1 2 3] When you enter a vector in the repl, it is evaluted to itself. Here an example that show it: =[1 2 (+ 1 2)] [1 2 3] And you can use the vector function for the same result: =(vector 1 2 (+ 1 2)) [1 2 3] The

Re: Blog post declare type implements protocol feature

2011-10-26 Thread Nicolas
Yes you need to provide an implementation of the protocol for the type directly or a parent interface. What the initial author says is that you can do that on any type, even on an outside library, without changing the initial Type source code or recompile it. You can do that at runtime and

Re: Reactions to google dart?

2011-10-14 Thread Nicolas
For me the real meaning of this is that support for new features in closure library will stop in its actual form in the years to come. Only bugs will be corrected, no more. This is already the case in a sence I think, because before Dart, GWT was viewed as the new official way to make new web

Re: Macro tutorials?

2011-10-10 Thread Nicolas
A good book to learn lisp macros, is On Lisp from Paul Graham. This book really cover advanced topics and concepts, and has many chapters related to macros. The book is freely available in online format from Paul Graham Website: http://www.paulgraham.com/onlisp.html On Oct 6, 1:02 pm, Michael

Re: producing Blub code and vv.

2011-10-03 Thread Nicolas
it manually. But I see it as more a research topic than engineering topic. With low probability of sucess. It is a good thing to work on it then when many things aren't here yet for clojure? Best Regards, Nicolas. On Sep 30, 5:48 am, Hank h...@123mail.org wrote: I think the major obstacle

Waiting for swank-clojure to be ready.

2011-10-03 Thread Nicolas Buduroi
Hi, I'm currently redoing my Clojure setup and I wonder how to make Emacs wait for swank-clojure to be ready before calling slime-connect. I've added a shortcut to start swank-clojure: (global-set-key [f8] '(lambda () (interactive) (start-process swank-clojure

Re: Waiting for swank-clojure to be ready.

2011-10-03 Thread Nicolas Buduroi
-directory root)) (set-process-filter process nil)) On Mon, Oct 3, 2011 at 8:33 PM, Phil Hagelberg p...@hagelb.org wrote: On Mon, Oct 3, 2011 at 5:12 PM, Nicolas Buduroi nbudu...@gmail.com wrote: Hi, I'm currently redoing my Clojure setup and I wonder how

Re: suggestion for clojure development

2011-09-30 Thread Nicolas
I think that backward compatibilities problem do hurt. Some people will not invest in an unstable language by default and some will be tempted to give up after experimenting too many problem with it. We don't choose a language,we choose a full echosystem that include libraries, IDE tooling,

Re: producing Blub code and vv.

2011-09-29 Thread Nicolas
Clojure has native interoperability with JVM CLR. This mean that you can have part of your code written in Clojure, part in Java/Jython/ JRuby if your target the JVM or C# if you target CLR. Of course you'll not be able to mess everything like first half of a method in Clojure, second half in

Re: Using Clojure to Generate Java Source?

2011-09-29 Thread Nicolas
Best would be to act as professionnal: - try to convince your new boss of the benefits of using clojure from a business point of view. - if this fail, either go back to writing java or quit. But do not try to abuse your boss and company by developping in clojure behind the scene and deliver some

Re: suggestion for clojure development

2011-09-28 Thread Nicolas
On Sep 28, 1:30 pm, Gary Poster gary.pos...@gmail.com wrote: On Sep 28, 2011, at 1:26 AM, Sean Corfield wrote: Perhaps Java has been different, but the languages I use and follow have not, with the exception of JavaScript.  I perceive it to be a mildly unfortunate fact of life at this

Re: On Lisp with Clojure

2011-09-09 Thread Nicolas
I would rather say difficult than impossible... and maybe not that important. After all JVM is turring complete. If scheme can do it compiling down to machine code, clojure could do it compiling down to JVM bytecode. On Sep 7, 1:54 am, Brian Goslinga quickbasicg...@gmail.com wrote: On Sep 6,

Re: New to Clojure -- Errors Are Frustrating

2011-08-03 Thread Nicolas
On 3 août, 03:00, Mark markaddle...@gmail.com wrote: The compiler might not be able to do better but the runtime system certainly could.  In this case, both filtered and more information is what's needed.   Why couldn't the runtime generate a message like: Symbol fac of type clojure.lang.IFn

Re : Re: novel feedback is always welcome

2011-08-01 Thread Nicolas
y I'am tThe main point for me of this whole discussion is that someone should use clojurescript if he want to use clojure instead of javascript on the browser. Like GWT, JWT, ZK or other, you do not longer develop in the client language. You develop in a different language and compile/generate

Re: Monadic implementation of the Shunting-yard algorithm

2011-05-03 Thread Nicolas Buduroi
On Tuesday, 3 May 2011 15:02:02 UTC-4, odyssomay wrote: I wrote a simple implementation: http://gist.github.com/953966https://gist.github.com/953966 (only supports operators) It's not very elegant (I don't know how to use fnparse..), but it is functional. What it does is find out what

Re: Monadic implementation of the Shunting-yard algorithm

2011-05-03 Thread Nicolas Buduroi
One small question, how would you modify your version to output s-expressions? -- 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

Re: Monadic implementation of the Shunting-yard algorithm

2011-05-03 Thread Nicolas Buduroi
understand your code. Either way I hope that this code helps in some way.. ;) Jonathan On Tue, May 3, 2011 at 2:23 AM, Nicolas Buduroi nbud...@gmail.com wrote: Hi, I'm working on my parsing skills using fnparse 2.2.7 and have written the following implementation of the Shunting-yard algorithm

Monadic implementation of the Shunting-yard algorithm

2011-05-02 Thread Nicolas Buduroi
Hi, I'm working on my parsing skills using fnparse 2.2.7 and have written the following implementation of the Shunting-yard algorithm: https://gist.github.com/952607 I plan to make a lightning talk about monadic parser at the next Bonjure meeting and I'd like to hear what people here think about

Re: clojure.contrib.sql = clojure.java.jdbc - looking for feedback!

2011-04-27 Thread Nicolas Buduroi
On Tue, Apr 26, 2011 at 2:16 PM, lispnik burnsid...@gmail.com wrote: ...Liquibase so I can get rollbacks and branching easily. Off-topic question: What does branching mean in the context of Liquidbase? I suggest not getting into the SQL in sexps/naming strategies business. That kind of

Re: clojure.contrib.sql = clojure.java.jdbc - looking for feedback!

2011-04-25 Thread Nicolas Buduroi
On Mon, Apr 25, 2011 at 12:23 PM, Michael michael-a...@db.com wrote: I was wondering if c.j.jdbc could provide some help in composing sql fragments, but I'm not sure what form it should take or if core clojure would suffice. We would have looked into ClojureQL, but it doesn't directly support

Re: Intro to Live Programming with Overtone

2011-04-24 Thread Nicolas Buduroi
Overtone really looks awesome, looking forward to use it! Thanks for the video. -- 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

Re: clojure.contrib.sql = clojure.java.jdbc - looking for feedback!

2011-04-23 Thread Nicolas Buduroi
I'm going to be working on clojure.java.jdbc, with Steve Gilardi, and I'd like to get people's feedback on what you like / what you don't like / what you need changed or added in clojure.contrib.sql so that clojure.java.jdbc can become what the community wants for 1.3.0. What I would like

Re: ANN: pallet.thread-expr, a macro lib for use with - argument threading

2011-04-22 Thread Nicolas Buduroi
This is a very interesting set of macros, I'll certainly use some of them. In fact I think this library should at least make it to clojure.contrib! BTW, there's a small error in the when-not- docstring, the result should be 1. -- You received this message because you are subscribed to the

ANN: Lobos 0.7, a SQL database schema manipulation library

2011-04-19 Thread Nicolas Buduroi
Hi, I've released version 0.7 of Lobos today, enjoy it. I've posted a more comprehesive announcement on the new Lobos Google Group: https://groups.google.com/forum/#!topic/lobos-library/mTL9HLiHOrA If you have questions, suggestions, comments or insults please post them there. For those who

Reading back record instances

2011-01-23 Thread Nicolas Buduroi
I've been using records extensively lately and I think they are a really great addition to Clojure. One problem I'm facing tough is to read them back once printed to a file (or anything else). All others Clojure data structures are supported by the reader, but not records. One way to do this

What's the best way to hide transaction error output from contrib.sql

2011-01-14 Thread Nicolas Buduroi
By design contrib.sql, when executing a batch of commands, uses transaction and if an exception is raised, it is printed to the error output stream. This is very practical but when you are using such code in a test that is meant to throw an exception it adds a lot of noise to the tests output. I

Re: REPL+Laziness: the worst combination ever!

2011-01-08 Thread Nicolas Buduroi
Didn't knew about scope, it looks like an interesting feature. Still as you point this is pretty much a problem BKAC! On Jan 8, 12:33 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: One goal of resource scopes [1] is to help with scoping activities at the REPL. That said, I think this is

Re: REPL+Laziness: the worst combination ever!

2011-01-08 Thread Nicolas Buduroi
On Jan 8, 12:25 pm, Brian Goslinga quickbasicg...@gmail.com wrote: I find that if your code is functional, laziness works quite well (except for the rare expensive function + chunking problem). Perhaps your code isn't very functional? (your mention of binding suggests that) That's a valid

REPL+Laziness: the worst combination ever!

2011-01-07 Thread Nicolas Buduroi
I've been doing a lot of Clojure lately and, of all thing, collection's laziness coupled with a REPL is what makes me loose the most time. I really love having laziness built-in by default and I'm a REPL-driven development addict, but sometimes I just loose minutes (if not hours) chasing imaginary

Re: ANN: ClojureQL 1.0.0 now released

2011-01-05 Thread Nicolas Buduroi
Congratulation, you've finally made it! P.S.: Nice job on the website! On Jan 5, 9:14 am, LauJensen lau.jen...@bestinclass.dk wrote: Hey everybody, Just a quick heads up that ClojureQL 1.0.0 is now released. All interfaces should be final and there are no known bugs. Works out of the box

Working with protocols

2010-12-22 Thread Nicolas Buduroi
Hi, I've been working lately on my first project (https://github.com/ budu/lobos) that use protocols. Up until now, it's been quite infuriating, I can't stop getting seemingly random No implementation of method exceptions and I really don't understand why. For example here's what happened this

Re: Working with protocols

2010-12-22 Thread Nicolas Buduroi
On Dec 22, 1:03 pm, David Nolen dnolen.li...@gmail.com wrote: (Foo.) is a Java method call determined at compile-time. If you change the definition of the Foo type/record, create-foo will be out of date. Default constructor fns could alleviate this but I think some design/modularity issues

Re: Catching ClassNotFoundException.

2010-12-16 Thread Nicolas Buduroi
Cool, that explain everything. Thanks On Dec 16, 4:40 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 16.12.2010 um 04:16 schrieb Nicolas Buduroi: So we could always use RT/classForName to detect what classes are available. Do you think the extend-type thrown exception can possibly

ANN: clj-help 0.2.0 released

2010-12-15 Thread Nicolas Buduroi
Hi, I've been using this small project to get some help while working at the REPL. It's a macro that regroups into one command a set of useful functions from contrib libraries while auto-quoting it's arguments. It's quite simple to use, after loading it (use 'clj- help), you only have to type

Re: ANN: clj-help 0.2.0 released

2010-12-15 Thread Nicolas Buduroi
It appears I've forgotten to include some essential information to this announcement! ;-) git repo: https://github.com/budu/clj-help leiningen: [clj-help 0.2.0] On Dec 15, 6:23 pm, Nicolas Buduroi nbudu...@gmail.com wrote: Hi, I've been using this small project to get some help while working

Catching ClassNotFoundException.

2010-12-15 Thread Nicolas Buduroi
Hi, is there a way of catching ClassNotFoundException? Using try..catch doesn't work! 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 posts from new members are moderated -

Re: Catching ClassNotFoundException.

2010-12-15 Thread Nicolas Buduroi
Yeah, while doing more testing it seems to depend from where the ClassNotFoundException is thrown. What I was trying to do at first is to call extend-type on a Java class only if it exists. Surrounding extend-type by a try..catch clause doesn't work here. So I tried to simply type: user (try

Re: Any demand for ClojureCLR support under slime / emacs?

2010-12-13 Thread Nicolas Buduroi
I'm interested, can't provide much programming help in this area tough. I could always help test it. On Dec 12, 6:36 pm, Mike K mbk.li...@gmail.com wrote: I really, really want ClojureCLR to play nice with emacs the way Clojure does.  I've looked at the swank-clojure sources, but I really

Re: (ab)using STM for longish calculations, network I/O

2010-10-15 Thread Nicolas Oury
for the retry part of the problem. (retry is an artifact of the non-blocking atomicity. If it fails, we need to restart) Interesting read if you do not know it already: http://clojure.org/state Best, Nicolas. -- You received this message because you are subscribed to the Google Groups Clojure

Re: precise numbers

2010-10-14 Thread Nicolas Oury
* 6 can be written as sqr(2)*3) If it is the case, you return [f (* e b d)] else you return [(* a c) (* b d)] Dividing is more difficult. I don't know if it is the most efficien way to do that, but it is the easiest to code. Best, Nicolas. -- You received this message because you

Re: generator in Clojure

2010-10-14 Thread Nicolas Oury
(defn iterate [s] (let [a (atom s)] (fn [] (let [s @a] (reset! a (next s)) (first s)) but it's not very idiomatic in clojure. (In Lisp it is traditional to hide a state in a closure. A lot of toy object language work like that) On Thu, Oct 14, 2010 at

Re: precise numbers

2010-10-13 Thread Nicolas Oury
On Tue, Oct 12, 2010 at 8:35 PM, cej38 junkerme...@gmail.com wrote: The more that I think about it, the more I would rather have a set of equalities that always work.  float= was a good try. The only way to do so is to have numbers with infinite precision. For example as lazy-seq of their

Re: precise numbers

2010-10-12 Thread Nicolas Oury
If you want to be really precise, most real numbers are an infinite number of decimals. If you encode them as a lazy seq of decimals, + - and other ops are doable. Comparison is semi-decidable only: it terminates only in certain case (finite number of decimals) or when the number are different.

Re: clojure-cake

2010-10-08 Thread Nicolas Oury
I had a similar error last time I tried. Didn't manage to solve it. On Fri, Oct 8, 2010 at 10:49 AM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: I forgot to mention the versions... My cake version is 0.4.18 and ruby version is ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] On

Re: Clojure 1.3 alpha 1 report - bitwise operations extremely slow

2010-10-01 Thread Nicolas Oury
There is no java definition for (Number, long) or (Number, int). As 1 is now a primitive, I think it cannot find any corresponding function. Strangely, putting 1M or (num 1) might be faster. Can someone try? On Fri, Oct 1, 2010 at 10:28 AM, David Powell djpow...@djpowell.net wrote: So, if

Re: Clojure 1.3 alpha 1 report - bitwise operations extremely slow

2010-10-01 Thread Nicolas Oury
David pointed out what should have been the obvious overhead (I'll blame it on being up at 2am), and Nicolas pointed out the specific problem. two solutions: - writing all combinations of unboxed/boxed for every function - having a more clever code generator that try to box every primitive

Re: anonymous fn or partial?

2010-09-30 Thread Nicolas Oury
The two styles are ok. Matter of taste. (partial ...) have probably a slight cost I wouldn't worry about except if profiler tells me to worry. The (partial...) style is called point-less, because you directly manipulate the arrows and not the points. It is the same kind of question as : should

Re: question regarding macro (ab)usage

2010-09-28 Thread Nicolas Oury
of the situation. you might want to trade these advantages for composability and ease of programming. Best, Nicolas. -- 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

Re: How often do you use REPL?

2010-09-28 Thread Nicolas Oury
On Tue, Sep 28, 2010 at 12:03 PM, David Cabana drcab...@gmail.com wrote: My standard practice is to split the (Emacs) screen, one side is a Clojure mode edit session, the other a repl.  Best of both worlds. One can easily build up complex expressions as required,  and still easily evaluate

Re: Hiccup with Sequence

2010-09-27 Thread Nicolas Oury
doseq do not return anything. (It is for side-effect only). You might be looking for 'for'. (doc for) - clojure.core/for ([seq-exprs body-expr]) Macro List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more

Re: Macro expansion problem

2010-09-27 Thread Nicolas Oury
#)) ([x1# x2# x3#] (. ~obj ~(symbol method-name) x1# x2# x3#)) ... up to enough (20 should do the trick) ~params) However, ti might be easier to explain what you are trying to achieve in a bigger context to see if there is a simpler path. Best, Nicolas. On Mon, Sep 27, 2010 at 6:52 AM

Re: Some code dramatically slower in Clojure 1.3 Alpha 1?

2010-09-25 Thread Nicolas Oury
Your code was simple enough for me to make a couple of educated guesses. For more complex code I'd use VisualVM, https://visualvm.dev.java.net/ David I use that too. Sampling for a first look, profiling with instrumentation for a more precise answer. (Here, the sampling gives even? and the

Re: finding value nearest x

2010-09-25 Thread Nicolas Oury
On Sat, Sep 25, 2010 at 3:40 PM, Jules julesjac...@gmail.com wrote: Maybe this: (min-key #(abs (- % 136)) xs) Wouldn't that be (apply min-key #(abs (- % 136)) xs)? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Some code dramatically slower in Clojure 1.3 Alpha 1?

2010-09-24 Thread Nicolas Oury
After profiling even seems effectively the culprit. Some method reflector shows up too. On Fri, Sep 24, 2010 at 6:15 PM, David Nolen dnolen.li...@gmail.com wrote: (defn next-term [n]   (if (= (mod n 2) 0) (/ n 2)       (inc (* n 3 (defn count-terms [n]   (if (= 1 n) 1       (inc

Re: Some code dramatically slower in Clojure 1.3 Alpha 1?

2010-09-24 Thread Nicolas Oury
Try (defn even? Returns true if n is even, throws an exception if n is not an integer {:added 1.0 :static true} [n] (zero? (bit-and (long n) (long 1 before your example. It is fast on my computer. (I believe there is a reflective call, without the explicit cast.) -- You received

Re: Isn't STM good at building an ant colony?

2010-09-20 Thread Nicolas Oury
If you have a fixed geometry of cells, it is quite easy to have one ref per cell. Which reduce a lot of contention. For example, on a grid where ant can go instead of representing the world as a ref to a matrix, you can represent the world as a matrix of refs. Those refs can then be update

Re: why the big difference in speed?

2010-09-19 Thread Nicolas Oury
A first good start is to put (set! *warn-on-relection* true) at the start of the file and removes all reflective access. Before the 1.3 release, function cannot receive/returns primitive so you might consider (defmacro next-gaussian [] `(.nextGaussian ^Random r)) (^Random is here to make sure

Re: partition-starting-every : yet another partition function

2010-09-17 Thread Nicolas Oury
I was just saying that not returning something that is a pair, for example nil, is good enough. (unfold (fn [x] (when (= x 10) [(* x x) (inc x)])) would work. Both function can be written with each other anyway. And they don't have the same number of args so they are compatible with each

Re: partition-starting-every : yet another partition function

2010-09-17 Thread Nicolas Oury
(defn unfold ([grow seed] (lazy-seq (if-let [[elt next-seed] (grow seed)] (cons elt (unfold grow next-seed) ([grow finished? seed] (unfold #(when (not (finished? %)) (grow %)) seed))) (unfold (fn [x] [(* x x) (inc x)]) #( % 10) 0) (0 1 4 9 16 25 36 49 64 81 100)

Re: partition-starting-every : yet another partition function

2010-09-16 Thread Nicolas Oury
to think of seq as the fixpoint of the functor (X - Cons Object (lazy X))) Best, Nicolas. -- 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

Re: Feature idea: meta-macros

2010-09-15 Thread Nicolas Oury
Your example can be solved with (binding ...) For the proposal, I think it's a bad idea : huge potential for abuse (and importing abuse from other namespaces written by other people) and little benefit. I wouldn't be so strongly against it if it was in a delimited scope. In any case, you can

Re: Feature idea: meta-macros

2010-09-15 Thread Nicolas Oury
You can also use binding eval evil brother : alter-var-root. On Wed, Sep 15, 2010 at 8:04 PM, Richard Newman holyg...@gmail.com wrote: My suggestion is inline with other commenters: use binding. If that doesn't satisfy you, consider using or writing a preprocessor like m4. -- You received

Re: why doesn't a function have a type ?

2010-09-14 Thread Nicolas Oury
that any function implements IFn. Best, Nicolas. -- 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

Re: clojurescript and 1.2.0

2010-09-13 Thread Nicolas Oury
of CL) I agree it will be a better idea to wait for Clojure-in-Clojure. Could you mail the list, when you want to start working back on this? I would really be happy to help you with the clojurization of clojurescript if you need more hands... Best regards, Nicolas. On Mon, Sep 13, 2010 at 5:59 AM

Re: clojurescript and 1.2.0

2010-09-13 Thread Nicolas Oury
Thanks for the link. Very interesting indeed. Didn't know about it. On Mon, Sep 13, 2010 at 11:38 AM, Daniel Werner daniel.d.wer...@googlemail.com wrote: On Sep 13, 9:40 am, Nicolas Oury nicolas.o...@gmail.com wrote: I switched to Parenscript for my small JS project, even if I's rather have

clojurescript and 1.2.0

2010-09-12 Thread Nicolas Oury
Dear all, I cannot manage to make ClojureScript work from clojure 1.2.0. It seems that *compiler-analyse-only* used to exist but do not exist anymore. Does someone know what it was and what replaced it? Best regards, Nicolas. -- You received this message because you are subscribed

Re: clojurescript and 1.2.0

2010-09-12 Thread Nicolas Oury
Oooops. Ansered my question. Haven't seen the patch in the git repository. Will try to apply it to clojure 1.2. On Sun, Sep 12, 2010 at 1:52 PM, Nicolas Oury nicolas.o...@gmail.com wrote: Dear all, I cannot manage to make ClojureScript work from clojure 1.2.0. It seems that *compiler

  1   2   3   4   >