Re: find first match in a sequence

2013-05-19 Thread Mikera
;t find it in the docs. > > Thanks, > Jeff > See the find-first function in my cljutils library: https://github.com/mikera/clojure-utils/blob/master/src/main/clojure/mikera/cljutils/find.clj Note the initial check to see if the collection is Indexed: if it is then it is better to search by

Re: Design/structure for a game loop in clojure

2013-05-20 Thread Mikera
You've described almost exactly the state update model used in Ironclad: https://github.com/mikera/ironclad I'd strongly suggest taking a look at the Ironclad source if your game is anything vaguely turn-based / strategic. Some comments: - A big, single immutable data structure for

Re: Design/structure for a game loop in clojure

2013-05-22 Thread Mikera
On Wednesday, 22 May 2013 16:46:54 UTC+8, Daniel Wright wrote: > Thanks everyone for your replies, in particular: > > Mikera: Glad to hear we're along the right lines, and thanks for the > extra advice. I've found your blog series on Alchemy very helpful while > cons

Re: asm-based clojure yet?

2013-05-22 Thread Mikera
On Wednesday, 22 May 2013 20:35:01 UTC+8, atkaaz wrote: > thank you very much, my search has lead me to seeking a lisp that could > compile to machine code (mainly because i cannot accept the 20-22 sec `lein > repl` startup time and eclipse/ccw memory consumptions - so I was hoping > for someth

Re: Game Project - HTML5 or Applet?

2013-05-24 Thread Mikera
You might want to consider LibGDX: https://code.google.com/p/libgdx/ Looks pretty flexible, can do HTML5 games with WebGL as well as Android, iOS and desktop. It's also Java based so should be pretty easy to use from Clojure. On Friday, 24 May 2013 17:22:20 UTC+8, JvJ wrote: > > I'm thinking o

Re: user math expression evaluation

2013-05-28 Thread Mikera
On Wednesday, 29 May 2013 02:19:41 UTC+8, Brian Craft wrote: > Are there any existing libs for the evaluation of math expressions? For > example, if the user enters "x + sin(y)", parse and evaluate the > expression, given vectors of floats for x and y. You can evaluate expressions like this ri

Re: user math expression evaluation

2013-05-29 Thread Mikera
anyone fancies taking that on, I'd be happy to support. On Thursday, 30 May 2013 06:19:02 UTC+8, Brian Craft wrote: > > This looks useful. Is it tied to jvm? > > On Tuesday, May 28, 2013 6:21:30 PM UTC-7, Mikera wrote: >> >> On Wednesday, 29 May 2013 02:19:41 UTC+8, Brian

Re: [GSoC] core.matrix NDArray project feature requests

2013-05-31 Thread Mikera
Hi Dmitry, One thing I've seen quite frequently in Clojure numerical code is some ugly code for manipulating Java arrays with areduce / aset / aget etc. It's one of the few areas where it's genuinely easier to write code in Java at the moment. So it would be awesome if the Clojure NDArray coul

Re: Making things go faster

2013-06-05 Thread Mikera
My setup is usually: - Eclipse with Counterclockwise plugin - Keep an open, running REPL at all times - Reload namespaces when necessary (Ctrl+Alt+L) - Run tests with clojure.test from the REPL This avoids the startup overhead most of the time - I usually only use the Maven / leiningen comma

Re: Clojure in production

2013-06-12 Thread Mikera
Hi Plínio, At Nuroko, we're using Clojure to develop our machine learning toolkit (using neural networks). The code is a mix of Clojure and Java. Some of our tools have public source code here: https://github.com/nuroko Mike. On Monday, 10 June 2013 22:47:25 UTC+1, Plinio Balduino wrote: >

Re: [pre-ANN] test2, the last Clojure testing framework

2013-06-12 Thread Mikera
frameworks such as JUnit. I maintain a small library cljunit ( https://github.com/mikera/cljunit ) which enables me to run clojure.test tests via JUnit in Eclipse, which is extremely convenient. It would be great if this kind of functionality could be included in future Clojure testing frameworks

Re: Clojure generates unnecessary and slow type-checks

2013-06-14 Thread Mikera
Hi Jason, Have you guys taken a look at core.matrix for any of this stuff? We're also shooting for near-Java-parity for all of the core operations on large double arrays. (use 'clojure.core.matrix) (require '[criterium.core :as c]) (let [a (double-array (range 1))] (c/quick-bench (

Re: In what OS do you code?

2013-06-15 Thread Mikera
On Friday, 14 June 2013 14:46:37 UTC+1, Erlis Vidal wrote: > Hi, > > I'm a bit curious to know in what OS do you code. Do you prefer iOS, > Linux, Windows? Why is that? Because the tools? The environment? > > Thanks! > I prefer Linux for the server side. Lean, fast, great tools, open source.

Re: Clojure generates unnecessary and slow type-checks

2013-06-15 Thread Mikera
On Friday, 14 June 2013 18:15:34 UTC+1, Jason Wolfe wrote: > Hey Mikera, > > I did look at core.matrix awhile ago, but I'll take another look. > > Right now, flop is just trying to make it easy to write *arbitrary* > array operations compactly, while minimizing the cha

Re: Clojure lang issue tracker

2013-06-15 Thread Mikera
Clojure uses JIRA as an issue tracker: http://dev.clojure.org/jira/browse/CLJ See also the contributing guidelines: http://clojure.org/contributing On Saturday, 15 June 2013 17:05:23 UTC+1, Plinio Balduino wrote: > > Hi there > > I would like to make a small contribution to Clojure and I would

Re: anyone interested in authoring a book on "Clojure for machine-learning" ?

2013-06-19 Thread Mikera
Not sure who approached you, but I've also been approached by a couple of companies in this space and they are essentially scams / not serious publishers. For example, they apparently offer only about 16% royalty to the author, and do essentially no vetting or quality control. The fact that the

Re: Adding implicit indexing to Clojure lists and arrays?

2013-06-27 Thread Mikera
I agree that negative indexing (and presumably also modulo indexing for the upper index?) is very useful. Stuff like this comes up all the time in core.matrix However I don't think it makes sense as a standard feature in Clojure's low-level data constructs for several reasons: a) It's a breakin

Re: Clojure generates unnecessary and slow type-checks

2013-06-28 Thread Mikera
On Thursday, 20 June 2013 08:45:47 UTC+1, Jason Wolfe wrote: > > On Saturday, June 15, 2013 4:37:06 AM UTC-7, Mikera wrote: >> >> On Friday, 14 June 2013 18:15:34 UTC+1, Jason Wolfe wrote: >> >>> Hey Mikera, >>> >>> I did look at core.matrix awh

Re: Adding implicit indexing to Clojure lists and arrays?

2013-06-28 Thread Mikera
Mike or mikera is fine :-) If you wanted to provide this kind of functionality, I'd normally suggest doing it with a protocol. Something like: (defprotocol PWrappedIndex (get-wrapped [coll index])) (extend-protocol PWrappedIndex clojure.lang.Indexed (get-wrapped [coll index]

Re: Functions that return seqs

2013-07-02 Thread Mikera
It's not really breaking principle of least surprise if you "expect" such functions to return sequences. A lot of people do expect this after a little bit of Lisp experience (Clojure or otherwise) I can see two "advantages" to having many functions return seqs: - It's a shared abstraction, which

Re: [ANN] byte-streams: a rosetta stone for all the byte representations the jvm has to offer

2013-07-02 Thread Mikera
This is cool, thanks Zach! Another set of mostly-isomporphic types that this could be applied to is different matrix/array types in core.matrix. core.matrix already has generic conversion mechanisms but they probably aren't as efficient as they could be. I'll take a look and see if the same tec

Re: Casting to Object[]

2013-07-02 Thread Mikera
I think that is the only way. The good news is that this is Clojure, so you can easily wrap it in an "object-array-cast" macro On Tuesday, 2 July 2013 15:41:02 UTC+1, Dmitry Groshev wrote: > > Hello all. > > I have a following deftype: > > (deftype NDArray > [^objects data > ^long n

Re: which one would you prefer (instantiate vs. new-instance)?

2013-07-04 Thread Mikera
Both are somewhat problematic from a performance perspective. I'd actually be tempted to do this in a "higher order function" style that returns a compiled construction function for the correct argument types, e.g. something like (def double-builder (instantiator Double Long)) (double-builder 2

Re: which one would you prefer (instantiate vs. new-instance)?

2013-07-04 Thread Mikera
. > > have I completely misunderstood you? can you show a sample/overview of the > 'instantiator' fn you're referring to? > > thanks, > > Jim > > > On 04/07/13 13:04, Mikera wrote: > > Both are somewhat problematic from a performance perspective.

Re: Sequential conditional transforms of an argument

2013-07-05 Thread Mikera
I really like the as-> macro for this kind of thing. (as-> (something) x (if (test1 x) (transform1 x) x) (if (test2 x) (transform2 x) x) (do-something-else-with x y) (if (test3 x) (transform3 x) x)) Advantages: - It's part of core in 1.5 - It's a macro and com

Re: Sequential conditional transforms of an argument

2013-07-05 Thread Mikera
On Friday, 5 July 2013 16:52:10 UTC+1, Laurent PETIT wrote: > 2013/7/5 Mikera >: > > I really like the as-> macro for this kind of thing. > > > > (as-> (something) x > > (if (test1 x) (transform1 x) x) > > (if (test2 x) (transfo

Re: clojure interpreters?

2013-07-09 Thread Mikera
My post "The Environment as a Value" might be of interest to you. https://groups.google.com/forum/#!searchin/clojure-dev/immutable$20environment/clojure-dev/S8BawG7nzJA/qfCd7hn67aoJ It contains a lot of similar ideas. An important point is that you don't necessarily need an interpreter to get th

Re: Clojure: Elegance vs. Performance?

2013-07-09 Thread Mikera
First of all, great post and a lot of great points. I feel your pain, because I also find myself struggling a lot to make idiomatic code fast in Clojure. Often I end up being forced to use some pretty ugly tricks to get the performance I need. Sometimes I just end up coding inner loops in Java

Re: Clojure: Elegance vs. Performance?

2013-07-09 Thread Mikera
On Tuesday, 9 July 2013 17:31:21 UTC+1, puzzler wrote: > On Tue, Jul 9, 2013 at 8:11 AM, Alexander Gunnarson < > alexander...@gmail.com > wrote: > >> My idea, which is probably very naive, but one which I'm curious about, >> is: >> >> *Is it possible to have some sort of set of automatic-optimizi

Re: Clojure: Elegance vs. Performance?

2013-07-10 Thread Mikera
used dynamically, why should we pay the overhead for extra indirection / dynamic features? The same goes for things like boxing and type casts. On Wednesday, 10 July 2013 01:15:14 UTC+1, Colin Fleming wrote: > > Hi Mikera, > > For your mutable var loop example, I think with-local-va

Re: matrix: masked arrays

2013-07-10 Thread Mikera
You could use ereduce (elementwise reduce) in core.matrix to do this. Something like: (let [NaN Double/NaN [sum n] (ereduce (fn [[acc cnt] x] (if (Double/isNaN x) [acc cnt] [(+ acc x) (inc cnt)])) [0 0] [0.0 1.0 NaN 2.0 NaN 3.0 4.

Re: vectorz doesn't handle scalars?

2013-07-10 Thread Mikera
Hmmm it seems to work for me: (+ 5 (matrix [1 2 3])) => # What environment and what versions of vectorz-clj / Clojure are you using? Some of the older versions didn't support scalar to vector broadcasting so that might be the problem On Thursday, 11 July 2013 00:44:46 UTC+1, Brian Craft wr

Re: matrix data types

2013-07-10 Thread Mikera
Element types are dependent on the implementation. Some implementations support arbitrary (Object) data types - this includes the default implementation that supports Clojure persistent vectors, e.g. [1 nil :foo] is a valid vector. Mathematical operations on such vectors use standard functions

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
;0.8.0"] > [net.mikera/vectorz-clj "0.10.0"] > > > On Wednesday, July 10, 2013 5:40:41 PM UTC-7, Mikera wrote: >> >> Hmmm it seems to work for me: >> >> (+ 5 (matrix [1 2 3])) >> => # >> >> What environment and what versi

Re: Documentation / usage --- Array vs. Vector

2013-07-11 Thread Mikera
This is a heavily overloaded naming space - especially when you consider code.matrix as well, and usage of these words in mathematical / scientific communities. Data scientists generally expect a "vector" to be a 1D collection of numeric values, in the same sense that a "matrix" is a 2D collec

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
Hi Brian, I've released a new vectorz-clj version to Clojars which should fix the problem: [net.mikera/vectorz-clj "0.11.0"] Hopefully that works for you! On Thursday, 11 July 2013 00:44:46 UTC+1, Brian Craft wrote: > > Without vectorz: > > => (+ 5 (matrix [1 2 3])) > [6 7 8] > > With vectorz:

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
x27;[mikera.vectorz.core :as vz]) > > (vz/+ 5 (vec [1 2 3])) > > > ClassCastException java.lang.Long cannot be cast to > mikera.vectorz.AVector mikera.vectorz.core/clone (core.clj:38) > > > Any suggestions? Is there anything else I need to do to my repl? Am I just > misusing

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
thanks! > > Is there an element-wise matrix multiply? Maybe I can copy the code for > the / operator. > > > On Thursday, July 11, 2013 5:57:30 AM UTC-7, Mikera wrote: >> >> Hi Brian, >> >> I've released a new vectorz-clj version to Clojars whi

Re: vectorz doesn't handle scalars?

2013-07-11 Thread Mikera
? > > Thanks! > > Patrick > > On Thursday, July 11, 2013 9:50:52 AM UTC-4, Mikera wrote: >> >> Ah - that is expected behaviour because you are using the specialised >> vector-only operators in "mikera.vectorz.core". These are fast type-hinted >>

Re: Interest in a Full Featured Clojure Blog Engine

2013-07-18 Thread Mikera
It sounds like a great project. I think the challenge will be the making the different pieces fit together neatly: there are lots of somewhat-overlapping libraries and I don't think anyone has yet figured out the right way to plug everything together - at least in the sense that "composability"

Re: Design Question: Agents vs. Refs

2013-07-19 Thread Mikera
If you want to do in in "pure functional style" then I would suggest a single atom / ref that contains the whole game state (including monsters, players, map, items etc.) That's the approach I've taken in the two Clojure games I've written so far, and it has worked pretty well. You might be int

Re: primitive array casts

2013-07-20 Thread Mikera
Do you mean something like (int-array [1 2 3 4])? This is a cast-like operation that produces a primitive array of ints, exactly like int[] in Java. You can then use it with array operations like "aget". If you want to type-hint int-array parameters then you need to use something like "^ints"

Re: java interop: passing int[]

2013-07-22 Thread Mikera
You can use vectorz-clj if you want fast double[] vector and matrix operations on the JVM. https://github.com/mikera/vectorz-clj It's basically a comprehensive wrapper over almost everything you might possibly want to do with Java double[] arrays, but wrapped up behind the core.matrix A

Re: Can we please deprecate the :use directive ?

2013-07-25 Thread Mikera
On Tuesday, 23 July 2013 21:55:12 UTC+1, Sean Corfield wrote: > On Tue, Jul 23, 2013 at 1:53 PM, Ben Wolfson > > wrote: > > On Tue, Jul 23, 2013 at 1:50 PM, Stefan Kamphausen > > > > > > wrote: > >> It complects require and refer ;-) > > How so? > > Because use = require + refer (essentiall

Re: Can we please deprecate the :use directive ?

2013-07-25 Thread Mikera
On Tuesday, 23 July 2013 16:50:50 UTC+1, Greg Slepak wrote: > I think I read somewhere that :use is no longer encouraged, but I could be > mistaken. > > From what I've read, it seems like most people agree that Clojure has too > many ways of including/importing/referencing/requiring/using thing

Re: Can we please deprecate the :use directive ?

2013-07-25 Thread Mikera
On Tuesday, 23 July 2013 19:17:02 UTC+1, Jozef Wagner wrote: > +1, :use is IMO an antipattern. > > 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 :) > Hmmm perhaps I'm guilty of this. But I find code muc

ANN: core.matrix 0.9.0 / vectorz-clj 0.13.1

2013-07-25 Thread Mikera
Two more releases in the ongoing crusade to bring top-class numerical computing facilities to Clojure: https://github.com/mikera/matrix-api https://github.com/mikera/vectorz-clj Key contents: - New API function "fill!" - First version of Dmitry's generic NDArray implementatio

Re: [ANN] byte-transforms: methods for hashing, compressing, and encoding bytes

2013-07-25 Thread Mikera
This looks very useful - thanks Zach! On Thursday, 25 July 2013 03:05:05 UTC+1, Zach Tellman wrote: > > https://github.com/ztellman/byte-transforms > > This is just a thin wrapper over byte-streams [1] and some best-in-class > hashing and compression algorithms, but I figure there are at least a

Complex numbers, anyone?

2013-07-27 Thread Mikera
Hi all, We're having a design discussion in the Numerical Clojure group about how to extend core.matrix to efficiently handle arrays of arbitrary scalar types (out of which complex numbers represent the canonical and perhaps most important case) If this is an important or interesting topic for

Re: Symbol.intern doesnt return already interned symbols?

2013-07-27 Thread Mikera
On Saturday, 27 July 2013 03:59:55 UTC+1, Jeremy Heiler wrote: > On July 26, 2013 at 10:39:47 AM, Jürgen Hötzel > (jue...@hoetzel.info) > wrote: > > I did some memory profiling on a Clojure Application. > > I wondered why 361000 clojure.lang.Symbols exist. > > So I did some object browsing on th

Re: Interest in a commercial IDE for Clojure?

2013-07-27 Thread Mikera
I'm always a little amused when people highlight the fragmentation of tools as a problem, and their solution is to propose a new tool. Just joking :-) . Of course I'd never want to discourage innovation and investment in the Clojure tools space. I'm one of the people who likes my tools to be O

Re: YA regular expression tool

2013-07-30 Thread Mikera
On Monday, 29 July 2013 21:20:49 UTC+1, Joel Holdbrooks wrote: > > I spent some time this weekend writing a little tool for generating > regular expressions *from known inputs*. My goal is to produce regular > expressions that backtrack as few times as possible along with a complete > and total

Re: Two Dimensional Associative Map

2013-08-02 Thread Mikera
hing factor). https://github.com/mikera/mikera/blob/master/src/main/java/mikera/engine/PersistentTreeGrid.java It's actually a 3D grid, but you can use just 2 dimensions and keep the 3rd set to zero. On Friday, 2 August 2013 01:59:40 UTC+1, JvJ wrote: > > I'm looking for an as

Re: Status of Generic Functions (a la lisp)

2013-08-04 Thread Mikera
I don't think there is currently a way to do this that is simultaneously: 1) Generic (dispatches on the type of all arguments) 2) Extensible (can be extended to new types at runtime) 3) Fast (about as fast as JVM dispatch allows) Protocols give you 2) and 3). Multimethods give you 1) and 2). Custo

Re: Can we please deprecate the :use directive ?

2013-08-05 Thread Mikera
On Monday, 5 August 2013 09:40:04 UTC+1, Korny wrote: > Agree that :use should be deprecated, mostly as it's quite a barrier to > folks new to the language that you need to know 3 different parts of the ns > macro before you start. > I really don't think :use was ever a significant problem for n

Re: Can we please deprecate the :use directive ?

2013-08-05 Thread Mikera
On Monday, 5 August 2013 11:35:22 UTC+1, Phillip Lord wrote: > Anthony Grimes > writes: > > I can't think of a single good reason to not deprecate :use. :require > can > > do everything :use could do now. > > Wait for it, wait for it > > > This isn't about whether or not (:use ..) without

Re: Can we please deprecate the :use directive ?

2013-08-05 Thread Mikera
On Monday, 5 August 2013 09:50:34 UTC+1, Steven Degutis wrote: > The only time I've seen :as lead to ugly code was when it was in a DSL > that would probably have been nicer to use if it was a data-based DSL like > Hiccup rather than code-based. > It's pretty ugly to use aliases for numerical c

Re: Lisp newbie seeks (macro?) wisdom - instrumentation and app metadata

2013-08-07 Thread Mikera
I'd suggest avoiding macros until you absolutely know that you need them. Usually they aren't necessary. Prefer writing pure functions (without side effects) - these are easier to reason about, easier to test, simpler to write correctly and easier to plug together / compose via higher order fun

Re: Lisp newbie seeks (macro?) wisdom - instrumentation and app metadata

2013-08-09 Thread Mikera
ypes). Store this in either an atom, an agent or a ref (depending on how you want to handle concurrent access and updates - typically an atom is sufficient unless you care about transactional updates to this state) > > > > On Thu, Aug 8, 2013 at 2:36 AM, Mikera > > wrote: &

Re: Lisp newbie seeks (macro?) wisdom - instrumentation and app metadata

2013-08-09 Thread Mikera
on't know how to >> capitalize on this rather abstract and vague notion. >> >> How do folks usually go about it when they have a desire to query the >> running system about its shape and structure? >> >> >> >> On Thu, Aug 8, 2013 at 2:36 AM, Mi

Re: Lisp newbie seeks (macro?) wisdom - instrumentation and app metadata

2013-08-10 Thread Mikera
them out. > One is Ironclad - a steampunk themed strategy game: http://www.mikera.net/ironclad/ or https://github.com/mikera/ironclad The other is Alchemy, a 7-day Roguelike game: https://github.com/mikera/alchemy Both are somewhat interesting from technical perspective in the sense that th

Re: Do you like the Clojure syntax?

2013-08-13 Thread Mikera
On Monday, 12 August 2013 15:52:53 UTC+8, Răzvan Rotaru wrote: > Hi, > > I'm curious about the general opinion on the Clojure syntax, whether > people actually like it or just use it because it provides macros. So I > would like to ask you to participate in a poll. Thank You. > > The importance

core.async - handling nils

2013-08-15 Thread Mikera
Hi all, I'm experimenting with core.async. Most of it is exceptionally good, but bit I'm finding it *very* inconvenient that nil can't be sent over channels. In particular, you can't pipe arbitrary Clojure sequences through channels (since sequences can contain nils). I see this as a pretty b

Re: core.async - handling nils

2013-08-17 Thread Mikera
. I'd be curious to here what Rich & team > considered and how they're thinking about it. However, my expectation is > that the nil approach won't change, since it's pretty much good enough. > > On Thursday, August 15, 2013 10:44:48 PM UTC-4, Mikera wrote: >&g

Re: core.async - handling nils

2013-08-18 Thread Mikera
further wrapping. > > Sent from my iPhone > > On Aug 17, 2013, at 5:48 PM, Mikera > > wrote: > > My overall sense is that the convenience of using if-let directly in a few > use cases doesn't justify making channels fall short of being able to send > arbitrary

Re: What's your preference, partial or closures?

2013-08-18 Thread Mikera
I prefer to use closures / higher order functions that return a function. Reasons: - You typically get much better performance by returning a closure. "partial" uses "apply", which adds a lot of overhead - It can result in cleaner user code (partials require a bit of mental decoding, and you can

Re: preference and implications of using as-> vs let

2013-08-19 Thread Mikera
I think a regular "let" is clearer in this kind of case. "as->" suggests to me that multiple rebindings will happen to the name: if that is not happening then it is confusing for readers IMHO. The only case I can think of where "as->" makes sense and the binding only happens once is if you are

Re: tools for minimizing forward declaration

2013-08-19 Thread Mikera
I've found the requirement to define things in order to be a major pain in the following reasonably common situation: A) public API in one namespace B) various functions used to implement public API in another namespace A clearly depends on B. But B often needs to depend on A also: you typicall

Re: tools for minimizing forward declaration

2013-08-20 Thread Mikera
There's a way to reconcile all of this: if you treat the "environment as a value" then I believe you can achieve both: - Incremental REPL-style commands that work immediately in the current environment - Arbitrary declaration order in files >From a technical perspective, the environment would c

Re: A strange syntax about clojure defn

2013-08-22 Thread Mikera
It's an old style type hint, indicating that the function returns a value of class "Server" (the full Java class name is probably in an :import declaration at the top of the file) The new style of type hint is just "^Server". Both forms of type hint still work at present, but you should prefer

Re: ANN: clj-tuple, efficient small collections

2013-08-25 Thread Mikera
Good stuff Zach - I've certainly wanted something like this on various occasions. Some comments: - core.matrix will also work with clj-tuple (because they support ISeq) - If you made the tuples support IPersistentVector I think they would be even more useful: it's helpful I think to see tuples

Re: lazy seq from reducers with core.async

2013-08-25 Thread Mikera
Nice idea Jozef! Hmmm this is another example of why nil-as-end-of-channel is a slightly problematic design decision for core.async: it makes this kind of code much more fiddly. On Monday, 26 August 2013 01:47:14 UTC+8, Jozef Wagner wrote: > > Hi, > > A distinctive feature of reducers is th

Re: [ANN] nativot 0.1.0 (leiningen plugin) public beta

2013-08-26 Thread Mikera
JarClassLoader looks cool Aren't there some pretty severe licensing restrictions though? Looks like it is GPLv3 or commercial license only from the website, which rules it out of most EPL projects I think On Tuesday, 27 August 2013 03:50:10 UTC+8, Alex Fowler wrote: > > > hi, nativot is a l

Re: core.async - handling nils

2013-08-27 Thread Mikera
Well, that's certainly a good explanation of why core.async works the way it does now - it's a natural and sensible starting point to build on Java Queues. I don't think that this necessarily implies that we have to follow this model in the future Clojure API though. The Java designers didn't a

Re: ANN Introducing EEP, a young [event] stream processing library

2013-08-30 Thread Mikera
Looks very interesting, thanks for sharing! Could you summarise how this fits in the ecosystem relative to Storm, Aleph etc? When should EEP be the most appropriate choice? On Saturday, 31 August 2013 05:02:27 UTC+8, Michael Klishin wrote: > > On behalf of the ClojureWerkz team [1], I'm happy to

Re: Java Metadata Wrapper

2013-08-30 Thread Mikera
It would be better, I think, if metadata was attachable via a protocol rather than than a wrapper: then you could just extend the protocol to any arbitrary Java class. Wrappers are a pain to make work because of wrapping / unwrapping and protocols also have the advantage of being very efficient.

Re: Java Metadata Wrapper

2013-08-30 Thread Mikera
lso been interested in this for Named (a protocol for things I can > call "name" on), although my use-case is mostly interop with Java > frameworks. > > > On 31 August 2013 15:13, Mikera >wrote: > >> It would be better, I think, if metadata was attachable via a pro

Re: Java Metadata Wrapper

2013-09-01 Thread Mikera
I was actually thinking of the case where the metadata was computed in some way from the Java object (i.e. when it is more like read-only property). In most of the cases where I have wanted metadata on arbitrary Java objects, this would have been sufficient. You probably want to go the wrapper

Re: hashing binary data

2013-09-03 Thread Mikera
On Wednesday, 4 September 2013 10:00:42 UTC+8, Brian Craft wrote: > I'm loading data files of about 1-2G, which are composed of a bunch of > numeric data blocks. I need to store the data blocks w/o storing > duplicates. They arrive as vectors of floats, and are stored as primitive > byte arrays

Re: hashing binary data

2013-09-03 Thread Mikera
On Wednesday, 4 September 2013 12:37:33 UTC+8, Brian Craft wrote: > > > > On Tuesday, September 3, 2013 9:14:30 PM UTC-7, Mikera wrote: >> >> On Wednesday, 4 September 2013 10:00:42 UTC+8, Brian Craft wrote: >> >>> I'm loading data files of

Re: BigDecimal and ==, with a proposed fix

2013-09-03 Thread Mikera
On Friday, 2 August 2013 12:28:51 UTC+8, CGAT wrote: > My understanding of == is that it is intended to establish numerical > equivalence > across types. But I think that basic contract fails with BigDecimal. For > instance, > > (== 1M 1.0M) ; => false > > because the scale properties of

Re: BigDecimal and ==, with a proposed fix

2013-09-03 Thread Mikera
On Wednesday, 4 September 2013 13:19:16 UTC+8, Mikera wrote: > On Friday, 2 August 2013 12:28:51 UTC+8, CGAT wrote: > >> My understanding of == is that it is intended to establish numerical >> equivalence >> across types. But I think that basic contract fails

Handling name collisions with clojure.core

2013-09-04 Thread Mikera
Hi all, While building the API for core.matrix, I've fun into a few cases where the "best" name is a direct clash with clojure.core. Examples are "+", "zero?", "vector?", "==" In many of these cases, the core.matrix behaviour is a natural extension of the clojure.core function (i.e. it extends

Re: Handling name collisions with clojure.core

2013-09-04 Thread Mikera
lob/master/src/primitive_math.clj#L154 > [2] > https://github.com/ztellman/primitive-math/blob/master/src/primitive_math.clj#L135 > > On Wednesday, September 4, 2013 6:22:08 PM UTC-7, Mikera wrote: >> >> Hi all, >> >> While building the API for core.matrix, I&#x

Re: Handling name collisions with clojure.core

2013-09-04 Thread Mikera
and not spit out warnings. And in my view (:use clojure.core.matrix) is already being very explicit: our user wants to write numerical code in this namespace, and would like to have all the relevant functions available :-) > > Sean > > On Wed, Sep 4, 2013 at 6:22 PM, Mikera >

Re: Counterclockwise

2013-09-05 Thread Mikera
Counterclockwise is great and it's definitely very actively developed. Laurent does a fantastic job and is very responsive. Perhaps you should be looking at the current GitHub tree rather than the old Google Code one? - https://github.com/laurentpetit/ccw/commits/master On Friday, 6 September

Re: Handling name collisions with clojure.core

2013-09-06 Thread Mikera
On Friday, 6 September 2013 03:15:40 UTC+8, Sean Corfield wrote: > On Wed, Sep 4, 2013 at 11:25 PM, Mikera > > wrote: > > I remember the debates :-) and I don't think there was anything like a > > consensus that "don't do that" is the right answer. >

Re: Handling name collisions with clojure.core

2013-09-06 Thread Mikera
On Friday, 6 September 2013 02:30:22 UTC+8, Armando Blancas wrote: > I just think the default behaviour should be super-friendly and not spit >> out warnings. >> > > If other libs also redefine any of those operators or names, now or in > later versions, I'd be glad to know. With last-one-in-w

Re: Clojure, floats, ints and OpenGL

2013-09-09 Thread Mikera
+1 for supporting all the JVM primitive types properly. It is worth noting that the benefits would extend much further than just OpenGL, e.g.: - int is a commonly used type in Java interop. Casting to/from it all the time is a minor annoyance/overhead - int is the type used for array indexing

Re: Clojure, floats, ints and OpenGL

2013-09-09 Thread Mikera
recieve a boxed Object and thus cannot > use == for comparison. > > JW > > > On Mon, Sep 9, 2013 at 6:02 PM, Mikera > > wrote: > >> +1 for supporting all the JVM primitive types properly. >> >> It is worth noting that the benefits would extend much f

Re: Functional purity and "globals" in Clojure

2013-09-11 Thread Mikera
state at all - you can launch several totally independent game instances from the same REPL. If you are interested, see the "launch" code at the bottom of this file: https://github.com/mikera/alchemy/blob/master/src/main/clojure/mikera/alchemy/main.clj On Tuesday, 10 September 2013 15:19:35 UTC

Re: macro woes (deftype generator)

2013-09-11 Thread Mikera
lised 2D and 3D transformation matrices (rotations, scaling etc.) - Affine transformations - core.matrix fully supported (which gives you a lot of more general matrix/vector features with a nice Clojure API) See: https://github.com/mikera/vectorz-clj And core.matrix: https://github.com/mikera/matrix-api

Re: Clojure, floats, ints and OpenGL

2013-09-12 Thread Mikera
On Friday, 13 September 2013 00:07:03 UTC+8, Christophe Grand wrote: > As others have already said: long & double only is a restriction for > function args. Not for interop. Not for local computations. Not for args to > definterface methods. The reason for this restriction is the combinatorial

Re: Clojure, floats, ints and OpenGL

2013-09-12 Thread Mikera
People *have* run into this problem a lot. People have just worked around it. The existence of great libraries like HipHip and vectorz-clj and some of Zach's stuff is IMHO to a large extent because people have needed high performance operations (often involving primitives / primitive arrays / c

Re: Clojure, floats, ints and OpenGL

2013-09-13 Thread Mikera
tter, IMHO, than forever accepting semantics that prevent idiomatic code from ever being truly fast. I'd rather see a bit of breakage and fix my code when upgrading to Clojure 2.0 than be stuck with poor performance forever. > > Timothy > > > On Thu, Sep 12, 2013 at 8:41

Re: Clojure, floats, ints and OpenGL

2013-09-14 Thread Mikera
namic var deref, but gain better runtime performance and the ability to use arbitrary types / primitives (which solves the OP's problem). This limited-scope proposal won't effect any existing dynamic usage, so people who like their fully mutable vars with their dynamic lookups can kee

Re: Clojure, floats, ints and OpenGL

2013-09-15 Thread Mikera
roposal > needs to have a working prototype, to prove that these ideas actually work, > until then proposals don't do much at all. Personally I don't see how the > ideas in this proposal would work from the repl, and the repl is where most > people do their work. > On Sep

Re: Clojure, floats, ints and OpenGL

2013-09-15 Thread Mikera
roposal > needs to have a working prototype, to prove that these ideas actually work, > until then proposals don't do much at all. Personally I don't see how the > ideas in this proposal would work from the repl, and the repl is where most > people do their work. > On Sep

Re: [ANN] Neanderthal, a fast, native matrix and linear algebra library for Clojure released + call for help

2015-01-13 Thread Mikera
g your tool in by changing a single line setting the underlying >> implementation to Neanderthal. And as Mikera points out, it would be nice >> if we kept the Clojure matrix API space cohesive. >> > -- You received this message because you are subscribed to the Google Groups &quo

Re: Clojure for Desktop UI Design Application

2015-01-13 Thread Mikera
I'd be pretty interested in this too. Though not quite enough to write it myself (I've made "good enough" interfaces with Swing interop). The thought occurs that there may be quite a bit of common code that could be shared with respect to diffing / cursors etc. that would work equally well for

  1   2   3   4   >