Re: advantage of dynamic typing

2011-09-21 Thread Ken Wesson
On Wed, Sep 21, 2011 at 3:00 AM, Dennis Haupt d.haup...@googlemail.com wrote: yes, but you magically need to know a) for which types does it work? if you give a byte to the function, will you get an error, or its first bit? or its first char after its been converted to a string? b) if i want

Re: coding-dojo-20110921

2011-09-21 Thread Ken Wesson
On Wed, Sep 21, 2011 at 8:20 AM, Denis Labaye denis.lab...@gmail.com wrote: Hello, On a code une implem alternative de retour dans le RER: https://gist.github.com/1231894 A+ Denis Hello, On a code what?? -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp

Re: coding-dojo-20110921

2011-09-21 Thread Ken Wesson
On Wed, Sep 21, 2011 at 3:13 PM, Meikel Brandmeyer m...@kotka.de wrote: Am 21.09.2011 um 19:59 schrieb Ken Wesson: On Wed, Sep 21, 2011 at 8:20 AM, Denis Labaye denis.lab...@gmail.com wrote: On a code une implem alternative de retour dans le RER: https://gist.github.com/1231894 On a code

Re: implement a shell in repl

2011-09-20 Thread Ken Wesson
Wouldn't the simplest way be to simply use the REPL itself as the shell, with a few things defined like this? (def dir (atom (System/getProperty user.home))) (defn pwd [] @dir) (defn cd [dir] (reset! @dir dir)) (defn ... ) -- Protege: What is this seething mass of parentheses?! Master: Your

Re: Is there a reason that def- isn't part of the core lib?

2011-09-19 Thread Ken Wesson
On Sun, Sep 18, 2011 at 6:12 PM, Luc Prefontaine lprefonta...@softaddicts.ca wrote: And yes, defn- should be located elsewhere than in core. +1 for moving it out of core, at least, defn- should not be make publicly available by core. I'm of more or less the opposite appearance: anything that

Re: Language shoutout clojure code does not have types

2011-09-19 Thread Ken Wesson
On Sun, Sep 18, 2011 at 11:20 AM, Andy Fingerhut andy.finger...@gmail.com wrote: One more detail.  The Scala program, and I think all of the fastest programs for that problem, use the GNU GMP library for big integer arithmetic. If that's true, then it indicates that the Java BigInteger class is

Re: Clojure embedded in a Java Application

2011-09-18 Thread Ken Wesson
On Sun, Sep 18, 2011 at 4:06 AM, Meikel Brandmeyer m...@kotka.de wrote: Am 18.09.2011 um 05:55 schrieb Ken Wesson: The easiest might be to just pass a map literal (in String form) through the Clojure reader. Variable integers or other simple objects can just be incorporated using the Java

Re: Clojure embedded in a Java Application

2011-09-18 Thread Ken Wesson
On Sun, Sep 18, 2011 at 4:40 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 18.09.2011 um 10:11 schrieb Ken Wesson: Tell me which is simpler: Reader.read({:foo 1 :bar + x + }); String x = 13rabc; Have fun. Syntactically invalid Clojure code would fail just as much in Clojure source

Re: Clojure embedded in a Java Application

2011-09-17 Thread Ken Wesson
On Sat, Sep 17, 2011 at 10:58 PM, Eamonn odon...@gmail.com wrote: Hi Meikel Thank you for your reply.  Is there a way to populate the HashMap before passing it to the invoke method The easiest might be to just pass a map literal (in String form) through the Clojure reader. Variable integers or

Re: misuse of or bug in transients?

2011-09-16 Thread Ken Wesson
IMO, get and contains? should work on transients. If the fn-call variant of get works, the others can for transients be defined in terms of that. Add containsKey to ITransientAssociative and implement containsKey on transient sets and maps to do what calling them as functions does, and the problem

Re: How to convert general recursion to loop .. recur syntax

2011-09-15 Thread Ken Wesson
On Thu, Sep 15, 2011 at 8:56 AM, Herwig Hochleitner hhochleit...@gmail.com wrote: Consider (defn find-in-tree  ([tree pred?]    (concat      (filter pred? tree)      (mapcat find-in-tree (filter sequential? tree) (repeat pred?) which of course is much simpler written as (defn

Re: autoboxing in 1.3 RC-0

2011-09-15 Thread Ken Wesson
On Thu, Sep 15, 2011 at 10:50 AM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Sep 15, 2011 at 3:18 AM, Sergey Didenko sergey.dide...@gmail.com wrote: Auto-boxing loop arg: change (loop [x 1 changed 0]  (if (= x 10)    changed    (recur (inc x)           (loop [y 1 changed-y changed]

Re: puzzlement over lazy sequences

2011-09-13 Thread Ken Wesson
On Tue, Sep 13, 2011 at 2:39 AM, Michael Gardner gardne...@gmail.com wrote: On Sep 12, 2011, at 11:28 PM, Ken Wesson wrote: But if, as you say, take, drop, etc. work for larger n, it should be easy to make nth work with larger n and non-random-access seqs, just by changing the non-random

Re: puzzlement over lazy sequences

2011-09-13 Thread Ken Wesson
On Tue, Sep 13, 2011 at 4:18 AM, Stefan Kamphausen ska2...@googlemail.com wrote: Hi, On Tuesday, September 13, 2011 6:28:01 AM UTC+2, Ken Wesson wrote: They're trees of arrays of 32 items, and the trees can in principle have arbitrary depth. So the 2^31 limit on Java arrays doesn't impact

Re: puzzlement over lazy sequences

2011-09-12 Thread Ken Wesson
On Mon, Sep 12, 2011 at 12:54 AM, Alan Malloy a...@malloys.org wrote: Integer overflow. user (mod 9876543210 (bigint (Math/pow 2 32))) 1286608618 Oops. But nth can probably be fixed while keeping good performance: (defn- small-drop [s n] (loop [n (int n) s (seq s)] (if (zero? n) s

Re: puzzlement over lazy sequences

2011-09-12 Thread Ken Wesson
On Mon, Sep 12, 2011 at 11:55 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: I'm guessing there are similar bugs in drop, take, and so forth with large n and large (or infinite) seqs. They should all be fixed. The other fns are ok, thanks to their separate heritage. drop, take, et al

Re: puzzlement over lazy sequences

2011-09-11 Thread Ken Wesson
On Sun, Sep 11, 2011 at 8:28 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: cycle actually calls lazy-seq.  A quick way to check such things at the REPL is with source: user= (source cycle) (defn cycle   Returns a lazy (infinite!) sequence of repetitions of the items in coll.   {:added

Re: Clojure 1.3: defs can now have docstrings; how so?

2011-09-06 Thread Ken Wesson
On Tue, Sep 6, 2011 at 9:13 AM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: user= (def foo A foo :foo) #'user/foo user= (doc foo) - user/foo   A foo nil Hrm. Doc on a var not bound to a function or macro doesn't print its (default) value? -- Protege: What is

Re: not= counterintuitive?

2011-09-04 Thread Ken Wesson
On Sat, Sep 3, 2011 at 1:30 PM, Despite desp...@gmail.com wrote: So, you want to make sure each value in the vector is unique?  My first thought was to put them into a set, then see if the set was equal to the vector, but clojure's equality doesn't allow for that. And if you put the set back

Re: new Getting Started page

2011-09-04 Thread Ken Wesson
On Sat, Sep 3, 2011 at 2:11 AM, Kevin Downey redc...@gmail.com wrote: The idea that the way to get started is with a fancy editor and a fancy ide is just crazy. The way to get started with Clojure is: write functions, and run them, and be happy. None of that requires any of the mandated

Re: new Getting Started page

2011-09-04 Thread Ken Wesson
On Sun, Sep 4, 2011 at 9:50 PM, Alan Malloy a...@malloys.org wrote: Are we catering to the crowd who (1) wants to try Clojure, and (2) doesn't have a text editor with copy/paste on their system? Well, in the original context a Unix commandline environment was being suggested as well, which

Re: how to create a ordered data structure which would efficiently return the element before and after it

2011-09-01 Thread Ken Wesson
On Thu, Sep 1, 2011 at 2:08 PM, Alan Malloy a...@malloys.org wrote: Well, the two calls to subseq are unpleasant and possibly slow. I was thinking there's a way to write it as a single operation that returns three items, say (subseq s = (dec 50)) to get the items before and after 50, but of

Re: Top secret clojure project names

2011-09-01 Thread Ken Wesson
On Thu, Sep 1, 2011 at 5:31 PM, JAX jayunit...@gmail.com wrote: Hi guys: I assume some of you have secret Clojure projects at work, that your bosses don't know about. I was going to suggest that we all decide on a convention for top secret clojure project names... Like maybe soft drink

Re: passing a list as a ref bombs

2011-08-31 Thread Ken Wesson
On Wed, Aug 31, 2011 at 3:14 PM, loonster tbur...@acm.org wrote: I'm converting a newLisp application I wrote, in production for several years, into clojure, and got stuck immediately. (def input-list (ref '(OR,CA,CO,ID,WA))) (defn list-ploop  accepts a ref and returns a list's first and

Re: get keys from defrecord

2011-08-30 Thread Ken Wesson
On Mon, Aug 29, 2011 at 10:14 PM, Steve Miner stevemi...@gmail.com wrote: On Aug 29, 2011, at 8:20 PM, Alex Miller wrote: I'm not sure if there are any enhancements in the 1.3 record support for this feature. In 1.3beta2, the record class has a static method getBasis that will give you

Re: ClojureScript and lein?

2011-08-30 Thread Ken Wesson
On Mon, Aug 29, 2011 at 9:09 PM, Eric Lavigne lavigne.e...@gmail.com wrote: I'm also a Mac user and probably in home all this howto will work, but in company where we all are using Windows there is no chance to get it working easily. There are people at your workplace who program in Clojure,

Re: A re look at re-groups

2011-08-30 Thread Ken Wesson
On Tue, Aug 30, 2011 at 11:18 AM, Matt Smith m0sm...@gmail.com wrote: I have been studying patterns or the notion of idiomatic code in Clojure.  The code in clojure.core has some good examples of proper Clojure code and is well done.  For that reason I was a bit surprised at the definition

Re: ClojureScript and lein?

2011-08-30 Thread Ken Wesson
On Tue, Aug 30, 2011 at 1:03 PM, Mark Rathwell mark.rathw...@gmail.com wrote: The sole alternative to an additional machine in that case is to perform major surgery on an existing one, involving a hard drive repartitioning VirtualBox is free:  http://www.virtualbox.org/ Emulators? I hadn't

Re: ClojureScript and lein?

2011-08-30 Thread Ken Wesson
On Tue, Aug 30, 2011 at 2:19 PM, Phil Hagelberg p...@hagelb.org wrote: On Tue, Aug 30, 2011 at 10:10 AM, Ken Wesson kwess...@gmail.com wrote: VirtualBox is free:  http://www.virtualbox.org/ Emulators? I hadn't considered those [...] I'd think it especially likely that if there's a free one

Re: mutability in the let-form!?

2011-08-27 Thread Ken Wesson
On Sat, Aug 27, 2011 at 6:05 AM, Alan Malloy a...@malloys.org wrote: Stylistically, it's often not very nice to rebind x a number of times; it's better to choose descriptive names for the intermediate steps. But there are certainly times occasions where using the same name can clarify meaning:

Re: JVM 7 support (invokedynamic)

2011-08-25 Thread Ken Wesson
On Thu, Aug 25, 2011 at 2:49 AM, Tal Liron tal.li...@gmail.com wrote: Hey folks, I just want to reassure y'all that I am working on this. It took a while to create a test environment: one of the challenges of using invokedynamic is that the Java language does not support it; so the best way

Re: Why can't I print new sequence?

2011-08-25 Thread Ken Wesson
On Thu, Aug 25, 2011 at 7:53 AM, octopusgrabbus octopusgrab...@gmail.com wrote: Ken: Thanks for the answer. You're welcome. You're correct about distinct. I'm working through some exercises. Ah. Always good to get to know the language better. -- Protege: What is this seething mass of

Re: Making clojure.lang.IDeref a protocol

2011-08-25 Thread Ken Wesson
On Thu, Aug 25, 2011 at 11:40 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: Has there been discussion about making clojure.lang.IDeref a protocol? Someday. The challenge is load order. A lot would have to change to make protocols available early enough in Clojure's bootstrap to allow

Re: I/O

2011-08-25 Thread Ken Wesson
On Thu, Aug 25, 2011 at 6:49 PM, Lee Spector lspec...@hampshire.edu wrote: While slurp and spit are beautifully elegant it's not so elegant to tell slurp how to find the file you want it to slurp. In many other languages/environments there's a concept of the working directory or project

Re: Peculiar transients behaviour

2011-08-24 Thread Ken Wesson
What does zipmap do if the key seq contains duplications? -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- You received this message because

Re: Apply concat and mapcat evaluate seqs unnecessarily

2011-08-24 Thread Ken Wesson
On Wed, Aug 24, 2011 at 3:49 PM, Asim Jalis asimja...@gmail.com wrote: I used take 0 as a simple example to illustrate the problem. But in general the standard mapcat evaluates terms than are needed. My f function does a web call and processes the JSON records produced by this call, so each

Re: Why can't I print new sequence?

2011-08-24 Thread Ken Wesson
On Wed, Aug 24, 2011 at 5:58 PM, octopusgrabbus octopusgrab...@gmail.com wrote: (defn f1     [in-seq]     (loop [new-seq [] cur-seq in-seq]     (if (nil? (first cur-seq))     new-seq     (if-not (nil? (x-in-seq (first cur-seq) new-seq))     (recur (conj

Re: clojure.java.jdbc: mapping BigDecimal to double

2011-08-23 Thread Ken Wesson
On Tue, Aug 23, 2011 at 9:54 PM, HiHeelHottie hiheelhot...@gmail.com wrote: Are there any future plans to add a mapping api to resultset-seq or is the pattern just to chain any custom mappings after resultset-seq? Is wrapping in (map double ...) too much typing? :) -- Protege: What is this

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-21 Thread Ken Wesson
On Sun, Aug 21, 2011 at 3:14 AM, Alan D. Salewski salew...@att.net wrote: That presumption is at least partially incorrect. Native apps (cmd.exe, for instance) launched from a cygwin bash command prompt can see environment variables exported by the parent bash process. I never claimed there

Re: Video Slides on Pattern Matching and Predicate Dispatch in Clojure

2011-08-19 Thread Ken Wesson
On Thu, Aug 18, 2011 at 11:00 PM, Meikel Brandmeyer m...@kotka.de wrote: Eh, what exactly does slideshare provide over a PDF put on some server somewhere? Apparently, the ability to annoy the hell out of whoever you try to share it with. -- Protege: What is this seething mass of

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-19 Thread Ken Wesson
On Thu, Aug 18, 2011 at 11:05 PM, dmiller dmiller2...@gmail.com wrote: Several comments: (a) 'clojure.load.path' is not new in 1.3.  It's been in the code since at least May, 2009. (b) Regarding Dimitre's comment below, I probably did have Java system properties on my mind at the time.  I

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-18 Thread Ken Wesson
On Wed, Aug 17, 2011 at 4:25 PM, Dimitre Liotev lio...@gmail.com wrote: you can not set and query such a variable in a Bash script. Code has already been posted to this thread that does exactly that. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL.

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-18 Thread Ken Wesson
On Thu, Aug 18, 2011 at 4:56 PM, D L lio...@gmail.com wrote: On Thu, Aug 18, 2011 at 7:34 PM, Ken Wesson kwess...@gmail.com wrote: On Wed, Aug 17, 2011 at 4:25 PM, Dimitre Liotev lio...@gmail.com wrote:      you can not set and query such a variable in a Bash script. Code has already been

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-17 Thread Ken Wesson
On Wed, Aug 17, 2011 at 9:48 AM, Alan D. Salewski salew...@att.net wrote:    $ /usr/bin/env -- ALJUNK_CRAP1=junk1 ALJUNK.CRAP2=junk2 /bin/bash -c env | grep ALJU    ALJUNK.CRAP2=junk2    ALJUNK_CRAP1=junk1 You approached the question from the perspective of one just wanting to launch

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-17 Thread Ken Wesson
On Thu, Aug 18, 2011 at 12:32 AM, Alan D. Salewski salew...@att.net wrote: On Wed, Aug 17, 2011 at 01:47:53PM -0400, Ken Wesson spake thus: On Wed, Aug 17, 2011 at 9:48 AM, Alan D. Salewski salew...@att.net wrote: I approached the question from the perspective of one wanting to invoke

Re: Spitting out a lazy seq to file???

2011-08-16 Thread Ken Wesson
On Tue, Aug 16, 2011 at 11:26 AM, Thomas th.vanderv...@gmail.com wrote: Hi everyone, I have been struggling with this, hopefully, simple problem now for quite sometime, What I want to do is: *) read a file line by line *) modify each line *) write it back to a different file This is a

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-16 Thread Ken Wesson
On Tue, Aug 16, 2011 at 1:20 AM, Alan D. Salewski salew...@att.net wrote: On Tue, Aug 16, 2011 at 12:34:39AM -0400, Ken Wesson spake thus: On Mon, Aug 15, 2011 at 11:13 AM, mrwizard82d1 mrwizard8...@gmail.com wrote: I understand that the 1.3 beta plans to add an environment variable named

Re: syntax quoting and namespaces misbehaving in test?

2011-08-16 Thread Ken Wesson
The def special form seems to be a bit strange that way, in that (def sym thingy) seems to do two things: execute a (declare sym) at read or macroexpansion time, even when inside a function definition rather than at top level, and execute an (alter-var-root! sym (constantly thingy)) when actually

Re: Stanford AI Class

2011-08-16 Thread Ken Wesson
On Tue, Aug 16, 2011 at 6:45 PM, André Thieme splendidl...@googlemail.com wrote: On Aug 13, 11:14 pm, Ken Wesson kwess...@gmail.com wrote: On Sat, Aug 13, 2011 at 1:36 PM, Lee Spector lspec...@hampshire.edu wrote: On the one hand most people who work in genetic programming these days

Re: Problem with Greeks!

2011-08-16 Thread Ken Wesson
On Tue, Aug 16, 2011 at 7:56 PM, cran1988 rmanolis1...@hotmail.com wrote: I tried (str Γεια!) and i got  ! what can I do to fix it ? Set something, somewhere, to UTF-8 that's probably set to ISO-8859-1 or US-ASCII right now. Also, her name would be spelt Λεια, and her famous plea Ηελπ με,

Re: Clojure-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-15 Thread Ken Wesson
On Mon, Aug 15, 2011 at 11:13 AM, mrwizard82d1 mrwizard8...@gmail.com wrote: I understand that the 1.3 beta plans to add an environment variable named clojure.load.path to provide a CLASSPATH mechanism for Clojure on the CLR. Although I use Windows, I have installed cygwin because I prefer

Re: Stanford AI Class

2011-08-14 Thread Ken Wesson
On Sun, Aug 14, 2011 at 8:50 AM, Paulo Pinto paulo.jpi...@gmail.com wrote: I guess that nowadays many AI systems are mainly programmed in some kind of specialized DSL. Sure Lisp based languages are a perfect candidate for it, but the plain mention of Lisp brings up some issues that you

Re: Stanford AI Class

2011-08-13 Thread Ken Wesson
On Sat, Aug 13, 2011 at 1:36 PM, Lee Spector lspec...@hampshire.edu wrote: As someone who works on code-modifying AI (genetic programming, much along the lines described above -- which, BTW, I would expect Thrun and Norvig to mention only briefly, if at all... but that's a debate for a

Re: is my understanding correct for function identity?

2011-08-13 Thread Ken Wesson
On Sat, Aug 13, 2011 at 1:57 PM, Thorsten Wilms t...@freenet.de wrote: On 08/13/2011 06:45 PM, jaime wrote: Are there other functions for the same purpose? I don't see how there could be, for the very same purpose. Though you might want to consider splitting up functions some more, instead.

Re: rebind var for all threads

2011-08-12 Thread Ken Wesson
On Fri, Aug 12, 2011 at 12:36 AM, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Aug 11, 2011 at 6:48 PM, Ken Wesson kwess...@gmail.com wrote: Eh. I now can't seem to actually find any recent post mentioning both it and Android. But mentioning it in connection with Google's app store

Re: rebind var for all threads

2011-08-12 Thread Ken Wesson
On Fri, Aug 12, 2011 at 10:17 AM, Stuart Sierra the.stuart.sie...@gmail.com wrote: Yes. The compiler probably optimized away the var lookup to an embedded constant. You'll need to use an atom, as Baldridge suggested. The Clojure compiler doesn't optimize anything away. However, in a situation

Re: Stanford AI Class

2011-08-12 Thread Ken Wesson
On Fri, Aug 12, 2011 at 12:41 PM, daly d...@axiom-developer.org wrote: Clojure has immutable data structures. Programs are data structures. Therefore, programs are immutable. So is it possible to create a Clojure program that modifies itself? Yes, if it slaps forms together and then executes

Re: Stanford AI Class

2011-08-12 Thread Ken Wesson
On Fri, Aug 12, 2011 at 4:25 PM, daly d...@axiom-developer.org wrote: Consing up a new function and using eval is certainly possible but then you are essentially just working with an interpreter on the data. How does function invocation actually work in Clojure? In Common Lisp you fetch the

Re: Stanford AI Class

2011-08-12 Thread Ken Wesson
(defn f [x] (println hello, x)) (defn g [] (eval '(defn f [x] (println goodbye, x (defn -main [] (#'user/f world!) (g) (#'user/f cruel world.)) Close enough? :) -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a

Re: lein deps gets error

2011-08-12 Thread Ken Wesson
On Fri, Aug 12, 2011 at 6:53 PM, jayvandal s...@ida.net wrote: I do a lein new hello_world and I get a directory called hello_world. I then try lein deps. I get several lines of errors starting with #! What am I doing wrong? = Microsoft

Re: rebind var for all threads

2011-08-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 2:05 PM, Mark Rathwell mark.rathw...@gmail.com wrote: (This is all moot at this point, since the author or Noir has made changes that allow it to be compatible with App Engine.) App Engine. Background: This was with noir version 1.1.0, and appengine-magic version

Re: rebind var for all threads

2011-08-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 4:45 PM, Alan Malloy a...@malloys.org wrote: Have you even tried a google search for app engine? It's (a) nothing to do with a phone, (b) fairly well known, and (c) easy to discover even if you've never heard of it. Previous discussions of App Engine here have implied

Re: Passing ClojureScript objects to JavaScript functions

2011-08-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 5:02 PM, Kevin Lynagh klyn...@gmail.com wrote: Alright, thanks for the info. Do you know why an automatic solution is out? I'm trying to use D3 from ClojureScript, but right now all of the clarity I get from Clojure's nicer data manipulation abstractions is lost

Re: rebind var for all threads

2011-08-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 5:47 PM, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Aug 11, 2011 at 2:10 PM, Ken Wesson kwess...@gmail.com wrote: Previous discussions of App Engine here have implied it to be associated with the APIs for Android, a phone OS. Now you've made me curious

Re: rebind var for all threads

2011-08-11 Thread Ken Wesson
On Thu, Aug 11, 2011 at 10:02 PM, Mark Rathwell mark.rathw...@gmail.com wrote: Is the app store for more than just Android device apps then? Apple has one central app store for iPhone/iPad apps, and now even has one for Mac apps.  Android's situation I haven't exactly figured out, but I think

Re: rebind var for all threads

2011-08-10 Thread Ken Wesson
On Wed, Aug 10, 2011 at 3:52 PM, Mark Rathwell mark.rathw...@gmail.com wrote: Is what I am trying to do possible? alter-var-root Handle with care. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or

Re: rebind var for all threads

2011-08-10 Thread Ken Wesson
On Wed, Aug 10, 2011 at 4:54 PM, Mark Rathwell mark.rathw...@gmail.com wrote:  alter-var-root It is still somehow using the original binding.  I am trying change the binding from aot compiled code, would that change anything? Yes. The compiler probably optimized away the var lookup to an

Re: rebind var for all threads

2011-08-10 Thread Ken Wesson
On Wed, Aug 10, 2011 at 5:20 PM, Mark Rathwell mark.rathw...@gmail.com wrote:  The lib B function uses blacklisted Java classes, ... Blacklisted??? -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or

Re: Elegant tools deserve elegant solutions. -- L. E. Gant

2011-08-08 Thread Ken Wesson
On Mon, Aug 8, 2011 at 2:46 AM, Tuba Lambanog tuba.lamba...@gmail.com wrote: I’m having a hard time thinking through the process of generating the candidate suffix set using set forms, and I’m beginning to think I have selected an arduous path (for me). Thoughts? Store the prefixes in a

Re: Elegant tools deserve elegant solutions. -- L. E. Gant

2011-08-08 Thread Ken Wesson
On Mon, Aug 8, 2011 at 11:41 AM, Tuba Lambanog tuba.lamba...@gmail.com wrote: Hi, Thank you for the tip. It does look like the Patricia tree -- or suffix tree -- is made-to-order for this kind of task. I'm reading up on it. You're welcome. Would there be a Clojure implementation of this

Re: Concurrency design

2011-08-08 Thread Ken Wesson
If the local bindings will never change, then why not just use (binding [whatever-setup ...] ...) wrapping the individual test bodies that need such setup? (Where explicit tear-down is required, you'd need try ... finally as well, or better yet a macro like with-open, but using binding instead of

Re: standalone indentation tool

2011-08-07 Thread Ken Wesson
On Sun, Aug 7, 2011 at 1:44 PM, Eric Lavigne lavigne.e...@gmail.com wrote: The pprint function in the Clojure standard library indents Clojure source code.      http://richhickey.github.com/clojure/clojure.pprint-api.html To get the result you are looking for, a tool would need to walk through

Re: ClojureScript Compile errors

2011-08-06 Thread Ken Wesson
On Sat, Aug 6, 2011 at 6:42 PM, Mark Engelberg mark.engelb...@gmail.com wrote: On Sat, Aug 6, 2011 at 2:30 PM, Rich Hickey richhic...@gmail.com wrote: Why all the attention to :use - I thought everyone agreed using it is a bad idea? ... The only benefit I see is that you can avoid a

Re: Looking for a functional solution for a simple problem

2011-08-04 Thread Ken Wesson
On Wed, Aug 3, 2011 at 7:03 AM, Chris Rosengren christopher.roseng...@gmail.com wrote: Hi, I'm using an iterative function to do this now but I would like to start programming in a more functional style I have an ordered (ascending) distinct sequence 1 4 5 34 36 38 53 55 59 62 How would I

Re: Re: How to import and use an enum enclosed in an java interface?

2011-08-03 Thread Ken Wesson
On Tue, Aug 2, 2011 at 10:42 AM, finbeu info_pe...@t-online.de wrote: Works! Ken, thx. You're welcome. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized

Re: java.lang.StackOverflowError when calling function name instead of recur

2011-08-03 Thread Ken Wesson
On Tue, Aug 2, 2011 at 4:47 PM, David Nolen dnolen.li...@gmail.com wrote: On Tue, Aug 2, 2011 at 4:43 PM, Trastabuga lisper...@gmail.com wrote: I just came across the issue of getting the StackOverflowError in the function reading long file and recursively building a list of data. After I

Re: What information does (:key x) convey?

2011-08-03 Thread Ken Wesson
On Wed, Aug 3, 2011 at 1:26 PM, Colin Yates colin.ya...@gmail.com wrote: +1 as well.  Surely (start-date voyage) would be more explicit than (start voyage) though meaning there is no ambiguity for me; I would have thought start-location. If it's start-date, then the circular? in the OP can only

Re: Best Way To Remove vector from vector of vectors?

2011-08-02 Thread Ken Wesson
On Tue, Aug 2, 2011 at 7:42 AM, octopusgrabbus octopusgrab...@gmail.com wrote: I'm having trouble with the suggested fix (shortened function name for testing). Here is some test data: (def vv1 [[49 48 47 46 nil 1 2 3 4][5 6 7 8 9 10 11 12 13]]) (defn f1  [all-csv-rows]  (let [clean-rows

Re: New to Clojure -- Errors Are Frustrating

2011-08-02 Thread Ken Wesson
On Tue, Aug 2, 2011 at 3:11 AM, recurve7 dan.m...@gmail.com wrote: Here's one example where recursion and lack of positional error feedback make it hard for me, as someone coming from Java, to spot the error (and seeing ClassCastException threw me off and had me wondering where/how I had done

Re: How to import and use an enum enclosed in an java interface?

2011-08-02 Thread Ken Wesson
On Tue, Aug 2, 2011 at 9:37 AM, finbeu info_pe...@t-online.de wrote: Hello, how do I have to use an enum in clojure that is enclosed in an java interface? I decomplied it in IDEA and I got something like that: package com.api.test; public interface Foo {     .     .     static

Re: Libraries and build management hell

2011-08-01 Thread Ken Wesson
On Mon, Aug 1, 2011 at 3:02 AM, pmbauer paul.michael.ba...@gmail.com wrote: I might be able to disprove your scurrilous charge if ... I doubt that since your earlier assertion was factually incorrect. If you have a personal problem with me, sort it out in private email or keep it to yourself

Re: timed termination of iterative algorithm

2011-07-31 Thread Ken Wesson
On Sun, Jul 31, 2011 at 10:25 AM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hello everybody,  I would like to have a long running process to return its current solution after some pre-determined amount of time. It so happens that the iteration is happening at a deeper nested

Re: novel feedback is always welcome

2011-07-31 Thread Ken Wesson
On Sun, Jul 31, 2011 at 10:27 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: In principle the line is clear. Everything is fair game. Novel feedback is always welcome. Question small decisions, question big ones. Press hard for quality. The opposite of providing novel feedback is

Re: timed termination of iterative algorithm

2011-07-31 Thread Ken Wesson
On Sun, Jul 31, 2011 at 12:41 PM, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Ken,  thank you for your response. Do you think you can give me a quick example of how to extend an Exception to be able to extract the value from the exception when it is caught.. Should I be using

Re: timed termination of iterative algorithm

2011-07-31 Thread Ken Wesson
Another, perhaps cleaner method leverages more of Java's and Clojure's concurrency tools. (def res (atom nil)) (defn outer-loop [...] (loop [x initial-value ...] (reset! res x) (recur (compute-new-x x ...) ...))) ... (defn do-it [timeout ...] (let [f (future (outer-loop ...))]

Re: Libraries and build management hell

2011-07-31 Thread Ken Wesson
On Sun, Jul 31, 2011 at 9:43 PM, yair yair@gmail.com wrote: On Jul 31, 12:28 pm, Ken Wesson kwess...@gmail.com wrote: Almost being the operative word. One distinct disadvantage is that it makes building your project require a working network connection snip This is not correct.  Once

Re: Libraries and build management hell

2011-07-31 Thread Ken Wesson
On Sun, Jul 31, 2011 at 11:57 PM, Sean Corfield seancorfi...@gmail.com wrote: On Sun, Jul 31, 2011 at 7:49 PM, Ken Wesson kwess...@gmail.com wrote: If you add a new dependency, the network connection is needed. If you add a new dependency and you don't already have the JAR downloaded, you

Re: Libraries and build management hell

2011-07-31 Thread Ken Wesson
On Mon, Aug 1, 2011 at 12:49 AM, pmbauer paul.michael.ba...@gmail.com wrote: What if you have the JAR on a disk somewhere, for other reasons, but until now it wasn't a dependency of that particular project? Your assertion that dependency management systems are in any way disadvantaged to

Re: Possible Issue with Listing 11.5 from the Joy of Clojure

2011-07-30 Thread Ken Wesson
On Sat, Jul 30, 2011 at 12:10 AM, Julien Chastang julien.c.chast...@gmail.com wrote: By the way, I still think you need a lock in the count function in the case where the caller tries to invoke the count function on a partially constructed object. I don't think that's possible in this case. As

Re: dynamically generated let bindings

2011-07-30 Thread Ken Wesson
On Sat, Jul 30, 2011 at 7:29 AM, Sam Aaron samaa...@gmail.com wrote: (fn [ args]  (let [foo (some logic goes here)        bar (some logic goes here)        ...]    (body goes here))) I just finished implementing a solution and it looks exactly like this. You're absolutely right - this is

Re: dynamically generated let bindings

2011-07-30 Thread Ken Wesson
On Sat, Jul 30, 2011 at 9:07 PM, Alan Malloy a...@malloys.org wrote: (get :foo argmap__5673__auto 42) is the right way to solve this problem. Is another way to solve it, yes, and a good one. Or if, as in the current example, you want to destructure a map with lots of defaults, simply: (let

Re: Libraries and build management hell

2011-07-30 Thread Ken Wesson
On Sat, Jul 30, 2011 at 10:58 AM, Mark Rathwell mark.rathw...@gmail.com wrote: I'm all for a better, easier solution that is better in most ways.  What I'm saying is: 1. I don't want to go back to downloading jar files from the websites of all of the libraries I want to use in a project and

Re: Alright, fess up, who's unhappy with clojurescript?

2011-07-30 Thread Ken Wesson
On Sat, Jul 30, 2011 at 10:22 PM, Luc Prefontaine lprefonta...@softaddicts.ca wrote: I would add that I want to see Rich maintain is grip on the Clojure wheel for a very long time. Consensual decisions are most of the time not the best. They are the result of compromises not based on

Re: dynamically generated let bindings

2011-07-29 Thread Ken Wesson
On Fri, Jul 29, 2011 at 12:49 AM, Jeff Rose ros...@gmail.com wrote: I don't think it's very typical to pass a form to a function, unless you plan on using eval at runtime. Or it's a function called by a macro to do some processing of forms. -- Protege: What is this seething mass of

Re: format and printf can't be used with BigInt

2011-07-29 Thread Ken Wesson
On Fri, Jul 29, 2011 at 1:52 AM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: Hi, Am Freitag, 29. Juli 2011 01:28:27 UTC+2 schrieb Sean Corfield: Kinda hard since that expression is not valid in 1.3 anyway: ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow

Are they scared of us yet?

2011-07-29 Thread Ken Wesson
They've just added with-open to JavaSE: http://download.oracle.com/javase/7/docs/technotes/guides/language/try-with-resources.html -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a

Re: format and printf can't be used with BigInt

2011-07-29 Thread Ken Wesson
On Fri, Jul 29, 2011 at 2:36 AM, Meikel Brandmeyer (kotarak) m...@kotka.de wrote: Hi, Am Freitag, 29. Juli 2011 08:24:54 UTC+2 schrieb Ken Wesson: Er, fast would be for primitive integer arithmetic to wrap rather than throw an exception or auto-promote. Both of the latter behaviors require

Re: Are they scared of us yet?

2011-07-29 Thread Ken Wesson
On Fri, Jul 29, 2011 at 2:48 AM, Laurent PETIT laurent.pe...@gmail.com wrote: So they decided to go the route of adding a .getSuppressed() (Exceptions) method in Throwable, thus behaving differently from other finally clauses ... ... so now we have a (with-open) whose semantics are not

Re: dynamically generated let bindings

2011-07-29 Thread Ken Wesson
On Fri, Jul 29, 2011 at 6:57 AM, Sam Aaron samaa...@gmail.com wrote: However, something like the following doesn't work: (defn binding-vec [foos]  `(vec (interleave ~names ~(take (count names) (repeat '`(count ~foos)) A, because the above code is probably incorrect (I just cobbled it

Re: Question regarding structural sharing, records, and maps

2011-07-29 Thread Ken Wesson
On Thu, Jul 28, 2011 at 11:59 PM, Trenton Strong trenton.str...@gmail.com wrote: 1.) Does structural sharing play well with nested structures? With a tree whose nodes are represented by nested maps, if a leaf node is updated with new data, will structural sharing efficiently represent the new

  1   2   3   4   5   6   7   8   9   10   >