Re: How about write clojure code like python mode?

2009-08-27 Thread Daniel Lyons
ow how widely supported SRFI 49 is by various Scheme implementations or how many programmers actually program with it. I suspect "not much" and "very few." — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: Clojure Code Style

2009-08-17 Thread Daniel Lyons
On Aug 17, 2009, at 1:27 AM, Meikel Brandmeyer wrote: > Not in general. But as a rule of thumb: every fn/#() > generates a class and hence everything using it: > defn, comp, partial, letfn, thunk'ing in macros, ... Thanks!

Re: Clojure Code Style

2009-08-16 Thread Daniel Lyons
On Aug 13, 2009, at 12:16 AM, Meikel Brandmeyer wrote: > Also this function generates two classes, while the > other two variants generate 6. Is there an easy way to tell how many classes a given function generates? — Daniel Lyons --~--~-~--~~~---~--~---

Re: Proposal: Promote clojure.contrib.def to a "core" lib

2009-08-14 Thread Daniel Lyons
f, with the other forms promoted -- either into > core.clj or into a clojure.def namespace. > > Thoughts? I myself am rather fond of defvar. I'm for it. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Daniel Lyons
hieve DSLs that would screw up the reader, such as the units one? Or is there a better example? I halfway like the named readtable idea proposed by Richard Newman, but I have to admit I still feel uneasy for some reason. — Daniel Lyons --~--~-~--~~~---~--~~

Re: Transcript of Rich's "Clojure for Lispers" talk uploaded

2009-08-13 Thread Daniel Lyons
well known. So marshall your impulses for the good and we'll all benefit. Instead it feels to me like you're trying to "win" something or other by catching Rich or the community in a lie. This kind of behavior isn't helpful to

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Daniel Lyons
+ 4 * 7) I don't understand what's stopping anyone from implementing the body of that macro to make it actually implement infix arithmetic. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Daniel Lyons
string, unless it's going to blow up when you have a syntax error at compile time, but as an abstraction layer it certainly didn't have enough information to do that correctly at compile time. — Daniel Lyons --~--~-~--~~~---~--~~ You received this m

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Daniel Lyons
better way to do it than CL does but I'm very wary of them. I don't think Scheme lets you have them at all. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Clojure Code Style

2009-08-13 Thread Daniel Lyons
they have some good applications (no pun intended). — Daniel Lyons --~--~-~--~~~---~--~~ 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 t

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Daniel Lyons
rather than driving off the meticulous souls who have the combination of skills and inclination to do something about it. This is what seems to me to have happened with Ruby and various other high level languages with mediocre performance. — Daniel Lyons --~--~-~--~~

Re: enhancement request: a simple way to read a file

2009-08-08 Thread Daniel Lyons
t; consistency of other core blocks like regex. Half the point of clojure.contrib is to be a staging area for future additions to core. The more that people use things like duck streams, the greater the likelihood they will be merged with core. -- Daniel Lyons --~--~-~--~~--

Re: zipping together two lists

2009-08-07 Thread Daniel Lyons
user> (map vector '(1 2 3) '(4 5 6)) ([1 4] [2 5] [3 6]) — Daniel Lyons --~--~-~--~~~---~--~~ 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

Re: enhancement request: a simple way to read a file

2009-08-07 Thread Daniel Lyons
ies one knows the java API by heart.) (vec (read-lines "/home/albert/test.xml")) — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Re: a better reductions?

2009-08-07 Thread Daniel Lyons
ancing act. I'm definitely for this change though. I use reductions from time to time. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send emai

Re: Idiomatic parsing of objects from several lines of a text file

2009-07-30 Thread Daniel Lyons
ambda" to be useful; the effect on Haskell code is really quite nice: http://alexott.blogspot.com/2009/02/emacs-haskell-pretty-lambda.html It can be customized for other languages, but I can't find any references to anyone doing it with Clojure yet. Details on the mode here: h

Re: Parallel garbage collection worthwhile?

2009-07-28 Thread Daniel Lyons
a bad attempt to me, just not yet very functional. I bet if you look at the lazy-seqs code above things will come together a little better. Probably it would help to try and implement a lazy list of the Fibonacci sequence before looking at that code, and then maybe try some o

Re: How to write performant functions in clojure (and other functional languages)

2009-07-24 Thread Daniel Lyons
Jeremy, On Jul 24, 1:20 pm, Jeremy Gailor wrote: > I'm just looking for general optimizations that I should be aware of, the > nature of the function itself isn't really important.  I could turn to > number theory to get some performance improvement, but from a Clojure > oriented perspective, wh

Re: ArithmeticException with doubles

2009-07-10 Thread Daniel Lyons
On Jul 10, 2009, at 2:05 PM, Kevin Downey wrote: > using math knowledge to answer (corner) cases of the floating point > spec is silly > people using doubles should be able to expect doubles to behave like > doubles I don't think it's silly, but fair e

Re: ArithmeticException with doubles

2009-07-10 Thread Daniel Lyons
that depend on it (Dijkstra's SSSP comes to mind) but I think x/0 is an error (unless it's 0/0). — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Best way to create nonref variable?

2009-07-09 Thread Daniel Lyons
cerned about the "right kind" of mutable variable might be a little misguided. Probably better to use recur and pass the new value to the next iteration of the loop instead, if there's any way you can do that. Keep it local instead of mutable. — Daniel Lyons --~--~-~--

Re: Clojure in Clojure?

2009-07-09 Thread Daniel Lyons
to optimize in places you might not want to and that it gives you a nice language to write your language in. :) It's also a good exercise in general and it makes it easier for someone who only knows the language the ability to work on the language. — Daniel Lyons --~--~-~--~

Re: Save current namespace like a Smalltalk image

2009-07-08 Thread Daniel Lyons
On Jul 8, 2009, at 10:22 AM, Sean Devlin wrote: > Isn't this why you would use a doc string, and not a comment? Docstrings aren't the only comments in my code. :) — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subs

Re: Save current namespace like a Smalltalk image

2009-07-08 Thread Daniel Lyons
tion. I'm sure there are other hang-ups (closures are probably another) but this is the first one that comes to mind for me. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure&quo

Re: Save current namespace like a Smalltalk image

2009-07-08 Thread Daniel Lyons
't be built at all without a running binary of a previous version. That kind of thing makes porting to new architectures quite difficult. Just my $0.02, — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Re: nth yields "java.lang.OutOfMemoryError: Java heap space"

2009-07-04 Thread Daniel Lyons
u aren't, unlike in OCaml, Scheme and Haskell, where it can be easy to get confused about which form is the final position.) — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" g

Re: how does clojure's reader determine encoding when reading source from file?

2009-07-02 Thread Daniel Lyons
Clojure. (setq slime-net-coding-system 'utf-8-unix) :) user> (def שלם 'peace) #'user/שלם user> שלם peace Interestingly, Emacs doesn't seem to change the writing direction, but when I pasted it into my mail client it did the right (-to-left) thing. This stuff is tri

Re: Return nil/null or empty object

2009-07-02 Thread Daniel Lyons
ogic from the side effects. It makes testing easier and pure functions are more composable and reusable. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group

Re: loneclojurian at ICFP programming contest

2009-07-02 Thread Daniel Lyons
re extremely proud of it because we had wasted so much time on a VM in Ruby and again in Python, hoping it would be a substantial improvement. Another team had written a VM with a just-in-time compiler which defeated our braindead C implementation handily. It was written in Haskell, of

Re: loneclojurian at ICFP programming contest

2009-07-02 Thread Daniel Lyons
ur honesty! You can come to my house and * my sister! I wish you wouldn't talk like that. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send ema

Re: loneclojurian at ICFP programming contest

2009-07-01 Thread Daniel Lyons
Unless the two implementations share the same general design and algorithms, we're comparing apples and oranges. Quicksort in Python will always dominate bubble sort in Clojure. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are su

Re: ants.clj and render thread starvation

2009-06-30 Thread Daniel Lyons
ry and run it through itself, of course ;) http://research.microsoft.com/en-us/um/cambridge/projects/terminator/ The rest of that original thread is a great read, by the way, and thanks for bringing it up! — Daniel Lyons --~--~-~--~~~---~--~~ You received this

Re: Problem with clojure code on .net.

2009-06-30 Thread Daniel Lyons
ite sure what it is doing either. Are you working on an app with specific meaning tied to the first character of a path name or is this a .NET filesystem thing? Just curious. Thanks and hope this helps, — Daniel Lyons --~--~-~--~~~---~--~~ You received this

Re: Problem with clojure code on .net.

2009-06-30 Thread Daniel Lyons
t-char)) "other" The nested if is a little unusual though. I would probably rewrite it to use cond. If you can get a repl going, try to step through each expression and see where the problem is that way. I don't have Clojure .NET set up to give a more precise answer unfo

Re: Clojure for Scientific and other CPU-intensive Computing

2009-06-30 Thread Daniel Lyons
On Jun 30, 2009, at 3:53 AM, fft1976 wrote: > > On Jun 30, 12:55 am, Daniel Lyons wrote: > >> I don't see why that wouldn't be the case, if you were using Java's >> native multidimensional arrays. I don't think it would be as much >> fun, >

Re: Binary Tree

2009-06-30 Thread Daniel Lyons
naged correctly (I was a sophomore, give me a break ;). This method doesn't have many advantages in Clojure though. :) — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Binary Tree

2009-06-30 Thread Daniel Lyons
og_2(I) where I is the index of the last non-nil value in the array. I'm not sure exactly what data structure you're working with to make your binary tree though. Can you send an example of the tree you have as vectors? Are you also trying to compute whether or not it'

Re: Troll in our midst - please ignore them

2009-06-30 Thread Daniel Lyons
ld be about as hard as just managing the troll problem on a case-by-case basis. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Re: Clojure for Scientific and other CPU-intensive Computing

2009-06-30 Thread Daniel Lyons
rom a lower level language, it would mean a loss of performance but a gain in productivity and abstraction. Sometimes those just aren't the right priorities. To each his own. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subs

Re: General Lisp Comment: side effects with Lisp oriented languages

2009-06-27 Thread Daniel Lyons
es but everybody hates checked exceptions. I think FP and OOP are really two sides of the same coin; after all, functions don't work without data and objects don't work without methods. Sometimes one is a better fit than the other. Like Martin Luther said, mankind is like a drunkard whom af

Re: A website written using Clojure.

2009-06-25 Thread Daniel Lyons
different namespace into your document. Pro, your XML is always valid; con, it's a pain to work with and sometimes you just want to dump out some crap and don't really care if it's valid. Convenience versus correctness. I tend to side with convenience on templating. I

Re: A website written using Clojure.

2009-06-25 Thread Daniel Lyons
On Jun 25, 2009, at 12:57 PM, CuppoJava wrote: > > I'm not running off any server. All the pages are static html, which > are generated by a Clojure script. Haha, that explains the speed. :) *slaps forehead* — Daniel Lyons --~--~-~--~~~---~--~

Re: Convincing others about Clojure

2009-06-25 Thread Daniel Lyons
On Jun 25, 2009, at 12:39 PM, CuppoJava wrote: > > I enjoyed Daniel Lyons post there. I recognize some Ayn Rand ideas > there. Ever read Atlas Shrugged perchance? =) Thanks! Fountainhead yes, Atlas Shrugged no, actually. :) But my suggestions there come from my (limited) experience

Re: A website written using Clojure.

2009-06-25 Thread Daniel Lyons
ar some thoughts. Very impressive and cool! And fast too! My comments are really things you've already heard on the list. You should use -'s instead of _'s, for consistency if not for readability, and I'm still leery of defblockfn. But part of the joy of Lisp is con

Re: [OT] Convincing others about Clojure

2009-06-25 Thread Daniel Lyons
the performance of Clojure? Is it fast? > > 3. People who want to use this are more academically inclined and are > not practical. This will make the whole project fail. > > I need some pointers on this. This is a really crucial thing for me > and > any help will be apprec

Re: Moving Window Function

2009-06-23 Thread Daniel Lyons
On Jun 23, 2009, at 2:38 PM, Christophe Grand wrote: > On Tue, Jun 23, 2009 at 9:14 PM, Daniel Lyons > wrote: > > Wish it were so, because I like your theory better than my reality: :) > > > Drat! Stupid reality! > > Now I have to bend it to make my theory valid. &

Re: Moving Window Function

2009-06-23 Thread Daniel Lyons
On Jun 23, 2009, at 12:41 PM, Christophe Grand wrote: > On Tue, Jun 23, 2009 at 8:02 PM, Daniel Lyons > wrote: > > > On Jun 23, 2009, at 11:37 AM, Kyle Schaffrick wrote: > > > As an aside, I also notice you prefer 'reduce to 'apply when using > > ari

Re: Moving Window Function

2009-06-23 Thread Daniel Lyons
lined code. Both my intuitions were wrong and it looks like 'apply is notably faster. — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: Code generation at runtime

2009-06-23 Thread Daniel Lyons
ful too, even if > less > critical. Is there a way to trick an eval into believing, it is a > compiler? (I know the trick must involve *compile-files* and > *compile-path* in some way, but I can't manage to make this work.) > > Are there other people on the mailing list co

Re: How can I stop "leaking" memory?

2009-06-23 Thread Daniel Lyons
= new SortedCollection(take n from coll) > for x in (drop n from coll): >result.add(x) >result.deleteMinimum() // adding 1 element and removing 1 keeps > the result collection at size n > return result > > Hope this helps, Yes, this explains it. :) Thanks! — Daniel Lyons

Re: How can I stop "leaking" memory?

2009-06-23 Thread Daniel Lyons
m just sorting the whole structure and taking the top n items. Is it really sqrt(N)? I'm under the impression insertion into a balanced binary tree is O(log(N)), but wouldn't you still need to have N of them? This algorithm reminds me of heap sort. — Daniel Lyons --~--~-~-

Re: How can I stop "leaking" memory?

2009-06-22 Thread Daniel Lyons
ous, I can see how to do max in O(N) time, so I can see how to do top-n in O(n*N) ≈ O(N) time, but I don't see how to do that in sqrt(N) time. What's this algorithm called or how does it work? — Daniel Lyons --~--~-~--~~~---~--~~ You received this

Re: leveraging Clojure STM in other JVM languages?

2009-06-22 Thread Daniel Lyons
side effects on the other side, and stuff on the other side can't manipulate Clojure's immutable types as though they are mutable due to Java's access protection mechanism. You would have to worry about side-effects happening on the other

Re: accum

2009-06-17 Thread Daniel Lyons
nd mutual respect are more important. — Daniel Lyons --~--~-~--~~~---~--~~ 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 me

Re: reasoning/logic programming from Clojure

2009-06-17 Thread Daniel Lyons
it though (which is probably a blessing). — Daniel Lyons --~--~-~--~~~---~--~~ 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 f

reasoning/logic programming from Clojure

2009-06-17 Thread Daniel Lyons
ur. Also, if you're going to be in Albuquerque this Sunday, the meeting will be at the UNM HPC Center and starts at 2 PM. Thanks, — Daniel Lyons --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure

Re: accum

2009-06-16 Thread Daniel Lyons
x (first c)) (rest c) > > (def *tris* (rest (accum-map + 0 (iterate inc 1 > > Notice how similar the accum-map code is to the accum code? With just > lazy-seq it would not be as clear. :) Oh? What about compared to this: (use 'clojure.contrib.seq-utils) (def *tri

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread Daniel Lyons
t you can use 'partial' instead too: (map (partial quad 1 0 0) my-ints) — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: Mnesia like?

2009-06-16 Thread Daniel Lyons
er than to go out and get comfortable with CouchDB in the hope that someday they'll work for Facebook or write the next Twitter. I also find the thought of using a language with software transactional memory to talk to a "database" that doesn't have transactions a

Re: Mnesia like?

2009-06-15 Thread Daniel Lyons
me benefits since it's built on Mnesia. http://couchdb.apache.org/ Hope that helps, — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To pos

Re: super-lazy-seq

2009-06-15 Thread Daniel Lyons
it probably avoids exactly these kinds of problems. Until I run into actual issues on my own, though, I'm going to let this problem remain theoretical and hope that one of the great minds working on the core can find a solution. For some reason I believe there

Re: super-lazy-seq

2009-06-15 Thread Daniel Lyons
nil until the stream is exhausted. Many streams seem to work like that in practice despite the caveat and I find it nicer looking than an explicit test. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this message beca

Re: Simple idiom in clojure, mutate a value

2009-06-11 Thread Daniel Lyons
e-num max-num)) (recur (.readLine reader) (+ UPDATEABLE_VALUE (SOME_FUNC) Whenever you would have modified a local variable before, in FP you establish a new binding instead. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--

Re: Anyone planning on using Clojure for ICFP 2009?

2009-06-11 Thread Daniel Lyons
nd I can press on in Clojure. I wish there were some details up on the contest site. I think 2006 ("Cult of the Bound Variable") was probably the best year. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this m

Re: agent questions - DOS - asynchrony - protection

2009-06-11 Thread Daniel Lyons
n't support getting the address of where these things really are in memory nor does it provide you with tools for manipulating them if you could get there. And a great deal of this is prevented not just by Clojure but by the JVM itself. There just isn't a lower level that you can ge

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Daniel Lyons
On Jun 10, 2009, at 12:03 PM, Toralf Wittner wrote: > On Wed, 2009-06-10 at 10:22 -0600, Daniel Lyons wrote: >> If the actions are executed serially, what is the benefit of having >> multiple threads per agent? > > There is none. Did anybody say there are multiple threads p

Re: agent questions - DOS - asynchrony - protection

2009-06-10 Thread Daniel Lyons
On Jun 10, 2009, at 4:22 AM, Toralf Wittner wrote: > As written above the serial execution of an Agent's actions makes this > thread-safe. If the actions are executed serially, what is the benefit of having multiple threads per agent? — Daniel Lyons http://www.storytotell.org

Re: agent questions - DOS - asynchrony - protection

2009-06-09 Thread Daniel Lyons
ys with MVCC in general. I think as long as you always acquire resources in the same order you are protected from deadlock. I agree with the book, that the real danger with commute is using it when you have a function that isn't commutative. Anybody want to help with my errors? — Daniel

Re: Thoughts on bags?

2009-06-09 Thread Daniel Lyons
, a lot of my database tables wind up with a sort-order column or an auto-incrementing ID, I admit. Of course, just because it violates relational theory doesn't mean it wouldn't be a great addition to the language. I'm curious. Would you mind sharing the code with the error

Re: Macro Design - by example

2009-06-09 Thread Daniel Lyons
h > variable parts as macro arguments. > - extract the parts which are not required to be > a macro as a function > - modify the macro to simply call the function I think this is extremely good advice. Thanks! — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--

Re: What books have helped you wrap your brain around FP and Clojure?

2009-06-08 Thread Daniel Lyons
elf-recursive functions in another thread, which is what Erlang's processes are like, but your remark piques my curiosity. Can one be implemented trivially via the other? — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You rec

Re: What books have helped you wrap your brain around FP and Clojure?

2009-06-06 Thread Daniel Lyons
I recommend "Purely Functional Data Structures" by Chris Okasaki. If you can get your hands on "OCaml for Scientists" it's pretty good too. And of course The Little Lisper/Schemer. I haven't made it through my copy of SICP or PAIP. -- Daniel On Jun 6, 2009, at 10:26 AM, kyle smith wrote:

Re: Question for Clojure-Mode users.

2009-06-06 Thread Daniel Lyons
check to see if the var refers to a macro that takes a & body > argument. But this is a lot of moving parts for a slim benefit. It's > easier just to name these kinds of macros with-foo. =) I think Slime does this with CL. At least I seem to remember having code with macros t

Re: Optimizing cross-product mappings

2009-06-05 Thread Daniel Lyons
Daniel, I guess I have to ask... why do you need to do this in the first place? :) Zip codes are already unique. Are you searching through data where someone else MD5'd some zip codes to obfuscate them? Just curious. — Daniel Lyons http://www.storytotell.org -- Te

Re: Optimizing cross-product mappings

2009-06-05 Thread Daniel Lyons
t sure if you can get a list of zip+4's as easily, but at 29,470 records, you're saving yourself 70,592 * 1000 MD5 calculations by just starting with this list. Plus this list gives you some auxiliary data that can't be inferred from the number by itself, like state and count

Re: Help with Math Question

2009-06-04 Thread Daniel Lyons
could make [1 2 3 4 5] and [5 4 3 2 1] come out with the same answer that I could see. I am quite curious what the final answer turns out to be but I couldn't come up with it in the ~20 minutes I spent on it. Let us know when you figure it out! — Daniel Lyons http://www.storytotell.org --

Re: subtractng sequence?

2009-06-03 Thread Daniel Lyons
that algorithm. Of course, I don't think you'll notice an improvement over the naive method until you hit several thousand elements or have similarly sized input lists. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You rece

Re: What is wrong with my code

2009-06-01 Thread Daniel Lyons
g, so if I were you I might start over rather than try to make this work. Hope that helps, — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure"

Re: What is wrong with my code

2009-05-31 Thread Daniel Lyons
intln "can't do this" > > > I found that each time I try form proceed-now-right I get error when > IF is true. Why is it so? The function chang works on it own... What parameters are you calling proceed-now-right with? — Daniel Lyons http://www.storytotell.org

Re: "Currying" / Partial Application macro

2009-05-31 Thread Daniel Lyons
to know whether that would be generally useful. Incidentally, have any of you taken a look at Liskell? <http://liskell.org/ > — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Re: "Currying" / Partial Application macro

2009-05-30 Thread Daniel Lyons
On May 30, 2009, at 7:25 PM, kinghajj wrote: > > On May 30, 1:19 pm, Daniel Lyons wrote: >> You can't have both partial application and variable arity functions. > > Uh, yeah you can. Haskell can have variadic functions, like > Text.Printf.printf, and with some explic

Re: "Currying" / Partial Application macro

2009-05-30 Thread Daniel Lyons
't have both partial application and variable arity functions. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

Re: how would I do this functionally? (internally mutable state)

2009-05-28 Thread Daniel Lyons
x27;t relevant to this problem though. It's on my mind because I was just recently hacking on something for a friend that uses Mac OS X's API to do that. Hope any of this helps and looking forward to (all) your feedback, :) — Daniel Lyons http://www.storytotell.org -- Tell It!

Re: Macro Writing Helper?

2009-05-28 Thread Daniel Lyons
Contrib: (clojure.contrib.duck-streams/spit "write-test.txt" "Hello") I think if there were a way to combine doto and with-open it would probably do what you want without needing another macro. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~--

Re: how would I do this functionally? (internally mutable state)

2009-05-28 Thread Daniel Lyons
>>>> information, which feels a bit ugly >>>> - I assume it means storing the full filename three times, once >>>> in >>>> the original file info structure, once in the memoized hash >>>&g

Re: how would I do this functionally? (internally mutable state)

2009-05-28 Thread Daniel Lyons
1) (group-by = (sort ...))). Sorting is still the question for me though. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

Re: how would I do this functionally? (internally mutable state)

2009-05-28 Thread Daniel Lyons
ot; "ef" "gh") But this doesn't: user> (sort-by get-comparators ["ab" "cd" "ef" "gh"]) java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.Cons

Re: regression

2009-05-27 Thread Daniel Lyons
ytko.com/blog/2008/12/16/evolving-genetic-algorithms-in-lisp/ This is really great! Thanks for sharing it with us! Cool stuff. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl

Re: how would I do this functionally? (internally mutable state)

2009-05-27 Thread Daniel Lyons
s great but it does seem to work. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Re: how would I do this functionally? (internally mutable state)

2009-05-27 Thread Daniel Lyons
her with it if I knew I had to compare a *lot* of files and I only cared about the result during one run, as inodes are frequently recycled. None of this really answers your question about internally mutable state. Of course internally mutable state is possible, either using closed-over

Re: regression

2009-05-26 Thread Daniel Lyons
less than .8") 1.0 (println "otherwise case")) Oh, and (rand) does the same thing as (rand 1), AFAIK. Hope you're enjoying Clojure as much as I am! Cheers, — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You

Re: Architecture for a clojure project

2009-05-25 Thread Daniel Lyons
c) 1 user> (.count c) 2 user> (.count c) 3 user> (.setTo c 10) 10 user> (.count c) 11 user> (.reset c) 0 user> (.peek c) 0 user> (.peek c) 0 user> It's more code, but it's also much more readable, accessible from Java (and other JVM languages) and might be close

Re: Clojure for high-end game development

2009-05-22 Thread Daniel Lyons
ws? It could happen. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ 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 To

Re: laziness performance question

2009-05-21 Thread Daniel Lyons
27;re losing a fair amount of flexibility for it. And I doubt that the performance difference has much to do with laziness or how laziness is implemented in it. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ You received this mess

Re: laziness performance question

2009-05-21 Thread Daniel Lyons
a balance between explicit iterators and a completely lazy language. Memoize and delay/force give you most of the other laziness or pure functional benefits you get in Haskell. (By the way, strictness annotations do wonders for making sense of Haskell.) Try it out. I bet you'll find it

Re: Bit-Shift without Sign-Extend?

2009-05-21 Thread Daniel Lyons
On May 21, 2009, at 7:39 PM, CuppoJava wrote: > > Hi everyone, > I'm just wondering where the equivalent of the ">>>" operator is for > Clojure. I need it to do a divide-by-power-of-2 on unsigned bytes. I could use this too. — Daniel Lyons h

Re: str-utils change proposal, round 2

2009-05-14 Thread Daniel Lyons
ders." [filename] (let [csv-data (read-csv filename) entry-struct (apply create-struct (map keyword (remove-comment (first csv-data] (map #(apply struct entry-struct %) (rest csv-data — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~---

Re: str-utils change proposal, round 2

2009-05-14 Thread Daniel Lyons
At pre-col1 0)) (.substring pre-col1 1) pre-col1) headers (map keyword (cons col1 columns))] (map #(apply hash-map (mapcat list headers %)) rows))) Thanks, — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~-

Re: What is Contrib?

2009-05-12 Thread Daniel Lyons
s and predecessors. — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~-~--~~~---~--~~ 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 To unsub

Re: CL libraries - Newbie question

2009-05-12 Thread Daniel Lyons
sing any other XML library from the Lisp world; in fact I don't want this one either, because it's so objecty, but I think it's important to maintain a sense of balance and respect. All of the CL libraries I tried worked. Getting everything installed and set up

  1   2   >