101 on simple and flexible graph query/update?

2014-07-10 Thread Bertrand Dechoux
Hi, I have various general questions about how one can perform simple and flexible graph query/update. If we start by a structure being nested maps then I know about get-in/update-in/assoc-in. The common point about these functions is that they all take a path to where the data is in the

Re: An Averaging function

2014-07-10 Thread Stephen Feyrer
Hi Sam, Lee. Thank you both. It would appear that I am faced with the old adage, A little knowledge is a dangerous thing. Again thank you, you ' ve been a great help. If I may impose upon you a little further? Would either of you be able to recommend an introductory book either for Clojure or

Re: 101 on simple and flexible graph query/update?

2014-07-10 Thread Thomas Heller
I usually just give every ENTITY in my system a primary id and structure everything in a nested map. {:people {1 {:id 1 :type :student :name Ben :taking-classes #{1 2}} 2 ...} :classes {1 {:id 1 :name Clojure 101} 2 ...}} This basically looks like a database table. You can

Re: 101 on simple and flexible graph query/update?

2014-07-10 Thread François Rey
On 10/07/14 10:26, Bertrand Dechoux wrote: For both question 1) and 2), a more appropriate data structure might be the answer like a graph/semantic-like store (Datomic or something else). The questions are about intermediary solutions which would be less heavier. I would suggest you look

Re: 101 on simple and flexible graph query/update?

2014-07-10 Thread Daniel Neal
Is there a way to do something similar with a more general definition of a path? The lens library Fresnel (https://github.com/ckirkendall/fresnel) might be worth a look - it abstracts get-in/assoc-in into lenses which can store/retrieve state from complex structures (and can be composed).

Re: An Averaging function

2014-07-10 Thread Linus Ericsson
You should try Clojure Programming (Halloway, Bedra). I felt enlightened after reading the first edition, the second edition is also very good! http://pragprog.com/book/shcloj2/programming-clojure /Linus On Thursday, July 10, 2014, Stephen Feyrer stephen.fey...@gmail.com wrote: Hi Sam, Lee.

Re: An Averaging function

2014-07-10 Thread Sam Ritchie
Good luck with the learning, by the way! I found that the language had a definite click after a few weeks, and then I was in for good. Because the syntax is simple, many of the examples you'll see as you work through the book have a similar shape to them; I think this makes it easier to start

Re: auto-reloading tests with diffs

2014-07-10 Thread Conrad
Thanks, that's exactly what I was looking for! On Thursday, July 3, 2014 8:41:07 AM UTC-5, Jake McCrary wrote: Hi Conrad, Not sure if this will meet your needs but I just tried using humane-test-output with lein-test-refresh and had auto-running of tests with a nice diff output. If

Re: 101 on simple and flexible graph query/update?

2014-07-10 Thread Bertrand Dechoux
*@*Thomas Heller: It's a bit cleaner indeed. That way, a 'join-like' operation does not need to know about the structure. But the three problematics from my post are still unsolved. *@Francois Rey:* I believe walk/prewalk/postwalk (and zipper?) might be the building blocks for implementing

When to use ! in function name

2014-07-10 Thread Cecil Westerhof
When a function returns a true/false value you should end it with a '?'. Clojure Programming says that with side effects you should end the function name with a '!'. I have functions reset-game! and walk!. But what about a function like look? It does not change state, but it displays where you

Re: When to use ! in function name

2014-07-10 Thread Plínio Balduino
IMO, ! is used when change any global state. A side effect like print on screen is not enough to cause a ! in the name. I think that's why the functions print/println don't have ! =) Plínio On Thu, Jul 10, 2014 at 12:28 PM, Cecil Westerhof cldwester...@gmail.com wrote: When a function returns

Re: When to use ! in function name

2014-07-10 Thread Stefan Kamphausen
On Thursday, July 10, 2014 5:28:26 PM UTC+2, Cecil Westerhof wrote: When a function returns a true/false value you should end it with a '?'. Clojure Programming says that with side effects you should end the function name with a '!'. Use the bang! only for things not safe in an STM

Re: When to use ! in function name

2014-07-10 Thread James Reeves
In clojure.core, an ending ! indicates a function that is unsafe for STM, rather than one with side effects. For instance, alter and send are functions with side effects, but have no ending ! because they're safe to use in a dosync block. In other words, an ending ! indicates a function has side

Re: When to use ! in function name

2014-07-10 Thread Softaddicts
The fn that does the display is the one having side effects. Now if your look fn creates the side effect, it should reflect that in its name. But... I wonder why it does so. Looking at something does not change state. You may be better splitting the side effect away from it or change the name.

Re: 101 on simple and flexible graph query/update?

2014-07-10 Thread François Rey
Also of interest is datomic datalog on regular clojure data structures and records: https://gist.github.com/stuarthalloway/2645453 https://gist.github.com/stuarthalloway/3068749 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: [question] Multimethods vs case

2014-07-10 Thread Elric Erkose
This sounds interesting. I tried to define a multimethod in one file and a method in another file. I had no success. -- 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

Re: An Averaging function

2014-07-10 Thread blake
I have yet to find a Clojure book I consider suitable for a novice to FP programming. The problem (it seems to me) is that the people who can write books on Clojure have long ago made the paradigm shift, and don't necessarily recall how that shift happened. This is similar to what I've found in

Re: An Averaging function

2014-07-10 Thread Raoul Duke
here are some related resources (books, videos). imbibe all of these and it might help. http://realmofracket.com/ http://landoflisp.com/ https://news.ycombinator.com/item?id=1023970 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

Re: [question] Multimethods vs case

2014-07-10 Thread Daniel Kersten
It does work. As far as I can tell, the namespace with defmethod must require the namespace with defmulti and also the namespace with defmethod must be required from some other namespace that is being executed. Eg: *foo.clj:* (ns foo) (defmulti mmtest identity) (defmethod mmtest :default [_]

Re: [question] Multimethods vs case

2014-07-10 Thread Elric Erkose
This cleared it up, thanks. -- 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

Re: [question] Multimethods vs case

2014-07-10 Thread Timothy Baldridge
Case only works with ints keywords and some other literals (including lists, but don't do that, since it doesn't do what you think it does). While multi-methods work on pretty much anything: (defmulti first-of-both (fn [a b] [(first a) (first b)])) (defmethod

[ANN] Counterclockwise 0.26.0

2014-07-10 Thread Laurent PETIT
Hello, Counterclockwise 0.26.0 has just been released. This version fixes lots of longstanding, unnerving usability issues. Please see the Changelog for detailed explanations: Release Note === http://doc.ccw-ide.org/ChangeLog.html#_changes_between_counterclockwise_0_25_2_and_0_26_0

Determine file of auxiliary test method with clojure.test?

2014-07-10 Thread Colin Fleming
Hi all, Cursive provides test functionality that paints pass/fail markers in the editors when tests are running. This all works great, except when someone defines a test that calls a function containing is forms in another namespace. An example: (ns foo.core-test (:require [clojure.test :refer

Re: An Averaging function

2014-07-10 Thread Marcus Blankenship
Ok, I'm sure this is heresy, but I'm getting a great deal from Paul Graham's On Lisp, even though the examples are in Common Lisp. Really amazing stuff!!! Sent from my iPhone On Jul 10, 2014, at 11:26 AM, Raoul Duke rao...@gmail.com wrote: here are some related resources (books, videos).

Re: Determine file of auxiliary test method with clojure.test?

2014-07-10 Thread Jeff Valk
You could override the clojure.test/do-report implementation and use the same stack frame trick that the default :fail case uses. Then from there, either use the file name from the StackTraceElement, or demunge the method name to get the var. I wouldn't really call that obvious, though. :-)

Re: 101 on simple and flexible graph query/update?

2014-07-10 Thread Frank Castellucci
Bertrand I've been doing a lot of Ontology (OWL) with directed graphs (with cycles) and DAGS. One application we went with the nested map structure however now that I've been working on a normalized BPMN/XPDL utility ( https://github.com/FrankC01/tributary ) I'm becoming enamored with the in

Re: practice for learning clojure

2014-07-10 Thread Gregg Williams
A web search turned up the following: http://stackoverflow.com/questions/3628958/good-clojure-code-examples https://groups.google.com/forum/#!topic/clojure/U6fLpc_NO98 I have heard from more than one source that the clojure.core source code is good to read. Maybe I'll get around to it myself

Re: An Averaging function

2014-07-10 Thread Joseph Smith
When you're done with On Lisp check out Let Over Lambda. :) --- @solussd On Jul 10, 2014, at 5:38 PM, Marcus Blankenship mar...@creoagency.com wrote: Ok, I'm sure this is heresy, but I'm getting a great deal from Paul Graham's On Lisp, even though the examples are in Common Lisp. Really

Re: An Averaging function

2014-07-10 Thread Marcus Blankenship
Have it, and it's next on my list. ;-) Thanks! On Jul 10, 2014, at 9:33 PM, Joseph Smith j...@uwcreations.com wrote: When you're done with On Lisp check out Let Over Lambda. :) --- @solussd On Jul 10, 2014, at 5:38 PM, Marcus Blankenship mar...@creoagency.com wrote: Ok, I'm sure

Developer with clojure wanted in Auckland.

2014-07-10 Thread Indiana Logan
Hi all .. I hope it is OK to post in here. I am looking for a number of Java developers with clojure experience for an exciting start up in Auckland. If you are interested to hear more then please email or call me - cheers, Indiana ilo...@globalattract.co.nz 09 903 0865 -- You received this