Re: Google Benchmark: needs a Clojure implementation...

2011-06-07 Thread Mark Engelberg
Is there a free source for the original article containing the detailed description of the algorithm? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are mo

Re: Radically simplified Emacs and SLIME setup

2011-06-08 Thread Mark Engelberg
Mon, May 30, 2011 at 3:10 PM, Mark Engelberg wrote: > The package installer saw the 1.9.2 release, which I installed.  I'm > still getting the "cannot find the path specified" error though. > > Thanks for all the help you all have provided so far; let me know if >

Re: Radically simplified Emacs and SLIME setup

2011-06-09 Thread Mark Engelberg
arter kit. > M-x package-install clojure-mode > > lein plugin install swank-clojure 1.3.1 > Be sure to remove any old swank-clojure from your plugin dir. > > invoke M-x clojure-jack-in from a project > > Works for me atleast. > > Phil - Thanks for all the great

Re: Radically simplified Emacs and SLIME setup

2011-06-09 Thread Mark Engelberg
OK, I just tried a totally clean install of emacs 24 (I had been using emacs 23.1), first deleting my existing .emacs.d directory and tried to do the absolute minimum that the instructions specified. I added the marmalade package repository to my .emacs file. I installed clojure-mode and clojure-

Re: Radically simplified Emacs and SLIME setup

2011-06-09 Thread Mark Engelberg
On Thu, Jun 9, 2011 at 8:20 AM, Jeff Dik wrote: > With clojure-mode 1.9.2 and (GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) > of 2009-07-30 on SOFT-MJASON) (according to emacs-version), I had to > change a s-exp on line 848 in clojure-mode.el from > >    (expand-file-name clojure-root) > > to > >    (

Re: Radically simplified Emacs and SLIME setup

2011-06-12 Thread Mark Engelberg
On Fri, Jun 10, 2011 at 8:46 PM, Phil Hagelberg wrote: > I can't really do that as it's flagrantly nonportable. However, it may > be that we can just rely on Leiningen to find the project root > instead. Does this work? Seems to work for me. -- You received this message because you are subscrib

Re: Radically simplified Emacs and SLIME setup

2011-06-12 Thread Mark Engelberg
I take that back (I had edited the wrong file, which wasn't the one my emacs was using). I get the error "Not enough arguments for format string". On Sun, Jun 12, 2011 at 10:56 AM, Mark Engelberg wrote: > On Fri, Jun 10, 2011 at 8:46 PM, Phil Hagelberg wrote: >> I can&

Re: Radically simplified Emacs and SLIME setup

2011-06-12 Thread Mark Engelberg
error in process filter: Search failed: "slime-load-hook" On Sun, Jun 12, 2011 at 4:51 PM, Phil Hagelberg wrote: > On Jun 12, 10:58 am, Mark Engelberg wrote: >> I take that back (I had edited the wrong file, which wasn't the one my >> emacs was using). >

Re: Wisdom sought for functional iterative processing

2011-06-13 Thread Mark Engelberg
On Mon, Jun 13, 2011 at 7:37 PM, Matthew Phillips wrote: > List items = initialItems (); > > for (Op op : operations) > { >  if (op.requiresDelete ()) >    items.remove (op.indexToDelete ()); > >  if (op.requiresAdd ()) >    items.add (op.indexToAdd (), op.newItem ()); > } One way to transform th

Re: Wisdom sought for functional iterative processing

2011-06-14 Thread Mark Engelberg
On Tue, Jun 14, 2011 at 7:41 PM, Matthew Phillips wrote: > Yes. I agree that can work, and that's what I've done in some other > situations, but it has the downside of lots of "recur" points > sprinkled around the loop body, which I think makes it almost as hard > to reason about as having lots of

Re: Why should I use emacs instead of netbeans?

2011-06-18 Thread Mark Engelberg
My main motivation for using Emacs is that it is rock-solid stable. I look forward, however, to the day when the clojure plug-ins for the other IDEs reach that level of maturity and stability, so I can leave Emacs behind. -- You received this message because you are subscribed to the Google Grou

Re: Clojure 1.3 Beta 1

2011-06-24 Thread Mark Engelberg
One of the main changes to 1.3 is that arithmetic operations on longs do not automatically overflow. In the early discussions of this new feature, it was pointed out that people who want overflow capability can use the special "prime" operators, but that the preferred way to do things would be to

Clojure for large programs, was Re: Please stand firm against Steve Yegge's "yes language" push

2011-07-02 Thread Mark Engelberg
On Sat, Jul 2, 2011 at 12:21 PM, James Keats wrote: > A very recent quote by Abelson is relevant: > "One of the things I’m learning here (Google) is the experience of > working on these enormous programs. I just never experienced that > before. Previously a large program to me was a hundred pages

Re: Clojure for large programs

2011-07-02 Thread Mark Engelberg
Ideally, I was hoping to start a more in-depth discussion about the pros and cons of "programming in the large" in Clojure than just waxing poetic about Clojure/Lisp's capabilities in the abstract :) Yes, much of the initial excitement around Clojure comes from the feeling of "Wow, I can do so muc

Re: Clojure for large programs

2011-07-04 Thread Mark Engelberg
On Sat, Jul 2, 2011 at 8:19 PM, Luc Prefontaine wrote: > Were did you find the link between functional languages and close proximity of > errors ? That's a language design decision. You may want to use assertions > on your fns to validate inputs. That sould improve your ability to track > errors

Lein build question

2011-07-09 Thread Mark Engelberg
As of today, my lein uberjar command is no longer working on an unchanged project that compiled perfectly three days ago. The errors I'm getting seem to be suggesting that lein is no longer able to get the contrib library for 1.2. Can anyone think of any reason why this line: :dependencies [[o

Re: Lein build question

2011-07-09 Thread Mark Engelberg
More specifically, it seems to be that clojure.contrib.duck-streams is no longer being found even though the project.clj file is unchanged. Was duck-streams removed from the monolithic 1.2.0 contrib build? -- You received this message because you are subscribed to the Google Groups "Clojure" grou

Re: Lein build question

2011-07-09 Thread Mark Engelberg
Never mind. I figured out the problem. Somehow, one of the runs of lein must have gotten interrupted in a way that left the compiled duck-stream files corrupted in my classes directory. By manually deleting the contents of the classes directory and starting fresh, everything worked. --Mark --

Re: Clojure 1.3 Beta 1

2011-07-09 Thread Mark Engelberg
On Fri, Jun 24, 2011 at 1:53 PM, Stuart Sierra wrote: > > There is currently no plan for a Clojure 1.3-compatible release of "old" > clojure-contrib. However, if people with commit access to "old" > clojure-contrib have time to fix all the little things that prevent it from > building under 1.3, I

Re: Clojure 1.3 Beta 1

2011-07-10 Thread Mark Engelberg
Whoops, I thought I was asking on the dev list, but autocompletion sent it to the regular clojure list. Sorry about that. I'm resending to the dev list. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goo

Re: Libraries and build management hell

2011-07-30 Thread Mark Engelberg
On Sat, Jul 30, 2011 at 7:58 AM, Mark Rathwell wrote: > One thing, though, is new users coming from Python/Ruby/etc really do seem > to have a hard time adjusting to the fact the standard is not to have a > Clojure installation, with a clj executable that you run scripts through, > and with global

Re: Libraries and build management hell

2011-07-30 Thread Mark Engelberg
On Sat, Jul 30, 2011 at 10:43 AM, Sean Corfield wrote: > On Sat, Jul 30, 2011 at 8:24 AM, Mark Engelberg > wrote: >> 95% of the time, I just want to open a >> file, write some Clojure code, and interactively test it in a REPL. > > Really? Genuine question. You're

Re: Clojure 1.3 Beta 1

2011-07-30 Thread Mark Engelberg
On Fri, Jul 29, 2011 at 10:09 AM, abedra wrote: > Can you provide a couple of concrete examples for this?  I will make > the ticket in JIRA and start working on it, but I am spread thin on > quite a few things at the moment and these examples will help a lot. > > Cheers, > > Aaron Bedra Sure, let

Re: ClojureScript Compile errors

2011-08-06 Thread Mark Engelberg
On Sat, Aug 6, 2011 at 2:30 PM, Rich Hickey wrote: > Why all the attention to :use - I thought everyone agreed using it is a bad > idea? ... > The only benefit > I see is that you can avoid a (minimum 2 character) prefix. The other benefit is it saves you from the cognitive load of having to kno

Re: Stanford AI Class

2011-08-08 Thread Mark Engelberg
The course website (for the actual classroom-based class that underlies the online class) doesn't list any programming language as a prerequisite. The only prerequisites listed are a strong understanding of probability and linear algebra. -- You received this message because you are subscribed t

Re: Stanford AI Class

2011-08-08 Thread Mark Engelberg
BTW, Norvig's older AI book uses LISP. According to his website, he switched to Python because students complained that the LISP code did not look enough like the pseudocode outline of how a given algorithm works, and had trouble making the connection between the two. -- You received this messa

Re: Stanford AI Class

2011-08-08 Thread Mark Engelberg
On Mon, Aug 8, 2011 at 2:18 PM, daly wrote: > It is trivial to make Lisp look like Python, > just put each paren on its own line and move them hard right. > Add a few macros (e.g. for) and you could probably parse it. I agree with most of what you said, but not this. There's a big difference bet

Re: is my understanding correct for function "identity"?

2011-08-13 Thread Mark Engelberg
(filter identity l) is a great way of removing all the false and nil items from l -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be

Re: Exception calling nth on Sets

2011-08-14 Thread Mark Engelberg
My guess is that nth (and by extension rand-nth) can't implicitly call seq on the collection because if it did, you'd lose the fast access that vectors provide. So you'll need to call seq on your set before passing it to rand-nth. -- You received this message because you are subscribed to the Go

Re: Stanford AI Class

2011-08-16 Thread Mark Engelberg
The Machine Learning class from 2008 has been available at iTunes University for a while, but I'm not aware of it having the same kinds of support materials as the online AI class has said they will offer. Be forewarned: the Machine Learning class is presented in a very math intensive way (statist

Re: Stanford AI Class

2011-08-16 Thread Mark Engelberg
Nice. I'm glad these other classes are getting the full treatment. It's really a shame they don't do a clearer job of defining the prerequisites. For example, they should post some sort of pre-test with specific examples of the kind of math that is needed to understand the class. I find it diff

Re: using contains? on transient collections

2012-02-29 Thread Mark Engelberg
It is the expected behavior for everyone who has ever gotten burned by this bug :) Seriously though, this has come up several times over the last couple of years. I remain baffled that this has never been fixed (at least not as of 1.3). There are two ways this could potentially be fixed. On the

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-07 Thread Mark Engelberg
On Wed, Mar 7, 2012 at 3:16 PM, Alex Baranosky < alexander.barano...@gmail.com> wrote: > I think that the real question that is: if you know Python and Clojure > equally well, then which is easier to read? > > Alex > > > I know both equally well (actually, I've logged more hours in my life coding

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-07 Thread Mark Engelberg
On Wed, Mar 7, 2012 at 3:12 PM, Joachim De Beule wrote: > Please define "readable". > > Thanks! > > "Readable" is a measure of how readily apparent the meaning of a program is from looking at it. If you wanted to measure this objectively, one possible way to do this would be to time how long it

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-07 Thread Mark Engelberg
Going back to the original poster's question, I think if I could make only one change to Clojure's syntax to improve readability, I'd take a page from other functional languages like F# and Racket and add a way to bind local variables that doesn't indent. So, for example, (let x 2) code would be

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-07 Thread Mark Engelberg
On Wed, Mar 7, 2012 at 10:43 PM, Andy Fingerhut wrote: > You might have a difficult time getting other Clojure coders to adopt the > practice in their code, but would this be almost as good? > > (let [x 2] > code) > > Achieving that would be as simple as hand-indenting it that way, or > adjusting

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-08 Thread Mark Engelberg
Sean, I agree that breaking things into smaller functions can potentially help. Often, though, I find that a function begins by unpacking and computing a large number of values that are all important for subsequent computations. Dispatching these computations to helper functions would mean passing

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-08 Thread Mark Engelberg
On Wed, Mar 7, 2012 at 11:37 PM, Sean Corfield wrote: > I actually find that to be a plus - there's no distracting variance > that artificially makes things "different" that don't need to be. > > I just thought of an amusing analogy. To me, reading Lisp takes more mental effort in the same way th

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-08 Thread Mark Engelberg
On Thu, Mar 8, 2012 at 2:45 AM, Nicolas wrote: > I’m not sure that just adding counter responses to almost all Mark > points really help. Most counter arguments here resume to "you are > doing it wrong" and "all clojure 'warts' are here to force you to > better design". > Looking back at my init

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-08 Thread Mark Engelberg
On Thu, Mar 8, 2012 at 6:04 PM, Evan Gamble wrote: > That would work for replacing a single cond surrounded by a single > let, but I often find myself writing a series of nested lets, when- > lets, if-lets, etc. to handle the exceptional cases in lets. A > contrived example: > > (when-let [a foo]

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-08 Thread Mark Engelberg
On Thu, Mar 8, 2012 at 9:44 AM, Laurent PETIT wrote: > You should probably both share gists of real code you're talking about, > shouldn't you ? > Most of the stuff I'm working on is closed-source. Offhand, I'm not sure what examples I can share, but I'll keep an eye out for that. In the meanti

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-08 Thread Mark Engelberg
On Thu, Mar 8, 2012 at 9:33 AM, Sean Corfield wrote: > I'm interested in hearing more > about the sort of functions that begin "by unpacking and computing a > large number of values that are all important for subsequent > computations". I'm not seeing this in my code so I assume we're > working on

Re: Can Clojure be as readable as Python or Ruby ?

2012-03-09 Thread Mark Engelberg
The nice thing about Grand's cond macro is that it matches the syntax of using :let inside for comprehensions, so it looks just like other Clojure code. In fact, once you've tried it, it feels surprising that it's not already built into Clojure, specifically because it is so similar to binding wit

Re: 'contains?' on 'sorted-set-by' based on the comparator only? (possible bug?)

2012-03-15 Thread Mark Engelberg
It's not a problem with Clojure, it's also how Java behaves. For sorted-sets to work properly, your comparator *must* satisfy the trichotomy property of orderings. Consider a comparison predicate less?. The trichotomy property states that for all x,y, exactly one of the following hold: (less? x

Re: Returning Success

2012-03-19 Thread Mark Engelberg
On Mon, Mar 19, 2012 at 3:56 AM, Narvius wrote: > I see several ways to achieve what I want, that is to return both the new > world state and success status. > 1) Compare the old and new value - doesn't seem very efficient. > Probably not as inefficient as you think. Identical things are recogn

Re: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-27 Thread Mark Engelberg
On Mon, Mar 26, 2012 at 3:37 AM, Sergey Didenko wrote: > Hi, > > I believe I've heard claims that nothing stops Clojure 1.3 code to be > made very close to Java in terms of execution speed. > > My personal experience is that it is very difficult to get Java execution speed. On high-level code, wh

Getting started with lein-cljsbuild

2012-04-18 Thread Mark Engelberg
I'm getting ready for my first foray into Clojurescript. I managed to get all the tools installed under Windows, and can run the repl and compiler from the command line using the instructions found at: https://github.com/clojure/clojurescript/wiki/Quick-Start So far, so good. Next, I downloaded

Code shared between clj and cljs

2012-04-18 Thread Mark Engelberg
What is an appropriate workflow for building underlying logic code that needs to be incorporated into both clojure code and clojurescript code? If the code is written in such a way that it would work under both Clojure and Clojurescript, what is the right way to name it and organize it in director

Re: Getting started with lein-cljsbuild

2012-04-18 Thread Mark Engelberg
I was able to get the plugin working by typing the following at the command-line (rather than using lein deps): C:\temp\cljstest>lein plugin install lein-cljsbuild 0.1.8 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

Re: Getting started with lein-cljsbuild

2012-04-19 Thread Mark Engelberg
Yes, I've only tested "lein cljsbuild once", but it worked just fine once I figured out the alternative way to get the plugin installed. On Thu, Apr 19, 2012 at 12:03 AM, Evan Mezeske wrote: > That's great news that you got it to work. I can't make any sense of the > stack trace you're seeing w

Re: Getting started with lein-cljsbuild

2012-04-19 Thread Mark Engelberg
Unfortunately, "lein trampoline cljsbuild repl-rhino" (and all the trampoline tasks) generates the same error that I got when I tried to run lein deps. On Thu, Apr 19, 2012 at 12:18 AM, Mark Engelberg wrote: > Yes, I've only tested "lein cljsbuild once", but

Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
I'm trying to get some Clojure code to compile to javascript. So I've got a clojurescript repl up and running, and I was hoping it would be a straightforward iterative process of: Compile code. Test code. Get detailed bug (or at least a line number) if I used a feature not available in clojurescri

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 4:59 AM, Dave Sann wrote: > If I have errors, I use the stacktrace which you can access easily in > chrome for example to get my bearing and figure out what is going on. > Can you elaborate on this? Right now, I'm using a rhino repl as per the getting started instruction

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 10:01 AM, Dave Sann wrote: > The error that you showed originally does not look like a compile error - > but an execution error. I may be wrong. > Agreed. The error happens only when I execute the code, not when I compile it. Since the code works fine in Clojure, my bes

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 10:56 AM, David Nolen wrote: > How are you compiling the code? > > David > > In the REPL, using (ns test (:require [namespace-of-file-I-want-to-compile :as s])) and then invoking the functions using (s/function item). -- You received this message because you are subscribe

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
lein-cljsbuild's trampoline tasks for starting REPLs are not working for me (I reported this in another thread). Seems to be a problem with lein's batch file for Windows not properly handling spaces in directories that relate to plugins. So I do lein repl (I've configured the project file with ad

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
g able to call the method "call" of undefined. Any other suggestions? Thanks, Mark On Thu, Apr 19, 2012 at 11:32 AM, David Nolen wrote: > Then you need construct your REPL with: > > (repl/repl env :warn-on-undeclared true) > > David > > On Thu, Apr 19, 2012 at

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
I've found that by completely exiting and restarting the REPL, it is working now. Woo hoo! Way, way, way slower though. 16 seconds to produce an answer that takes 6 milliseconds in Java. I have a suspicion that part of the time difference may have something to do with Clojurescript's treatment

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 4:46 PM, Evan Mezeske wrote: > Is the 16 seconds figure from running your code in Rhino? > Yes, Rhino. I'm also not doing any optimizations, although my understanding is that advanced optimizations is more about pruning code and reducing file size than reducing execution

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 4:38 PM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > I am working on an optional type system for Clojure. It looks more like > Scala's type system, ie. working on top of existing Java types. > > I saw Gilad Bracha speak a couple weeks ago about the des

Re: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
OK, I ran the same test directly in the browser with optimizations. I wasn't doing it in a REPL, so I couldn't use the time function, but Firefox appeared to take about 2 seconds, and Chrome was definitely under a second. So yes, there does seem to be a world of difference from Rhino. I'm still

Re: Inconsistency of dissoc on maps vs records?

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe wrote: > > Out of curiosity, why is this useful to you? > It certainly has performance benefits. When things are tested for equality (e.g., to test against keys in a hash map), identical things are the fastest to recognize as equal. Also, saves on

Re: Reducers

2012-05-08 Thread Mark Engelberg
Exciting! I'm having trouble visualizing at what points the computation is actually executed, and therefore, I'm not clear on how this feature interacts with dynamic binding. If the reducers/map occurs in one dynamic binding context, and the fold occurs in another, what happens? -- You received

Re: ...regarding Clojure's STM performance and scalability

2012-05-09 Thread Mark Engelberg
The important thing to remember is that most researchers/programmers are looking for a silver bullet for concurrency that will allow programmers to get semantically correct programs *without having to change the way they think or do things*. The idea is to take a typical imperative program and wit

defs in Clojurescript REPL

2012-05-13 Thread Mark Engelberg
In Clojure, when you def a variable, the REPL prints the name of the variable rather than the value. In Clojurescript, when you def a variable, the REPL prints the value assigned to the variable. This is problematic when working with lazy values. Is there any particular reason the Clojurescript R

Re: defs in Clojurescript REPL

2012-05-14 Thread Mark Engelberg
more specific example of why this is a problem? > > > On Monday, May 14, 2012, Mark Engelberg wrote: > >> In Clojure, when you def a variable, the REPL prints the name of the >> variable rather than the value. >> In Clojurescript, when you def a variable, the REPL prints t

Re: defs in Clojurescript REPL

2012-05-14 Thread Mark Engelberg
On Mon, May 14, 2012 at 4:41 PM, David Nolen wrote: > On Mon, May 14, 2012 at 7:27 PM, Mark Engelberg > wrote: > >> (def tree (function-that-produces-an-enormous-tree 2)) >> > > Isn't doing this at the top level bad form? > The purpose of a REPL is for inte

Re: defrecord with "inheritance"

2012-05-20 Thread Mark Engelberg
On Sun, May 20, 2012 at 4:31 PM, David Nolen wrote: > Nearly all of the data structures have been ported to ClojureScript. It's > not clear to me that we needed traits at any point. > > David > > > Until it has all been factored into protocols that make it easy for people to implement their own d

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 1:53 AM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote: > I just have. This is a nice work. There is a lot of repetitions though. > Thanks Nicolas for putting together these examples. This is exactly what I've been talking about. Whenever someone talks about the

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 10:12 AM, nicolas.o...@gmail.com < nicolas.o...@gmail.com> wrote: > The point is not whether deftype is useful or not. It is in the > language so it must be useful, even it it is rarely. > The point is whether it is an expressive construct or not. > And it is not expressive

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 11:12 AM, David Nolen wrote: > So "real world" complex systems avoid inheritance like the plague. So > remind me again why it's desirable? > > David > > > I never said I want inheritance. I want convenient reuse of partial implementations. Inheritance is one way to achiev

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 4:00 PM, David Nolen wrote: > The only two protocols that involve specifying more than 2 fns is > IWatchable (3) and MultiFn (5). It's not clear to me that they would > benefit from partial specification. > I don't think there's enough body of code using protocols to real

Re: defrecord with "inheritance"

2012-05-21 Thread Mark Engelberg
On Mon, May 21, 2012 at 4:23 PM, kovas boguta wrote: > On Mon, May 21, 2012 at 6:08 PM, Mark Engelberg > wrote: > > > I never said I want inheritance. I want convenient reuse of partial > > implementations. Inheritance is one way to achieve it, but I'd like to > &g

Upgrading clojurescript

2012-05-28 Thread Mark Engelberg
My understanding is that there's a relatively new release of clojurescript available, with better implementations of the persistent data structures. On Windows, the initial install required several manual steps. Can someone explain to me which steps need to be redone in order to update an existin

Re: Getting started with lein-cljsbuild

2012-05-28 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 1:29 AM, Mark Engelberg wrote: > Unfortunately, "lein trampoline cljsbuild repl-rhino" (and all the > trampoline tasks) > generates the same error that I got when I tried to run lein deps. > I mentioned last month that I was able to get "lein c

Re: Getting started with lein-cljsbuild

2012-05-28 Thread Mark Engelberg
On Mon, May 28, 2012 at 6:28 PM, Ben Mabey wrote: > I actually hit this same problem with lein-cljsbuild the other day but on > OSx. I had ~/Foo Bar Baz/my-project and it was complaining that the Bar > class could not be found when I tried to use the repl tasks. So, I don't > think it is strict

Re: Getting started with lein-cljsbuild

2012-05-28 Thread Mark Engelberg
On Mon, May 28, 2012 at 6:49 PM, Evan Mezeske wrote: > Also, observe that if the project's path contains a space, "lein > trampoline repl" fails as well. > > > Right, this is a big part of why I think that lein trampoline was at least part of the culprit. But by ensuring that the project's path

Re: When arithmetic on a computer bite back

2012-06-02 Thread Mark Engelberg
1.4411518807585587E17 ends in 0, and therefore when you divide by 2, it should end in 5. It's not a power of 2, it is a merely an inexact approximation of one. On Sat, Jun 2, 2012 at 2:31 AM, Tassilo Horn wrote: > Yes, you did. How can a power of two divided by two be *odd* (well, > except for

Re: Slow 'quick sort'

2012-06-08 Thread Mark Engelberg
last and drop-last are slow operations on seqs, and no matter what you pass in for the initial input, once you hit the recursive calls, you're passing in seqs (because that's what filter produces). Try first and rest. -- You received this message because you are subscribed to the Google Groups "

Re: Scheme dotted pair equivalent in Clojure

2012-06-17 Thread Mark Engelberg
A cons is essentially just a struct with two fields. In Clojure, it's sort of like: (defrecord Cons [car cdr]) (defn cons [x y] (Cons. x y)) (defn first [x] (:car x)) (defn rest [x] (:cdr x)) The amazing thing is that you can represent any collection of arbitrary length, just by nesting these st

Re: Scheme dotted pair equivalent in Clojure

2012-06-17 Thread Mark Engelberg
In the previous post, I accidentally deleted a dot when pasting: user=> (clojure.lang.MapEntry :a 1) should have been user=> (clojure.lang.MapEntry. :a 1) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goo

Re: memoization of an no-arg fn that returns a map?makes sense?

2012-06-19 Thread Mark Engelberg
I think what you really want to do is use "delay" on specific fields. This way, you don't need to make a function that builds the map every time, you just define the map, replacing, for example, the :north-player-start line with the following: :north-player-start (delay (starting-checkers true))

Re: memoization of an no-arg fn that returns a map?makes sense?

2012-06-19 Thread Mark Engelberg
On Tue, Jun 19, 2012 at 11:02 AM, Jim - FooBar(); wrote: > On 19/06/12 18:32, Mark Engelberg wrote: > >> This effectively memoizes the specific field that needs it, rather than >> the whole map. >> > > but I need the whole map 'memoized' cos it's

Re: Why cannot "last" be fast on vector?

2012-06-28 Thread Mark Engelberg
On Thu, Jun 28, 2012 at 6:59 PM, Tamreen Khan wrote: > Here's a somewhat old but still generally useful article on how Clojure > vectors are implemented: > http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/ > > > Vectors are optimized for random access

Re: Why cannot "last" be fast on vector?

2012-06-29 Thread Mark Engelberg
It is clear that some collections *could* support a more efficient last. Anything with random access. Anything that supports rseq (e.g., sorted collections). There are multiple ways to accomplish this; I presume a protocol would do the trick. Perhaps the original design decision is easily justif

Re: Why cannot "last" be fast on vector?

2012-06-29 Thread Mark Engelberg
vectors and sorted collections, for sure. On Fri, Jun 29, 2012 at 4:42 PM, David Nolen wrote: > On Fri, Jun 29, 2012 at 6:49 PM, Warren Lynn wrote: > > The same? If internally it can be faster, be faster. If not, don't > change. > > For which types do you think they can be made faster? > > Davi

Re: Why cannot "last" be fast on vector?

2012-06-29 Thread Mark Engelberg
On Fri, Jun 29, 2012 at 4:50 PM, David Nolen wrote: > On Fri, Jun 29, 2012 at 7:28 PM, Sam Ritchie wrote: > > Perhaps place them inside a protocol, where core supplies implementations > > for ISeq only? This would make it easier to extend efficient behavior to > > other types without placing a b

Re: Why cannot "last" be fast on vector?

2012-06-29 Thread Mark Engelberg
On Fri, Jun 29, 2012 at 5:17 PM, David Nolen wrote: > As I said, if ISeq and ILast are both protocols that won't work. No > protocol inheritance. > > I don't see how inheritance factors into this. This works just fine in Clojure 1.3. What am I missing?: (defprotocol Last (better-last [s]))

Re: Why cannot "last" be fast on vector?

2012-06-29 Thread Mark Engelberg
On Fri, Jun 29, 2012 at 4:50 PM, David Nolen wrote: > ISeq *is* an interface on Clojure JVM. But ideally it would be > protocol as in ClojureScript. But then all ISeq implementing types > must also implement this new protocol you are suggesting to get these > basic *generic* sequence operations w

Re: Why cannot "last" be fast on vector?

2012-06-29 Thread Mark Engelberg
On Fri, Jun 29, 2012 at 8:55 PM, Mark Engelberg wrote: > my understanding is that in Clojure, every protocol generates a Java > interface, so I can't think of any reason why you couldn't list that > generated interface as a "type" in another protocol (although I

Re: Why cannot "last" be fast on vector?

2012-06-30 Thread Mark Engelberg
On Sat, Jun 30, 2012 at 10:24 AM, Warren Lynn wrote: > I think some people agree with me something is broken here (puzzler, for > example. Please correct me is I am wrong as I don't want to hijack other > people's opinion). > One really nice thing about the Clojure community is that from the ver

Protocol as an abstract data type

2012-06-30 Thread Mark Engelberg
This is a continuation of issues raised in the thread about making the core "last" function behave in a polymorphic manner. The separation of interfaces from implementation in Java serves several purposes, but one thing it does is it allows the creation of abstract data types, i.e., a type that is

Re: Protocol as an abstract data type

2012-06-30 Thread Mark Engelberg
On Sat, Jun 30, 2012 at 9:36 PM, David Nolen wrote: > Look at the implementation of nth. Or how polymorphic unification works in > ClojureScript core.logic for ISequential. I misspoke a bit, should have > clearer that I simply meant that ILast (probably something else entirely) > needs to be care

Re: Protocol as an abstract data type

2012-06-30 Thread Mark Engelberg
Never mind, found 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this grou

Re: Protocol as an abstract data type

2012-06-30 Thread Mark Engelberg
OK, I get it now. Protocols are attached to very specific capabilities. With this structure, it is easy to: Write a function that operates on an input that fulfills a specific protocol. Write a function that operates on an input that fulfills (all of) multiple protocols. Write a function that op

Light Table on Windows XP

2012-07-02 Thread Mark Engelberg
I have been unable to get Light Table to work on Windows XP. I suspect this has something to do with not installing the proper version of Power Shell, but the install instructions are exceedingly sparse and no such details have been provided. I submitted feedback through official channels but (un

Re: Light Table on Windows XP

2012-07-03 Thread Mark Engelberg
I've emailed Mark Rathwell offline with some more questions to see if I can troubleshoot the Powershell problems I had. Also, Chris Granger contacted me saying he wouldn't necessarily expect it to work on XP, but he gave me instructions on how to run LightTable without the Powershell script if nee

Re: mutual reference in FP style

2012-07-06 Thread Mark Engelberg
You basically have two choices. Choice 1, give names to each of your nodes, and link names to names. (def cycle {:a {:value 2, :link :b}, :b {:value 3, :link :a}} Choice 2, use one of Clojure's reference types (def a (ref {:value 2})) (def b (ref {:value 3})) (dosync (alter a assoc :link b) (alte

Re: Light Table on Windows XP

2012-07-09 Thread Mark Engelberg
That worked. Thanks. On Thu, Jul 5, 2012 at 8:50 AM, Mark Rathwell wrote: > My guess on this is that you need PowerShell 2.0, just a guess though. > It can be download as a part of this package: > > http://www.microsoft.com/en-us/download/details.aspx?id=16818 > > > On Thu, Jul 5, 2012 at 10:21

Re: Little becnhmark (need insight)

2012-07-23 Thread Mark Engelberg
I would guess you'd get closer to Scala's perf if you use records to represent your trees, rather than vectors. -- 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 memb

<    5   6   7   8   9   10   11   12   13   >