Re: map semantics

2014-02-07 Thread Mars0i
On Friday, February 7, 2014 10:17:15 PM UTC-6, Andy C wrote: > > But what really bothers me is that laziness / not laziness affects the > result of evaluation as in above example. That is against some fundamental > rules of FP (gotta check how Haskell does it :-P). > Well, it's not really lazine

Re: map semantics

2014-02-08 Thread Mars0i
Maybe another way to put it is that what is, uh, "broken" isn't 'map' or 'seq', but '=', which is willing to tell you that two things (sets) are the same when they're not! We also have the non-broken predicate 'identical?', however, that gets it right. It's nice to also have a set-equal predic

Re: map semantics

2014-02-08 Thread Mars0i
7;. (I'm assuming that calling 'seq' on any two sorted sets that are = always returns seqs that are =.) (Don't take offense at the tone of my remarks. I think we're all on the same side here.) On Saturday, February 8, 2014 10:14:37 PM UTC-6, Mars0i wrote: > > Maybe

Re: unconditional append to end

2014-02-09 Thread Mars0i
On Sunday, February 9, 2014 10:45:04 PM UTC-6, Alan Thompson wrote: > > ... > I saw an email a while back that claimed ClojureDocs.org is working on a > re-write of the site, and an upgrade from Clojure 1.2 to 1.5. In the > meantime, is there a better way of exploring the API? > Not a full answ

Re: [Kind of off-topic] Enlightenment

2014-02-09 Thread Mars0i
I don't think I ever had an a-ha moment with Lisp per se, because it was one of the first languages I learned. But Friedman and Felleisen's *The Little Schemer* (then titled *The Little Lisper*) was a revelation. I didn't understand recursion until I worked through it, and it was also only th

Re: unconditional append to end

2014-02-10 Thread Mars0i
On Monday, February 10, 2014 11:56:18 AM UTC-6, t x wrote: > > Someone needs to make a flappy bird version of > > http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html > > > It provides a description of the function, you type in the function name. > :-) > Like

Re: unconditional append to end

2014-02-10 Thread Mars0i
On Sunday, February 9, 2014 11:38:39 PM UTC-6, mynomoto wrote: > > +1 to the Cheat Sheet although I prefer this version: > http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html > Several variations on the cheatsheet are available via links from the main cheatshee

Where is the rotations function?

2014-02-10 Thread Mars0i
At one time there was a function named "rotations" in clojure.contrib.seq, and at another time in clojure.contrib.seq-utils . Neither of these libraries seem to be present as of Clojure 1.5, and I am not finding rotations anywhere else. Does rotations exist? I can write it myself, but don't

Re: Where is the rotations function?

2014-02-11 Thread Mars0i
rib library, but > it's trivial to implement: > > (defn rotations [xs] (take (count xs) (partition (count xs) 1 (cycle > xs > > On 11 February 2014 05:53, Mars0i > > wrote: > > At one time there was a function named "rotations" in > clojure.co

Re: range-sum

2014-02-12 Thread Mars0i
On Wednesday, February 12, 2014 2:33:34 PM UTC-6, John Wiseman wrote: > > In the olden lisp days, reduce was often preferred to apply because apply > could hit limits on the number of arguments that could be passed to a > function. > Still an issue with some Common Lisps. I've hit the limit

Re: range-sum

2014-02-12 Thread Mars0i
On Wednesday, February 12, 2014 5:14:42 PM UTC-6, Mars0i wrote: > On Wednesday, February 12, 2014 2:33:34 PM UTC-6, John Wiseman wrote: >> >> Is that a potential issue with clojure? >> > > (range 1) > > Then copy its output from the terminal window. >

Re: range-sum

2014-02-12 Thread Mars0i
rguments, right? It's a limit on the size of a literal or > something? > > I ask because (apply + (range 1)) works fine, but maybe I've missed > some subtlety. > > Thanks, > John > > > > On Wed, Feb 12, 2014 at 3:32 PM, Mars0i > > wrote:

Re: [ANN] Clojure 1.6.0-beta1

2014-02-14 Thread Mars0i
Could someone clarify for me why "some?" as a name for not nil makes sense at all in the first place? Not criticizing. I just don't understand what existence or there being some of something has to do with nil. Maybe I don't understand the intent of nil. I came to Clojure from Common Lisp.

Re: [ANN] Clojure 1.6.0-beta1

2014-02-15 Thread Mars0i
Thanks for all of the very helpful answers about nil and "some". I understand now. I'll add my voice to those who are bothered by the two distinct uses of "some" (some, some-fn vs some->, some->>, some?) bother me. I celebrate the semi-arbitrary quirkiness of function names in Common Lisp,

Re: [ANN] Clojure 1.6.0-beta1

2014-02-15 Thread Mars0i
Thank you for all of the very helpful answers about nil and "some". I understand now. I am *very* grateful to Rich Hickey and all of the other dedicated Clojure developers. For what it's worth, I'll add my voice to those who are bothered by the two distinct uses of "some" (some, some-fn vs so

Re: [ANN] Clojure 1.6.0-beta1

2014-02-15 Thread Mars0i
Thank you for all of the very helpful answers about nil and "some". I understand now. I am *very* grateful to Rich Hickey and all of the other dedicated Clojure developers. For what it's worth, I'll add my voice to those who are bothered by the two distinct uses of "some" (some, some-fn vs so

Re: [ANN] Clojure 1.6.0-beta1

2014-02-16 Thread Mars0i
I like Alex's suggestions. Another option is "something" rather than "some" or "exists". "Something" has the disadvantage that it's long, so when you combine it with addition strings, you get something even longer. On the other hand, for me both "some" and "exists" sound like existential qu

Re: why Clojure/Lisp is so fast

2014-02-18 Thread Mars0i
It really depends on the benchmark and the programmer, and sometimes on the computer. And on what a person chooses to report. Here are some benchmarks, probably only representative of very special cases, that show Java beating Clojure in many cases, Java and SBCL both beating each other in som

Re: apply to quoted form

2014-03-22 Thread Mars0i
A remark from someone who's not a clojure expert, and isn't familiar with 4clojure or its goals: IMO eval isn't bad. It's a tool, and it can be abused like any tool. You have a choice. Using eval with your original code would be a lot simpler, but there are tradeoffs. -- You received this m

Re: list all functions in namespace?

2014-04-04 Thread Mars0i
(doc dir) - clojure.repl/dir ([nsname]) Macro Prints a sorted directory of public vars in a namespace On Friday, April 4, 2014 6:53:54 PM UTC-5, Christopher Howard wrote: > > Is there some trick Clojure command to list all functions defined in a > namespace? > -- You

The Cons in iterate's return value

2014-04-16 Thread Mars0i
The docstring for iterate says that it returns a lazy sequence, but it returns a Cons wrapped around a LazySeq. This means, for example, that realized? can't be applied to what iterate returns. Is this a problem with the iterate docstring? Or should realized? be applicable to Conses? I assu

Re: Why I'm giving Clojure a try

2014-04-16 Thread Mars0i
I second Dan Cross's comment. You also need to get used to *reading*standard Lisp code indentation. It's not hard, but it's different from what's common for most languages. Then when your editor reformats your code, you easily can see whether there's something wrong with your parentheses. O

Re: Why I'm giving Clojure a try

2014-04-16 Thread Mars0i
Syntax-highlighting helps, although not for user-defined functions (at least not in Vim, which is what I use). On Wednesday, April 16, 2014 12:30:45 PM UTC-5, Gary Trakhman wrote: > > What's harder than parentheses is the fact that any sort of semantics can > be hidden under simple words in the

Re: The Cons in iterate's return value

2014-04-16 Thread Mars0i
On Wednesday, April 16, 2014 2:39:24 PM UTC-5, gianluca torta wrote: > > this issue on core.typed > http://dev.clojure.org/jira/browse/CTYP-96 > > in particular the

Re: Why I'm giving Clojure a try

2014-04-17 Thread Mars0i
Thanks for that image, Manuel Paccagnella. I'd never seen it. However, the top image leaves out most of the parentheses, and they're part of the beauty, for me--along with the indentation. (I had a little bit of trouble Googling up a stable URL for the image, but finally found this, for anyone

Re: The Cons in iterate's return value

2014-04-17 Thread Mars0i
On Thursday, April 17, 2014 10:36:13 AM UTC-5, A. Webb wrote: > On Wednesday, April 16, 2014 10:35:14 PM UTC-5, Mars0i wrote: >> >> >> But then should realized? be able to deal with a Cons containing a >> LazySeq? >> >> (Is this an issue worthy of JIRA?

Re: Style question (predicates)

2014-04-17 Thread Mars0i
While *every?* and *not-any?* return true or false, *some* returns the first truthy value in a sequence, or nil if there are none. Similarly, *empty?* returns true or false, while *empty* and *not-empty*return a collection or nil. However, it seems as if* some*, *empty*, and *not-empty *are int

Re: Style - Keyword access or accessors?

2014-04-23 Thread Mars0i
One of the things I hated about Java when I did Java programming for a living, a number of years ago, was having to define accessors, over, and over, and over again for each class. What a waste of time! (Not to mention the instance in which we made a client move to using paper rather than sof

Re: Style - Keyword access or accessors?

2014-04-24 Thread Mars0i
I do think there's a legitimate role for routine use of accessors in some contexts, btw. I seem to have been traumatized by my experience with them, however. :-) On Thursday, April 24, 2014 12:48:04 AM UTC-5, Mars0i wrote: > > One of the things I hated about Java when I did Java

Re: Proposing a new Clojure documentation system (in Clojure)

2014-04-26 Thread Mars0i
Some thoughts: Having concise documentation in the same place as the code minimizes a certain kind of work: I want my functions to be commented in the source file so that someone reading it later (maybe me) will quickly understand what they're supposed to do. If Clojure didn't have docstrings

Re: Proposing a new Clojure documentation system (in Clojure)

2014-04-29 Thread Mars0i
On Tuesday, April 29, 2014 10:47:58 PM UTC-5, da...@axiom-developer.org wrote: > > Phil, > > > I like the general idea of the Valentin's proposal, but I don't > > understand every bit of it. It sounds complicated. Personally, I'd > > rather see something that's relatively simple, and good eno

Re: Proposing a new Clojure documentation system (in Clojure)

2014-04-29 Thread Mars0i
On Tuesday, April 29, 2014 11:01:46 PM UTC-5, Mars0i wrote: > > On Tuesday, April 29, 2014 10:47:58 PM UTC-5, da...@axiom-developer.orgwrote: >> >> Phil, >> >> > I like the general idea of the Valentin's proposal, but I don't >> > understand

Re: Proposing a new Clojure documentation system (in Clojure)

2014-04-30 Thread Mars0i
Tim, I am in full support of the approach to documentation that you describe, for individuals and organizations that feel that it best supports their needs. It's a good approach. I don't favor requiring an entire programming community to follow it. That's too much of an imposition. I do lik

Re: Proposing a new Clojure documentation system (in Clojure)

2014-05-01 Thread Mars0i
On Wednesday, April 30, 2014 1:03:24 PM UTC-5, Gregg Reynolds wrote: > The one thing that I think would be genuinely useful and developer > friendly with respect to Clojure is a means of making type signatures > explicit. Clojure may be dynamically typed, but everything has an intended > typ

Re: core.async and Joy of Clojure

2014-05-01 Thread Mars0i
On Monday, April 28, 2014 9:42:06 AM UTC-5, gamma235 wrote: > > I heard that Joy of Clojure would be adding a lot in the 2nd edition, > including a section on core.logic; is core.async also on that list? > I bought the pre-release + final release *Joy of Clojure* 2nd ed. package, so I have the

Re: core.async and Joy of Clojure

2014-05-02 Thread Mars0i
/2 price, and I have seen that offer more than once since I bought the package. It may that at this point they won't offer any further 1/2 price deals on JoC, but if they do, you could buy it that way.) On Friday, May 2, 2014 1:07:36 AM UTC-5, gamma235 wrote: > > Thank you Mars0i!! &

Re: deep thinking

2014-05-02 Thread Mars0i
There's a lot in between the amazingly common practice of barely commenting code--as if it was self-explanatory--and literate programming. Part of the reason I comment my code is so that *I* can understand it later. -- You received this message because you are subscribed to the Google Groups "

Re: deep thinking

2014-05-02 Thread Mars0i
On Friday, May 2, 2014 5:39:51 PM UTC-5, Mars0i wrote: > > There's a lot in between the amazingly common practice of barely > commenting code--as if it was self-explanatory--and literate programming. > Part of the reason I comment my code is so that *I* can understand it &g

Re: Proposing a new Clojure documentation system (in Clojure)

2014-05-05 Thread Mars0i
(There are now three recent threads on documentation in the Clojure Google group*. *The other threads are "Code Genres" and "Deep Thinking". It was actually *da...@axiom-developer.org's May* 4 post in "Deep Thinking" that stimulated these remarks; I posted in this thread only because it has "

Re: Proposing a new Clojure documentation system (in Clojure)

2014-05-06 Thread Mars0i
On Tuesday, May 6, 2014 4:53:36 AM UTC-5, Phillip Lord wrote: > > Gregg Reynolds > writes: > > That sounds about right to me; communication (writing) skills, mainly. > Of > > course, my degree is in the humanities, so I would say that. Now I > think > > of computation as a new addition to

Re: Proposing a new Clojure documentation system (in Clojure)

2014-05-06 Thread Mars0i
On Tuesday, May 6, 2014 9:39:47 AM UTC-5, Gregg Reynolds wrote: > > For what it's worth, I generally prefer manpages for API and language > documentation. Very fast, with good search capabilities. > I agree, but I suspect that this is a minority view. > My main complaint about the Clojure d

Re: Proposing a new Clojure documentation system (in Clojure)

2014-05-06 Thread Mars0i
On Tuesday, May 6, 2014 2:22:13 PM UTC-5, da...@axiom-developer.org wrote: > > Gregg, > > > My original comment on litprog ("bad bad bad") was admittedly a little > > strong. I think its bad for some things, fine for others. And it's > > possible litprog conventions will evolve to address the

Re: Functional programming and security

2014-05-06 Thread Mars0i
On Monday, May 5, 2014 3:20:41 AM UTC-5, Cecil Westerhof wrote: > > > ​That is why I do not understand that (where I live) they think you can > only be a good programmer if you only program in one language. > If I had to come up with a rule of thumb along this dimension it would be: Any truly ex

Re: Contagious BigDecimals?

2014-05-07 Thread Mars0i
Reviving a thread from three years ago (feel free to point me to something more recent) ... In Clojure 1.6: (class (+ 1 1.0M)) ; ==> java.math.BigDecimal (class (+ 1.0 1.0M)) ; ==> java.lang.Double So combining a BigDecimal with a Long produces a BigDecimal, but combining it with a Double pr

Re: Contagious BigDecimals?

2014-05-07 Thread Mars0i
On Wednesday, May 7, 2014 1:00:01 PM UTC-5, squeegee wrote: > > > On May 7, 2014, at 12:11 PM, Mars0i > > wrote: > > To me, the fact that BigDecimal is contagious sometimes but not always, > seems confusing in a way that could encourage bugs. The fact that BigInts >

Re: Rethinking Literate Programming

2014-05-10 Thread Mars0i
I think we all know this, but just to make sure the point is clear (in some of the dicussion here, it doesn't seem that it is), the alternatives are not only: (a) Source code with docstrings (or fancy formatted docstrings with links, etc.) and sparse comments, but no other explanatory text anyw

Is there a term for non-map collections?

2014-05-16 Thread Mars0i
As Tim McCormack's helpful web page on Collections and Sequences in Clojuresays, "Newcomers to Clojure are often confused by the collection and sequence abstractions and how they relate to one another." I'd been using collections and

Re: Is there a term for non-map collections?

2014-05-16 Thread Mars0i
On Friday, May 16, 2014 12:09:36 PM UTC-5, squeegee wrote: > > I think I’d use “kws” or “keywords” in that case. I’d expect a seq of > keywords. > > I don’t think keyw-seq is too narrow though. The items in a seq on a map > are “map entries" or more generically “pairs”, not “keywords”. > OK, b

Re: Is there a term for non-map collections?

2014-05-16 Thread Mars0i
On Friday, May 16, 2014 12:46:10 PM UTC-5, squeegee wrote: > > > On May 16, 2014, at 1:23 PM, Mars0i > > wrote: > > OK, but "seq" implies that sets aren't appropriate, but as long as I don't > care about order, they may be perfectly fine. > &

Re: Is there a term for non-map collections?

2014-05-16 Thread Mars0i
It's clear that the answer to my question is: No. There is no common term for non-map collections. Btw, the way that I expressed the question has been misleading. I'm not really interested in a function that is supposed to accept only collections of keywords. I defined a function, which in my

Re: Heidegger, literate programming, and communication

2014-05-21 Thread Mars0i
On Wednesday, May 21, 2014 6:03:04 AM UTC-5, da...@axiom-developer.org wrote: > > The primary focus of a "documentation system" is communication from > the author to the audience. > > One of the struggles apparent in discussing issues of communication, > especially with programmers, is Heideg

Re: Heidegger, literate programming, and communication

2014-05-21 Thread Mars0i
Tim, >From my point of view there are at least a few things that seem clear: 1. I think that Gregg Reynolds and I agree on a lot, but I would add to his remarks that there is almost always a human audience for source code, as well as the compiler/interpreter. Sometimes, the audience is just th

Re: Heidegger, literate programming, and communication

2014-05-22 Thread Mars0i
Tim, Your project of LP'ing the Clojure internals is not at all inconsistent with my view. That is code that would benefit from being widely understood, even by people who won't maintain it. I learned a lot from reading the "Lions" book on an early version of Unix, even though I probably ne

Re: [Axiom-developer] Heidegger, literate programming, and communication

2014-05-22 Thread Mars0i
On Thursday, May 22, 2014 4:05:58 PM UTC-5, Gary Johnson wrote: > > Hi folks, > > I suspect I'm the Gary that Tim thought he was referring to since I've > posted on several of his other LP-related threads (though not this one > until now). > I cede the name "Gary" to Gary. > But really,

Re: Help with a memory leak

2014-05-22 Thread Mars0i
On Wednesday, May 21, 2014 7:43:41 PM UTC-5, Bauna wrote: > > The main loop is here[2] in the function trace-gen that generates a lazy > list. I don't care about the memory required during the execution of the > function but after it should be GC'd all. > Just a quick question: Have you check

Re: gemacl: Scientific computing application written in Clojure

2014-06-03 Thread Mars0i
Jose, This is an old thread, and whatever problems you might be dealing with now, they're probably not the same ones as when the thread was active. However, I think that if parallel code uses the built-in Clojure random number functions, there is probably a bottleneck in access to the RNG. Wi

Re: non-lazy clojure?

2014-06-03 Thread Mars0i
On Monday, June 2, 2014 3:32:59 PM UTC-5, Lee wrote: > > I've generally liked Clojure's pervasive laziness. It's cute and it > sometimes permits lovely, elegant approaches to particular programming > problems. > After worrying about some bad potential problems with mutation of data structures

Allow reseeding/rebinding RNG behind rand?

2014-06-03 Thread Mars0i
t appears that the random number generator for rand used can't be reseeded, so there is no way to precisely repeat an experiment involving randomness, except by redefining rand. Also, there is no way to specify that rand in different threads should use different RNGs (a strategy discussed in th

Re: Top-down code in namspaces

2014-06-04 Thread Mars0i
On Sunday, June 1, 2014 9:36:55 AM UTC-5, Glen Mailer wrote: > > Hi everyone, I'm looking to get some opinions on code style. > > Specifically, I like to write my code in a top-down. > > What I mean by that is that within a file the highest-level functions sit > at the top, and are implemented i

Re: Top-down code in namspaces

2014-06-04 Thread Mars0i
On Wednesday, June 4, 2014 9:42:41 AM UTC-5, Mars0i wrote: > > ... Then I add the new functions to the declare statement by hand, or I > periodically do something like: > > grep defn mysourcefile.clj >> mysourcefile.clj > (Be careful to use two ">"s!) >

Re: gemacl: Scientific computing application written in Clojure

2014-06-04 Thread Mars0i
On Tuesday, June 3, 2014 12:46:55 PM UTC-5, Mars0i wrote: > > (def ones (doall (repeat 1000 1))) > (bench (def _ (doall (map rand ones ; 189 microseconds average time > (bench (def _ (doall (pmap rand ones ; 948 microseconds average time > For the record, I worried

Re: Allow reseeding/rebinding RNG behind rand?

2014-06-04 Thread Mars0i
On Tuesday, June 3, 2014 4:56:26 PM UTC-5, Andy Fingerhut wrote: > > This ticket seems to be at least somewhat related to your questions: > > http://dev.clojure.org/jira/browse/CLJ-1420 > > Andy > Yes, thanks for finding that, Andy. It looks like it would address the problem about accessing

Re: Allow reseeding/rebinding RNG behind rand?

2014-06-04 Thread Mars0i
On Wednesday, June 4, 2014 2:55:20 AM UTC-5, Gunnar Völkel wrote: > > Once you notice that you usually need a fast solution. > Yes! > The easiest solution is to just pass around an instance of > java.util.Random which you create with the desired seed. Another options is > to have a constru

Re: Is it the right Clojure group for a newbie

2014-06-04 Thread Mars0i
On Tuesday, June 3, 2014 8:41:33 AM UTC-5, Gregg Reynolds wrote: > > I know you've asked for online resources, but I can't resist a plug for The > Little Schemer . It's > short, very clear, starts at the very beginning, and you don't even need a >

Past and future of data.generators

2014-06-04 Thread Mars0i
clojure.core provides a minimal set of functions for random effects: rand, rand-int, and rand-nth, currently with no simple ability to base these on a resettable random number generator or on different RNGs in different threads. (But see this ticket

Advice on managing random number generators across threads

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

Re: Advice on managing random number generators across threads

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

Re: Advice on managing random number generators across threads

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

Re: Advice on managing random number generators across threads

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

Re: Advice on managing random number generators across threads

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

Re: Advice on managing random number generators across threads

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

Re: Advice on managing random number generators across threads

2014-06-07 Thread Mars0i
On Saturday, June 7, 2014 7:09:53 PM UTC-5, Alexander Hudek wrote: > > Keep in mind that there could be accuracy reasons why you might want to > use multiple random number generators (aka multiple streams). See the > section "Single Versus Multiple Streams" here: > > http://www.cse.msu.edu/~cse80

Re: Past and future of data.generators

2014-06-07 Thread Mars0i
For the record, after doing some simple speed comparisons of ampling functions from Incanter, data.generators, and bigml/sampling (using Criterium, and making sure to doall lazy sequences), it appears that data.generators performs very well in some situations. -- You received this message beca

Re: Past and future of data.generators

2014-06-07 Thread Mars0i
For the record, I just did some simple speed comparisons of sampling functions from Incanter, data.generators, and bigml/sampling, and data.generators performs very well. It was fastest in some tests. -- You received this message because you are subscribed to the Google Groups "Clojure" group

Re: using "hidden" parameters?

2014-06-13 Thread Mars0i
Here's a way to do it. Not sure if this is what you want. (let [x (atom 12)] (defn next-number [] (swap! x inc))) Functions are clojures, which means that next-number can retain a pointer to a variable that it can see when it's defined. If some of the ideas here are unfamiliar: The atom func

Leiningeng 2.4.x problem? Or is it my config?

2014-06-19 Thread Mars0i
After I upgrading to Leiningen 2.4.0, Ctrl-C causes an exception that throws me out to the shell, rather than bringing me back to the Leiningen prompt. I just upgraded to 2.4.2 and still have the problem. On another machine with an older Leiningen, I have no problem. I suspect it's something

Re: is PG's "imperative outside-in" advice any good?

2013-10-17 Thread Mars0i
In CL, `let*` works like Clojure's `let`, in that both allow you to bind later variables to valued calculated from earlier ones. (CL's `let` only allows references to things defined before entering the `let`.) A couple of years ago I was hacking on some CL code originally written by someone e

Re: get fn and not-found

2013-10-28 Thread Mars0i
This is essentially the same as some of the other solutions, but more succinct: (or (get a-map :b) (println "Oh no!")) -- -- 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

Why isn't a docstring allowed for defrecord?

2013-10-30 Thread Mars0i
I understand that defrecord can't take a docstring (see "Doc string for variables and record" in this group), and I have learned that record types are somewhat odd beasts. I know that there are workarounds (http://clojure-log.n01se.net/date/2010-10-03.html). Still, I'm surprised. *Why* can'

Re: Why isn't a docstring allowed for defrecord?

2013-10-31 Thread Mars0i
Looks pretty ugly, but it's easy enough to wrap it up in a function.) On Wednesday, October 30, 2013 11:19:33 AM UTC-5, Mars0i wrote: > > I understand that defrecord can't take a docstring (see "Doc string for > variables and record" in this group), and I ha

Re: Why isn't a docstring allowed for defrecord?

2013-10-31 Thread Mars0i
On the other hand, the behavior of Point. might be considered a good thing (or not): user=> (defrecord Point [x y]) user.Point user=> (meta #'Point.) CompilerException java.lang.RuntimeException: Unable to resolve var: Point. in this context, compiling:(NO_SOURCE_PATH:6:1) user=> (meta #'->Poi

Re: Why isn't a docstring allowed for defrecord?

2013-10-31 Thread Mars0i
e of the things I love about Clojure is its Java interop.) On Thursday, October 31, 2013 10:38:31 AM UTC-5, Mauricio Aldazosa wrote: > > On Thu, Oct 31, 2013 at 9:15 AM, Mars0i > > wrote: > >> Excellent. Thanks Tassilo. I had attempted to do the same sort of thing >>

Re: newbie question: how to include external libraries from Leiningen REPL

2013-11-07 Thread Mars0i
I'm pretty new, also. The Leiningen documentation that's easy to find has all of the information you need ... but it's not easy to sort out at first. Cedric Greevey gives the answer for standard libraries that usually come with Clojure. For others, I suggest: Find the library name and versio

Re: Does Pedestal have a future in the long run

2013-11-11 Thread Mars0i
Thanks, Cedric, for insightful comments about documentation. I'll add that for me, if the only documentation is a video, I have to *really* want to learn about a programming tool to go any further. Videos don't allow you to take in information any faster than information at exactly the speed

Re: Step by step debugging

2013-11-12 Thread Mars0i
Colin (or anyone), for a Clojure newbie, could you spell out what you're saying about *compiler-options* and -Dblahblah a little bit further? I think you're saying that if *compiler-options* is set to :disable-locals-clearing , then values of local variables are available, somehow. Can I see

Re: Step by step debugging

2013-11-12 Thread Mars0i
On Tuesday, November 12, 2013 11:15:11 PM UTC-6, Mars0i wrote: > > ... I'm seriously wondering at this moment, though, whether I should stop > and do the rewrite in CL instead, despite several advantages of Clojure for > me. Being able to easily look at any data structure at a

Re: Step by step debugging

2013-11-12 Thread Mars0i
ious about where the -Dblahblah goes, etc. Thanks. On Tuesday, November 12, 2013 11:15:11 PM UTC-6, Mars0i wrote: > > Colin (or anyone), for a Clojure newbie, could you spell out what you're > saying about *compiler-options* and -Dblahblah a little bit further? I > think you&

Re: Step by step debugging

2013-11-13 Thread Mars0i
Thanks Colin! Wow--that's extremely helpful. The concepts are very clear now, and I now understand that it's a map *compiler-options* is supposed to be set to. What I was trying before wasn't right. No matter what I do, I am not seeing an effect on the value of *compiler-options* from the co

Re: Step by step debugging

2013-11-13 Thread Mars0i
Colin, Got it--this setting is relevant to use of a debugger. I was trying to see something from vanilla and Leiningen repls. Thank you for taking so much time to explain. (My current debugger is (print (format ...)). Have to upgrade.) -Marshall On Wednesday, November 13, 2013 5:16:27 PM

Re: maintainability, DSLs, declarative APIs, etc.

2013-11-15 Thread Mars0i
One more point that no one has emphasized: Lisps allow code to write code. Sometimes the way to provide an abstraction or generalization of a pattern is by writing a code-writer. Macros provide a convenient way of using that capability. (On a project years ago, for every Java class of kind X

Re: Best Practice For Logging vs. Functional (and Elegant)

2013-11-26 Thread Mars0i
I'm not an experienced Clojure programmer, and not fully committed to functional programming, so others will probably have ... cooler, and better answers. But to me it seems that there is nothing special to this situation that has to do with functional programming. Adding code that reports on

Re: how to convert LISP to Java class

2013-11-27 Thread Mars0i
Shabbir Ahamed, People here can be very helpful. However, I don't think that you have described your problem in enough detail for anyone to know how to answer. Why is there a Lisp file in the middle of the process? What's in it? What dialect of Lisp is it in? Why does it need to be convert

Re: how to convert LISP to Java class

2013-11-28 Thread Mars0i
I would only add that from what I understand so far, it's pretty easy to use Clojure to define what Java would recognize as Java classes. (Is this wrong?) I find ABCL-Java interoperability to be workable but less pleasant. I think this has to do with the fact that ABCL takes an existing langu

Re: Is The Joy if Clojure up to date?

2013-11-30 Thread Mars0i
Amazon claims that the publication date of the second edition is Feb. 28, 2014. On Saturday, November 30, 2013 5:30:06 AM UTC-6, Magomimmo wrote: > > Is still very good, but the second edition is on the way to be officially > publish (FWIK). > > mimmo > > > On Saturday, November 30, 2013 12:21:2

Re: Is The Joy if Clojure up to date?

2013-12-01 Thread Mars0i
+1 for the promo code. Thanks. Manning got at least one new direct customer. On Sunday, December 1, 2013 2:55:06 AM UTC-6, Michael Klishin wrote: > > 2013/12/1 Sean Corfield > > >> +1 for Manning's MEAP approach - I've bought most of my Manning books >> through the early access program over the

Re: How to go about 'proving' why dynamically typed languages are better.

2013-12-23 Thread Mars0i
I came to this thread late, and have only skimmed some of the answers, but I think that the following, somewhat oblique, opinion hasn't yet been expressed about the, I don't know, maybe ... harassment by "type weenies" that zcaudate feels. Apologies in advance if I've missed a similar point. F

Re: How to go about 'proving' why dynamically typed languages are better.

2013-12-23 Thread Mars0i
comes with more practical experience. I can > be happy using a dynamically typed language when the price to be paid for > getting it wrong isn't as high; but all of my experience goes against > "lightening up" in the demanding programming context where I work every day. > &

Re: How to go about 'proving' why dynamically typed languages are better.

2013-12-23 Thread Mars0i
On Monday, December 23, 2013 5:39:54 PM UTC-6, Rich Morin wrote: > > My take is that required types may force premature optimization and may > inhibit the creative process. > That's an interesting point. I like it. Kind of off topic, but my earlier remark about psychological factors that might

Re: Is Clojure right for me?

2013-12-27 Thread Mars0i
On Friday, December 27, 2013 10:02:46 AM UTC-6, Massimiliano Tomassoli wrote: > > I've seen Clojure in action and I know it's extremely concise and > expressive. What I wanted to know is how it copes with complexity when you > develop complex systems. > My intuition is that getting rid of or

Re: Is Clojure right for me?

2013-12-27 Thread Mars0i
On Friday, December 27, 2013 6:27:34 PM UTC-6, Massimiliano Tomassoli wrote: > > I must admit I don't like its syntax (or absence of it), but I hope to get >> used to it. >> > This is understandable. I think that the things that are most important for becoming comfortable with the syntax, other

<    1   2   3   4   >