Re: Question about sets

2012-09-04 Thread Andy Fingerhut
just too elegant > to give up! I don't think anyone is against consistency... > > Jim > > ps: IMO sets should always remove duplicates quietly...that is the whole > point of using them programmatically! > > > On 04/09/12 17:30, Andy Fingerhut wrote: >> I hav

Re: Question about sets

2012-09-04 Thread Andy Fingerhut
I have created a dev page for this issue. It isn't a JIRA ticket because it isn't clear to me yet exactly what the changes should be. http://dev.clojure.org/display/design/Allow+duplicate+map+keys+and+set+elements A couple of questions there for people that dislike the current behavior. You ca

Re: assoc with uneven arguments

2012-08-29 Thread Andy Fingerhut
On Aug 29, 2012, at 12:17 PM, Chas Emerick wrote: > On Aug 29, 2012, at 2:20 PM, Ambrose Bonnaire-Sergeant wrote: > >> I think assoc should throw an error when applied with uneven arguments. >> >> Currently, the "missing" value is just replaced with nil. >> >> (assoc {} :a 1 :b) >> ;=> {:a 1, :

Re: Deprecation of Swank Clojure, long live nrepl.el

2012-08-28 Thread Andy Fingerhut
The issue with an exception when trying to find the doc of a namespace is a known issue, and should be fixed in Clojure 1.5 when it is released: http://dev.clojure.org/jira/browse/CLJ-902 You could try out clojure-1.5.0-alpha4 to see if it fixes the problem for you, if that happens to be conven

Re: A Performance Comparison of SBCL & Clojure

2012-08-27 Thread Andy Fingerhut
I've written several of the Clojure programs on the site. I'm not omniscient when it comes to writing efficient Clojure code, but I know a few of the techniques. Several, if not most, of the Clojure solutions already take advantage of mutable data structures, for example. There are some faste

Re: What is the meaning of :while in a for ?

2012-08-23 Thread Andy Fingerhut
I've added some examples of :when and :while, including those given by Herwig and Tassilo in this thread, at ClojureDocs: http://clojuredocs.org/clojure_core/clojure.core/for Note: Anyone with a free account can add/edit examples on that site. Andy On Aug 21, 2012, at 8:34 AM, nicolas.o...@gma

Re: recursion question

2012-08-14 Thread Andy Fingerhut
An additional step on top of Raoul's: Take the first #, subtract it from the goal, recursively ask if the remaining #s can sum to the now-lesser goal. If so, return yes, or the set of numbers that worked (which should include whatever was returned from the recursive call, plus the first #) If

Re: Immutability rules when it comes to Ref type

2012-08-10 Thread Andy Fingerhut
Hussein: If you ignore the ref for the moment, making any "change" to a map, or a map nested inside a map however many levels deep you wish, does not mutate the original map. Instead it creates a brand new map with the new set of keys and values. It is as if the original was copied, and the c

Re: Much longer build time for Clojure on HDD vs. SSD (4 min vs 30s)

2012-07-16 Thread Andy Fingerhut
There are links to older discussions on this topic in the description of ticket CLJ-703: http://dev.clojure.org/jira/browse/CLJ-703 Also proposed patches to Clojure, although I don't know whether some of those may lead to incorrect behavior. Andy On Jul 16, 2012, at 12:48 PM, Raju Bitter wrot

Re: General subsequence function

2012-06-29 Thread Andy Fingerhut
ow receptive > the community is. :-) > > On Thursday, June 28, 2012 2:53:27 PM UTC-4, Andy Fingerhut wrote: > From quick & easy, to slower & more difficult, here are some options: > > Use the functions you want in your own code, and find happiness in the fact > that th

Re: General subsequence function

2012-06-28 Thread Andy Fingerhut
>From quick & easy, to slower & more difficult, here are some options: Use the functions you want in your own code, and find happiness in the fact that they are quick & easy to write. Make a library of this and perhaps other related functions on github. Perhaps also release JARs to clojars.org

Re: clojure.inspector.inspect-table gives up when first element is nil...

2012-06-18 Thread Andy Fingerhut
Agreed with everything Sean said, except I wanted to point out that making a unit test for functions that create GUI windows might be a little bit out of the beaten path of the existing unit tests. There may be a way to create a unit test that calls inspect-table with arguments that make it thr

Re: Why is lein so slow?

2012-06-14 Thread Andy Fingerhut
On Jun 13, 2012, at 5:27 PM, Warren Lynn wrote: > I cannot help notice that leinengen seems quite slow. Even "lein help" takes > 8 seconds to finish printing all the information. I am using version 2 on > Windows 7(that .bat file). Can anyone explain what is going on? Or is it just > me? Thank

Re: 'dotimes' will not work inside a 'doto'...

2012-06-14 Thread Andy Fingerhut
it would be best having a 'common traps and pitfalls' somewhere > centrally... > > Jim > > On 15/06/12 00:02, Andy Fingerhut wrote: >> >> >> On Jun 14, 2012, at 7:59 AM, Jim - FooBar(); wrote: >> >>> well, no... :-) >>

Re: 'dotimes' will not work inside a 'doto'...

2012-06-14 Thread Andy Fingerhut
On Jun 14, 2012, at 7:59 AM, Jim - FooBar(); wrote: > well, no... :-) > > Jim > > On 14/06/12 15:52, David Nolen wrote: >> >> On Thu, Jun 14, 2012 at 10:39 AM, Jim - FooBar(); >> wrote: >> Evaluates x then calls all of the methods and functions with the >> value of x supplied at the front

Re: load namespace programmatically

2012-06-08 Thread Andy Fingerhut
Does this do what you want? (defn require-from-string [s] (require (symbol s))) Andy On Jun 8, 2012, at 5:37 PM, Leandro Oliveira wrote: > Hi, > > What is the best way to implement require-from-string? > > Ex: > > # require-from-string words like require but accepts namespaces as strings.

Re: [PATCH] RFC: Add Functions `tabify` And `untabify`

2012-06-08 Thread Andy Fingerhut
On Jun 8, 2012, at 10:58 AM, Stuart Sierra wrote: > Stuart Halloway wrote: >> Whatever we do let's make sure we think about how to make it available in >> all Clojure dialects. > > Yes. When it comes to adding stuff to clojure.string, I'd like to focus > less on adding single-purpose functions l

Re: hyphenate - imperative for

2012-06-06 Thread Andy Fingerhut
Dave: I don't know if it will help you do it more succinctly, and I don't know whether with-local-vars is implemented in ClojureScript, but at least in Clojure with-local-vars is a way to have local mutable variables in a single-threaded piece of code, and know that the mutability stays local t

Re: Using Clojure internal libraries in another project

2012-06-03 Thread Andy Fingerhut
License-wise, the Clojure implementation code is copyright by Rich Hickey, and distributed under the Eclipse Public License. Thus your code would need to be distributable with a license compatible with this license, or perhaps could be completely closed source if your code was not distributed (

Re: Different behavior at REPL vs compiled code

2012-05-19 Thread Andy Fingerhut
Clojure does "know" the type -- it knows that it is a string, rather than a number, and it does not support doing arithmetic operations on strings, hence the error. Whereas Perl would automatically convert from a string to a number in a case like this, Clojure does not. One could argue that su

Re: [ANN] Clojure Namespace Browser (clj-ns-browser "1.0.0")

2012-05-16 Thread Andy Fingerhut
Did you use the instructions under "Install & Start-up" on this page? https://github.com/franks42/clj-ns-browser Also, what OS are you using (and if Windows, are you using Cygwin, too?), and what do you get as output of the command "lein version"? Thanks, Andy On May 16, 2012, at 6:16 PM, then

Re: docstrings of if-let and when-let incorrect

2012-05-15 Thread Andy Fingerhut
If if-let/when-let had multiple bindings, how would you propose to define the condition of whether to do the "then" branch? As the logical AND of all of the multiple forms? The OR? Only use the first expression? Only the last? I don't see that any of those is any more clear or "least surpris

Re: Odd termination behaviour of a program that uses pmap

2012-05-08 Thread Andy Fingerhut
ojure futures, I've added examples to those two functions that recommend reading the examples for future. Andy On May 8, 2012, at 11:18 AM, Andy Fingerhut wrote: > Not desired, but currently normal behavior. > > This happens whenever certain concurrency features of Clojure are used

Re: Odd termination behaviour of a program that uses pmap

2012-05-08 Thread Andy Fingerhut
Not desired, but currently normal behavior. This happens whenever certain concurrency features of Clojure are used, creating other threads, and they take a while for them to be cleaned up on exit. Besides pmap, futures and a few other Clojure functions cause this. You can work around it if yo

How to handle dependencies on multiple versions of the same library?

2012-05-02 Thread Andy Fingerhut
I haven't actually run across this before, but I suspect someone else has. I was curious how people handle it. Suppose you have your project A, and it uses Leiningen (the issue is more widely applicable, but for the sake of example). * A depends on some version of library B, which in turn depe

Re: (update-in) and getting the new value at the leaf efficiently

2012-04-26 Thread Andy Fingerhut
Here is one way to do it called update-in+. It returns a vector consisting of the new udpated value, like update-in does, followed by the original value (in case you might want to see that for some reason), followed by the updated value. (defn update-in+ ([m [k & ks] f & args] (if ks

Clojure cheatsheets with several flavors of tooltips

2012-04-23 Thread Andy Fingerhut
The tooltip version of the Clojure/Java cheatsheet is not published at [1] just yet, but hopefully we can figure out how to make that happen in a while: [1] http://clojure.org/cheatsheet There is an updated link at the bottom of that page called "Download other versions" that leads to [2]: [2]

Andy Fingerhut wants to chat

2012-04-14 Thread Andy Fingerhut
--- Andy Fingerhut wants to stay in better touch using some of Google's coolest new products. If you already have Gmail or Google Talk, visit: http://mail.google.com/mail/b-d7d845b242-b84a102cf0-A1gnhr4A2hNcJ4MUjH_o4M

Re: Boolean

2012-04-13 Thread Andy Fingerhut
One little nit that confuses me. Boolean/FALSE is documented as being of type Boolean in Java documentation, yet it is treated by Clojure the same as primitive boolean false: user=> (clojure-version) "1.3.0" user=> (if Boolean/FALSE "logical true" "logical false") "logical false" user=> (identica

Re: Boolean

2012-04-12 Thread Andy Fingerhut
I know that having such things in the doc strings would probably be your ideal, but note that clojuredocs.org is editable by anyone, and one could in a few minutes create an account there and document what they consider corner cases. I don't know where you'd most like to find these kinds of notes.

Re: Read in a big file and get GC limit/outofmemory error.

2012-04-10 Thread Andy Fingerhut
On Apr 9, 2012, at 10:05 PM, Andy Wu wrote: > Hi there, > > I'm studying algo-class.org, and one of it's programming assignment > gives you a file containing contents like below: > 1 2 > 1 7 > 2 100 > ... > > There is roughly over 5 million lines, and i want to first construct a > vector of vect

Slides with some basics on Clojure documentation

2012-04-06 Thread Andy Fingerhut
Slides aren't usually as fun without the talk that comes with them, but I don't think it was recorded. Nothing too fancy here -- just some slides I used at a discussion we had on Clojure documentation at last night's Bay Area Clojure User Group monthly meetup: http://www.meetup.com/The-Bay-Are

Re: SubVec anomaly

2012-03-29 Thread Andy Fingerhut
Thanks for the catch. Bug report with patch created: http://dev.clojure.org/jira/browse/CLJ-962 Andy On Mar 29, 2012, at 2:15 AM, stirfoo wrote: > > user=> (nth (subvec [:??? 1 2] 1) -1) > :??? > > This could be a bug, not sure. > > Only the upper bound of the internal SubVec is being check

Re: GSOC Idea: Interactive documentation with autodoc

2012-03-28 Thread Andy Fingerhut
My fork of cd-client has code to create a local snapshot of all examples, see-alsos, and comments in clojuredocs.org, save it to a file, and switch to "local mode", which pulls all results from the snapshot file instead of clojuredocs.org. https://github.com/jafingerhut/cd-client Andy On Mar

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-28 Thread Andy Fingerhut
ou like it better. Andy On Mar 27, 2012, at 3:41 PM, Andy Fingerhut wrote: > I would be happy to, if someone could teach me how to do it. I didn't write > the JavaScript that does the tooltips -- I just took the TipTip jQuery plugin > and bashed away at it slightly until it did wh

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-27 Thread Andy Fingerhut
ly moving the mouse into the popup text and that causes > the popup to disappear. > > On Monday, March 26, 2012 2:25:17 PM UTC-7, Andy Fingerhut wrote: > Welcome, Pierre. > > Thanks for the info. My current thinking is to start publishing on > clojure.org two, or maybe even

Re: beginner - stuck in dependencies and possibly old versions

2012-03-27 Thread Andy Fingerhut
I've installed Leiningen on many machine following the brief installation instructions here: https://github.com/technomancy/leiningen If you put 1.3.0 version of Clojure in your project.clj and do "lein deps", it should download that version of Clojure into the "lib" directory of your project.

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-26 Thread Andy Fingerhut
ranks of web-standards-heathens who stretch the original intent of these mechanisms, I do so proudly :-) Andy On Mar 25, 2012, at 10:36 PM, Pierre Mariani wrote: > > > On Saturday, March 24, 2012 11:59:49 PM UTC-7, Andy Fingerhut wrote: > I've tried again using links with doc string

Re: Clojure cheatsheet with tooltips (alpha)

2012-03-26 Thread Andy Fingerhut
to make the cheatsheet more of a > modular, queryable structure than it currently is. > > Cheers, > '(Devin Walters) > > On Monday, March 26, 2012 at 4:35 AM, mnicky wrote: > >> Seems that the text of cl-format overflows the right edge of the tooltip: >> h

Re: Clojure cheatsheet with tooltips (alpha)

2012-03-26 Thread Andy Fingerhut
ems that the text of cl-format overflows the right edge of the tooltip: > http://i.imgur.com/B0ljt.png (tested in FF, Opera, Chrome) > > On Monday, March 26, 2012 11:12:50 AM UTC+2, Andy Fingerhut wrote: > I've replaced this test page [1] with another one. The one I poste

Re: Clojure cheatsheet with tooltips (alpha)

2012-03-26 Thread Andy Fingerhut
ary files to generate these pages, including my modified jQuery TipTip plugin, are here: https://github.com/jafingerhut/clojure-cheatsheets Andy On Mar 24, 2012, at 3:15 AM, Andy Fingerhut wrote: > There are still some problems with this, but it is ready for experimental > use, at

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-25 Thread Andy Fingerhut
On Mar 25, 2012, at 12:15 AM, Cedric Greevey wrote: > On Sun, Mar 25, 2012 at 2:59 AM, Andy Fingerhut > wrote: >> I've tried again using links with doc strings as the values of the title >> attribute, but when the text in Firefox 11.0 it does not honor the line &g

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-25 Thread Andy Fingerhut
I've tried again using links with doc strings as the values of the title attribute, but when the text in Firefox 11.0 it does not honor the line breaks in my text, but reflows it. Try it out yourself at [1]: [1] http://homepage.mac.com/jafingerhut/files/cheatsheet-clj-1.3.0-v1.4-tooltips/cheat

Clojure cheatsheet with tooltips (alpha)

2012-03-24 Thread Andy Fingerhut
There are still some problems with this, but it is ready for experimental use, at least. Alex, please don't put this on clojure.org -- it ain't ready yet. http://homepage.mac.com/jafingerhut/files/cheatsheet-clj-1.3.0-v1.4-tooltips/cheatsheet-full.html I found and used TipTip for tooltips [1],

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-23 Thread Andy Fingerhut
Mar 23, 2012 at 1:11 PM, Cedric Greevey wrote: > On Fri, Mar 23, 2012 at 3:57 PM, Andy Fingerhut > wrote: > > Thanks for the suggestions, folks. > > > > Cedric, have you tried your method before? I'm not sure, but I think it > was > > the thing that I

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-23 Thread Andy Fingerhut
y On Fri, Mar 23, 2012 at 12:50 PM, Cedric Greevey wrote: > On Fri, Mar 23, 2012 at 10:58 AM, Andy Fingerhut > wrote: > > I definitely like the tooltip idea. I like it so much that I've already > played with it a bit, looking at several web pages with instructions f

Re: removing a hash-map from a set using hash-map's field.

2012-03-23 Thread Andy Fingerhut
Sets are good when you have a collection of things, the precise order isn't important to you, and you want to avoid duplicates. I used one in some code recently where I wanted to maintain a collection of people who were co-authors in a Clojure patch, and the input file I started with could ment

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-23 Thread Andy Fingerhut
I definitely like the tooltip idea. I like it so much that I've already played with it a bit, looking at several web pages with instructions for how to do it, but my knowledge of good ways to do this is zero except for the results of those Google searches. Has anyone implemented tooltips on a

New(er) Clojure cheatsheet hot off the presses

2012-03-22 Thread Andy Fingerhut
Alex Miller not only organizes conferences that are a blast to attend (i.e. Clojure/West, and I'm inclined to believe Strange Loop would be cool, too), he also puts up new versions of the Clojure cheatsheet when I ask him nicely. Here it is, in the usual place: http://clojure.org/cheatsheet L

Re: into applied to transient vectors undocumented?

2012-03-20 Thread Andy Fingerhut
cannot be cast to clojure.lang.IPersistentCollection clojure.core/conj (core.clj:83) user=> (into x [5 6 7]) [1 2 3 5 6 7] Andy On Mar 20, 2012, at 11:30 AM, Andy Fingerhut wrote: > func! (bang) is a naming convention from the programming language Scheme that > Clojure often uses. In general it means that th

Re: into applied to transient vectors undocumented?

2012-03-20 Thread Andy Fingerhut
ctions MAY take a transient but ALWAYS return a > persistent collection, right? :) > > thx > Las > > 2012/3/20 Andy Fingerhut > into uses transient and persistent! for speed. The fact that into can take a > transient as input is an accidental consequence of that,

Re: into applied to transient vectors undocumented?

2012-03-20 Thread Andy Fingerhut
into uses transient and persistent! for speed. The fact that into can take a transient as input is an accidental consequence of that, I think. Before into was changed to use transients internally, it could only take persistent data structures as input, and return a persistent data structure.

Re: Returning Success

2012-03-19 Thread Andy Fingerhut
I liked approach 2 myself, if the goal is to stick with pure functions when it isn't too difficult. It avoids the comparison of 1, and gets you back exactly the info you want to go onwards from there. You can add a caveat that I haven't written a lot of application code with Clojure, so weight

Re: understanding data structures, and other low-level stuff

2012-03-19 Thread Andy Fingerhut
tory sections at the beginning, and then jump to those specific sections. Save all the stuff on algorithms for when and if you are interested. Andy On Mar 18, 2012, at 8:57 PM, Andy Fingerhut wrote: > Feel free to ask follow-up questions on the basics privately, since many > Clojure progr

Re: understanding data structures, and other low-level stuff

2012-03-18 Thread Andy Fingerhut
Feel free to ask follow-up questions on the basics privately, since many Clojure programmers are probably already familiar with them, whereas follow-up questions on persistent data structures are very on-topic, since I would guess many people who have studied computer science and/or programming

Re: How to escape a space in a keyword?

2012-03-13 Thread Andy Fingerhut
Ah, my senior moment was not noticing the invalid example use of symbol in the second example, which was passing strings of decimal digits to symbol. I went ahead and deleted that one. Thanks, Andy On Mar 13, 2012, at 12:04 AM, Andy Fingerhut wrote: > Which one? > > (sy

Re: How to escape a space in a keyword?

2012-03-13 Thread Andy Fingerhut
there. Andy On Mar 12, 2012, at 11:53 PM, Meikel Brandmeyer (kotarak) wrote: > Hi, > > Am Dienstag, 13. März 2012 07:46:58 UTC+1 schrieb Andy Fingerhut: > > http://clojuredocs.org/clojure_core/clojure.core/symbol > > > And right below is an example of invalid usage. >

Re: How to escape a space in a keyword?

2012-03-12 Thread Andy Fingerhut
Thanks. These are now available on clojuredocs.org pages for functions keyword and symbol: http://clojuredocs.org/clojure_core/clojure.core/symbol http://clojuredocs.org/clojure_core/clojure.core/keyword linked to from: http://clojure.org/cheatsheet Andy On Mar 12, 2012, at 10:11 PM, Frank

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

2012-03-07 Thread Andy Fingerhut
You might have a difficult time getting other Clojure coders to adopt the practice in their code, but would this be almost as good? (let [x 2] code) Achieving that would be as simple as hand-indenting it that way, or adjusting the auto-indenter of your favorite text editor to do it that way. A

Re: clojure url exception

2012-03-03 Thread Andy Fingerhut
o))) # user=> (let [x #java.net.URL["file:///home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]] (printf "(class x)=%s x='%s'\n" (class x) x)) (class x)=class clojure.lang.Symbol x='file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.

Re: clojure url exception

2012-03-03 Thread Andy Fingerhut
I'm not sure what it is, but here is another transcript that may provide additional clues, and with a slightly later version of Clojure: user=> (clojure-version) "1.4.0-beta1" user=> (def x #java.net.URL["file:/home/hara/dj/usr/src/clojurescript/src/cljs/cljs/core.cljs"]) #'user/x user=> x # use

Re: using contains? on transient collections

2012-02-29 Thread Andy Fingerhut
Some related JIRA tickets, http://dev.clojure.org/jira/browse/CLJ-700 http://dev.clojure.org/jira/browse/CLJ-757 http://dev.clojure.org/jira/browse/CLJ-932 All have patches, although I don't personally know whether they are correct fixes. Andy On Feb 29, 2012, at 10:08 PM, Mark Engelberg wrot

Re: Clojure 1.3 updated cheatsheet with links to clojuredocs.org

2012-02-27 Thread Andy Fingerhut
Cedric: At the bottom of the main clojuredocs.org page is the text below. I've copied it here because perhaps the best way to get such changes made is to contribute changes to the code of the clojuredocs.org web site. At the least, it would be good to open a case. You'll have to go to the si

Re: Clojure 1.3 updated cheatsheet with links to clojuredocs.org

2012-02-27 Thread Andy Fingerhut
where Andy hosts the latex source and code to generate > everything for the cheatsheet contents? > > > > On Feb 27, 7:57 am, Bill Caputo wrote: >> On Feb 27, 2012, at 1:22 AM, Andy Fingerhut wrote: >> >>> Thanks to several people who provided feedback, especiall

Clojure 1.3 updated cheatsheet with links to clojuredocs.org

2012-02-26 Thread Andy Fingerhut
"Metadata", with some hints on what all those ^:foo things mean. + Removed mention of structmaps (defrecord is recommended) + Moved Regex functions to strings section I'm not planning on any more updates soon, but if anyone has suggestions for further improvements, please contact me.

Re: Bret Victor - Inventing on Principle

2012-02-24 Thread Andy Fingerhut
Perhaps someone will volunteer to transcribe it and post that. You know, maybe someone who can type quickly and prefers text. :-) I've done that for one of Rich's earlier talks posted as video. It takes time, and I'm not volunteering for this one. Andy On Feb 24, 2012, at 11:57 AM, Cedric Gr

Re: clojure thesis opportunity

2012-02-22 Thread Andy Fingerhut
I haven't written such code myself, but one motivation for creating Erlang was software for telecommunications systems, where they have very high uptime requirements and needed the ability to update code on a running system. It can replace definitions of functions in place as well as any Lisp.

Re: Clojure 1.3.0 updated cheatsheet, and one with links to clojuredocs.org

2012-02-20 Thread Andy Fingerhut
h of your whole browser window when looking at those pages. Andy On Feb 20, 2012, at 1:39 PM, Weber, Martin S wrote: > > On 2012-02-20 16:30 , "Andy Fingerhut" wrote: >> This will likely go live on clojure.org/cheatsheet in a few days, but I >> want to give it a littl

Re: bug in clojure.repl/doc to print namespace docs (?)

2012-02-20 Thread Andy Fingerhut
Yep, and there is a patch ready to go in JIRA: http://dev.clojure.org/jira/browse/CLJ-902 Andy On Feb 20, 2012, at 3:17 PM, Frank Siebenlist wrote: > When I request the doc for a namespace, an exception gets thrown (clojure > 1.3): > > >user=> (doc clojure.core) >ClassNotFoundExcepti

Re: Clojure 1.3.0 updated cheatsheet, and one with links to clojuredocs.org

2012-02-20 Thread Andy Fingerhut
:foo things mean. + Removed mention of structmaps (defrecord is recommended) + Moved Regex functions to strings section More details on changes made since sheet version 1.0: http://homepage.mac.com/jafingerhut/files/cheatsheet-clj-1.3.0-v1.2/CHANGELOG.txt Andy On Feb 15, 2012, at 11:21 AM, A

Clojure 1.3.0 updated cheatsheet, and one with links to clojuredocs.org

2012-02-15 Thread Andy Fingerhut
Fogus, Alex Millier, and I have made some updates to the Clojure cheatsheet for Clojure 1.3.0: http://clojure.org/cheatsheet The links there go to the generated documentation on clojure.github.com. Below is a version that is the same as the one above, except that its links go to the appropria

Improved apropos

2012-02-06 Thread Andy Fingerhut
I have occasionally been frustrated by the behavior of apropos because it returns a list of matching symbols, but with no clue as to which namespace those symbols are in. I wrote a couple of functions to help with this, apropos2 and unresolve. https://gist.github.com/1757414 apropos2 is like apr

Re: Why don't these two functions produce equivalent results?

2012-01-28 Thread Andy Fingerhut
One way to think of it is that both assoc and assoc! create and return new maps that are different than the originals they were given as input. assoc never modifies the original map. assoc! might, or it might not. It depends on implementation details. A correct Clojure program will never rely o

Re: Literate programming in emacs - any experience?

2012-01-23 Thread Andy Fingerhut
I've only briefly scanned what I think is the relevant code in tangle.lisp posted by Tim Daly, but it appears that the @ must be the first character on a line, which with indenting I've never seen in a Clojure source file. It would be a tiny change to make the @ required to be on a line by itself,

Re: strange problem

2012-01-18 Thread Andy Fingerhut
I don't have some code lying around to do that, but I might make one. The name strings would require several megabytes of storage, but as long as you don't mind that... In the mean time, I have perhaps the next best thing: a function escape-supp that replaces these supplementary characters with s

Re: strange problem

2012-01-17 Thread Andy Fingerhut
On Tue, Jan 17, 2012 at 4:35 AM, Rasmus Svensson wrote: > You can use this as a temporary workaround: > >(require '[clojure.string :as str]) > >(defn strip-supplementary [s] > (str/replace s #"[^\u-\u]+" "(removed supplementary > characters)")) > >(strip-supplementary "The

Re: strange problem

2012-01-16 Thread Andy Fingerhut
I don't have enough knowledge to tell you "Oh, just do this, and your Emacs issues will be solved." but I can give some hints as to what these characters are, so perhaps others can say, or you can direct your Google searches in a more focused manner. I believe those are Unicode characters, and one

Re: converting a string to a list

2012-01-14 Thread Andy Fingerhut
This may not be important for your application, but if what you want in the returned sequence are strings, and if you expect to deal with Unicode characters that are not in the Basic Multilingual Plane (BMP) set, then note the following differences. (map str s) will return a separate string for ea

Re: Map/Reduce Performance Question

2012-01-13 Thread Andy Fingerhut
If I am reading your example correctly, that pmap is simply being used to iterate over the characters of a line read into a string, then yes, you are using pmap in a very inefficient way. pmap creates a future for every element of the sequence you give it, and that is significantly more computatio

Any char-based Java file I/O with arbitrary seek?

2012-01-05 Thread Andy Fingerhut
If this doesn't seem like a question for a Clojure group, I'll preface this by saying it is motivated by writing Clojure examples for a "Clojure cookbook" [1]. So far the examples are intended to work like the Perl examples from the 1st edition of the Perl Cookbook [2], but it may grow beyond that

Re: Any built-in way to print to stream besides *out*?

2011-12-31 Thread Andy Fingerhut
is? > > (defn printf+ [& [writer & more :as xs]] > (if (instance? java.io.PrintWriter writer) > (binding [*out* writer] > (apply println more)) > (apply println xs))) > > On Sat, Dec 31, 2011 at 10:01 AM, Andy Fingerhut > wrote: > >> I k

Any built-in way to print to stream besides *out*?

2011-12-31 Thread Andy Fingerhut
I know I can bind *out* to another stream like *err*, but is that the only way built-in to Clojure? (binding [*out* *err*] (println "This will go to *err*, not *out*")) If it is the only way, is there some library perhaps where someone has implemented a function that lets you specify the output s

Re: How to get the vector?

2011-12-20 Thread Andy Fingerhut
Those are native Java arrays you are getting. If you see things like 'int[]', 'double[]', that is a hint. Also the '[I' and '[D' are abbreviated type specifiers for such things in certain contexts in Clojure. I think the hex string is an address, or Java object ID, or something like that. You

Re: Read linux PATH in clojure

2011-12-17 Thread Andy Fingerhut
Argh. Hit send without rereading my example more carefully. I misplaced a paren in my final example. It should have been: (.SetFilePrefix (str (get (System/getenv) "VTK_DATA_ROOT") "/Data/headsq/quarter")) Andy On Sat, Dec 17, 2011 at 5:01 PM, Andy Fingerhut wrote:

Re: Read linux PATH in clojure

2011-12-17 Thread Andy Fingerhut
Here is a one-line transcript in a REPL showing an example of getting the value of the environment variable PATH: user=> (get (System/getenv) "PATH") "/Users/jafinger/bin:/Users/jafinger/Documents/bin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/sbin:/usr/sbin:/Users/jafinger/bin/atp:/Users/jafi

Can JVM GC be tweaked to quickly reuse memory of objects that soon become garbage?

2011-12-16 Thread Andy Fingerhut
This is a question about Clojure performance on the JVM. There might be similar but different tweaks on the CLR or for ClojureScript, but I'm only curious about those if someone knows how to achieve the desired performance improvements today. I can give more concrete examples if there is interest

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-10 Thread Andy Fingerhut
finger trees, which Chouser has implemented for Clojure: https://github.com/clojure/data.finger-tree Andy On Sat, Dec 10, 2011 at 6:43 AM, Andy Fingerhut wrote: > conj adds an element to a data structure in a place most efficient for the > particular type of data structure. For lists, this

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-10 Thread Andy Fingerhut
conj adds an element to a data structure in a place most efficient for the particular type of data structure. For lists, this is at the beginning. For vectors, it is at the end: user=> (conj (conj (conj '(1 2 3) 4) 6) 7) (7 6 4 1 2 3) user=> (conj (conj (conj [1 2 3] 4) 6) 7) [1 2 3 4 6 7] If yo

Re: Macro to ease multiple-key sorting

2011-12-07 Thread Andy Fingerhut
On Wed, Dec 7, 2011 at 8:29 PM, Alan Malloy wrote: > On Dec 7, 8:12 pm, Andy Fingerhut wrote: > > Ugh. And if I were slightly lazier at pressing the send button, I would > > have realized that the laziness of map and remove gives this > short-circuit > > evaluation. &g

Re: Macro to ease multiple-key sorting

2011-12-07 Thread Andy Fingerhut
ascending order for :name, but explicit ascending order for :salary: (pprint (sort (multicmp :name [- :age] [+ :salary]) employees)) Thanks, Andy On Wed, Dec 7, 2011 at 7:23 PM, Andy Fingerhut wrote: > The intent of making it a macro is that it allows short-circuit > evaluation, like Clojure&#

Re: Macro to ease multiple-key sorting

2011-12-07 Thread Andy Fingerhut
amp; keys] > (fn [a b] >(or (first (remove zero? (map #(compare (% a) (% b)) > keys))) >0))) > > (sort-by (multicmp < =) coll) > > On Dec 7, 5:51 pm, Andy Fingerhut wrote: > > I've been going through the PLEAC web sit

Macro to ease multiple-key sorting

2011-12-07 Thread Andy Fingerhut
I've been going through the PLEAC web site, writing Clojure examples corresponding to the Perl code examples from the Perl Cookbook: http://pleac.sourceforge.net Michael Bacarella started a github repo to collect these together, and I'm helping flesh some of them out. https://github.com/mbacarel

ANN: clojuredocs REPL client with off-line mode

2011-12-06 Thread Andy Fingerhut
This is still early, but it might be in a form where someone would like to use it, and I'd appreciate suggestions on what would make it more useful. It is a fork of the clojuredocs client created by Lee Hinman, with some additions so that you can either run it in the default "web mode", where it r

Re: Potential bug: pmap vs chunked seqs

2011-10-23 Thread Andy Fingerhut
It isn't hard to write your own variation of pmap that does not do more parallelism than you want, regardless of whether the input sequence is chunked or not. I wrote one for a Clojure submission to the computer language benchmarks game a year or so ago. Besides avoiding unwanted parallelism for

Re: Question:Multi-Core processor affinity for load balancing Clojure Web apps

2011-10-20 Thread Andy Fingerhut
I would suspect that you would not get a _significant_ performance advantage from specifying processor affinity, but if you really want to measure it and find out by experimentation, read on. I was not able to find any portable way within a JVM to set processor affinity, after some amount of Googl

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-11 Thread Andy Fingerhut
One benefit would be convenience of enabling parallelism on nested data structures. One function at the top level could use parallelism, and the pieces, perhaps handled by separate functions, and perhaps nested several levels deep in function calls, could also use parallelism. If it were implemen

Re: Spread work onto multiple threads (in pure Clojure)

2011-10-10 Thread Andy Fingerhut
I'll post more on this later, but I wanted to point out one case where I found that pmap was not achieving the desired level of speedup (# of CPUs/cores) that you would initially expect, and it is not due to any reasons that I've posted about before. Imagine a 4-core CPU. There are 4 physical CPU

Re: suggestion for clojure development

2011-10-01 Thread Andy Fingerhut
Tal, did you consider the possibility of staying with Clojure 1.2.1 and its libraries? Or was that not under consideration for some reason? Andy On Sat, Oct 1, 2011 at 6:03 PM, Tal Liron wrote: > On Tuesday, September 27, 2011 1:57:03 PM UTC-5, Arthur Edelstein wrote: >> >> So my request for C

Re: Clojure v1.4 - what is new, changed and in development

2011-09-27 Thread Andy Fingerhut
Pardon my ignorance -- I've not done anything with AJAX before. Is there a way to do this in a single HTML file, and include all of the tooltips in that file? If so, do you have an example of this I could use to learn from? Just two or three links each with different tooltips would be enough to

Re: can't see the error

2011-09-26 Thread Andy Fingerhut
This: randomPoint #(apply new point (repeatedly 3 randomInt)) does not work, but is almost what you want. It doesn't work because new is a macro, and apply only works with functions as the first arg. Using the following two lines, first to define a function, then to use it with apply, seems lik

<    3   4   5   6   7   8   9   10   >