Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
C-4, David Nolen wrote: > > negation is hard. This has come up several times. It may be possible to a > better form of negation as failure via delays, but this not high on my > current priority list. Patches to make it work are of course most welcome. > > > On Thu, Mar

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
y, 28 March 2013 15:44:01 UTC-4, David Nolen wrote: > > This won't work. Rewrite this example w/o using facts and try to > understand why it won't work. > > David > > On Thu, Mar 28, 2013 at 3:37 PM, JvJ >wrote: > >> Here's what I'm trying.

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Any other hints? I'd love to spend time on this brain tickler, but I have other things to do. On Thursday, 28 March 2013 16:05:00 UTC-4, JvJ wrote: > > Alright, I'm starting to get it but not quite there > > (run* [q] > (fresh [x] > (conde >

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Btw if I sounded sarcastic I wasn't. I actually would love to spend time thinking about it. On Thursday, 28 March 2013 16:12:06 UTC-4, JvJ wrote: > > Any other hints? I'd love to spend time on this brain tickler, but I have > other things to do. > > On Thursday, 28

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
t; > You said you wanted q to be a member of a some list A. Then why not use > membero? But you don't want q to be a member of some list B. Then try to > write a not-membero in terms of disequality. > > (run* [q] > (membero q '(1 2 3 4)) > (not-membero q '(

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Also, on a side note, the following doesn't seem to make sense: (defn hates-drink [d] On Thursday, 28 March 2013 16:53:09 UTC-4, David Nolen wrote: > > Excellent! :) > > > On Thu, Mar 28, 2013 at 4:46 PM, JvJ >wrote: > >> HOORAY! I did it all by myself!

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
d. What's the deal? (defn hates-drink [d] (fresh [] (is-drink d) (not-likes-drink d))) On Thursday, 28 March 2013 16:53:09 UTC-4, David Nolen wrote: > > Excellent! :) > > > On Thu, Mar 28, 2013 at 4:46 PM, JvJ >wrote: > >> HOORAY! I did it all by m

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Right Right. That makes sense. Thanks. On Thursday, 28 March 2013 17:05:58 UTC-4, David Nolen wrote: > > On Thu, Mar 28, 2013 at 5:01 PM, JvJ >wrote: > >> (defn hates-drink >>[d] >>(is-drink d) >>(not-likes-drink d)) >> > > This is a

Invoke a specific multimethod

2013-03-29 Thread JvJ
Is it possible to invoke a particular multimethod and bypass the dispatch function? For instance, suppose that I have a multimethod with a dispatch value of ::foo, and it's a really complex method. Now, I want all cases where the dispatch function returns nil to use the same multimethod. Is t

Floating point comparator issue?

2013-03-29 Thread JvJ
Alright check this out: ;; Normal subtraction as comparator sorts in ascending order (sort-by identity #(- %1 %2) [1 -1]) (-1 1) ;; Reverse subtraction as comparator sorts in descending order (sort-by identity #(- %2 %1) [1 -1]) (1 -1) ;;=== ;; And now w

Re: Floating point comparator issue?

2013-03-30 Thread JvJ
That makes sense. Thanks. On Friday, 29 March 2013 22:21:21 UTC-4, Alan Malloy wrote: > > Comparator.compare returns an int. (int 0.2) and (int -0.2) both > return 0. Thus, your comparator is returning 0, saying "I don't care > what order these go in". > &g

Re: Invoke a specific multimethod

2013-03-30 Thread JvJ
get-method. Thanks, that was exactly what I was looking for! On Saturday, 30 March 2013 07:20:54 UTC-4, Chas Emerick wrote: > > On Mar 30, 2013, at 12:00 AM, George Oliver wrote: > > > > On Friday, March 29, 2013 6:19:19 PM UTC-7, JvJ wrote: >> >> Is it p

Re: Invoke a specific multimethod

2013-03-30 Thread JvJ
Also, nice syntax highlighting! How'd you do that? On Saturday, 30 March 2013 23:54:03 UTC-4, JvJ wrote: > > get-method. Thanks, that was exactly what I was looking for! > > On Saturday, 30 March 2013 07:20:54 UTC-4, Chas Emerick wrote: >> >> On Mar 30, 2013, at

Re: hash-map initialization issue

2013-03-30 Thread JvJ
Here's a cheezy hack, use identity. #(identity {:foo %}) On Thursday, 28 March 2013 17:51:10 UTC-4, Ryan wrote: > > Thanks for your explanation Jonathan. I am still a bit confused however > what is the proper solution here. Should i use an anonymous function > instead to do what I want or can i

Re: Sweet-expressions

2013-03-30 Thread JvJ
Once you write enough lisp, eliminating parens becomes more trouble than it's worth. Also the guy who did this has the same name as my dad? I'm ashamed. On Monday, 25 March 2013 06:52:23 UTC-4, poetix wrote: > > I really like the look of this: > > http://readable.sourceforge.net/ > > which defi

Re: hash-map initialization issue

2013-03-31 Thread JvJ
...even cheezier, use do #(do {:foo %}) On Saturday, 30 March 2013 23:58:31 UTC-4, JvJ wrote: > > Here's a cheezy hack, use identity. > > #(identity {:foo %}) > > On Thursday, 28 March 2013 17:51:10 UTC-4, Ryan wrote: >> >> Thanks for your explanation Jonathan

core.logic: Database context monad

2013-04-04 Thread JvJ
I've been working a lot with core.logic and pldb ( https://github.com/threatgrid/pldb), and I've been troubled by the lack of an assertion operation that would allow addition of facts to a database as a relational operation. I've been thinking that this could be solved by creating some kind of

Re: core.logic: Database context monad

2013-04-04 Thread JvJ
r interesting ideas even if you can't make > assertion/retraction relational. > > > On Thu, Apr 4, 2013 at 9:21 PM, JvJ >wrote: > >> I've been working a lot with core.logic and pldb ( >> https://github.com/threatgrid/pldb), and I've been troubled by the l

Re: core.logic: Database context monad

2013-04-05 Thread JvJ
Regardless of the existential issues concerning perception vs. reality on the brokenness of links, thanks for providing the reading material. On Friday, 5 April 2013 10:28:43 UTC-4, Bost wrote: > > I found this http://gradworks.umi.com/3380156.pdf on > http://www.cs.indiana.edu/~webyrd/ > --

core.logic: partial resolution

2013-04-05 Thread JvJ
Is there a way in core.logic to get something like the "best possible substitution" for a goal that doesn't complete? I wrote a macro: 1. (defn- condf-fn 2. "Allows each line to incrementally succeed." 3. [& [g & gs :as goals]] 4. (if (empty? goals) 5. () 6. `((co

Opinions on Equality Semantics

2013-04-08 Thread JvJ
This is just an idle curiosity up for discussion, but in Clojure, if (= a b) is true, then given some function f, it is not necessarily true that (= (f a) (f b)) For instance: (defn check-eq [f a b] [(= a b) (= (f a) (f b))]) (check-eq #(conj % 1) '(1 2 3) [1 2 3]) [true false] Even though th

Is conj supposed to preserve metadata?

2013-04-14 Thread JvJ
I've noticed that the conj operation seems to preserve metadata in most cases: >(meta (conj (with-meta [] {:a 1}) 5)) {:a 1} However, I'm not sure if this is something I can depend on, or if it's just a fluke. Is this "part of the spec", as it were? -- -- You received this message because yo

Thanks!

2013-04-23 Thread JvJ
I just submitted my master's thesis, written in Clojure, and I'd just like to say the community here has been really helpful. Thanks to David Nolen and Ambrose Bonnaire-Sergeant for helping me out with a number of core.logic questions. Thanks to Norman Richards for the pldb library, which helped

I tripped out

2013-05-05 Thread JvJ
Is anyone else tripped out when they realize that when you write args for a function you're basically just destructuring an arg vector? It trips me out. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

Getting a Custom JFrame up and Running

2012-05-11 Thread JvJ
Hi, I'm new to Clojure, but a longtime Java programmer. I'm trying to get the hang of gen-class, and I'd like to write a custom JFrame that extends the paint method so I can get some ***aw3xX0m3 gr4f-X***. Anyways, I'm having some trouble understanding gen-class, inheritance, etc. Here's what I

Help with Macros and Matchure

2012-06-07 Thread JvJ
Hi, I've recently started using the matchure library for pattern matching (https://github.com/dcolthorp/matchure). Basically, I'd like match a number of different values and bind the first match to a symbol. In matchure, binding to a variable can be done like this: (if-match [(and ?c "Hi") "Hi"

Re: Help with Macros and Matchure

2012-06-08 Thread JvJ
Well, I'm the dumbest person ever. Here's the solution: (if-match [(and ?c (contains? *chars* c)) "Trip"] c) On Jun 7, 4:48 pm, JvJ wrote: > Hi, > > I've recently started using the matchure library for pattern matching > (https://github.com/dcolthorp/mat

Standard alias for partial?

2012-06-19 Thread JvJ
This is not really a big deal, but I was wondering if there was a shorter alias for partial in the standard library. It seems like one of those things that should require a single-character operator. I usually do something like this : (def $ partial) I wonder if something like that could be i

Extending protocol for maps

2012-07-27 Thread JvJ
Is there a way to extend whatever protocol is used by Clojure maps (struct maps, array maps, hash maps, etc.)? -- 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

Problems extending sequences

2012-07-27 Thread JvJ
I'm trying to create a new ISeq type, just to try to get the hang of extending sequences. It's not working, though. As far as I can tell, I've implemented all necessary methods. However, I still get an error when attempting to create an instance of the type. When I enter the following in the

Translating from Prolog to core.logic

2012-07-28 Thread JvJ
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. However, the core.logic equivalent doesn't seem to work: user

Re: Translating from Prolog to core.logic

2012-07-28 Thread JvJ
Alright, that makes sense. I suppose that since facts are represented under the hood as relations, anyways, that this might work. Thanks. On Saturday, 28 July 2012 21:52:46 UTC-4, David Nolen wrote: > > On Sat, Jul 28, 2012 at 8:53 PM, JvJ wrote: > > I'm having trouble

Clojure Practice?

2012-09-01 Thread JvJ
I've been interested in Clojure for some time, but I haven't really needed to code much recently (in any language). Does anyone have any ideas on good ways to practice Clojure (like websites with practice problems or whatever)? -- You received this message because you are subscribed to the Go

Re: Clojure Practice?

2012-09-01 Thread JvJ
programming in > clojure involves, and you can type in and run the code right on the site. > > On Sat, Sep 1, 2012 at 4:56 PM, JvJ >wrote: > >> I've been interested in Clojure for some time, but I haven't really >> needed to code much recently (in any language). Doe

Re: Clojure Practice?

2012-09-01 Thread JvJ
15 buck for ebook? not bad... exercises really are the way to go! -- 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 yo

core.logic: Defining facts and relations on a per-thread basis

2012-09-05 Thread JvJ
If anyone is familiar with the implementation of core.logic, I'd like to know if it's possible to re-bind the globals in such a way as to give distinct fact and relation databases for each thread. Any help would be appreciated. -- You received this message because you are subscribed to the Go

Does anybody hate xml property lists?

2012-10-04 Thread JvJ
. Anyways, the program is a whopping 68 lines, and is right here, in case anyone wants to check it out: https://github.com/JvJ/Plister -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: == is not transitive?

2012-10-04 Thread JvJ
The only reason for this that I can think of is incomplete rules for casting numbers. On Thursday, 4 October 2012 20:39:05 UTC-4, Ben wrote: > > user> [(== 0 0.0) (== 0.0 0.0M) (== 0.0M 0)] > [true true false] > user> [(== 0 0.0 0.0M) (== 0 0.0M 0.0) (== 0.0 0 0.0M) (== 0.0 0.0M 0) > (== 0.0M

Issues with Penumbra

2012-10-11 Thread JvJ
I'm trying to make a project using Penumbra for opengl, but somehow I get an issue when I try (use 'penumbra.opengl). It looks like there's a class excepiton: penumbra.PenumbraSystem [Thrown class java.lang.ClassNotFoundException] Here's the project file I'm using: (defproject enjine "1.0.0-S

Re: Issues with Penumbra

2012-10-12 Thread JvJ
numbra >>> I notice OP was using a different fork (?) >>> >>> >>> On Thu, Oct 11, 2012 at 11:46 PM, Zach Tellman >>> >>> > wrote: >>> >>>> I updated Penumbra to target the project structure for Leiningen 2 a >>>>

Inconsistent Exceptions

2012-10-15 Thread JvJ
I'm having a peculiar issue with Java interop. I'm running a program in 2 different ways: -Running the program directly -Calling the main function from Clojure Oddly, by calling main from Clojure, I get an exception that isn't there when I run normally: UnsupportedOperationException This parser

Re: Inconsistent Exceptions

2012-10-15 Thread JvJ
I just found out that my clojure project is using jre7, while the other project is using jre6. That probably has something to do with it. On Monday, 15 October 2012 19:17:26 UTC-4, JvJ wrote: > > I'm having a peculiar issue with Java interop. > > I'm running a progr

core.logic : facts and functions with same name

2012-10-17 Thread JvJ
I'd like to be able to define facts and functions in a single relation. For example: (defrel friends x y) (facts friends [['Kaylen 'Holly] ['John 'Jim]]) ;; Here I want to put something that says friends(x,y) == friends(y,x) ;; Or perhaps "Jack is everyone's friend" ;; How w

Replacing nested let statements with assignments

2012-10-18 Thread JvJ
I'm not sure if anyone's already done this, but I recently got tired of writing code that looked like this: (let [a 1] (ns cljutils.core) (defn- form-check "Ensures the form represents an assignment. Such as (:= a 1)" [form] (and (= 3 (count form)) (= := (first form)) (symbol?

Replacing nested let statements with assignments

2012-10-18 Thread JvJ
I'm not sure if anyone's done this before, but I'm fed up with writing code that looks like this: (let [a 1] (println "this is a: " a) (let [b 2] (println "this is b: " b) (let [c 3] (println "this is c: " c) (+ a b c I'd rather do something more l

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
I didn't realize you could bind to empty identifiers like that. Alright, that makes more sense. I figured I was missing something. On Thursday, 18 October 2012 12:11:49 UTC-4, David Nolen wrote: > > On Thu, Oct 18, 2012 at 12:01 PM, JvJ >wrote: > >> I'm not sure

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
Exactly. A big part of the reason was that I needed to do things between when other variables were initialized. On Thursday, 18 October 2012 12:17:17 UTC-4, Ben wrote: > > On Thu, Oct 18, 2012 at 9:12 AM, keeds > > wrote: > > I'm confused. How does the following not work? > > > > (let [a 1 b

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
Exactly. Not only debugging, but java interop that involved calling methods with side effects. On Thursday, 18 October 2012 15:02:47 UTC-4, David Nolen wrote: > > On Thu, Oct 18, 2012 at 2:55 PM, Alan Malloy > > wrote: > >> It's rare to get tired of this, because nobody does it: it's not >> com

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
On a side note, I was partially inspired by Haskell's do notation, which is imperative-looking syntactic sugar for monadic binds. On Thursday, 18 October 2012 12:01:33 UTC-4, JvJ wrote: > > I'm not sure if anyone's done this before, but I'm fed up with writing &

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
On a side note, I was partially inspired by Haskell's do notation, which is imperative-looking syntactic sugar for monadic bind operators. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
Most of what could be accomplished by an internal define could be done with a let statement. But if you don't want to add the brackets, you can create your own function definition macro that converts defs to lets. On Thursday, 18 October 2012 17:12:04 UTC-4, Grant Rettke wrote: > > On Thu, Oct

Re: Replacing nested let statements with assignments

2012-10-18 Thread JvJ
The doto form is great, but as far as I know, it only lets you thread a single object. I'm looking at creating several objects consecutively. On Thursday, 18 October 2012 17:11:08 UTC-4, Grant Rettke wrote: > > I figured you would use doto for that. > > On Thu, Oct 18, 201

Game Engine: Modelling Objects as Finite State Machines

2012-10-20 Thread JvJ
I've started to make a 2D game engine in Clojure using Penumbra and JBox2D (I'm thinking of calling it "Enjine", but the name was already taken by a JavaScript game engine.) Because FSM's are such an integral part of game programming, I'd like to build them into the design. In particular, I'd

How to Aliasing Java Class Names?

2012-10-21 Thread JvJ
I'm trying to import some classes from a library (jpl), which have names already taken by java.lang classes. When I try to import jpl.Float and jpl.Integer, I get exceptions due to name clashes. Is there a way to alias the class names so that I can use them? -- You received this message beca

Calling name on a keyword gives nil??

2012-10-22 Thread JvJ
I'm getting a REALLY weird error. I'm trying to check if a set of keywords are all uppercase. When binding a value to 'res' in the let statement, I traverse a list of keywords. However, the calls to the name function on those keywords give nil. The debug print statement clearly shows that the

Re: Calling name on a keyword gives nil??

2012-10-22 Thread JvJ
HAHAHA DERP! Wow that was stupid. But thanks. On Monday, 22 October 2012 10:58:45 UTC-4, JvJ wrote: > > I'm getting a REALLY weird error. I'm trying to check if a set of > keywords are all uppercase. > When binding a value to 'res' in the let statement,

Re: Calling name on a keyword gives nil??

2012-10-22 Thread JvJ
ng...not sure though... > > Jim > > > On 22/10/12 16:09, Bronsa wrote: > > I've had this happening to me too. > Couldn't figure out wtf was going on. > > Until somebody understands what's the problem is, you can(let [s (.sym > ^clojure.lang.Keyword k

Build Issues with Eclipse

2012-10-29 Thread JvJ
I'm working on a project that requires clojure-java interop. I'd like to have a clojure project referenced by a java project, but there seems to be some issues. First of all, I can't seem to get the standard ccw Clojure project to generate any compiled classes, so I've resorted to using Leinin

Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread JvJ
toms for global references. Here it is, if you want to take a look: https://github.com/JvJ/enjine, but remember it's very VERY preliminary. On Tuesday, 30 October 2012 03:00:07 UTC-4, titon barua wrote: > > Hi, > I am very new to Clojure and functional programming in general. I am g

Re: Build Issues with Eclipse

2012-10-30 Thread JvJ
Thanks for this. I think I'm getting somewhere, but I'm still having some problems. I'm trying to use lein-localdeps. I seem to have been able to install the jar to my local repository, but when I run lein deps it says it can't find it. Also, I have some native dependencies that aren't being

Re: bug or feature? boxed Doubles can give divide-by-zero error

2012-10-30 Thread JvJ
I executed the same test in java and got "infinity" as a result. What version of the JDK are you using? I'm using 1.7 On Tuesday, 30 October 2012 11:10:17 UTC-4, Tim Olsen wrote: > > Hello Clojurians. > > Normally by some IEEE floating-point standard, division by 0.0 should > give Infinity (o

Re: Build Issues with Eclipse

2012-10-30 Thread JvJ
I've resorted to explicitly calling compile from the REPLin CCW projects. It's not the best system, but it works. On Tuesday, 30 October 2012 14:17:47 UTC-4, JvJ wrote: > > Thanks for this. I think I'm getting somewhere, but I'm still having some > problem

Variadic Arguments in Gen-class

2012-10-31 Thread JvJ
Does anyone know if it's possible to generate java methods which take variadic arguments using gen-class? -- 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 a

Re: Variadic Arguments in Gen-class

2012-10-31 Thread JvJ
not straightforward to do > that, YMMV. > > Neale. > > [1] https://groups.google.com/d/topic/clojure/HMpMavh0WxA/discussion > On Oct 31, 2012 1:30 PM, "JvJ" > wrote: > >> Does anyone know if it's possible to generate java methods which take >> variad

Easy way to implement IFn in java?

2012-11-02 Thread JvJ
I'm writing a Java interface to some Clojure code, and some of the code needs functions as parameters. I'd like to be able create objects from anonymous inner classes. Something like this: func = new IFn(){ public Object invoke(obj1,...){ //code in here } }; I'd like to be able

Re: Easy way to implement IFn in java?

2012-11-03 Thread JvJ
turn RT.assoc(m, k, v); > } > }; > (code from clojure.lang.Var.assoc) > > > > On Sat, Nov 3, 2012 at 12:51 AM, JvJ >wrote: > >> I'm writing a Java interface to some Clojure code, and some of the code >> needs functions as parameters. >> I'd like to b

Re: Free Clojure Course

2012-11-06 Thread JvJ
Seems like nifty shenanigans but how much does this course cover? On Sunday, 28 October 2012 06:54:02 UTC-4, Ryan Kelker wrote: > > There's a free 19 part series on basic Clojure @ > http://www.udemy.com/clojure-code > -- You received this message because you are subscribed to the Google Gr

Re: Free Clojure Course

2012-11-06 Thread JvJ
Seems like nifty shenanigans but how much does this course cover? It would be nice to see a course that covered some of the more advanced features of the language, like multimethods, concurrent programming, interop, etc. On Sunday, 28 October 2012 06:54:02 UTC-4, Ryan Kelker wrote: > > There'

Re: Cdr car

2012-11-06 Thread JvJ
After seeing this thread I looked into car and cdr, and there's one thing I really liked about them: the various compositions. There's quite a number of functions like caar, cadr, cadadr, etc. It's lengthy to do that in clojure with just first and rest. On Tuesday, 16 October 2012 18:40:24 UTC

Re: Cdr car

2012-11-07 Thread JvJ
That's good to know! On Tuesday, 6 November 2012 12:48:27 UTC-5, Sean Corfield wrote: > > On Tue, Nov 6, 2012 at 9:34 AM, JvJ > > wrote: > > There's quite a number of functions like caar, cadr, cadadr, etc. It's > > lengthy to do that in clojure with

Where did the idea of metadata come from?

2012-11-12 Thread JvJ
Metadata is a really useful feature, and it's been helping me a lot. It seems like a flash of genius on the part of Mr. Hickey. I'm wondering if similar concepts exist in other programming languages that inspired it, or if it's unique to Clojure. Just a matter of curiosity, really. -- You r

Re: Where did the idea of metadata come from?

2012-11-14 Thread JvJ
hmap instead of metadata is also good enough for the > purpose. > > [1] https://github.com/drewr/postal > > Cheers, > -Takahiro > > On Nov 13, 6:01 am, JvJ wrote: > > Metadata is a really useful feature, and it's been helping me a lot. It > > seem

Sorted Sets With Duplicate Elements

2012-11-20 Thread JvJ
First of all: I don't EXACTLY mean duplicate elements. I just mean duplicates in those parts of the elements which are compared. For instance, I recently tried to have a sorted set of 2-element vectors where the comparator < was used on the second element, however, something like this happene

Re: Sorted Sets With Duplicate Elements

2012-11-20 Thread JvJ
Simple solution. It works! Thanks. On Tuesday, 20 November 2012 10:59:23 UTC-5, Bronsa wrote: > > what about using <= as sorting fuction? > > 2012/11/20 JvJ > > >> First of all: I don't EXACTLY mean duplicate elements. I just mean >> duplicates in

Efficiency of Dijkstra's algorithm

2012-11-20 Thread JvJ
I've just implemented Dijkstra's algorithm, and as far as I can tell, it works. However, I'm a little concerned at the efficiency. Specifically, I am using sorted sets, and I can't break apart the set into first/next and keep it as a set. I have to get next as a sequence and then apply sorted

Re: Efficiency of Dijkstra's algorithm

2012-11-20 Thread JvJ
0]] [:B [[:A :B] 10]]} On Tuesday, 20 November 2012 12:50:21 UTC-5, Andy Fingerhut wrote: > > Have you tried using first to get the smallest item from the set, and then > create a new sorted set with the item remove by using (disj my-sorted-set > item) ? > > Andy > > On Nov 2

Re: Sorted Sets With Duplicate Elements

2012-11-20 Thread JvJ
Thanks for the tip. On Tuesday, 20 November 2012 13:13:09 UTC-5, puzzler wrote: > > On Tue, Nov 20, 2012 at 8:01 AM, JvJ >wrote: > >> Simple solution. It works! Thanks. >> > > No, it doesn't work. It may print correctly now, but it won't actually &g

Re: Efficiency of Dijkstra's algorithm

2012-11-20 Thread JvJ
I'll look into this. Actually, I was thinking of implementing A* as well, so thanks! On Tuesday, 20 November 2012 13:18:08 UTC-5, puzzler wrote: > > I just responded in your other thread, suggesting you look at > priority-map. Now that I see this thread, I can tell you that priority-map > is

priority-map pop issue

2012-11-21 Thread JvJ
I'm not sure if this is an error or not, but priority-maps behaves strangely when given a function like <=. (pop (priority-map-by <= :a 1 :b 2 :c 3)) => {:a 1 :b 2 :c 3} ;; First element isn't popped. Is this supposed to happen? -- You received this message because you are subscribed to the Go

Re: priority-map pop issue

2012-11-21 Thread JvJ
ty > (exactly one of the following hold: a function for Clojure's sorted collections, including priority-map. You > have to use something like <. > > On Wed, Nov 21, 2012 at 6:08 PM, JvJ >wrote: > >> I'm not sure if this is an error or not, but priority-ma

Re: Anyone using Sublime Text 2 + SumblimeREPL with Windows?

2012-11-22 Thread JvJ
Hi, I've started using Sublime as well, and I'm having the same problem. Any progress? On Wednesday, 19 September 2012 03:27:01 UTC-4, cp16net wrote: > > I am trying this out with clojure on windows sublime 2.0.1. > > i get the clojure repl up using 'ctrl+f12' then 'c' then 's' > then i type (pr

Re: Anyone using Sublime Text 2 + SumblimeREPL with Windows?

2012-11-22 Thread JvJ
PL. When editing a Clojure source code file, to evaluate it, I hold CTRL > key down, press comma key twice, release CTRL key, then press lower case f > (for file). This works for me. > > > On Thursday, November 22, 2012 5:56:30 PM UTC-5, JvJ wrote: >> >> Hi, I'v

Easy update function for nested structures

2012-12-03 Thread JvJ
I'm wondering if there's something that can be used like update-in, but with multiple key-lists and values. Like, for example, taking a list of [x y] coordinates for a 2-dimensional array, and changing the values at all of those coordinates. -- You received this message because you are subscri

Re: Easy update function for nested structures

2012-12-03 Thread JvJ
n you 2d array is a vector of vectors and you supply a tf update > function? > > Las > > 2012/12/3 JvJ > > >> I'm wondering if there's something that can be used like update-in, but >> with multiple key-lists and values. >> >> Like, for example

core.logic vs. Prolog

2012-12-10 Thread JvJ
I have some code that uses Prolog, but I want to get rid of the native dependencies inherent in SWI Prolog/JPL. If I were to switch to core.logic, what would I lose and what would I gain? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to th

Re: core.logic vs. Prolog

2012-12-11 Thread JvJ
;) > > > On Tue, Dec 11, 2012 at 12:29 AM, JvJ >wrote: > >> I have some code that uses Prolog, but I want to get rid of the native >> dependencies inherent in SWI Prolog/JPL. >> >> If I were to switch to core.logic, what would I lose and what would I &

Re: core.logic vs. Prolog

2012-12-11 Thread JvJ
gt;> Not sure when I'll get to these - there is a considerable amount of >> interesting optimization work to be done on the current CLP(FD) >> implementation and surrounding CLP infrastructure. >> >> If there's some Prolog feature / predicate you'd like

Re: (#({:a %}) :b)

2012-12-13 Thread JvJ
Clever, but I always thought -> had to take more than one parameter. Maybe that's only for ->> On Thursday, 13 December 2012 13:35:33 UTC-5, Gary Verhaegen wrote: > > I've found this gem in The Joy of Clojure : > > #(-> [%]) > > which would work similarly for any literal, I guess : #(-> {:a %}

zip-reduce

2012-12-24 Thread JvJ
The other day I wrote this as a utility function because I couldn't find anything like it in the zipper libary. Am I missing something? Is something like this implemented somewhere? (defn zip-reduce "Reduce called on a zipper." [f acc z] (if (zip/end? z) acc (recur f (f acc z)

<    1   2   3