Q: Any plans to make the default value of :gen-max a dynamic var?

2016-07-11 Thread Joseph Wayne Norton
Taken from the spec documentation: And additional args that control gen > :gen-max - the maximum coll size to generate (default 20) Q: Any plans to make the default value of :gen-max a dynamic var? -- You received this message because you are subscribed to the Google Groups "Clojur

Re: OOM error but Memory in use (percentage/used/max-heap): ("6%" "228M" "3342M")

2015-08-11 Thread piastkrakow
eld posted this code to track memory use, so I have > been using this to keep track of my app's memory usage: > > (defn- memory-bean > "Return the MemoryMXBean." > [] > (java.lang.management.ManagementFactory/getMemoryMXBean)) > > (defn- heap-usage > "

OOM error but Memory in use (percentage/used/max-heap): ("6%" "228M" "3342M")

2015-08-11 Thread piastkrakow
memory usage." [^java.lang.management.MemoryMXBean bean] (.getHeapMemoryUsage bean)) (defn- heap-used-max "Given heap memory usage, return a pair of used/max values." [^java.lang.management.MemoryUsage usage] [(.getUsed usage) (.getMax usage)]) (defn memory-usage &qu

Re: max doesn't return max?

2012-12-12 Thread Juan Martín Muñoz Facorro
Arguments to *max* should be supplied explicitly. If you want to use a sequence you should use *apply* with *max*: (apply max [1 2 0.5]) Regars, Juan On Wednesday, December 12, 2012 6:12:20 PM UTC-3, HamsterofDeath wrote: > > maybe i am blind, but why does max return the complete la

Re: max doesn't return max?

2012-12-12 Thread Timothy Baldridge
(doc max) user=> (doc max) - clojure.core/max ([x] [x y] [x y & more]) Returns the greatest of the nums. nil max doesn't take a sequence, it takes one or more values and finds the max of them. So use (apply max coll) to get what you want. Timothy On Wed,

max doesn't return max?

2012-12-12 Thread Dennis Haupt
maybe i am blind, but why does max return the complete lazy seq here instead of the maximum number? if i just print as-products, i get a list of numbers. (count solution) tells me there are 1000+ and yet max gives me the complete list? (ns euler.Problem8) (def digits

Re: How to apply max to a list of values given a predefined value order?

2012-12-05 Thread Mark Engelberg
(def order-list [Tier5 Tier10 Tier20 Tier30 Tier40 Tier50]) (def rank (into {} (map-indexed (fn [i x] [x i]) orders))) (apply max-key rank [Tier20 Tier10 Tier30]) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, sen

How to apply max to a list of values given a predefined value order?

2012-12-05 Thread scabbage
I need to apply a "max" operator to a list like this: [Tier20 Tier10 Tier30] It should give me "Tier30" as the max. My predefined order list (from low to high) is: [Tier5 Tier10 Tier20 Tier30 Tier40 Tier50] What's the best way to achieve this in clojure? -- You rece

fileseq modifiers - :min-depth, :max-depth ?

2012-10-01 Thread coltnz
Hi, not sure if this is considered too frivolous somehow but I've thought many times how nice it would be to modify a fileseq call by using a min-depth or max-depth modifier rather constructing a filter. Depth would refer to the levels of the underlying treeseq returned. So min-depth=

Re: More Concise or Idiomatic Max Sub-Array?

2012-09-30 Thread noahlz
> Another version I believe is more evident utilizes reductions to build a > list over all the *max-ending-here*s. You can then just pick the maximal > value in that list, giving you the maximal subarray: > > (defn max-subarray [A] > (let [pos+ (fn [sum x] (if (neg? sum) x (

Re: More Concise or Idiomatic Max Sub-Array?

2012-09-29 Thread Jean Niklas L'orange
> > Is there a more concise implementation, perhaps using `filter` or merely > by making the `reduce` version more "idiomatic" somehow? > Another version I believe is more evident utilizes reductions to build a list over all the *max-ending-here*s. You can then just pick

More Concise or Idiomatic Max Sub-Array?

2012-09-28 Thread noahlz
I've implemented the following two versions of the "Max Sub-Array" problem (http://en.wikipedia.org/wiki/Maximum_subarray_problem) in Clojure, using the Kadane algorithm. First with `loop` / `recur` (defn max-sub-array [A] (loop [x (first A) a (rest A)

Re: clojure.core/max and NaN

2011-11-01 Thread Alexander Taggart
See http://dev.clojure.org/jira/browse/CLJ-738 for clarity on this issue. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient

Re: clojure.core/max and NaN

2011-11-01 Thread Ben Smith-Mannschott
On Tue, Nov 1, 2011 at 21:00, Michael wrote: > > > On Nov 1, 12:14 pm, Ben Smith-Mannschott > wrote: >> 3. Define that min and max will ignore any NaN arguments. > > What is: > > (min NaN NaN) > > in this situation;  ()? The part of the message you didn

Re: clojure.core/max and NaN

2011-11-01 Thread Michael
On Nov 1, 12:14 pm, Ben Smith-Mannschott wrote: > 3. Define that min and max will ignore any NaN arguments. What is: (min NaN NaN) in this situation; ()? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: clojure.core/max and NaN

2011-11-01 Thread Brian Hurt
On Tue, Nov 1, 2011 at 12:14 PM, Ben Smith-Mannschott wrote: > > 2 Make NaN contagious > - > > Define min and max to return NaN if and only if at least one of their > arguments is NaN. This seems most in keeping with the (admittedly > perverse) behavio

Re: clojure.core/max and NaN

2011-11-01 Thread Ben Smith-Mannschott
I've opened http://dev.clojure.org/jira/browse/CLJ-868 "The min and max functions in clojure.core behave unpredictably when one or more of their arguments is Float/NaN or Double/NaN. This is because the current implementation assumes that > provides a total ordering, but this is not

Re: clojure.core/max and NaN

2011-10-30 Thread Brian Goslinga
On Oct 30, 4:02 am, bOR_ wrote: > Hi all, > > Ran into something unexpected with "max". > > user> (sd-age-female 13)                                                   > > [10 NaN 0.746555245613119]                                                 >

Re: clojure.core/max and NaN

2011-10-30 Thread Mikhail Kryshen
Why does Clojure have it's own naive implementation of max for doubles instead of using max from java.lang.Math which has necessary checks for NaN and the positive and negative zeros? On Sun, 30 Oct 2011 15:36:23 +0100 Ben Smith-Mannschott wrote: > On Sun, Oct 30, 2011 at 10:02, bOR

Re: clojure.core/max and NaN

2011-10-30 Thread Ben Smith-Mannschott
On Sun, Oct 30, 2011 at 10:02, bOR_ wrote: > Hi all, > Ran into something unexpected with "max". > user> (sd-age-female 13) > > > [10 NaN 0.746555245613119] > > > user> (apply max (sd-age-female 13)) > > 0.746555245613119 TL;DR: Don

clojure.core/max and NaN

2011-10-30 Thread bOR_
Hi all, Ran into something unexpected with "max". user> (sd-age-female 13) [10 NaN 0.74

Re: Weird result for (get max key)

2010-11-19 Thread Ken Wesson
On Fri, Nov 19, 2010 at 8:52 PM, Bob Shock wrote: > I had a bug in my code where I meant to type: > > (get map key) > > and instead typed: > > (get max key) > > It seems that any function name I put in for "max" always returns nil. > > user=> (get

Re: Weird result for (get max key)

2010-11-19 Thread Mike Meyer
On Fri, 19 Nov 2010 17:52:03 -0800 (PST) Bob Shock wrote: > I had a bug in my code where I meant to type: > > (get map key) > > and instead typed: > > (get max key) > > It seems that any function name I put in for "max" always returns nil. > > u

Weird result for (get max key)

2010-11-19 Thread Bob Shock
I had a bug in my code where I meant to type: (get map key) and instead typed: (get max key) It seems that any function name I put in for "max" always returns nil. user=> (get max 3) nil user=> (get min 3) nil user=> (get maxx 3) java.lang.Exception: Unable to resolve s

Re: max-key taking a list rather than different number of args

2010-11-15 Thread Tom Hall
> > You should be able to use (apply max-key f someseq); apply takes a variable > number of args, and only the last is expanded. > Thanks, thought there would be something like this! -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: max-key taking a list rather than different number of args

2010-11-14 Thread Stuart Campbell
On 15 November 2010 14:17, Tom Hall wrote: > Hi, > > I think a better usage for max-key would be > (max-key f someseq) > rather than passing the values as args. > > I used > (defn max-key-seq [f someseq] > (apply max-key (into [f] someseq))) > to make it do what

max-key taking a list rather than different number of args

2010-11-14 Thread Tom Hall
Hi, I think a better usage for max-key would be (max-key f someseq) rather than passing the values as args. I used (defn max-key-seq [f someseq] (apply max-key (into [f] someseq))) to make it do what I wanted Is there a better way? Cheers, Tom -- You received this message because you are

Re: Transpose and cast and max

2010-07-30 Thread Luka Stojanovic
On Fri, 30 Jul 2010 16:03:17 +0200, Base wrote: Hi All I have a vector in the following format: [ ["M" "3.4" "5.6"] ["L" "4.2" "6.6"] ["L" "4.9" "7.9"] ["L" "1.1" "2.4

Re: Transpose and cast and max

2010-07-30 Thread Base
quot;4.2" "6.6"] ["L" "4.9" "7.9"] ["L" "1.1" > > "2.4"]["L" "5.4" "4.5"] > > ] > > > I would like to create a vector that contains the max values of each > > of the

Re: Transpose and cast and max

2010-07-30 Thread Steve Purcell
On 30 Jul 2010, at 15:03, Base wrote: > Hi All > > I have a vector in the following format: > > [ >["M" "3.4" "5.6"] ["L" "4.2" "6.6"] ["L" "4.9" "7.9"] ["L" "1.1&q

Transpose and cast and max

2010-07-30 Thread Base
Hi All I have a vector in the following format: [ ["M" "3.4" "5.6"] ["L" "4.2" "6.6"] ["L" "4.9" "7.9"] ["L" "1.1" "2.4"]["L" "5.4" "4.5"] ]

Re: Bug in 1-arg max/min implementation? (Was: Should max and min have 0-arg implementations?)

2010-07-09 Thread Mark Engelberg
> Given that max only works on numbers, then why doesn't (max []) throw > the same exception as (max [] [])? Or, for that matter, (max \a) throw > the same exception as (max \a \b \c)? Clojure tends not to guarantee any particular behavior for invalid inputs. It might return a

Bug in 1-arg max/min implementation? (Was: Should max and min have 0-arg implementations?)

2010-07-09 Thread Mike Meyer
On Fri, 9 Jul 2010 13:57:05 -0400 Stuart Halloway wrote: > Once you walk down the path of "What should (max) return?" I think you won't > want a default behavior. > > Stu > > P.S. Agreed that (max []) is a bad example. Given that max only works on numbers, th

Re: Should max and min have 0-arg implementations?

2010-07-09 Thread Stuart Halloway
Once you walk down the path of "What should (max) return?" I think you won't want a default behavior. Stu P.S. Agreed that (max []) is a bad example. > I noticed that http://clojure-examples.appspot.com/clojure.core/max has both > (apply max [1 2 3 4]) -> 4 and (max

Should max and min have 0-arg implementations?

2010-07-09 Thread Aaron Cohen
I noticed that http://clojure-examples.appspot.com/clojure.core/max has both (apply max [1 2 3 4]) -> 4 and (max []) -> [] (which I think is a poor example). However, when attempting to add another example for (apply max []) which I expected to return nil, that instead it throws an excepti

http://www.stylishdudes.com cheap sell air max shoes, nike shoes,ugg shoes,jordan shoes,handbag,jeans,shox shoes,Get Nike Shoes at Super Cheap Prices

2009-03-08 Thread stylishdudes...@gmail.com
Get Nike Shoes at Super Cheap Prices Discount Nike air jordans (www.stylishdudes.com) Discount Nike Air Max 90 Sneakers (www.stylishdudes.com) Discount Nike Air Max 91 Supplier (www.stylishdudes.com) Discount Nike Air Max 95 Shoes Supplier (www.stylishdudes.com) Discount Nike Air Max 97

Re: Back on max again...

2008-11-04 Thread Paul Stadig
ompare-fn %1 %2)) %1 %2) args)) (defmacro generic-max [a b] (if (or (and (instance? Number a) (instance? Number b)) (and (= (:tag (meta a)) 'int) (= (:tag (meta b)) 'int))) (do (println "Using max") `(max ~a ~b)) (do (p

Re: Back on max again...

2008-11-04 Thread Konrad Hinsen
er criteria)? A macro gets its arguments unevaluated (necessarily, being called at compile time). I don't see how it could know their types. Given something like (max a b) how could you figure out the types of the values that will be bound to a and b when the macro-gen

Re: Back on max again...

2008-11-04 Thread Paul Stadig
the type hint of its parameters (or some other criteria)? So a macro could expand to a call to some optimized version for numeric types (max) if possible, but otherwise it would expand to a version that uses Comparable or compare or something generic. Instead of having to add this optimization directly

Re: Back on max again...

2008-11-04 Thread Graham Fawcett
On Tue, Nov 4, 2008 at 10:00 AM, Christian Vest Hansen <[EMAIL PROTECTED]> wrote: > > On Tue, Nov 4, 2008 at 3:12 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: >> On Nov 4, 9:00 am, "Christian Vest Hansen" <[EMAIL PROTECTED]> >> wrote: >>> "Generally" by custom but not required by contract of the Com

Re: Back on max again...

2008-11-04 Thread Christian Vest Hansen
On Tue, Nov 4, 2008 at 3:12 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Nov 4, 9:00 am, "Christian Vest Hansen" <[EMAIL PROTECTED]> > wrote: >> "Generally" by custom but not required by contract of the Comparable >> interface. And those are all Numbers, right? >> >> Comparable imposes natural

Re: Back on max again...

2008-11-04 Thread Cosmin Stejerean
and Date both > > > implement Comparable. Comparable is supposed to impose a total > > > ordering on a set, so in a finite set of objects of the same type, the > > > max is always well defined. > > > > +1 on (min) and (max) operating on Comparables. >

Re: Back on max again...

2008-11-04 Thread Rich Hickey
of the Comparable interface. > > >> > Ah, yes, this is true, I hadn't realized that String and Date both > >> > implement Comparable. Comparable is supposed to impose a total > >> > ordering on a set, so in a finite set of objects of the same type, the > >

Re: Back on max again...

2008-11-04 Thread Paul Stadig
On Tue, Nov 4, 2008 at 7:45 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > Hmm... > > Do you want: > > (max 1 2.1 4/5) > > to work? > > If so, you can't base it on Comparable, which generally only supports > homogenous types. > > max, like >, is a

Re: Back on max again...

2008-11-04 Thread Christian Vest Hansen
e both >> > implement Comparable. Comparable is supposed to impose a total >> > ordering on a set, so in a finite set of objects of the same type, the >> > max is always well defined. >> >> +1 on (min) and (max) operating on Comparables. >> > > H

Re: Back on max again...

2008-11-04 Thread Rich Hickey
ow objects of a type should be sorted is > >> the point of the Comparable interface. > > > Ah, yes, this is true, I hadn't realized that String and Date both > > implement Comparable. Comparable is supposed to impose a total > > ordering on a set, so in a finite set

Re: Back on max again...

2008-11-04 Thread Paul Stadig
ction system based on the Collections interfaces, and have max and min functions that only operate on numbers. It would seem we should embrace the Comparable and Comparator interfaces as well. Paul On Tue, Nov 4, 2008 at 12:23 AM, Mark H. <[EMAIL PROTECTED]> wrote: > > On Nov 3

Re: Back on max again...

2008-11-03 Thread Christian Vest Hansen
yes, this is true, I hadn't realized that String and Date both > implement Comparable. Comparable is supposed to impose a total > ordering on a set, so in a finite set of objects of the same type, the > max is always well defined. +1 on (min) and (max) operating on Comparables. -- V

Re: Back on max again...

2008-11-03 Thread Mark H.
le is supposed to impose a total ordering on a set, so in a finite set of objects of the same type, the max is always well defined. If I wanted the max of a set of strings representing dates, however, I'd still comment the code to indicate what "max" means. I'd also consider repl

Re: Back on max again...

2008-11-03 Thread Cosmin Stejerean
On Nov 3, 2008, at 8:35 PM, Mark H. wrote: > > On Nov 3, 5:39 pm, "Paul Stadig" <[EMAIL PROTECTED]> wrote: >> Could/Should the max function be modified to work against the >> Comparable interface instead of expecting its arguments to be >> numbers? >

Re: Back on max again...

2008-11-03 Thread .Bill Smith
> The semantics of "max string" are unclear enough that it would be > better to write out the operation explicitly so that all readers of > the code know what you mean. Agreed. For example, the semantics of "max string"

Re: Back on max again...

2008-11-03 Thread Matt Revelle
On Nov 3, 2008, at 9:35 PM, Mark H. wrote: > > On Nov 3, 5:39 pm, "Paul Stadig" <[EMAIL PROTECTED]> wrote: >> Could/Should the max function be modified to work against the >> Comparable interface instead of expecting its arguments to be >> numbers? >

Re: Back on max again...

2008-11-03 Thread Mark H.
On Nov 3, 5:39 pm, "Paul Stadig" <[EMAIL PROTECTED]> wrote: > Could/Should the max function be modified to work against the > Comparable interface instead of expecting its arguments to be numbers? > > I'm working with a sequence of strings that are dates in the

Back on max again...

2008-11-03 Thread Paul Stadig
Could/Should the max function be modified to work against the Comparable interface instead of expecting its arguments to be numbers? I'm working with a sequence of strings that are dates in the "-mm-dd" format, and I want to find the max. Calling max gives an exception about

Re: max

2008-10-20 Thread André Thieme
On 16 Okt., 22:01, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > #(identity %) is more compactly written as: identity. > > This works: > >         user=> (apply max (filter identity '(1 2 nil 4))) >         4 > > In this case, number? i

Re: max

2008-10-16 Thread Martin DeMello
On Oct 16, 1:45 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Just to add to the confusion: I want compact to remove nil and   > false. :-) They'll revoke your ruby license :) irb(main):031:0> [1,2,3,4,false,nil,5,6].compact => [1, 2, 3, 4, false, 5, 6] martin --~--~-~--~~---

max-key/min-key ... while we're on the subject

2008-10-16 Thread Paul Stadig
While were on the subject, wouldn't it make sense to rename max-key to max-fn or something? I gather that it is called max-key because you can pass a keyword as a way to index into a map, but since keywords implement IFn and in this case they are actually being used as a function, and yo

Re: max

2008-10-16 Thread Paul Stadig
Thanks, Rich. That's easier on the eyes. Also, that set trick is pretty cool! Paul On Thu, Oct 16, 2008 at 5:20 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > I've been meaning to add remove for a while. It's certainly more > general than compact, and (filter (complement ...)) gets cumbersome >

Re: max

2008-10-16 Thread Rich Hickey
boolean values, but want to remove the nils (perhaps > they're a sentinel for some other meaning). > > user> (compact [true false nil true true]) > (true false true true) > > I think it makes sense to have the number functions like max and min throw a > NPE, and since fal

Re: max

2008-10-16 Thread Brian Doyle
t; > user> (compact [true false nil true true]) > (true false true true) > > I think it makes sense to have the number functions like max and min throw > a NPE, and since false and nil are distinct, I think it makes sense to have > a compact that removes nil, but leaves false. >

Re: max

2008-10-16 Thread Paul Stadig
true]) (true false true true) I think it makes sense to have the number functions like max and min throw a NPE, and since false and nil are distinct, I think it makes sense to have a compact that removes nil, but leaves false. Paul On Thu, Oct 16, 2008 at 4:45 PM, Stuart Halloway <[EMAIL PROTECTE

Re: max

2008-10-16 Thread Stuart Halloway
Just to add to the confusion: I want compact to remove nil and false. :-) > Perhaps another nudge for compact is that it's not as simple as > (filter identity coll), to wit: > > user> (filter identity [1 2 nil false 4]) > (1 2 4) > > user> (filter #(not (nil? %)) [1 2 nil false 4]) > (1 2 fal

Re: max

2008-10-16 Thread Paul Stadig
idiom will occur everywhere. It certainly does in the other > languages I use. > > (2) Clojure needs compact *more* than these other languages, if > functions like max are going to fall out with NPE. I like the idea of > functions not being generally nil-safe where there is no obvious > in

Re: max

2008-10-16 Thread Stuart Halloway
I am going to vote twice on this one. +2 for adding compact to Clojure. :-) (1) This idiom will occur everywhere. It certainly does in the other languages I use. (2) Clojure needs compact *more* than these other languages, if functions like max are going to fall out with NPE. I like the

Re: max

2008-10-16 Thread Paul Stadig
rks, but would it be > possible > > to add a 'squeeze or 'compact function so we could do something like > (apply > > max (compact coll))? > > I like how few functions clojure has built in (compared to say common > lisp). It think this is partly achieved throug

Re: max

2008-10-16 Thread Chouser
On Thu, Oct 16, 2008 at 3:26 PM, Paul Stadig <[EMAIL PROTECTED]> wrote: > > Something like (filter #(identity %) coll) works, but would it be possible > to add a 'squeeze or 'compact function so we could do something like (apply > max (compact coll))? I like how few

Re: max

2008-10-16 Thread Stephen C. Gilardi
le to add a 'squeeze or 'compact function so we could do > something like (apply max (compact coll))? #(identity %) is more compactly written as: identity. This works: user=> (apply max (filter identity '(1 2 nil 4))) 4 In this case, number? is also a go

Re: max

2008-10-16 Thread Stuart Halloway
t be > possible to add a 'squeeze or 'compact function so we could do > something like (apply max (compact coll))? > > > Paul > > On Thu, Oct 16, 2008 at 3:22 PM, Stuart Halloway <[EMAIL PROTECTED] > > wrote: > > Hi Paul, > > I think the current b

Re: max

2008-10-16 Thread Paul Stadig
OK. Then next question. Is there some reason we don't have a "remove the nils" function in the 'clojure namespace? Something like (filter #(identity %) coll) works, but would it be possible to add a 'squeeze or 'compact function so we could do something like (app

Re: max

2008-10-16 Thread Stuart Halloway
Hi Paul, I think the current behavior is reasonable. It is consistent across all the numeric functions. And if the nil got into max by being a sentinel value from some other function, I don't think there is a right way to interpret it. Stuart > Currently, "(max 1 2 nil 4)&

max

2008-10-16 Thread Paul Stadig
Currently, "(max 1 2 nil 4)" throws a NPE. Would it be reasonable to expect it to return "4"? Or is it right that it throws an NPE? Paul --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "C