Re: ClojureScript: comparing dates

2012-08-16 Thread David Nolen
On Thu, Aug 16, 2012 at 3:06 PM, D.Bushenko wrote: > Hi, > > I'm trying to compare dates with ClojureScript like this: > > (ns common > (:require [goog.date.Date])) > . . . > (goog.date.Date/compare (js/Date.) (js/Date.)) Is your Google Closure up to date? You should confirm that goog.date.Date

Re: Exception message in read-string - Clojure vs ClojureScript

2012-08-16 Thread David Nolen
On Thu, Aug 16, 2012 at 1:24 AM, Shantanu Kumar wrote: > Hi, > > I encountered this when trying to run `read-string` on Clojure > (clojure.core) and ClojureScript (cljs.reader). I noticed when I run > (read-string ""), I get the exception message "EOF while reading" on Clojure > but on ClojureScri

Re: Any chance for Ratio and BigInt support in ClojureScript?

2012-08-15 Thread David Nolen
On Wed, Aug 15, 2012 at 6:10 PM, Tyler Tallman wrote: > By wasting my time I mean if it is clear goog.math.integer is a bad idea it > would be great if someone who knows would help a brother out and tell me. > :-) > I we are slowly moving a large google closure codebase into clojurescript so > I h

Re: clojure.logic project.clj file

2012-08-15 Thread David Nolen
On Wed, Aug 15, 2012 at 6:00 PM, Sean Corfield wrote: > I know David said he only uses it for interactive development but I > think it will cause confusion for others. Perhaps the best solution > would be to move it aside, delete it from Git, move it back and add it > to .gitignore? That way David

Re: [ANN] Ekeko: querying Java projects using core.logic

2012-08-15 Thread David Nolen
On Tue, Aug 14, 2012 at 8:35 PM, Coen De Roover wrote: > Dear all, > > I'm pleased to announce the first release of Ekeko, an Eclipse plugin for > querying Java projects using core.logic: > https://github.com/cderoove/damp.ekeko > > Screencast: > http://youtu.be/5wvVFQa1hVU > > Ekeko is still a w

Re: [ANN] Ekeko: querying Java projects using core.logic

2012-08-15 Thread David Nolen
On Tue, Aug 14, 2012 at 8:35 PM, Coen De Roover wrote: > Dear all, > > I'm pleased to announce the first release of Ekeko, an Eclipse plugin for > querying Java projects using core.logic: > https://github.com/cderoove/damp.ekeko > > Screencast: > http://youtu.be/5wvVFQa1hVU > > Ekeko is still a w

Re: Any chance for Ratio and BigInt support in ClojureScript?

2012-08-15 Thread David Nolen
On Tuesday, August 14, 2012, dspiteself wrote: > I have extensive google closure experience, but little low level > clojurescript experience. > Could we use the clojure library's Integer or long type. It will likely > not be as fast but when you need it you need it. > > http://closure-library.goog

Re: Any chance for Ratio and BigInt support in ClojureScript?

2012-08-15 Thread David Nolen
t 11, 2012 1:47:06 PM UTC-5, David Nolen wrote: >> >> On Sun, Aug 5, 2012 at 10:43 PM, Olaf Delgado-Friedrichs >> wrote: >> > Thanks for the link! I didn't know that the Closure library contained >> an >> > arbitrary precision type, but should have exp

Re: not-nilo in core.logic?

2012-08-15 Thread David Nolen
On Wed, Aug 15, 2012 at 9:53 AM, Jim - FooBar(); wrote: > OK thanks a lot both of youit turns out the != works just fine! > > at the moment I've almost completed the entire moving rules for chess and > checkers (including kills) but only on an empty board...the only thing > remaining to finish

Re: clojure.logic project.clj file

2012-08-15 Thread David Nolen
On Wed, Aug 15, 2012 at 9:32 AM, Marshall T. Vandegrift wrote: > David Nolen writes: > >> Should core.logic support specific versions of Lein? Ideally Lein 2 >> would support Lein 1.X files. > > My understanding is that the reason the new version is lein 2.0 instead >

Re: not-nilo in core.logic?

2012-08-15 Thread David Nolen
On Wed, Aug 15, 2012 at 9:02 AM, Jim - FooBar(); wrote: > Hi everyone, > > I was thinking about how to invert the 'nilo' relation found in core.logic: > > (defn nilo > "A relation where a is nil" > [a] > (== nil a)) > > > there is a != operator but it is in the arithmetic namespace so i don'

Re: clojure.logic project.clj file

2012-08-14 Thread David Nolen
On Tue, Aug 14, 2012 at 10:31 PM, Brent Millare wrote: > Well just looking at the source, :source-path is never looked up, only > :source-paths. All project.clj files that are prepped for leiningen2 use > :source-paths to my knowledge. Should core.logic support specific versions of Lein? Ideally

Re: clojure.logic project.clj file

2012-08-14 Thread David Nolen
On Tue, Aug 14, 2012 at 10:09 PM, Brent Millare wrote: > Well just using leiningen2 and then lein repl, and then > > user=> (require 'clojure.core.logic) > FileNotFoundException Could not locate clojure/core/logic__init.class or > clojure/core/logic.clj on classpath: clojure.lang.RT.load (RT.jav

Re: clojure.logic project.clj file

2012-08-13 Thread David Nolen
On Mon, Aug 13, 2012 at 4:38 PM, Brent Millare wrote: > I think the :source-path line in project.clj should be :source-paths > ["src/main/clojure"]. Is :source-path still looked up in leiningen2? Is there something specific you are trying to do? David -- You received this message because you a

Re: core.logic: (run* [q] (membero :x #{:x})) -> ()

2012-08-11 Thread David Nolen
On Sat, Aug 11, 2012 at 2:14 PM, Moritz Ulrich wrote: > > Hi, fellow logic programmers! > > > Shouldn't `membero' work with sets? > > I notice that > > (run* [q] (membero :x #{:x})) > > returns no results while > > (run* [q] (membero :x (seq #{:x}))) > > returns the (in my opinion) correct res

Re: Any chance for Ratio and BigInt support in ClojureScript?

2012-08-11 Thread David Nolen
On Sun, Aug 5, 2012 at 10:43 PM, Olaf Delgado-Friedrichs wrote: > Thanks for the link! I didn't know that the Closure library contained an > arbitrary precision type, but should have expected it. > > When you speak of performance, do you mean the extra cost of checking > argument types for the ari

Re: ClojureScript & protocols

2012-08-08 Thread David Nolen
On Wed, Aug 8, 2012 at 3:52 AM, Alexander Solovyov wrote: > On Wed, Aug 8, 2012 at 4:47 AM, David Nolen wrote: >>> Ok, I figured out (well, not I, but m0smith from #clojure): protocols >>> should be imported using :require :as, rather than :use :only. >> >> This

Re: ClojureScript & protocols

2012-08-07 Thread David Nolen
On Tue, Aug 7, 2012 at 3:03 PM, Alexander Solovyov wrote: > On Mon, Aug 6, 2012 at 10:44 AM, Alexander Solovyov > wrote: >> I have a simple protocol Map here: >> https://github.com/piranha/cj-locations/blob/master/src/map.cljs >> >> And an implementation of it here (I tried with extend-type as we

Re: School Seating Charts

2012-08-07 Thread David Nolen
On Tue, Aug 7, 2012 at 12:24 AM, Evan Mezeske wrote: > Anyway, I've rambled on far too much already. I just thought people might > want to hear about a Clojure success story. Technical success, that is... > Whether it's a commercial success remains to be seen. :) > > -Evan An excellent experie

Re: why would this fail in core.logic?

2012-08-07 Thread David Nolen
On Tue, Aug 7, 2012 at 10:09 AM, Jim - FooBar(); wrote: > > I've got the moving rules for all chess-pieces working... :-) > > David, would you like me to put them somewhere as examples to core.logic? I > remember you saying that you'd love some translations from prolog to > core.logic or general

Re: why would this fail in core.logic?

2012-08-07 Thread David Nolen
On Tue, Aug 7, 2012 at 6:46 AM, Jim - FooBar(); wrote: > (defn bishop-moves [x y] > (let [xmax 8 ymax 8] > (run* [q] > (fresh [a b] > (< a xmax) > (< b ymax) > (= (- x a) > (- y b)) > > (== q [a b]) > (= (- x a) (- y b)) Is not going to wo

Re: why would this fail in core.logic?

2012-08-06 Thread David Nolen
You have to be careful when using Clojure or Java operations in core.logic programs. I would recommend avoiding it until you're comfortable with writing pure core.logic programs. On Monday, August 6, 2012, Jim - FooBar(); wrote: > caution! logic noob question following...why does the following fa

Re: Any chance for Ratio and BigInt support in ClojureScript?

2012-08-05 Thread David Nolen
On Sun, Aug 5, 2012 at 12:45 AM, Olaf Delgado-Friedrichs < olaf.delg...@googlemail.com> wrote: > Hi, > > I am currently learning Clojure/ClojureScript and enjoying it a lot. Since > I have a bit of code I am planning to port that requires precise rational > arithmetic, I am particular delighted by

core.logic 0.8-alpha1 is out

2012-08-02 Thread David Nolen
The list of changes is simply too long :) Please give it a shot. I'd like to make sure that it doesn't create problems for existing core.logic usage. Documentation on the new functionality forthcoming! David -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: A succinct & reasonably fast sudoku solver in core.logic

2012-07-31 Thread David Nolen
A much shorter version using an everyo goal I just landed in master: http://gist.github.com/3217582 David On Tue, Jul 31, 2012 at 11:36 AM, gaz jones wrote: > Wow, that's pretty nice. > > On Tue, Jul 31, 2012 at 8:07 AM, David Nolen > wrote: > > Ever since I read Norvig

A succinct & reasonably fast sudoku solver in core.logic

2012-07-31 Thread David Nolen
Ever since I read Norvig's cool Python solution, http://norvig.com/sudoku.html, I've been wanting to see if this could be done in core.logic without sacrificing generality. Now that we have cKanren extensions in master I gave it a shot (thanks to Martin Trojer) and I'm happy with the results. http

Re: Testing ClojureScript

2012-07-30 Thread David Nolen
Looks like Node.js is being aliased as SpiderMonkey. That won't work. I suggest installing V8 from source. I'll update the ClojureScript Github wiki with instructions for testing latest JavaScriptCore and SpiderMonkey. David On Monday, July 30, 2012, Timothy Baldridge wrote: > I'm trying to run

Re: Translating from Prolog to core.logic

2012-07-28 Thread David Nolen
On Sat, Jul 28, 2012 at 8:53 PM, JvJ wrote: > I'm having trouble translating some Prolog code to core.logic. > > In particular, I'd like to do something like this: > >> 2 ?- assert(a(b)). >> true. >> 3 ?- assert(a(a(b))). >> true. >> 4 ?- a(X). >> X = b ; >> X = a(b). >> 5 ?- a(a(X)). >> X = b. W

Re: reactive programming for UIs and other use cases

2012-07-26 Thread David Nolen
On Thu, Jul 26, 2012 at 11:51 AM, Yann Schwartz wrote: > I'm in no way a clojurescript specialist, but how hard would it be to wire > RxJs (the javascript version of the impressive Reactive Extensions > framework) to clojurescript? Using it probably wouldn't be much work. It's not clear to me tha

Re: reactive programming for UIs and other use cases

2012-07-26 Thread David Nolen
On Wed, Jul 25, 2012 at 5:23 AM, eric wrote: > Now, reactive programming isn't necessarily central to the development of > Clojure core or contrib so readers here might be interested, too. Posting in > "Clojure Dev" is handled rather restrictively so if you can't post there, > why not post to this

Re: Pathfinding via core.logic

2012-07-24 Thread David Nolen
On Tue, Jul 24, 2012 at 2:21 PM, Timothy Baldridge wrote: > All of these returned a 3 element set, but I'd like this to work with > arbitrary length paths. Any suggestions where to start reading up on > this? Is reading the reasoned schemer required for understanding how > to use core.logic? The

core.logic w/ cKanren extensions preview

2012-07-24 Thread David Nolen
Tom Hickey recorded my NYC Clojure presentation on cKanren extensions to core.logic - http://vimeo.com/46163091 David -- 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 n

Re: core.match "invert" match

2012-07-24 Thread David Nolen
On Tue, Jul 24, 2012 at 6:03 AM, Simone Mosciatti wrote: > Thanks, it was what i thought... > > Any other suggestion is still welcome :-) I don't really understand your example. Can you clarify? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To pos

Re: core.match "invert" match

2012-07-23 Thread David Nolen
On Mon, Jul 23, 2012 at 6:42 PM, Simone Mosciatti wrote: > Hi everybody, > I was looking if it is possible to invert the match macro, an example worth > more than 1000 words. > > (def x (match [a b] >[true true] 0.5 >[false true] 0.6 >[true false] 0.4 >[false false] 0.8)) > > (max

Re: Little becnhmark (need insight)

2012-07-23 Thread David Nolen
have not changed. On Mon, Jul 23, 2012 at 5:07 PM, David Nolen wrote: > (deftype Tree [n l r] > clojure.lang.Indexed > (nth [this idx] > (nth this idx nil)) > (nth [_ idx not-found] > (case idx > 0 n > 1 l > 2 r > not-found))) &

Re: Little becnhmark (need insight)

2012-07-23 Thread David Nolen
(deftype Tree [n l r] clojure.lang.Indexed (nth [this idx] (nth this idx nil)) (nth [_ idx not-found] (case idx 0 n 1 l 2 r not-found))) (defn generate-tree [[h & t :as coll]] (when (seq coll) (let [lr (generate-tree t)] (Tree. h lr lr (defn to-list

Re: Little becnhmark (need insight)

2012-07-23 Thread David Nolen
On Mon, Jul 23, 2012 at 4:52 PM, Alexander Semenov wrote: > To some degree. Neither Clojure nor Haskell won't beat direct mutable code > in Scala which results in 65ms on a machine 2x slower than my current. Direct mutable code can be written with little difficulty in Clojure. It's just discourag

Re: Little becnhmark (need insight)

2012-07-23 Thread David Nolen
On Mon, Jul 23, 2012 at 4:30 PM, Alexander Semenov wrote: > Yes, but these are implementation details - API is still functional and > side-effects free. So your benchmark is just timing implementation details. I'm sure you can get get identical numbers to Scala / Haskell if you provide your own

Re: Little becnhmark (need insight)

2012-07-23 Thread David Nolen
On Mon, Jul 23, 2012 at 2:58 PM, Alexander Semenov wrote: > > (do (time (doall (to-list tree))) :done) > "Elapsed time: 19716.222 msecs" > > Why is this so? Both results are kind of disappointing for me cause Scala > gives me ~270ms time using functional code and 5x faster using the mutable > one

Re: Can you make Amotoen faster?

2012-07-19 Thread David Nolen
On Wed, Jul 18, 2012 at 10:12 PM, Richard Lyman wrote: > All, > > There's not much code, and (sadly) not much documentation, but what's > there needs some performance love. > > https://github.com/richard-lyman/amotoen > > Notes: > - jvisualvm doesn't like me this week so help there might be enoug

Re: ClojureScript, Chrome Extension and BrowserREPL

2012-07-17 Thread David Nolen
On Tue, Jul 17, 2012 at 3:00 PM, Hubert Iwaniuk wrote: > > Hi David, > > Do you know rationale for using CrossPageChannel? > If that could be removed it would simplify BrowserREPL a lot, and would > already unlock Chrome Extension. > > Cheers, > Hubert. Because it works on nearly all browsers - e

Re: ClojureScript, Chrome Extension and BrowserREPL

2012-07-17 Thread David Nolen
On Tue, Jul 17, 2012 at 11:22 AM, Hubert Iwaniuk wrote: > Hello Everyone, > > Did anyone managed to get BrowserREPL running within Chrome Extension? > I'm having hard time getting it up. > > Basically what happens for me is CrossPageChannel communication > initialization failure both from content

Re: ClojureScript compiler generates incorrect javascript code for protocol function

2012-07-10 Thread David Nolen
On Tue, Jul 10, 2012 at 12:23 PM, Praki wrote: > Hi, > > The javascript code generated for the following clojurescript is wrong. The > problem is, if the protocol name is hyphenated, the generated name is > treating that as an arithmetic expression rather than translating the hyphen > to underscor

Re: ClojureScript instead of CoffeeScript for complete web app development?

2012-07-07 Thread David Nolen
On Sat, Jul 7, 2012 at 5:26 PM, Balint Erdi wrote: > That's right. So the reducers library in ClojureScript will probably also > use less memory then working with sequential operations but it will not get > any speed boost since in the Javascript VM it will not run in parallel. Is > that right? >

Re: Core.logic interface to Lucene in 10 lines

2012-07-06 Thread David Nolen
On Fri, Jul 6, 2012 at 3:01 PM, Jamie wrote: > Here's another clojure.core.logic relation. This time for > > http://api.stlouisfed.org/docs/fred/series_observations.html > > https://gist.github.com/3062006 > > Example: > > The dates and rates of the US 10-year Treasury note when the rates wer

Re: Core.logic interface to Lucene in 10 lines

2012-07-06 Thread David Nolen
On Fri, Jul 6, 2012 at 10:16 AM, Jamie wrote: > Core.logic is great. Here's a trivial 10-line core.logic relation backed by > a Lucene index. Simple and useful (at least to us). Need a library of such > things. > > Comments and improvements appreciated. > > Details at https://gist.github.com/30

Re: clojurescript failing silently?

2012-07-06 Thread David Nolen
Sounds like we need one ticket with a minimal case and another one which points out the revision where stacktraces disappeared for you. David On Fri, Jul 6, 2012 at 3:12 AM, kovas boguta wrote: > On Fri, Jul 6, 2012 at 2:59 AM, David Nolen wrote: >> On Fri, Jul 6, 2012 at 2:43 AM, kov

Re: clojurescript failing silently?

2012-07-05 Thread David Nolen
On Fri, Jul 6, 2012 at 2:43 AM, kovas boguta wrote: > For instance the protocol in the namespace that I forget to quality > doesn't get recognized: > WARNING: Symbol mvc/IMVC is not a protocol at line 38 > src/cljs/client/subsession.cljs > > yet it works anyway. (have no idea how to make that go a

Re: clojurescript failing silently?

2012-07-05 Thread David Nolen
d behavior is that this will produce a > stacktrace in the js console? > > I can try using git bisect if this is supposed to work. > > On Fri, Jul 6, 2012 at 2:32 AM, David Nolen wrote: >> Sounds like we need more information. Have you tried git bisect to >> determine the spec

Re: clojurescript failing silently?

2012-07-05 Thread David Nolen
Sounds like we need more information. Have you tried git bisect to determine the specific revision? David On Fri, Jul 6, 2012 at 2:27 AM, kovas boguta wrote: >> The odd thing is, when I evaluate the same input at the js repl in the >> terminal, it works. So now there are two problems :0 >> > > S

Re: clojurescript failing silently?

2012-07-05 Thread David Nolen
Can you be more precise? On Friday, July 6, 2012, kovas boguta wrote: > Upgrading to build 1424, it seems like errors that were once displayed > in the browser console are now somehow suppressed. > > When I'm at the cljs repl, I get the the errors. But thats not nearly > as useful, since I have t

Re: clojurescript multimethod error

2012-07-02 Thread David Nolen
On Tue, Jul 3, 2012 at 1:01 AM, Robert Marianski wrote: > I can confirm that this patch resolves the issue for me. Thanks! > > As to whether null and undefined should be interchangeable, I'm not sure > what the right answer is. I think that depends on how many times > undefined is returned as a re

Re: clojurescript multimethod error

2012-07-02 Thread David Nolen
Please open a ticket with these details: http://dev.clojure.org/jira/browse/CLJS Thanks! David On Mon, Jul 2, 2012 at 10:37 PM, Robert Marianski wrote: > I'm getting an error when trying to call a multimethod in a certain > scenario. I'm unfortunately not able to reproduce this when running it

Re: Creating a custom Closure UI component in Clojurescript

2012-07-01 Thread David Nolen
On Fri, Jun 29, 2012 at 9:08 AM, Danny O' Connor wrote: > Hello, > > I'm trying to build an user interface in Clojurescript using the Google > Closure library. > > It appears that the idiomatic way to use the goog.ui package is to create > subclasses of goog.ui.Component. > > Firstly, is this poss

Re: Clojure type of Java array

2012-07-01 Thread David Nolen
The set of Java array types is open. You can however extend array classes as you encounter them at runtime. http://dosync.posterous.com/51626638 David On Sun, Jul 1, 2012 at 1:17 PM, Warren Lynn wrote: > > So if I want to extend a protocol to all Java arrays, is there a single type > I can use?

Re: Clojure type of Java array

2012-07-01 Thread David Nolen
If you want to check if something is an array: (.. x getClass isArray) David On Sun, Jul 1, 2012 at 11:35 AM, Warren Lynn wrote: > Somebody asks me to add handling of Java array in clj-cc/last. But I am > confused what will be the type of Java array in Clojure. Fox example: > > (type (.toCharAr

Re: Protocol as an abstract data type

2012-07-01 Thread David Nolen
On Sun, Jul 1, 2012 at 10:31 AM, Michał Marczyk wrote: > Additionally I would like to note that Haskell's ad hoc polymorphism > solution, the system of type classes, allows for extensions predicated > on a type class already being implemented: > > -- no dependencies on other type classes > instanc

Re: Protocol as an abstract data type

2012-07-01 Thread David Nolen
On Sun, Jul 1, 2012 at 9:04 AM, Vinzent wrote: > Extend on nil, IIndexed and default (I realize that it's currently > impossible in cljs). IIndexed is the protocol that maps to nth. We already extend IIndexed to nil. Extending default to IIndexed leads to horrible things like the following: (ind

Re: Protocol as an abstract data type

2012-07-01 Thread David Nolen
How do you think the conditionals can be removed? On Sunday, July 1, 2012, Vinzent wrote: > Just an idea: predicate dispatch can be combined with protocols into one > thing, eliminating the need for defrecord-like things at all. Low level > types defined with deftype, higher-level abstractions de

Re: Protocol as an abstract data type

2012-06-30 Thread David Nolen
On Sat, Jun 30, 2012 at 11:15 PM, Mark Engelberg wrote: > > In any case, I feel like I understand better how you've structured things in > ClojureScript and what can and can't be done easily with protocols. Thanks! I think predicate dispatch + protocols could eliminate the existing closed cases.

Re: Protocol as an abstract data type

2012-06-30 Thread David Nolen
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 carefully considered since the logic needs too be moved to the act

Why cannot "last" be fast on vector?

2012-06-30 Thread David Nolen
On Friday, June 29, 2012, Mark Engelberg wrote: > 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 t

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

2012-06-29 Thread David Nolen
ISeq is a interface on Clojure JVM. So that will work. In ClojureScript it won't as ISeq is a protocol. On Friday, June 29, 2012, Mark Engelberg wrote: > On Fri, Jun 29, 2012 at 5:17 PM, David Nolen > > > wrote: > >> As I said, if ISeq and ILast are both pro

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

2012-06-29 Thread David Nolen
On Fri, Jun 29, 2012 at 8:02 PM, Mark Engelberg wrote: > I think the suggestion is to create a protocol for each function that could > potentially gain speed improvements for specialized types.  So for example, > ILast could be a protocol.  extend ILast to have an implementation for ISeq > (using

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

2012-06-29 Thread David Nolen
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 big burden on core. ISeq *is* an interface on Clojure JVM. But

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

2012-06-29 Thread David Nolen
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? David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to

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

2012-06-29 Thread David Nolen
On Fri, Jun 29, 2012 at 5:17 PM, Mark Engelberg wrote: > It is clear that some collections *could* support a more efficient last. > Anything with random access.  Anything that supports rseq (e.g., sorted > collections). And what does overloading last in this way mean for drop-last, take-last, but

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

2012-06-29 Thread David Nolen
On Fri, Jun 29, 2012 at 4:25 PM, Warren Lynn wrote: > My understanding here is "ISeq" is an INTERNAL, implementation level > interface/abstraction, not the user/language level abstraction (which in > this case should be "ordered collection", as somebody called) It is not internal. It is a user/la

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

2012-06-29 Thread David Nolen
On Fri, Jun 29, 2012 at 12:30 PM, Weber, Martin S wrote: > I'm sorry to say, but IMHO you failed to communicate the critical point to > your audience. If your audience keeps failing to grasp the point, and > communicates this failure back by asking the same question.. Perhaps we differ on the mat

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

2012-06-29 Thread David Nolen
On Fri, Jun 29, 2012 at 12:13 PM, Warren Lynn wrote: > If the design choice has nothing to do with speed path, Could you let us > know why we cannot get free speed improvements on vectors? I already have. -- You received this message because you are subscribed to the Google Groups "Clojure" gro

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

2012-06-29 Thread David Nolen
On Fri, Jun 29, 2012 at 10:51 AM, Warren Lynn wrote: > 1. Put good documentations on the functions, and the programmer needs to > have some idea what data structure is fast/slow for what use. If the > programmer does not have a clue, why would making "last" artificially slow > on vectors help? Plu

Re: Using core.logic at a lower level

2012-06-29 Thread David Nolen
On Fri, Jun 29, 2012 at 10:29 AM, Konrad Hinsen wrote: > What I worry about is not so much losing functionality, but > restructuring of the code or renaming of the interfaces, functions, > etc. > > Konrad. I don't forsee the protocols or functions around logic vars & unification changing. I'm act

Re: Using core.logic at a lower level

2012-06-29 Thread David Nolen
On Fri, Jun 29, 2012 at 9:37 AM, Konrad Hinsen wrote: > I wonder if there is any "official" (i.e. stable and ideally documented) way > to use logic variables and unification from core.logic without running the > constraint solver. More specifically, I'd like to > > - define some logic variables >

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

2012-06-28 Thread David Nolen
So you recommend that "last" should be only function that accepts IPersistentStack *and* ISeqable and does the appopiate thing? Or are there others? On Thursday, June 28, 2012, Mark Engelberg wrote: > On Thu, Jun 28, 2012 at 6:59 PM, Tamreen Khan > > > wrote: > >> Here's a somewhat old but stil

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

2012-06-28 Thread David Nolen
On Thu, Jun 28, 2012 at 7:32 PM, Warren Lynn wrote: > This is an off-shoot subject from my last post "General subsequence > function". > > I found people had similar questions before (one year ago): > > http://groups.google.com/group/clojure/browse_thread/thread/712711f049507c63/aea7cf438aa22922

Re: ClojureScript instead of CoffeeScript for complete web app development?

2012-06-28 Thread David Nolen
reducers are already available - though further perf work needs to be done to really deliver on the performance promises. Even so I wouldn't be surprised if they already outperform many chained sequence operations. David On Thu, Jun 28, 2012 at 5:45 PM, Ben Mabey wrote: > On 6/24/12 10:31 PM, C

Re: General subsequence function

2012-06-28 Thread David Nolen
It's a sequence operation and plenty useful. On Thu, Jun 28, 2012 at 4:56 PM, Tassilo Horn wrote: > Meikel Brandmeyer writes: > > Hi Meikel, > > >> And yes, there are some counter examples like `count` and `last`... > > > > last is not a counterexample. last is a sequence function, which acts >

Re: General subsequence function

2012-06-28 Thread David Nolen
On Thu, Jun 28, 2012 at 4:28 PM, Meikel Brandmeyer wrote: > Hi, > > Am 28.06.2012 um 20:52 schrieb Tassilo Horn: > > > And yes, there are some counter examples like `count` and `last`... > > last is not a counterexample. last is a sequence function, which acts on > seqs. It just calls seq on its

Re: ClojureScript instead of CoffeeScript for complete web app development?

2012-06-28 Thread David Nolen
On Mon, Jun 25, 2012 at 12:31 AM, Christian M. wrote: > I have developed a tiny web app in Clojure/ClojureScript and have written > an overview here . In > general, it was an exciting experience, but I also faced several problems > with ClojureSc

Re: reloading protocols causes problems

2012-06-19 Thread David Nolen
On Tue, Jun 19, 2012 at 12:14 PM, Sam Aaron wrote: > It seems that guarding the protocol declarations inside of a defonce does > the job nicely, although it is a big fugly. It's not too bad a trade-off > though, because we rarely, if ever, want to change a protocol definition > live. My main conc

Re: reloading protocols causes problems

2012-06-19 Thread David Nolen
On Tue, Jun 19, 2012 at 10:49 AM, Phil Hagelberg wrote: > Protocols necessarily make some unfortunate dynamicity trade-offs in the > name of self-hosting. If you value interactive development over execution > efficiency perhaps they are not the right choice. > > -Phil > Depending on what Clojure

Re: Scheme dotted pair equivalent in Clojure

2012-06-16 Thread David Nolen
dotted pairs and cons in Scheme and CL both allow you specify an improper tail. This has some historical utility if you are using cons as a way to build up non-list data structures. Scheme and CL both provide better facilities for data structures than using cons. As far as I know lists are just co

Re: Scheme dotted pair equivalent in Clojure

2012-06-16 Thread David Nolen
Not possible in Clojure and a source of hassle in Scheme and Common Lisp. If you have dotted pairs you can never know if you have a proper list. David On Sat, Jun 16, 2012 at 11:35 AM, octopusgrabbus wrote: > I have a need to learn enough scheme to read it and write a few functions. > I came acr

Re: ClojureScript Analyzer Decoupled

2012-06-15 Thread David Nolen
On Fri, Jun 15, 2012 at 1:41 PM, Timothy Baldridge wrote: > But I'd rather collaborate with ClojureScript. Are there any ongoing > efforts to make this cross platform? The current analyzer contains > quite a few java calls. For instance, .contains, and .indexOf. Is > Raphael working on this, or ca

ClojureScript Analyzer Decoupled

2012-06-15 Thread David Nolen
Thanks to Raphael Amiard's hard work the ClojureScript analyzer is now decoupled: http://github.com/clojure/clojurescript/commit/9ad79e1c9b87c862ccb7ad6aad37d90414123c76 This is a big step towards making the ClojureScript compiler infrastructure pluggable. There's a couple of JS things to clean u

Re: Enfocus issues

2012-06-14 Thread David Nolen
On Fri, Jun 15, 2012 at 1:23 AM, Andreas Kostler < andreas.koest...@leica-geosystems.com> wrote: > (set! (.onload js/window) start) Should be (set! (.-onload js/window) start) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: Clojurescript (latest) advanced mode compilation => java.lang.ClassCastException ?

2012-06-14 Thread David Nolen
This should be resolved in master - please let us know if you continue to run into problems. On Thu, Jun 14, 2012 at 3:06 PM, David Nolen wrote: > Thank you! http://dev.clojure.org/jira/browse/CLJS-315 > > > On Thu, Jun 14, 2012 at 6:43 AM, Dave Sann wrote: > >> I (thi

Re: Clojurescript (latest) advanced mode compilation => java.lang.ClassCastException ?

2012-06-14 Thread David Nolen
c.innerRun(FutureTask.java:303) > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.

Re: Is there a reason why 'some' returns "nil" instead o "false"?

2012-06-14 Thread David Nolen
Definitely something that should not written as a macro :) David On Thu, Jun 14, 2012 at 1:14 PM, Jim - FooBar(); wrote: > you can always make your own with a little macro but if you just started > learning today you may want to stick with some... > > I, like you, wanted a version that returns

Re: Is there a reason why 'some' returns "nil" instead o "false"?

2012-06-14 Thread David Nolen
not-every? is a predicate (note the ?) some is not. On Thu, Jun 14, 2012 at 11:31 AM, Jacobo Polavieja < jacobopolavi...@gmail.com> wrote: > Hi! > > I've just started learning Clojure today. I've started reading "Clojure - > Functional Programming for the JVM" ( > http://java.ociweb.com/mark/clo

Re: 'dotimes' will not work inside a 'doto'...

2012-06-14 Thread David Nolen
On Thu, Jun 14, 2012 at 10:39 AM, Jim - FooBar(); wrote: > Evaluates x then calls all of the methods and functions with the > value of x supplied at the front of the given arguments > that's in the docstring for doto. but dotimes is not a method or a function is it? :) David -- You received t

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-14 Thread David Nolen
t's created on top of 312). > > Cheers, > M. > > > On 12 June 2012 03:22, David Nolen wrote: > > Thanks! > > > > On Mon, Jun 11, 2012 at 9:22 PM, Michał Marczyk < > michal.marc...@gmail.com> > > wrote: > >> > >> See >

Re: Clojurescript (latest) advanced mode compilation => java.lang.ClassCastException ?

2012-06-13 Thread David Nolen
e I will report it. > > Otherwise - I am keen to know if anyone else sees a similar problem. > > D > > > On Tuesday, 12 June 2012 22:51:39 UTC+10, David Nolen wrote: > >> That ticket has been resolved. >> >> For your own issue, more details required. If you can

Re: Clojurescript (latest) advanced mode compilation => java.lang.ClassCastException ?

2012-06-12 Thread David Nolen
That ticket has been resolved. For your own issue, more details required. If you can isolate it, open a ticket. David On Tue, Jun 12, 2012 at 8:16 AM, Dave Sann wrote: > I have started seeing java.lang.ClassCastException when compiling in > advanced mode. > > Compilation is fine with simple op

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread David Nolen
Thanks! On Mon, Jun 11, 2012 at 9:22 PM, Michał Marczyk wrote: > See > > http://dev.clojure.org/jira/browse/CLJS-312 > > for :import (patch attached). Looking at 272 now... > > > On 12 June 2012 03:16, Michał Marczyk wrote: > > On 11 June 2012 18:49, David Nol

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread David Nolen
On Mon, Jun 11, 2012 at 1:37 PM, tomoj wrote: > I noticed that it works fine to just do (:require [goog.async.Deferred :as > d]) and to use (goog.async.Deferred.) to call the constructor (in this case > Deferred is also used as a namespace, so require makes sense). > > With :require w/o :as suppo

Re: Clojurescript - Javascript constructor and namespace with the same name problem

2012-06-11 Thread David Nolen
This is an known existing issue. Using :require to important constructors just doesn't make sense. 2 patches I think could help here: 1) support for :import 2) support for :require w/o :as Anyone game to submit some fixes? David On Thu, Jul 28, 2011 at 10:41 AM, Marko Kocić wrote: > Hi all,

Re: core.logic for encoding the rules of chess or checkers? is it plausible/desirable ?

2012-06-11 Thread David Nolen
On Mon, Jun 11, 2012 at 12:30 PM, mnicky wrote: > You can probably substitute the "is" operator of Prolog with the "==" > operator of core.logic, but very likely you will have to define your own > "greather than" and "lower than" operators... > > > Marek. > There is an arithmetic namespace that

Re: core.logic for encoding the rules of chess or checkers? is it plausible/desirable ?

2012-06-11 Thread David Nolen
I don't have the time to work on this myself but I'd more than welcome a "Translations from Prolog" page on the core.logic GitHub wiki. David On Mon, Jun 11, 2012 at 11:31 AM, Jim - FooBar(); wrote: > Thanks a million mnicky!!! > A simple explanation like yours is just what I needed...I think i

Re: fully type-hinted record still uses reflection!

2012-06-10 Thread David Nolen
You can cast to primitive int with (int ...) On Sun, Jun 10, 2012 at 1:53 PM, Jim - FooBar(); wrote: > On 10/06/12 18:43, Ben Smith-Mannschott wrote: > >> "can accept ints or doubles" >> >> How is the Clojure compiler to know wether to compile a call to >> Point.setLocation(double,**double) or Po

<    4   5   6   7   8   9   10   11   12   13   >