Re: Debugging support for clojure?

2009-03-11 Thread Tassilo Horn
Phil Hagelberg writes: Hi Phil, >> If not, is there better way than inserting gazillions of printlns to >> check why and where a function doesn't do the right thing? > > Most definitely! Break your functions up into smaller pieces, then > write tests for them using test-is. If your functions a

Re: transposing a small java class in clojure

2009-03-11 Thread rb
On Mar 10, 8:24 pm, Kevin Downey wrote: > I don't know how many arguments the method you are overriding with > onLogin takes, but the function you define should take one more > argument then the method you are overiding, the first argument being > an explicit reference to an instance That was it

Re: filter1 interesting?

2009-03-11 Thread Vagif Verdi
Is (first (filter ..) lazy like in haskell ? I would hate to wait for filter to get all results just to throw them out and pick the first one. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: filter1 interesting?

2009-03-11 Thread Christian Vest Hansen
On Wed, Mar 11, 2009 at 9:01 AM, Vagif Verdi wrote: > > Is (first (filter ..) lazy like in haskell ? Yes. > I would hate to wait for filter to get all results just to throw them > out and pick the first one. > > > > -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~-~--

Re: filter1 interesting?

2009-03-11 Thread Laurent PETIT
filter is lazy. first is not 3/11 Vagif Verdi > > Is (first (filter ..) lazy like in haskell ? > I would hate to wait for filter to get all results just to throw them > out and pick the first one. > > > > --~--~-~--~~~---~--~~ You received this message because yo

Witch Emcas for Windows to use with Clojure

2009-03-11 Thread anderspe
Hi! I thinking of test to use Emacs for Clojure development, but under Windows i have found 2 diffrent XEmacs or Gnu Emacs what is the recommendation, to use... ?!! Or is it just a matter of tast.. // Anders --~--~-~--~~~---~--~~ You received this message because

Re: Witch Emcas for Windows to use with Clojure

2009-03-11 Thread Paul Drummond
Not sure about "XEmacs vs Gnu Emacs" but for GNU Emacs there are some options. By far the best option when starting out is ClojureBox: http://clojure.bighugh.com/ It's a one-click installer to get you started. It includes everything you need to develop in Clojure with Emacs including Slime. I

Re: Witch Emcas for Windows to use with Clojure

2009-03-11 Thread anderspe
Thanks, will test this. // Anders On 11 Mar, 12:00, Paul Drummond wrote: > Not sure about "XEmacs vs Gnu Emacs" but for GNU Emacs there are some > options.  By far the best option when starting out is ClojureBox: > > http://clojure.bighugh.com/ > > It's a one-click installer to get you started.

Re: Witch Emcas for Windows to use with Clojure

2009-03-11 Thread Marko Kocić
Or you can compile emacs from CVS for yourself. It's not that hard as it used do be. --~--~-~--~~~---~--~~ 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 un

Re: Debugging support for clojure?

2009-03-11 Thread Jeffrey Straszheim
Probably. The Java BigInteger classes are not particularly fast, and do not seem to be a priority to Sun. Therefore Clojure is not competitive on large integer algorithms. On Wed, Mar 11, 2009 at 2:21 AM, Tassilo Horn wrote: > > Phil Hagelberg writes: > > Hi Phil, > > >> If not, is there bette

design patterns for event driven applications

2009-03-11 Thread Anatoly Yakovenko
I just starting playing around with clojure, and i know nothing of java beyond the syntax. I am trying to implement an interface that gets called by some 3rd party application whenver an event occurs. If i was doing this in haskell I would serialize the events in a channel and write a parser to

Re: Static type guy trying to convert

2009-03-11 Thread Laurent PETIT
2009/3/11 mikel mev...@mac.com > > > > Saying that something sucks and suggesting that people who like it are > fools isn't an argument, it's just yanking people's chains to get > attention. Are you talking about Linus's speak against cvs, subversion and their users ? :-) ok, this was just a j

Re: Enjoying test-is

2009-03-11 Thread stephaner
I use test-is too, this is a very usefull test framework. The framework is very easy to use and provide nice output when tests fail. Since I'm still learning Clojure, I do enjoy using the actual versus expected output of a failed test. Thanks again Mr. Sierra, --~--~-~--~~--

Re: Static type guy trying to convert

2009-03-11 Thread Jon Harrop
On Wednesday 11 March 2009 04:44:17 e wrote: > ...Afterall he could have chosen a dynamically typed language for his > business if he had wanted to... FWIW, my company ships products written in many different languages including dynamic languages and I have been programming in dynamic languages

Re: Static type guy trying to convert

2009-03-11 Thread Konrad Hinsen
On Mar 11, 2009, at 3:31, Jon Harrop wrote: > Most of the reasons given in this thread were red herrings and many > of static > typing's real issues were not even touched upon: ... I'd add two more: - Metaprogramming is a lot more complicated with static typing. Look at MetaOCaml or Templa

cells/add-watch question

2009-03-11 Thread linh
I have a question about cells. I'm not sure how to explain my problem so maybe the easiest way is to show some code. Let's say I have this piece of code: (def my-atom (atom {... big map with many entries ...})) . (add-watch my-atom :update update-fn) . (swap! my-atom (some-fn ...)) When my-atom

Re: Static type guy trying to convert

2009-03-11 Thread Cosmin Stejerean
On Tue, Mar 10, 2009 at 9:31 PM, Jon Harrop wrote: [...] > > > 2. The whole thing does not need to be complete or even functional for > > you to start unit testing. > > Apples and oranges: unit tests are not the same between dynamic and static > code bases because dynamic code bases rely upon a

Re: design patterns for event driven applications

2009-03-11 Thread Jeffrey Straszheim
It is impossible to give a simple answer. You need to be more specific about the needs of your application. Will it need to be concurrent, for instance? On Tue, Mar 10, 2009 at 7:49 PM, Anatoly Yakovenko wrote: > > I just starting playing around with clojure, and i know nothing of > java beyond

Re: Static type guy trying to convert

2009-03-11 Thread Jay Fields
On Tue, Mar 10, 2009 at 11:44 PM, e wrote: > > > My interest right now in following clojure is to learn ALL the arguments, > including his. > The problems with Jon's criticisms is that they are the same fear, uncertainty and doubt ideas that are repeated time and time again by static language ze

Request: Can clojure.contrib.walk provide a reduce type operation?

2009-03-11 Thread Jeffrey Straszheim
Currently the clojure.contrib.walk code provides a nice way to perform a depth first map operation on trees. However, I need to fold across a tree. It would be nice if walk provided this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: What profilers are you using?

2009-03-11 Thread pmf
On Mar 11, 4:41 am, Allen Rohner wrote: > Replying to my own question because I figured it out. On the profiler > tab, before you hit "start profiling", click the settings checkbox. > Edit the "start from class" field. Mine was set to jline.**. After > changing it to the appropriate namespace for

Re: On the importance of recognizing and using maps

2009-03-11 Thread Konrad Hinsen
On Mar 8, 2009, at 18:53, Rich Hickey wrote: > I know people usually think of collections when they see vector/map/ > set, and they think classes and types define something else. However, > the vast majority of class and type instances in various languages are > actually maps, and what the class/

Re: Static type guy trying to convert

2009-03-11 Thread Jon Harrop
On Wednesday 11 March 2009 15:05:39 Konrad Hinsen wrote: > On Mar 11, 2009, at 3:31, Jon Harrop wrote: > > Most of the reasons given in this thread were red herrings and many > > of static > > typing's real issues were not even touched upon: > > ... > > I'd add two more: > > - Metaprogramming is a

Re: cells/add-watch question

2009-03-11 Thread Raffael Cavallaro
On Mar 11, 11:20 am, linh wrote: > According to the API doc, add-watch must have 4 args: a key, a > reference, > its old-state and its new state. What I'm missing here is an addtional > arg that can be passed in some way to update-fn so that update-fn > knows what entries in my-atom has change

Re: cells/add-watch question

2009-03-11 Thread Raffael Cavallaro
On Mar 11, 1:24 pm, Raffael Cavallaro wrote: > ;; this just makes a big map atom where integer keys are associated > with integer values should rather be as follows to get integer keyword keys: (def my-atom (atom (assoc (apply hash-map (take 1000

Re: On the importance of recognizing and using maps

2009-03-11 Thread Cosmin Stejerean
On Wed, Mar 11, 2009 at 12:00 PM, Konrad Hinsen wrote: > > On Mar 8, 2009, at 18:53, Rich Hickey wrote: > > > I know people usually think of collections when they see vector/map/ > > set, and they think classes and types define something else. However, > > the vast majority of class and type insta

Re: Static type guy trying to convert

2009-03-11 Thread Jon Harrop
On Wednesday 11 March 2009 15:30:01 Cosmin Stejerean wrote: > Actually it happens a lot in real code and in many non-trivial programs in > static typed languages you end up with a proliferation of types that are > simply there to make the compiler happy. To me it happens very often where > I know

Re: Debugging support for clojure?

2009-03-11 Thread Howard Lewis Ship
Just updated, working like a charm. On Tue, Mar 10, 2009 at 5:17 PM, CuppoJava wrote: > > Have you updated to the latest version? > > If it's setup properly, you should be able to set breakpoints by > clicking on the grey column on the left side of your code. > > Also, not every line can be brea

Re: What profilers are you using?

2009-03-11 Thread Allen Rohner
pmf wrote: > On Mar 11, 4:41 am, Allen Rohner wrote: > > Replying to my own question because I figured it out. On the profiler > > tab, before you hit "start profiling", click the settings checkbox. > > Edit the "start from class" field. Mine was set to jline.**. After > > changing it to the ap

Re: Static type guy trying to convert

2009-03-11 Thread Raoul Duke
> Another red herring: you are describing a disadvantage of nominal over > structural typing. Not dynamic vs static typing. there are probably several different arguments being conflated in such discussions. for example, theory vs. practice: there is the theory of what in fact are the options f

Re: android app development with clojure

2009-03-11 Thread rob
Hi Remco, If you've written up anything, or plan to, on your progress on getting Clojure going on the Android platform I'm very interested in learning more. Thanks! Rob On Feb 6, 12:29 pm, "Remco van 't Veer" wrote: > Got startup time down to 5 seconds by completely eliminating the use > of li

Re: android app development with clojure

2009-03-11 Thread rob
That is exciting! Have you posted any code or advice/instruction on how one could repeat what you did with Clojure on the Android phone? Rob On Feb 6, 12:29 pm, "Remco van 't Veer" wrote: > Got startup time down to 5 seconds by completely eliminating the use > of lispreader and putting of load

Re: cells/add-watch question

2009-03-11 Thread linh
Thanks Raffael, I'll try that On Mar 11, 6:42 pm, Raffael Cavallaro wrote: > On Mar 11, 1:24 pm, Raffael Cavallaro > wrote: > > > ;; this just makes a big map atom where integer keys are associated > > with integer values > > should rather be as follows to get integer keyword keys: > > (def my-

Re: What is Clojure NOT good for?

2009-03-11 Thread Howard Lewis Ship
I ran into a bit of the "but we can hire Java coders" mentality when I presented Clojure at a local JUG. Due to time constraints, I didn't get into it at the time, but my basic thought is: "I don't care what you know, I care what you can learn!" Also, there's the myth of the "immediately produc

keys of struct-maps

2009-03-11 Thread jim
Is there a more efficient way of getting the keys of a struct-map besides creating an instance and passing it to keys: >(def ts (create-struct :a :b)) >(keys (struct ts)) (:a :b) Thanks, Jim --~--~-~--~~~---~--~~ You received this message because you are subscr

Re: Static type guy trying to convert

2009-03-11 Thread Jon Harrop
On Wednesday 11 March 2009 18:18:59 Raoul Duke wrote: > > Another red herring: you are describing a disadvantage of nominal over > > structural typing. Not dynamic vs static typing. > > there are probably several different arguments being conflated in such > discussions. > > for example, theory v

Re: Static type guy trying to convert

2009-03-11 Thread Cosmin Stejerean
On Wed, Mar 11, 2009 at 1:03 PM, Jon Harrop wrote: > > On Wednesday 11 March 2009 15:30:01 Cosmin Stejerean wrote: > > Actually it happens a lot in real code and in many non-trivial programs > in > > static typed languages you end up with a proliferation of types that are > > simply there to make

Re: Request: Can clojure.contrib.walk provide a reduce type operation?

2009-03-11 Thread Kevin Downey
if your walk pushes the items into a Queue, you can just reduce across the Queue On Wed, Mar 11, 2009 at 9:24 AM, Jeffrey Straszheim wrote: > Currently the clojure.contrib.walk code provides a nice way to perform a > depth first map operation on trees.  However, I need to fold across a tree. > I

Re: Request: Can clojure.contrib.walk provide a reduce type operation?

2009-03-11 Thread Jeffrey Straszheim
Yeah, I figured something like that out, but it was non-obvious. It might be nice helper function sometime down the road. On Wed, Mar 11, 2009 at 3:49 PM, Kevin Downey wrote: > > if your walk pushes the items into a Queue, you can just reduce across the > Queue > > On Wed, Mar 11, 2009 at 9:24

Re: Static type guy trying to convert

2009-03-11 Thread Jon Harrop
On Wednesday 11 March 2009 18:35:46 Cosmin Stejerean wrote: > On Wed, Mar 11, 2009 at 1:03 PM, Jon Harrop wrote: > > Another red herring: you are describing a disadvantage of nominal over > > structural typing. Not dynamic vs static typing. > > You are correct, my apologies. I was trying to show

Re: Static type guy trying to convert

2009-03-11 Thread ntu...@googlemail.com
On Mar 11, 5:26 am, Raffael Cavallaro wrote: > Some of you may not know of Jon's behvior on comp.lang.lisp so some > background will be useful here. I would appreciate it if you would consider his arguments instead of discrediting him. His post is not insulting and contains valid arguments. So p

Re: Dotted method invocations (and other reader niceties) do not work in #= forms

2009-03-11 Thread Chas Emerick
Replying to my own (old) post -- the reason why all reader capabilities aren't available in #= forms is that the reader isn't currently being recursively applied to the body of those forms. Only certain aspects of the full reader's functionality (like dotted constructor invocations) are being rec

Re: Static type guy trying to convert

2009-03-11 Thread chris
I don't think it is impossible to begin adding type inference and stronger typing to clojure or any fully dynamic language. You could begin with a set of runtime tests (such as range of a given number or what keys are in a dictionary). These tests allow you to go from an untyped world to a typed

Clojure.main/repl function

2009-03-11 Thread NarayanS
I am using the clojure.main/repl function to start a new repl in my application. When I am done i want to close it. Repl has a read-eval- print going - how can i stop it? Currently i am passing "caught" option which throws an exception for certain condition and breaks the loop. --~--~-~--~

Re: Static type guy trying to convert

2009-03-11 Thread Jon Harrop
On Wednesday 11 March 2009 20:27:15 chris wrote: > Lets take this discussion forward and think of how we could > incrementally add the important benefits of strongly typed and > inferred systems like ML, Haskell, and F# to Clojure while keeping the > very beautiful and clean syntax and minimal men

Re: Static type guy trying to convert

2009-03-11 Thread Raffael Cavallaro
On Mar 11, 4:17 pm, "ntu...@googlemail.com" wrote: > I would appreciate it if you would consider his arguments instead of > discrediting him. His post is not insulting and contains valid > arguments. So please don't shoot the messenger. When the "messenger" is habitually insulting he loses cr

Re: Static type guy trying to convert

2009-03-11 Thread Joshua
You can get those warm fuzzies back when you develop in an IDE such as Netbeans, IntelliJ, or Eclipse. They can compile the code and provide some feedback. The plugins are kinda young, but they may provide enough to help make the jump. Joshua On Mar 10, 1:16 am, zoltar wrote: > Hey everyone. I'

Re: keys of struct-maps

2009-03-11 Thread Timothy Pratley
They are not currently exposed, but a trivial patch will achieve what you want: http://groups.google.com/group/clojure/web/struct.patch user=> (defstruct ts :a :b) #'user/ts user=> (struct-keys ts) (:a :b) Regards, Tim. On Mar 12, 5:23 am, jim wrote: > Is there a more efficient way of getting

Re: Request: Can clojure.contrib.walk provide a reduce type operation?

2009-03-11 Thread Stuart Sierra
On Mar 11, 12:24 pm, Jeffrey Straszheim wrote: > Currently the clojure.contrib.walk code provides a nice way to perform a > depth first map operation on trees. However, I need to fold across a tree. > It would be nice if walk provided this. Hi Jeffrey, I agree it would be a useful feature. I'l

Re: cells/add-watch question

2009-03-11 Thread Timothy Pratley
> This is beacuse my-atom contains a lot > of data and I don't want to search for the change. Just curious, but shouldn't equality tests in Clojure always be instant regardless of data size due to shared structure? I suppose I'm curious what 'shared structure' gives and what it doesn't. --~--~-

Re: Enjoying test-is

2009-03-11 Thread Stuart Sierra
On Mar 11, 2:45 am, mikel wrote: > I just wanted to say thanks to Stuart Sierra for test-is. On Mar 11, 9:15 am, stephaner wrote: > I use test-is too, this is a very usefull test framework. You're both very welcome! -Stuart Sierra --~--~-~--~~~---~--~~ You recei

Re: filter1 interesting?

2009-03-11 Thread Stuart Sierra
On Wed, Mar 11, 2009 at 9:01 AM, Vagif Verdi wrote: > Is (first (filter ..) lazy like in haskell ? It's lazy in the sense that it will only consume the sequence up to first positive result. If it doesn't find one, it will consume the entire sequence and return nil. Therefore, this form is not

Re: What is Clojure NOT good for?

2009-03-11 Thread Stuart Sierra
Ok, here's a real one: if you need to use a lot of C/C++ libraries, for which there are no Java replacements, Clojure won't be much fun, because C/C++ interop with Java is not fun. You'll probably be happier with a Lisp/Scheme implementation that compiles to C; several such languages exist. -Stu

Re: On the importance of recognizing and using maps

2009-03-11 Thread Chouser
On Wed, Mar 11, 2009 at 1:54 PM, Cosmin Stejerean wrote: > > IMHO a big reason Python programmers don't typically treat objects like is > maps/dictionaries is that the set of things found in the map (dictionary) > for that object (__dict__) are just a small subset of the interesting > attributes

Re: Enjoying test-is

2009-03-11 Thread Jeffrey Straszheim
Me too! I'm writing tests right now. On Wed, Mar 11, 2009 at 6:11 PM, Stuart Sierra wrote: > > On Mar 11, 2:45 am, mikel wrote: > > I just wanted to say thanks to Stuart Sierra for test-is. > On Mar 11, 9:15 am, stephaner wrote: > > I use test-is too, this is a very usefull test framework. > >

Re: cells/add-watch question

2009-03-11 Thread linh
i didn't think of that. if equality tests is instant, would finding out the difference also be instant? for example, is this instant: (difference new-set old-set) ? On Mar 11, 11:11 pm, Timothy Pratley wrote: > > This is beacuse my-atom contains a lot > > of data and I don't want to search for t

Re: Debugging support for clojure?

2009-03-11 Thread Mark Engelberg
On Wed, Mar 11, 2009 at 12:21 AM, Tassilo Horn wrote: > Investigated it a bit more (doing the algorithm step by step in the > repl) and now I know what's the culprit:  The `expt' function from the > math contrib library is dead slow. Dead slow? Compared to what? A naive expt function just mult

Accuracy of *file*

2009-03-11 Thread Phil Hagelberg
I'm interested in getting the location on disk of the current file. It appears *file* provides this, but unfortunately it doesn't provide an absolute path. Inside the file /home/phil/src/mire/src/mire/rooms.clj: mire/rooms.clj I tried using java.io.File so I'd have access to getAbsolutePath,

Re: design patterns for event driven applications

2009-03-11 Thread CuppoJava
Hi Anatoly, Unfortunately I don't know of a nice way of expressing an event-driven architecture in Clojure, but I'm very interested in what you said about accomplishing it in Haskell. Would you mind explaining that in some more detail? Perhaps if I understood it, I can even help come up with a Cl

Re: design patterns for event driven applications

2009-03-11 Thread Raoul Duke
> Unfortunately I don't know of a nice way of expressing an event-driven > architecture in Clojure, but I'm very interested in what you said > about accomplishing it in Haskell. (iiuc?) here is a game example: http://home.doramail.com/ns999/asteroids.html (which is based off of a haskell version

Re: Static type guy trying to convert

2009-03-11 Thread James Reeves
On Mar 11, 2:31 am, Jon Harrop wrote: > > 2. The whole thing does not need to be complete or even functional for > > you to start unit testing. > > Apples and oranges: unit tests are not the same between dynamic and static > code bases because dynamic code bases rely upon a huge number of additio

Is Clojure's lack of support for forward referencing a feature or a bug?

2009-03-11 Thread quasar
It seems it makes Clojure source code to be in the order of lowest-to- highest abstraction. Naive mutual recursion based on top-level functions is impossible. I am curious, is it due to the current implementaiton of Reader or by design? Best regards, Leonid --~--~-~--~~~-

Re: Debugging support for clojure?

2009-03-11 Thread Jerry K
Also, I've not looked at any of the math code in clojure contrib, but expressed as such, I wouldn't expect the idiom "(mod (expt n exp) m)" to be at all fast for reasons largely independent of the numeric implementation underneath. Computing the entire power and then reducing it modulo m is going

Another cells library

2009-03-11 Thread Jeffrey Straszheim
I've put together another cells-like library. Mine differs from the others in that it uses ref's and transactions, allowing global integrity checks, rollbacks, and other features that the agent based cells systems do not have. It can be found at: http://github.com/straszheimjeffrey/dataflow/tr

Re: Is Clojure's lack of support for forward referencing a feature or a bug?

2009-03-11 Thread pmf
On Mar 11, 4:23 pm, quasar wrote: > It seems it makes Clojure source code to be in the order of lowest-to- > highest abstraction. > Naive mutual recursion based on top-level functions is impossible. > I am curious, is it due to the current implementaiton of Reader or by > design? You can use (

Re: Is Clojure's lack of support for forward referencing a feature or a bug?

2009-03-11 Thread Timothy Pratley
Clojure does support forward referencing (if I understand your question): user=> (declare a) user=> (defn b [x] (a x)) user=> (defn a [x] (b x)) user=> (a 4) java.lang.StackOverflowError Note: (declare a) is a synonym for (def a) which works also. It is also quite trivial to patch the compiler to

Re: Static type guy trying to convert

2009-03-11 Thread Jon Harrop
On Thursday 12 March 2009 00:01:43 James Reeves wrote: > On Mar 11, 2:31 am, Jon Harrop wrote: > > > 2. The whole thing does not need to be complete or even functional for > > > you to start unit testing. > > > > Apples and oranges: unit tests are not the same between dynamic and > > static code

Re: Static type guy trying to convert

2009-03-11 Thread Raoul Duke
> On the other hand, I do seem to get less bugs than with Ruby, so > perhaps immutability is a more significant factor than static typing > when it comes to creating robust applications. in a way, i can totally believe that, and it sounds really good, even if it isn't true :-) i mean, one of the

Re: On the importance of recognizing and using maps

2009-03-11 Thread Cosmin Stejerean
On Wed, Mar 11, 2009 at 5:34 PM, Chouser wrote: [...] > > Defining a instance method for a Python class allows you to connect > some code to your data, which internally uses a type pointer from the > instance to the class. In Clojure you can put functions directly in > the metadata (as clojure.z

Re: What is Clojure NOT good for?

2009-03-11 Thread Korny Sietsma
Agreed. An interesting parallel is getting Java developers to use Javascript well - sure, anyone can look at javascript code and probably work it out - it's a much smaller jump to javascript syntax than clojure syntax. But even so, I know lots of Java coders who never really "get" javascript stuf

Re: keys of struct-maps

2009-03-11 Thread jim
Thanks. I found a way to accomplish what I needed, but I'll tuck that patch in my back pocket for later. Jim On Mar 11, 5:07 pm, Timothy Pratley wrote: > They are not currently exposed, but a trivial patch will achieve what > you want:http://groups.google.com/group/clojure/web/struct.patch > --

Re: Static type guy trying to convert

2009-03-11 Thread Jon Harrop
On Thursday 12 March 2009 00:28:06 Raoul Duke wrote: > i mean, one of the major benefits, i think, of immutability is that > you are in so many ways actually reducing the cognitive load that you > are under when running mental simulations of your program -- which is > a crucial part of being a pro

Question about throwing errors

2009-03-11 Thread Mark Engelberg
I'm thinking about implementing a backtracking mechanism that throws errors as a way to escape out of the current computation and try another possibility. I'd want to create a specific error to escape, and the backtracking mechanism should only catch this very specific error. Now, I vaguely reca

Re: Static type guy trying to convert

2009-03-11 Thread Mark Engelberg
I know of someone who tracked all his bugs in a year of coding in both Scheme (dynamic) and ML (static). He said that there was no real difference. The kind of bugs that are caught by static type systems are also quickly identified upon an initial run with a few basic test cases in a dynamic typ

Re: Question about throwing errors

2009-03-11 Thread David Nolen
Doesn't error-kit do this? On Wed, Mar 11, 2009 at 10:15 PM, Mark Engelberg wrote: > > I'm thinking about implementing a backtracking mechanism that throws > errors as a way to escape out of the current computation and try > another possibility. I'd want to create a specific error to escape, > a

Re: Static type guy trying to convert

2009-03-11 Thread James Reeves
On Mar 12, 12:26 am, Jon Harrop wrote: > On Thursday 12 March 2009 00:01:43 James Reeves wrote: > > This doesn't have to be the case. There is nothing inherently magical > > about a types that makes them more concise to define than a unit test. > > Type inference: you don't write anything and the

Re: Static type guy trying to convert

2009-03-11 Thread e
This is a nice post . . . would the partially static typing come from the IDE? That seems like the trend right now, but then you gotta get a good IDE, and no two would ever be the same, which I think is controversial. On Wed, Mar 11, 2009 at 4:27 PM, chris wrote: > > I don't think it is impossi

Re: Clojure plugin for IntelliJ IDEA published

2009-03-11 Thread Ilya Sergey
Hi Mike. What are you talking about assume compilation of Clojure classes. For this we have to implement first some script, which will compile some of your files. You're first who asked for such functionality and this is really cool. So, we're going to implement it in near-term future. It seems t

Re: Static type guy trying to convert

2009-03-11 Thread e
> A while ago, I did some brute force tests on a simple stack-based > language to get some testable metrics on how many unit tests you need > to guarantee correctness. With a language of 7 instructions and a > maximum program size of 8 instructions, there are about 6.7 million > program permutation

Bug in set?

2009-03-11 Thread Raffael Cavallaro
user=> (use 'clojure.set) nil user=> (set (list [:a 1] [:b 2])) #{[:b 2] [:a 1]} user=> (set (list [:a 1] [:b 2] [:c 3])) #{[:b 2] [:c 3] [:a 1]} user=> (difference *1 *2) #{[:c 3]} user=> (difference (set (list [:a 1] [:b 2])) (set (list [:a 1] [:b 2] [:c 3]))) #{} Is this a bug or am I just not

Re: What is Clojure NOT good for?

2009-03-11 Thread e
On Wed, Mar 11, 2009 at 6:28 PM, Stuart Sierra wrote: > > Ok, here's a real one: if you need to use a lot of C/C++ libraries, > for which there are no Java replacements, Clojure won't be much fun, > because C/C++ interop with Java is not fun. You'll probably be > happier with a Lisp/Scheme implem

Re: Bug in set?

2009-03-11 Thread Stephen C. Gilardi
On Mar 11, 2009, at 11:11 PM, Raffael Cavallaro wrote: user=> (use 'clojure.set) nil user=> (set (list [:a 1] [:b 2])) #{[:b 2] [:a 1]} user=> (set (list [:a 1] [:b 2] [:c 3])) #{[:b 2] [:c 3] [:a 1]} user=> (difference *1 *2) #{[:c 3]} user=> (difference (set (list [:a 1] [:b 2])) (set (list [

Re: Workflow poll?

2009-03-11 Thread Shawn Hoover
On Sat, Mar 7, 2009 at 4:53 PM, Mark Engelberg wrote: > > I've been using the Clojure-in-a-box setup for Windows, which was > absolutely instrumental in getting me to try out Clojure. But if I > keep downloading the latest versions of Clojure, it drifts out of sync > with the included SLIME devel

Re: Bug in set?

2009-03-11 Thread Raffael Cavallaro
On Mar 11, 11:43 pm, "Stephen C. Gilardi" wrote: > Here are the expressions and results in a simplified notation: > > #{a b c} - #{a b} => #{c} > > #{a b} - #{a b c} => #{} ok, so I was misunderstanding how difference works. I thought both would evaluate to #{c}. thanks --~--~-~--~--

Re: cells/add-watch question

2009-03-11 Thread Raffael Cavallaro
On Mar 11, 6:57 pm, linh wrote: > i didn't think of that. > if equality tests is instant, would finding out the difference also be > instant? > for example, is this instant: (difference new-set old-set) ? I don't think so: (defn set-difference-time-test [n] (let [s1 (set (apply hash-map

Re: version of -> short-circuiting on nil

2009-03-11 Thread rzeze...@gmail.com
Not that I have any immediate use for this at the moment, but I +1 your proposal. I make use of the ?. operating in Groovy, and it can be helpful. On Mar 10, 4:08 am, Laurent PETIT wrote: > Hello, > > 2009/3/10 Jason Wolfe > > > > > > > > > > (let [person (get-the-person)] > > >   (when-not (n

Re: cells/add-watch question

2009-03-11 Thread Timothy Pratley
And equality time does depend on the size of the data structure too it seems: user=> (def v (doall (range 1000))) user=> (def v2 (doall (range 1000))) user=> (time (= v2 v)) "Elapsed time: 2.772923 msecs" user=> (def v (doall (range 10))) user=> (def v2 (doall (range 10))) user=> (time (=

Re: Static type guy trying to convert

2009-03-11 Thread Korny Sietsma
On Thu, Mar 12, 2009 at 11:26 AM, Jon Harrop wrote: > IME, the trouble can be well worth it. I once wasted two weeks trying to track > down bugs in a thousand lines of code using unit tests and never managed it. > When I finally caved in and tried to leverage the static type system instead, > I f

Speed issues vs. Python

2009-03-11 Thread tristan
Hi guys, I'm loving Clojure, but i'm having a lot of trouble writing programs in it that run as fast as my python equivalents. One example is code i've written for projecteuler.net problem 87 (for those who don't want to see any solutions don't click the links below :)) my python version http://