lispy.el - a vi-like Paredit. Some Clojure features added.

2014-02-02 Thread Oleh
Hi all,

I've recently added some Clojure support to
https://github.com/abo-abo/lispy.

A short description of the package is that it's all the Paredit
functions (and more) bound to unprefixed keys, e.g. a, c, 1, 2
etc. Nothing to do with evil package. Keys call commands instead
of self-inserting when the point is in positions called special
(marked here with |):

|(defn sqr |[x]| |(* x x)|)|

This comes together nicely since you rarely want to self-insert in those 
positions.

Just to show how succinct the usage can be, you can transform
from this:

|(defn sqr [x] (* x x))

with just 4c to this:

|(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))

and further with 3j to this:

(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
|(defn sqr [x] (* x x))
(defn sqr [x] (* x x))

and further with 2; to this:

(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
(defn sqr [x] (* x x))
;; (defn sqr [x] (* x x))
;; (defn sqr [x] (* x x))

Here's another example that shows how to transform

|(map sqr (filter odd? [1 2 3 4 5]))

to

(- [1 2 3 4 5]
 (map sqr)
 (filter odd?))|

I show it in a run-able test form (many more tests at github):

(should
 (string=
  (lispy-with
   |(map sqr (filter odd? [1 2 3 4 5])) 2(-]]]wwlM)
  (- [1 2 3 4 5]\n  (map sqr)\n  (filter odd?))|))

The steps are:

1. 2( - wrap with parens. 
2. - - self-insert (because point isn't special).
3. ] - forward list - point becomes special.
4.  - barf.
5. ]] - forward, barf, forward.
6. ww - move sexp up twice.
7. l - exit list forwards.
8. M - transform sexp to multi-line.
9. you can e - eval to see if code works.

Full description and some screenshots can be found at 
https://github.com/abo-abo/lispy.

Here's a list of Clojure-specific features (cider is used for most):

- look up doc inline in an overlay with C-1
- look up function arguments inline with C-2
- eval with e
- eval and insert with E
- goto symbol in file with g (clojure-semantic required)
- goto definition with F

The package is available in MELPA if you want to give it a go.
Feedback welcome.

regards,
Oleh



-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] clj-refactor.el 0.10.0

2014-02-02 Thread adrians
Didn't mean to imply that you should try to corner the market in 
refactorings, but simply thought you might be wanting to promote a useful 
Clojure tool across editors. I'm not sure if Chris views Light Table as a 
Clojure-centric editor though at this point, Clojure probably does have the 
best support. As far as LT not having this kind of functionality already, 
the plugin system was just recently (around a month) formalized so that's 
to be expected. Given that the editor is developed in ClojureScript, I 
assumed that a port from Emacs Lisp might not be as much work as going to a 
different language altogether.  

On Saturday, February 1, 2014 4:30:47 PM UTC-5, Magnar Sveen wrote:

 Sorry, mate. It's not about cornering the market in clojure refactorings - 
 it's just scratching our own itch, and hopefully other people find it 
 useful too.

 I'm a little surprised Light Table doesn't offer these things already. 
 Isn't it a Clojure-centric editor?

 On Saturday, February 1, 2014 8:22:53 PM UTC+1, adrians wrote:

 Really cool stuff, guys. Are you considering a Light Table version as 
 well?



-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Coverage tools in Clojure

2014-02-02 Thread Aaron France
Hi,

I'm looking for coverage reporting in Clojure. I've been using
Cloverage[1] but I'm just wondering if there are any other coverage
tools?

Aaron


[1] https://github.com/lshift/cloverage


pgpMaXQ__7lWz.pgp
Description: PGP signature


Re: Help about using clojure in org mode in Emacs with CIDER

2014-02-02 Thread greg r
The worg documentation for the Clojure language has been updated:
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html

The installation instructions should result in a current 
Clojure/CIDER/clojure-mode/Leiningen system.

Regards,
Greg

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Why does Clojure at times use Java classes as their base type?

2014-02-02 Thread Mark Gandolfo
I tried asking this on twitter and wasn't getting my question across in 140 
characters so I decided to post here. 
I'm curious as to why Clojure as a language hasn't abstracted/hidden all of 
Java's classes and created their own in the Clojure. namespace. 

For example

Big Ints are of type and class Clojure.lang.BigInt. 

user= (type 1N)
clojure.lang.BigInt
user= (class 1N)
clojure.lang.BigInt


Although a Long is a java.lang.Long both in type and class

user= (class 1)
java.lang.Long
user= (type 1)
java.lang.Long


Similarly a character is of type java.long.Character

user= (type \a)
java.lang.Character
user= (class \a)
java.lang.Character


Again with Java strings

user= (class string)
java.lang.String
user= (type string)
java.lang.String


Although a Strings have a few functions in the clojure.strings namespace 
which can be accessed. Why wouldn't clojure.lang.string be the type? And 
somehow inherit/remap all of the java string functions?
Was this design decision made during the languages conception to clean up 
the clojure namespaces? Or is there another reason that I'm not seeing?


-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Idiomatic way to construct potentially time bound target channel in core.async

2014-02-02 Thread Jan Herich
If anyone is interested, that's roughly what i'm currently thinking about...

(ns async-util.input-pipe
  (:require [clojure.core.async.impl.protocols :as impl]
[clojure.core.async :refer [! close! go-loop]]))
 
(defprotocol InputPipe
  (attach* [p ch])
  (detach* [p]))
 
(defn input-pipe
  Creates and return input pipe of supplied channel.
  [ch]
  (let [i (atom nil)
p (reify
impl/Channel
(close! [_] (impl/close! ch))
(closed? [_] (impl/closed? ch))
 
impl/ReadPort
(take! [_ fn1] (impl/take! ch fn1))
 
impl/WritePort
(put! [_ val fn1] (impl/put! ch val fn1))
 
InputPipe
(attach* [_ ch-i] (if (impl/closed? ch)
false
(do (reset! i ch-i) true)))
(detach* [_]  (if (impl/closed? ch)
false
(do (reset! i nil) true]
(go-loop []
  (when-let [i-v @i]
(let [val (! i-v)]
  (if (nil? val)
(close! p)
(recur)
p))
 
(defn attach-input
  Attaches channel to input-pipe channel, returns false
   if input-pipe channel is closed, true otherwise.
  [p ch]
  (attach* p ch))
 
(defn detach-input
  Detaches input from input-pipe channel, returns false
   if input-pipe channel is closed, true otherwise
  (detach* p))


Dňa piatok, 31. januára 2014 19:18:37 UTC+1 Jan Herich napísal(-a):

 Hello Folks,

 I need to construct core.async channel with following semantics:

 1. When the channel is created, timeout is attached to channel
 2. After timeout passes out, channel is closed
 3. It's possible to detach timeout from the channel before it passes out

 Now i implemented it with something like this:

 (defn create-cancel-channel
   [channel-to-notify timeout-ms]
 (let [cancel-channel (async/chan)
   timeout-channel (async/timeout timeout-ms)]
   (async/go
 (let [[_ c] (async/alts! [cancel-channel timeout-channel])]
   (when (= c timeout-channel)
 (async/close! cancel-channel)
 (async/close! channel-to-notify
   cancel-channel))
  
 ;; transport channel
 (def transport-channel (async/chan))
  
 ;; cancel-channel
 (def cancel-channel (create-cancel-channel transport-channel 2000))
  
 ;; to cancel the transport channel timeout, just close the cancel-channel
 (async/close! cancel-channel)


 But i'm rather unsatisfied with this solution because it seems little bit 
 clunky and what's worse, 
 i need to explicitly keep track of those cancel channels. 
 Obviously core.async pipe would greatly simplify this, but it seems, that 
 there's no way to disconnect
 piped channels. Maybe mult/tap/untap, even if i won't use broadcasting 
 semantic of those constructs.
 Any other ideas ?  



-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why does Clojure at times use Java classes as their base type?

2014-02-02 Thread Aaron France

Hi,


What's the benefit of hiding/abstracting the underlying platform away?
There are reams of documentation about the Java classes and simply
renaming them to say they are Clojure classes would seem to reduce the
discoverability of those docs.

JMTC

Aaron

On Sun, Feb 02, 2014 at 02:50:01PM -0800, Mark Gandolfo wrote:
 I tried asking this on twitter and wasn't getting my question across in 140 
 characters so I decided to post here. 
 I'm curious as to why Clojure as a language hasn't abstracted/hidden all of 
 Java's classes and created their own in the Clojure. namespace. 
 
 For example
 
 Big Ints are of type and class Clojure.lang.BigInt. 
 
 user= (type 1N)
 clojure.lang.BigInt
 user= (class 1N)
 clojure.lang.BigInt
 
 
 Although a Long is a java.lang.Long both in type and class
 
 user= (class 1)
 java.lang.Long
 user= (type 1)
 java.lang.Long
 
 
 Similarly a character is of type java.long.Character
 
 user= (type \a)
 java.lang.Character
 user= (class \a)
 java.lang.Character
 
 
 Again with Java strings
 
 user= (class string)
 java.lang.String
 user= (type string)
 java.lang.String
 
 
 Although a Strings have a few functions in the clojure.strings namespace 
 which can be accessed. Why wouldn't clojure.lang.string be the type? And 
 somehow inherit/remap all of the java string functions?
 Was this design decision made during the languages conception to clean up 
 the clojure namespaces? Or is there another reason that I'm not seeing?
 
 
 -- 
 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 group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


pgpSXTVybmKJF.pgp
Description: PGP signature


Re: Why does Clojure at times use Java classes as their base type?

2014-02-02 Thread Mikera
It would be a bad idea to wrap up everything in custom types:

a) It would add a performance overhead. Better to use the Java types 
directly - they are very well optimised on the JVM
b) It would make it much harder to use Java libraries and APIs. Java APIs 
expect the correct Java type, and wouldn't understand clojure.lang.String 
 for example
c) There's no real advantage to reinventing the wheel. The Java types are 
already pretty good for what they are designed for, e.g. String is fast and 
immutable.
d) It would be a lot of extra work. People have better things to do in this 
community, I think!

The clojure.lang.BigInt is a special case - There was probably some good 
reason to reimplement java.math.BigInteger (perhaps: performance? getting a 
consistent hashcode?)

Likewise clojure.lang.Ratio doesn't have a good equivalent in the Java API, 
so needed to be a new implementation.

On Monday, 3 February 2014 06:50:01 UTC+8, Mark Gandolfo wrote:

 I tried asking this on twitter and wasn't getting my question across in 
 140 characters so I decided to post here. 
 I'm curious as to why Clojure as a language hasn't abstracted/hidden all 
 of Java's classes and created their own in the Clojure. namespace. 

 For example

 Big Ints are of type and class Clojure.lang.BigInt. 

 user= (type 1N)
 clojure.lang.BigInt
 user= (class 1N)
 clojure.lang.BigInt


 Although a Long is a java.lang.Long both in type and class

 user= (class 1)
 java.lang.Long
 user= (type 1)
 java.lang.Long


 Similarly a character is of type java.long.Character

 user= (type \a)
 java.lang.Character
 user= (class \a)
 java.lang.Character


 Again with Java strings

 user= (class string)
 java.lang.String
 user= (type string)
 java.lang.String


 Although a Strings have a few functions in the clojure.strings namespace 
 which can be accessed. Why wouldn't clojure.lang.string be the type? And 
 somehow inherit/remap all of the java string functions?
 Was this design decision made during the languages conception to clean up 
 the clojure namespaces? Or is there another reason that I'm not seeing?




-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


possible to preserve formatting info with read-string?

2014-02-02 Thread Sarkis Karayan
Hey guys,

Is there a similar function to read-string that preserves formatting info 
(perhaps by storing formatting info as metadata)?

My app does a read-string on a clojure file and saves the content to 
datomic (each fn is stored in an entity, each file can have multiple fns).

The difficulty that I am having is that the formatting isn't preserved when 
I read the content of the fn from datomic.

Any advice?

Thanks,
Sarkis

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: possible to preserve formatting info with read-string?

2014-02-02 Thread Nicola Mometto

You can try using tools.reader[1]'s source-logging-push-back-reader:

user= (require '[clojure.tools.reader :as r]
  #_=  '[clojure.tools.reader.reader-types :as readers])
nil

user= (- {  :foo [ bar] } readers/source-logging-push-back-reader
   r/read meta :source)
{  :foo [ bar] }

[1]https://github.com/clojure/tools.reader

Sarkis Karayan writes:

 Hey guys,

 Is there a similar function to read-string that preserves formatting info
 (perhaps by storing formatting info as metadata)?

 My app does a read-string on a clojure file and saves the content to
 datomic (each fn is stored in an entity, each file can have multiple fns).

 The difficulty that I am having is that the formatting isn't preserved when
 I read the content of the fn from datomic.

 Any advice?

 Thanks,
 Sarkis

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] clj-refactor.el 0.10.0

2014-02-02 Thread Joel Holdbrooks
Slam dunk! Looking forward to trying this out.

On Thursday, January 30, 2014 5:13:36 AM UTC-8, Magnar Sveen wrote:

 clj-refactor.el
 Since the last update, there's been lots of activity for 
 clj-refactor.elhttps://github.com/magnars/clj-refactor.el
 . Alex Baranosky https://github.com/AlexBaranosky and Lars 
 Andersenhttps://github.com/expez have 
 joined the team, and here are the new features:
 More let refactorings

 Starting with:

 (defn handle-request
   (let [body (find-body abc)]
 {:status 200
  :body body})) 

 With the cursor in front of 200, I do cljr-move-to-let:

 (defn handle-request
   (let [body (find-body abc)
 X 200]
 {:status X
  :body body}))

 Again I have two cursors where the Xes are, so I type out the name, and 
 press enter:

 (defn handle-request
   (let [body (find-body abc)
 status 200]
 {:status status
  :body body}))

 Pretty handy. And it works with if-let and when-let too.

 *Thread first all, thread last all, unwind all*

 Convenience functions to thread all the way down, or unwind the entire 
 threading macro.
 Cycling Privacy

 Given this function:

 (defn add [a b]
   (+ a b))

 I do cljr-cycle-privacy:

 (defn- add [a b]
   (+ a b))

 I do cljr-cycle-privacy again to return to the original:

 (defn add [a b]
   (+ a b))

 Given this def:

 (def config
   docs
   {:env staging})

 I do cljr-cycle-privacy:

 (def ^:private config
   docs
   {:env staging})

 I do cljr-cycle-privacy again to return to the original:

 (def config
   docs
   {:env staging})

 https://github.com/magnars/clj-refactor.el#cycling-collection-typeCycling 
 Collection Type

 Given this collection:

 (:a 1 :b 2)

 I do cljr-cycle-coll to return:

 {:a 1 :b 2}

 ... and then 3 more times:

 [:a 1 :b 2]#{:a 1 :b 2}(:a 1 :b 2)


 https://github.com/magnars/clj-refactor.el#cycling-between-strings-and-keywordsCycling
  
 Between Strings and Keywords

 Given this string:

 refactor

 I do cljr-cycle-stringlike to return:

 :refactor

 ... and then 3 more times:

 refactor:refactorrefactor

 Thanks to Jay Fields https://github.com/jaycfields and 
 emacs-livehttps://github.com/overtone/emacs-live for 
 these cycling features. Good idea!
 Destructuring keys

 Given this:

 (defn- render-recommendation [rec]
   (list [:h3 (:title rec)]
 [:p (:by rec)]
 [:p (:blurb rec)  
  (render-link (:link rec))]))

 I place the cursor on rec inside [rec] and do cljr-destructure-keys:

 (defn- render-recommendation [{:keys [title by blurb link]}]
   (list [:h3 title]
 [:p by]
 [:p blurb  
  (render-link link)]))

 If rec had still been in use, it would have added an :as clause.

 For now this feature is limited to top-level symbols in a let form. PR 
 welcome.
 https://github.com/magnars/clj-refactor.el#stop-referringStop referring

 Given this:

 (ns cljr.core
   (:require [my.lib :as lib :refer [a b]]))
 (+ (a 1) (b 2))

 I place cursor on my.lib and do cljr-stop-referring:

 (ns cljr.core
   (:require [my.lib :as lib]))
 (+ (lib/a 1) (lib/b 2))

 https://github.com/magnars/clj-refactor.el#optional-setupEven more
 There's also 

-  cljr-sort-ns to sort the namespace
-  cljr-replace-use to replace old :use statements with new :refer 
:all statements.
-  cljr-add-declaration to declare the defn you're in.

 So, clj-refactor.el still knows nothing about your code. At some point we 
 want to piggyback on an nrepl-connection to do the tricky parts of 
 refactoring, but for now we're happy to make life a little easier.

 Hope you enjoy!




-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] clj-refactor.el 0.10.0

2014-02-02 Thread Joel Holdbrooks
Slam dunk! Looking forward to trying this out.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


ANN: [lein-describe 0.1.0] plugin for displaying detailed information about Clojure projects

2014-02-02 Thread Joel Holdbrooks
lein-describe

Have you ever be involved in a Clojure project and wondered how are these 
dependencies used? or what do these plugins do?. This plugin can help 
you answer those questions.

lein-describe provides detailed information about Clojure project 
dependencies and plugins. With a single command you can get a glance at 
dependency descriptions, licenses, and more.
https://github.com/noprompt/lein-describe#usageUsage

Put [lein-describe 0.1.0] into the :plugins vector of your :user 
profilehttps://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md
.
https://github.com/noprompt/lein-describe#exampleExample

$ cd /path/to/clojure/project
$ lein describe
PROJECT DEPENDENCIES:

Dependency: [com.cemerick/piggieback 0.1.2]
Description: Adding support for running ClojureScript REPLs over nREPL.
URL: http://github.com/cemerick/piggieback
License(s): Eclipse Public License (http://www.eclipse.org/legal/epl-v10.html)
Dependencies: [org.clojure/clojure 1.5.1]
  [org.clojure/tools.nrepl 0.2.3]
  [org.clojure/clojurescript 0.0-2014]
  [clojure-complete 0.2.3]
...

PLUGIN DEPENDENCIES:

Dependency: [com.cemerick/austin 0.1.3]
Description: The ClojureScript browser-repl, rebuilt stronger, faster, easier.
URL: http://github.com/cemerick/austin
License(s): Eclipse Public License (http://www.eclipse.org/legal/epl-v10.html)
Dependencies: [org.clojure/clojure 1.5.1]
  [org.clojure/clojurescript 0.0-2014]
  [com.cemerick/piggieback 0.1.2]
  [org.clojure/tools.nrepl 0.2.3]
  [clojure-complete 0.2.3]
...

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: possible to preserve formatting info with read-string?

2014-02-02 Thread Sarkis Karayan
Perfect, thank you!


On Sunday, February 2, 2014 9:38:03 PM UTC-5, Sarkis Karayan wrote:

 Hey guys,

 Is there a similar function to read-string that preserves formatting info 
 (perhaps by storing formatting info as metadata)?

 My app does a read-string on a clojure file and saves the content to 
 datomic (each fn is stored in an entity, each file can have multiple fns).

 The difficulty that I am having is that the formatting isn't preserved 
 when I read the content of the fn from datomic.

 Any advice?

 Thanks,
 Sarkis



-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: possible to preserve formatting info with read-string?

2014-02-02 Thread Sarkis Karayan
Perfect, thank you!

On Sunday, February 2, 2014 9:45:09 PM UTC-5, Nicola Mometto wrote:


 You can try using tools.reader[1]'s source-logging-push-back-reader: 

 user= (require '[clojure.tools.reader :as r] 
   #_=  '[clojure.tools.reader.reader-types :as readers]) 
 nil 

 user= (- {  :foo [ bar] } readers/source-logging-push-back-reader 
r/read meta :source) 
 {  :foo [ bar] } 

 [1]https://github.com/clojure/tools.reader 

 Sarkis Karayan writes: 

  Hey guys, 
  
  Is there a similar function to read-string that preserves formatting 
 info 
  (perhaps by storing formatting info as metadata)? 
  
  My app does a read-string on a clojure file and saves the content to 
  datomic (each fn is stored in an entity, each file can have multiple 
 fns). 
  
  The difficulty that I am having is that the formatting isn't preserved 
 when 
  I read the content of the fn from datomic. 
  
  Any advice? 
  
  Thanks, 
  Sarkis 


-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Program using distincto runs forever.

2014-02-02 Thread Atamert Ölçgen
This succeeds:

(run 1 [q]
  (distincto q)
  (== q [1 2 3])) - ((1 2 3))



But this runs forever:

(run 1 [q]
  (distincto q)
  (== q [1 2 3 1]))



BTW, why is it so difficult to create a bug report for core.logic? Issue 
tracker is not enabled in GitHub. I signed up to http://dev.clojure.org/ 
but still can't create a ticket.

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Program using distincto runs forever.

2014-02-02 Thread David Nolen
This is not a bug, just a result of the evaluation model - order matters.

Bugs can be filed here: http://dev.clojure.org/jira/browse/LOGIC

David


On Mon, Feb 3, 2014 at 12:51 AM, Atamert Ölçgen atamert.olc...@gmail.comwrote:

 This succeeds:

 (run 1 [q]
   (distincto q)
   (== q [1 2 3])) - ((1 2 3))



 But this runs forever:

 (run 1 [q]
   (distincto q)
   (== q [1 2 3 1]))



 BTW, why is it so difficult to create a bug report for core.logic? Issue
 tracker is not enabled in GitHub. I signed up to http://dev.clojure.org/but 
 still can't create a ticket.

  --
 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 group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Program using distincto runs forever.

2014-02-02 Thread Atamert Ölçgen

 This is not a bug, just a result of the evaluation model - order matters.


I thought order didn't matter (unless otherwise stated) in core.logic. Is
there a way for me to infer which goals are like this? (by looking at the
code if not from docs)

I am trying to get this working:

(defn geto [c k v]
  (matche [c]
([[]] (nilo k))
([[f . r]] (fresh [a] (firsto f a)
  (conde [(== a k) (resto f v)]
 [(geto r k v)])


(defn keyso [c k]
  (matche [c]
([[]] (nilo k))
([[f . r]] (fresh [a b] (firsto f a)
(keyso r b)
 (conso a b k)


(defn distinctkeyso [c]
  (fresh [x]
(keyso c x)
(distincto x)))


(run 1 [q]
  (fresh [x]
(geto x :tree false)
(== q true)
(geto x :tree q)
(distinctkeyso x)))


But it doesn't complete with that distinctkeyso. I tried to use maps but it
didn't work[1], so I decided to give lists a try. geto and keyso seem to
work fine.

[1]
http://stackoverflow.com/questions/21519290/why-isnt-featurec-create-a-contradiction



On Mon, Feb 3, 2014 at 6:01 AM, Atamert Ölçgen mu...@muhuk.com wrote:

 I can't log in:

 com.atlassian.jira.util.dbc.Assertions$NullArgumentException: user should
 not be null!




  On Mon, Feb 3, 2014 at 5:58 AM, David Nolen dnolen.li...@gmail.comwrote:

 This is not a bug, just a result of the evaluation model - order matters.

 Bugs can be filed here: http://dev.clojure.org/jira/browse/LOGIC

 David


 On Mon, Feb 3, 2014 at 12:51 AM, Atamert Ölçgen atamert.olc...@gmail.com
  wrote:

 This succeeds:

 (run 1 [q]
   (distincto q)
   (== q [1 2 3])) - ((1 2 3))



 But this runs forever:

 (run 1 [q]
   (distincto q)
   (== q [1 2 3 1]))



 BTW, why is it so difficult to create a bug report for core.logic? Issue
 tracker is not enabled in GitHub. I signed up to http://dev.clojure.org/but 
 still can't create a ticket.

  --
 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 group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 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 group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 Kind Regards,
 Atamert Ölçgen

 -+-
 --+
 +++

 www.muhuk.com




-- 
Kind Regards,
Atamert Ölçgen

-+-
--+
+++

www.muhuk.com

-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Why does Clojure at times use Java classes as their base type?

2014-02-02 Thread Janne Lemmetti
There's a nice explanation on why Clojure has BigInt in Clojure 
Programminghttp://www.clojurebook.com/ (page 
428). Like Mikera wrote, there were two reasons: one was that Java's 
BigInteger's hashCode is not consistent with Long's hashCode. Secondly 
Clojure BigInts have been optimized for performance: while all operations 
involving BigIntegers must be performed using its (slower) software-based 
implementations, Clojure optimizes math involving BigInts to use primitive 
(much faster) operations when possible, as long as the values involved are 
withing the range of primitive 64-bit longs.

On Monday, 3 February 2014 03:47:41 UTC+2, Mikera wrote:

 It would be a bad idea to wrap up everything in custom types:

 a) It would add a performance overhead. Better to use the Java types 
 directly - they are very well optimised on the JVM
 b) It would make it much harder to use Java libraries and APIs. Java APIs 
 expect the correct Java type, and wouldn't understand clojure.lang.String 
  for example
 c) There's no real advantage to reinventing the wheel. The Java types are 
 already pretty good for what they are designed for, e.g. String is fast and 
 immutable.
 d) It would be a lot of extra work. People have better things to do in 
 this community, I think!

 The clojure.lang.BigInt is a special case - There was probably some good 
 reason to reimplement java.math.BigInteger (perhaps: performance? getting a 
 consistent hashcode?)

 Likewise clojure.lang.Ratio doesn't have a good equivalent in the Java 
 API, so needed to be a new implementation.

 On Monday, 3 February 2014 06:50:01 UTC+8, Mark Gandolfo wrote:

 I tried asking this on twitter and wasn't getting my question across in 
 140 characters so I decided to post here. 
 I'm curious as to why Clojure as a language hasn't abstracted/hidden all 
 of Java's classes and created their own in the Clojure. namespace. 

 For example

 Big Ints are of type and class Clojure.lang.BigInt. 

 user= (type 1N)
 clojure.lang.BigInt
 user= (class 1N)
 clojure.lang.BigInt


 Although a Long is a java.lang.Long both in type and class

 user= (class 1)
 java.lang.Long
 user= (type 1)
 java.lang.Long


 Similarly a character is of type java.long.Character

 user= (type \a)
 java.lang.Character
 user= (class \a)
 java.lang.Character


 Again with Java strings

 user= (class string)
 java.lang.String
 user= (type string)
 java.lang.String


 Although a Strings have a few functions in the clojure.strings namespace 
 which can be accessed. Why wouldn't clojure.lang.string be the type? And 
 somehow inherit/remap all of the java string functions?
 Was this design decision made during the languages conception to clean up 
 the clojure namespaces? Or is there another reason that I'm not seeing?




-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Program using distincto runs forever.

2014-02-02 Thread David Nolen
Termination in Prolog like systems is a hard problem and core.logic doesn't
provide much innovation here yet. I don't have time to look more closely at
your specific program. I recommend looking at a good Prolog text as they
often discuss issues around termination and possible workarounds.

David


On Mon, Feb 3, 2014 at 1:15 AM, Atamert Ölçgen mu...@muhuk.com wrote:

 This is not a bug, just a result of the evaluation model - order matters.


 I thought order didn't matter (unless otherwise stated) in core.logic. Is
 there a way for me to infer which goals are like this? (by looking at the
 code if not from docs)

 I am trying to get this working:

 (defn geto [c k v]
   (matche [c]
 ([[]] (nilo k))
 ([[f . r]] (fresh [a] (firsto f a)
   (conde [(== a k) (resto f v)]
  [(geto r k v)])


 (defn keyso [c k]
   (matche [c]
 ([[]] (nilo k))
 ([[f . r]] (fresh [a b] (firsto f a)
 (keyso r b)
  (conso a b k)


 (defn distinctkeyso [c]
   (fresh [x]
 (keyso c x)
 (distincto x)))


 (run 1 [q]
   (fresh [x]
 (geto x :tree false)
 (== q true)
 (geto x :tree q)
 (distinctkeyso x)))


 But it doesn't complete with that distinctkeyso. I tried to use maps but
 it didn't work[1], so I decided to give lists a try. geto and keyso seem to
 work fine.

 [1]
 http://stackoverflow.com/questions/21519290/why-isnt-featurec-create-a-contradiction



 On Mon, Feb 3, 2014 at 6:01 AM, Atamert Ölçgen mu...@muhuk.com wrote:

 I can't log in:

 com.atlassian.jira.util.dbc.Assertions$NullArgumentException: user should
 not be null!




  On Mon, Feb 3, 2014 at 5:58 AM, David Nolen dnolen.li...@gmail.comwrote:

 This is not a bug, just a result of the evaluation model - order matters.

 Bugs can be filed here: http://dev.clojure.org/jira/browse/LOGIC

 David


 On Mon, Feb 3, 2014 at 12:51 AM, Atamert Ölçgen 
 atamert.olc...@gmail.com wrote:

 This succeeds:

 (run 1 [q]
   (distincto q)
   (== q [1 2 3])) - ((1 2 3))



 But this runs forever:

 (run 1 [q]
   (distincto q)
   (== q [1 2 3 1]))



 BTW, why is it so difficult to create a bug report for core.logic?
 Issue tracker is not enabled in GitHub. I signed up to
 http://dev.clojure.org/ but still can't create a ticket.

  --
 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 group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


  --
 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 group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 Kind Regards,
 Atamert Ölçgen

 -+-
 --+
 +++

 www.muhuk.com




 --
 Kind Regards,
 Atamert Ölçgen

 -+-
 --+
 +++

 www.muhuk.com

 --
 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 group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
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 group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at