Re: importing a single function in ns

2014-06-06 Thread Reid McKenzie
(ns foo (:use com.foo.bar :only [baz quxx])) is totally supported by the ns macro. Reid On 06/07/2014 12:53 AM, Glen Rubin wrote: > My namespace currently looks like this: > > > (ns providence.core > (:gen-class) > (:use seesaw.chooser) > (:use seesaw.core) > (:use clojure.java.shell))

importing a single function in ns

2014-06-06 Thread Glen Rubin
My namespace currently looks like this: (ns providence.core (:gen-class) (:use seesaw.chooser) (:use seesaw.core) (:use clojure.java.shell)) However, I only use sh from java.shell choose-file from seesaw.chooser and alert from seesaw.core. How do I import these single functions from th

Re: Advice on managing random number generators across threads

2014-06-06 Thread Mars0i
On Friday, June 6, 2014 10:33:04 PM UTC-5, Mars0i wrote: > > On Friday, June 6, 2014 2:26:25 PM UTC-5, Linus Ericsson wrote: >> >> Here I assume that the incoming calls to agents aren't guaranteed to >> strictly ordered among different agents, even though the agents reside in >> one of two thre

Re: bigint and biginteger

2014-06-06 Thread Mark Engelberg
Java has a class called java.math.BigInteger. Clojure's biginteger simply typecasts to the built-in java class. Several years ago, Clojure exclusively used java.math.BigInteger to handle integers larger than longs. Back then, Clojure's arithmetic operators would automatically overflow, so if you

Re: Advice on managing random number generators across threads

2014-06-06 Thread Mars0i
Wow. Linus, thanks for the very detailed answer. It sounds as your view is that there's no problem with the logic of my proposed solution, but it seems wasteful to create 100 RNGs, when I don't actually need to have so many of them. Your solutions provide ways to get the same result without m

Re: Advice on managing random number generators across threads

2014-06-06 Thread Mars0i
Thanks Lee. It looks like this could be useful. On Friday, June 6, 2014 4:19:11 PM UTC-5, Lee wrote: > > > I don't know if this will be helpful in your application, or even if it's > the best approach for our own work (or if java 1.7 provides a simpler > approach?), but FWIW one of my projects

Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread David Nolen
Given the feedback so far such a request seems to be in the minority. You could run a separate project for the CLJS parts. That said, is there something in the latest release (0.0-2227) that you find problematic that you can't continue with it? David On Fri, Jun 6, 2014 at 8:36 PM, Matching Socks

bigint and biginteger

2014-06-06 Thread Plínio Balduino
Hi there. I read old threads and I didn't understand why Clojure has bigint and biginteger. Could you explain better? Thank you Plínio -- 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 No

Re: [ANN] clj-generators - generator magic inspired by Python

2014-06-06 Thread Gary Johnson
Gotcha. By all means then, hack away. ;-) -- 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 unsubs

Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread Matching Socks
Can a lein-cljsbuild clj+cljs project specify separate versions of Clojure for the cljs and clj parts? If not, please give it another 6 months. On Friday, June 6, 2014 10:43:42 AM UTC-4, David Nolen wrote: > > Future releases of ClojureScript will have a hard dependency on Clojure > 1.6.0

Re: Extend-protocol to numbers fails with zero in CLJS

2014-06-06 Thread Logan Linn
It will work for 0 if you use `number` instead of `js/Number`. Generally you shouldn't extend any js/* type On Friday, June 6, 2014 9:57:38 AM UTC-7, Karsten Schmidt wrote: > > I'm trying to extend-protocol for numbers and various other types (incl. > collections & nil) in CLJS, so have been doi

Re: [ANN] clj-generators - generator magic inspired by Python

2014-06-06 Thread Alex Engelberg
Gary, I fully acknowledge that there are many ways to create lazy sequences that are much more elegant and efficient. However, as I mentioned, I'm very fascinated by generators in Python, and I mostly wanted to toy around with how to implement it in Clojure. Also, as I mentioned, for beginners w

Re: Advice on managing random number generators across threads

2014-06-06 Thread Lee Spector
I don't know if this will be helpful in your application, or even if it's the best approach for our own work (or if java 1.7 provides a simpler approach?), but FWIW one of my projects deals with the thread-local RNG issue via: https://clojars.org/clj-random -Lee On Jun 6, 2014, at 12:28 PM,

Re: Advice on managing random number generators across threads

2014-06-06 Thread Linus Ericsson
(I think your stepwise problem is better to be solved without agents, see below.) I realized that the *rng* actually is conflated, it keeps both the state for the random number generator AND the algorithm used for the random number generation. This is usually not a problem, since the state-size an

Re: Advice on managing random number generators across threads

2014-06-06 Thread Mars0i
On Friday, June 6, 2014 2:05:16 PM UTC-5, Gunnar Völkel wrote: > > In Java 7 you would use ThreadLocalRandom you said in another thread. > Well, in Java 6 you already have ThreadLocal [1] and thus you are able to > build a thread local Random yourself to keep Java 6 as minimum requirement. > > [1

Re: Advice on managing random number generators across threads

2014-06-06 Thread Gunnar Völkel
In Java 7 you would use ThreadLocalRandom you said in another thread. Well, in Java 6 you already have ThreadLocal [1] and thus you are able to build a thread local Random yourself to keep Java 6 as minimum requirement. [1] http://docs.oracle.com/javase/6/docs/api/index.html?java/lang/ThreadLoc

Re: [ClojureScript] Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread Mimmo Cosenza
that’s great. thanks Nicola mimmo On 06 Jun 2014, at 19:48, Nicola Mometto wrote: > > For that matters, I'm working on writing tools.analyzer.js and the > minimum clojure version supported will be 1.4.0 > > Nicola > > > Chris Granger writes: > >> Since I doubt there'd be any others, I'll be

Re: [ClojureScript] Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread Nicola Mometto
For that matters, I'm working on writing tools.analyzer.js and the minimum clojure version supported will be 1.4.0 Nicola Chris Granger writes: > Since I doubt there'd be any others, I'll be the only dissenter ;) > > People already get mad Light Table requiring 1.5 since we use CLJS to do > an

Re: [ClojureScript] Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread David Nolen
My hope is that the GSoC analyzer work will allow ClojureScript and projects like LT to share an analyzer without the hassle of conflicting release cycles. Any help to expedite this decoupling is of course appreciated. David On Fri, Jun 6, 2014 at 1:43 PM, Chris Granger wrote: > Since I doubt

Re: [ClojureScript] Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread Chris Granger
Since I doubt there'd be any others, I'll be the only dissenter ;) People already get mad Light Table requiring 1.5 since we use CLJS to do analysis and such. Bumping it up to 1.6 means it'd be a long time before we could move our version of CLJS again. Maybe that's not a real issue and really jus

Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread Mimmo Cosenza
+1 mimmo On 06 Jun 2014, at 19:22, Andrey Antukh wrote: > +1 > > > 2014-06-06 19:19 GMT+02:00 Karsten Schmidt : > +1 > > On 6 Jun 2014 16:59, "David Nolen" wrote: > Clojure 1.6.0 introduced Murmur3 for much improved collection hashing and > several new functions & macros. There's very littl

Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread Andrey Antukh
+1 2014-06-06 19:19 GMT+02:00 Karsten Schmidt : > +1 > On 6 Jun 2014 16:59, "David Nolen" wrote: > >> Clojure 1.6.0 introduced Murmur3 for much improved collection hashing and >> several new functions & macros. There's very little incentive to continue >> to support 1.5.X given these enhancemen

Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread Karsten Schmidt
+1 On 6 Jun 2014 16:59, "David Nolen" wrote: > Clojure 1.6.0 introduced Murmur3 for much improved collection hashing and > several new functions & macros. There's very little incentive to continue > to support 1.5.X given these enhancements. > > David > > > On Fri, Jun 6, 2014 at 11:48 AM, Joshua

Re: Clojure on iOS devices - Swift as a host?

2014-06-06 Thread Mike Fikes
Maybe ClojureSwift does have potential, even with respect to *performance* as well: There's decent speculative chatter [1] about Swift’s safety enabling aggressive optimizations that can't be performed in unsafe languages like Objective-C, with Swift outperforming on RC4 and other benchmarks. [

Re: Extend-protocol to numbers fails with zero in CLJS

2014-06-06 Thread Karsten Schmidt
...actually, this would be sufficient: if (goog.isDefAndNotNull(and__3466__auto__)) { ... } On 6 Jun 2014 17:57, "Karsten Schmidt" wrote: > I'm trying to extend-protocol for numbers and various other types (incl. > collections & nil) in CLJS, so have been doing something like this (reduced > ema

Extend-protocol to numbers fails with zero in CLJS

2014-06-06 Thread Karsten Schmidt
I'm trying to extend-protocol for numbers and various other types (incl. collections & nil) in CLJS, so have been doing something like this (reduced email version): (defprotocol PDeltaEq (delta= [a b])) (extend-protocol PDeltaEq js/Number (delta= [a b] :yay) nil (delta= [_ b] (nil? b)))

Re: Advice on managing random number generators across threads

2014-06-06 Thread Mars0i
One more point: I would save the system-time-determined seed of the initial RNG to a file (i.e. the RNG used to generate seeds for each Person's RNG). I believe this will allow me to re-run a simulation with identical results, by seeding the initial RNG with the seed saved from the previous si

Advice on managing random number generators across threads

2014-06-06 Thread Mars0i
I'm writing an agent-based simulation framework, in which agents are Clojure records called Persons. There are 40-100 persons at present, but conceivably the number could go up to 1000. In each timestep, Persons' states are functionally updated by mapping update functions across the collectio

Re: Eval-ing a map expression in Emacs Live doesn't seem to work

2014-06-06 Thread J Irving
Not sure I follow. When you eval in the REPL buffer, you just have to type (foo "name") and hit return. When you do this (and you're in the correct namespace, which you can tell by seeing the namespace in the REPL prompt) it should evaluate correctly. Is that not happening? What buffer are you hi

Re: ClojureScript & Clojure 1.6.0

2014-06-06 Thread David Nolen
Clojure 1.6.0 introduced Murmur3 for much improved collection hashing and several new functions & macros. There's very little incentive to continue to support 1.5.X given these enhancements. David On Fri, Jun 6, 2014 at 11:48 AM, Joshua Ballanco wrote: > No objection, but I’m curious what are

ClojureScript & Clojure 1.6.0

2014-06-06 Thread David Nolen
Future releases of ClojureScript will have a hard dependency on Clojure 1.6.0. If you have any objections, speak up now :) David -- 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 p

Re: Is it the right Clojure group for a newbie

2014-06-06 Thread douglas smith
here is pdf of Little Schemer http://scottn.us/downloads/The_Little_Schemer.pdf On Friday, June 6, 2014 9:17:58 AM UTC-4, douglas smith wrote: > > Sounds like we are in a similar position. > > Maybe we could start a study group of sorts. -not sure how? > > We could post back to this thread

Re: Is it the right Clojure group for a newbie

2014-06-06 Thread douglas smith
Sounds like we are in a similar position. Maybe we could start a study group of sorts. -not sure how? We could post back to this thread for now and see what happens. Someone have a better suggestion? Doug On Monday, June 2, 2014 5:36:51 PM UTC-4, shar...@gmail.com wrote: > > All, >

Re: arguments passed to a macro

2014-06-06 Thread Phillip Lord
Christopher Howard writes: > Is there a trick for "pre-expanding" some of the arguments passed to a > macro? Say you wanted to do this > > code: > > (def swing-imports '(javax.swing JFrame JButton ImageIcon JPanel)) > > (ns example.myprogram > (:import swing-imports)) > ... >

Re: Effective Clojure book?

2014-06-06 Thread Frank Castellucci
No, but there is support for just about everything Meyers so if you already own that you just saved yourself some money! Frank On Wednesday, June 4, 2014 9:30:26 PM UTC-4, Mike Fikes wrote: > > Are there any books yet that prescribe best practices for Clojure, à la > Meyers or Bloch? > -- Yo