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,
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 #)
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
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
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 they are quick easy to write.
Make a library
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
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
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(); jimpil1...@gmail.com
wrote:
Evaluates x then calls all of the methods and functions with the
value of x supplied at the
' 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... :-)
Jim
On 14/06/12 15:52, David Nolen wrote:
On Thu, Jun 14, 2012 at 10:39 AM, Jim - FooBar(); jimpil1...@gmail.com
wrote:
Evaluates x then calls
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 you.
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 like
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.
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
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
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
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,
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
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
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,
creating other threads
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
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
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 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_4vTk
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= (identical?
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
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 vector of
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:
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 checked.
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 what I wanted. I've tried using
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
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.
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 three versions of the cheatsheet:
(1) no tooltips, just like
, 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 least. Alex, please don't put this on clojure.org
.
All necessary 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
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 strings as the values of the title
attribute
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]
On Mar 25, 2012, at 12:15 AM, Cedric Greevey wrote:
On Sun, Mar 25, 2012 at 2:59 AM, Andy Fingerhut
andy.finger...@gmail.com 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
breaks in my
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],
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
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
On Fri, Mar 23, 2012 at 12:50 PM, Cedric Greevey cgree...@gmail.com wrote:
On Fri, Mar 23, 2012 at 10:58 AM, Andy Fingerhut
andy.finger...@gmail.com 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
PM, Cedric Greevey cgree...@gmail.com wrote:
On Fri, Mar 23, 2012 at 3:57 PM, Andy Fingerhut
andy.finger...@gmail.com 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 tried that led me to add (b) to my
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
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.
return a
persistent collection, right? :)
thx
Las
2012/3/20 Andy Fingerhut andy.finger...@gmail.com
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
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 the function mutates data, i.e
, 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 programmers are probably already familiar
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
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
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
(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.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
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?
(symbol 'foo)
(symbol
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.
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
#URL
/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.cljs'
nil
Andy
On Mar 3, 2012, at 12:08 PM, Andy Fingerhut wrote:
I'm not sure what it is, but here is another transcript that may
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
for the cheatsheet contents?
On Feb 27, 7:57 am, Bill Caputo logos...@gmail.com wrote:
On Feb 27, 2012, at 1:22 AM, Andy Fingerhut wrote:
Thanks to several people who provided feedback, especially Steve Miner, and
to Alex Miller for updating the web site yet again, there is a new
cheatsheet
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
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.
Andy
On Feb 20, 2012, at 1:30 PM, Andy Fingerhut wrote:
This will likely go live
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
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.
)
+ 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, Andy Fingerhut wrote:
Fogus, Alex Millier, and I have made some updates
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)
ClassNotFoundException
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 andy.finger...@gmail.com wrote:
This will likely go live on clojure.org/cheatsheet in a few days, but I
want to give it a little longer for folks to have
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
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
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
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,
On Tue, Jan 17, 2012 at 4:35 AM, Rasmus Svensson r...@lysator.liu.sewrote:
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)))
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 ones
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
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
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
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
:
Like this?
(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 andy.finger...@gmail.com
wrote:
I know I can bind *out
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
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)
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 andy.finger...@gmail.comwrote
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
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 you
at 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 andy.finger...@gmail.comwrote:
conj adds an element to a data structure in a place most efficient for the
particular type of data structure
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.
zero? (map #(compare (% a) (% b))
keys)))
0)))
(sort-by (multicmp =) coll)
On Dec 7, 5:51 pm, Andy Fingerhut andy.finger...@gmail.com wrote:
I've been going through the PLEAC web site, writing Clojure examples
corresponding to the Perl code
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 andy.finger...@gmail.comwrote:
The intent of making it a macro is that it allows short-circuit
evaluation, like
On Wed, Dec 7, 2011 at 8:29 PM, Alan Malloy a...@malloys.org wrote:
On Dec 7, 8:12 pm, Andy Fingerhut andy.finger...@gmail.com 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
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
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
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
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
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 tal.li...@gmail.com wrote:
On Tuesday, September 27, 2011 1:57:03 PM UTC-5, Arthur Edelstein wrote:
So
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
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
All persistent data structures are immutable, but not all immutable data
structures are persistent.
For example, imagine an immutable array that, unlike Clojure's vector data
structure, implemented conj by copying the entire array into a new one
with the original elements plus the new one.
resource
contention, etc.
I have similar issues sometimes when I launch parallel threads via sends to
agents. Will this behave similarly to pmap? If so, is there a
straightforward way to get the same kind of benefit as medusa-pmap in an
agent context?
-Lee
On Sep 22, 2011, at 11:34 PM, Andy
To be very precise, (conj v new-elem) is O(log n) in time and space, but it
is constant-ish because the base of the logarithm is something like 32,
rather than something like 2, so the constant factor multiplying the log n
is typically pretty small.
Also, there is no difference in Clojure's
pmap will limit the maximum number of simultaneous threads. So will the
medusa library's medusa-pmap.
The difference is that if one job early in the list takes, e.g., 100 times
longer than the next 20, and you have 4 cpus available, pmap will start the
first (4+2)=6 in parallel threads, let jobs
pmap already uses future/deref in its implementation. When it does so, it
limits the *maximum* parallelism possible to be at most (number-of-cpus + 2)
threads running at a time, and depending upon the time taken by each of the
objects you are mapping over, it can be less then that.
I don't know
There is definitely a particular width that it was made for the layout to
work well. I'm not enough of an HTML guru to know whether there is a good
way to make it automatically adjust to display at other screen widths, but
if you or someone else is, you can download the Clojure program that
Everyone is welcome to make faster versions if they can figure out how.
I suspect that most of the time is spent in BigInteger math in that
particular program. If so, type annotation won't speed that up.
Glad to be proved wrong, though!
Andy
On Sun, Sep 18, 2011 at 12:02 AM, Vagif Verdi
if such a submission would be
acceptable.
Andy
On Sun, Sep 18, 2011 at 8:16 AM, Andy Fingerhut andy.finger...@gmail.comwrote:
Everyone is welcome to make faster versions if they can figure out how.
I suspect that most of the time is spent in BigInteger math in that
particular program. If so, type annotation
701 - 800 of 890 matches
Mail list logo