[ANN] Gorilla REPL v0.4.0

2017-01-30 Thread Jony Hudson
Hi All,

 it's a pleasure to announce a new release of Gorilla REPL :-) For those 
that haven't seen it before, Gorilla REPL is a browser-based notebook 
environment for Clojure that lets you make interactive documents with 
tables, graphs etc.

The most important thing to note about this release is that I didn't do any 
of the work! Ben Bailey has been taking an active role in moving Gorilla 
forward, which is really great as I don't have a lot of time to devote to 
it at the moment. Congrats to Ben for the great work on this release.

This release brings in some features that Ben has developed for use in a 
class he and Lee Spector teach. They allow Gorilla to be used to edit plain 
Clojure files as well as rich Gorilla worksheets. This allows them to use 
Gorilla as the sole environment for working in Clojure, which I'm told 
makes the set-up for the class much easier!

As always you can find everything you need to know at 
http://gorilla-repl.org .


Jony

-- 
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/d/optout.


[ANN] Gorilla REPL v0.3.6

2016-02-24 Thread Jony Hudson
Hi All,

 I'm happy to point you to a new Gorilla REPL release. I can't take any 
credit for this, as all of the work was done by contributors in this 
release :-) From the changelog:

## Version 0.3.6

- Axis labels on plots (thanks to @dtolpin).
- Bump to latest CIDER-nrepl version 0.10.2.
- Undo segment delete (thanks to @mikeivanov).


If you're new to Gorilla REPL, you can find out all you want to know here:

http://gorilla-repl.org/

And instructions for getting started here:

http://gorilla-repl.org/start.html

Enjoy!


Jony

-- 
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/d/optout.


Re: How do threads work in command-line REPL?

2016-02-09 Thread Jony Hudson
I'm pretty fuzzy on how nREPL works, so I might be getting it wrong here 
... but I think it processes each method through a `future`. See:

https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/server.clj#L28

All of the nREPL operations are async, AFAIK, and I think the future is 
also relied upon to implement interruptible evaluation. See:

https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/interruptible_eval.clj#L243

But I can't say I really understand that much of the eval code, so like I 
say, I could be totally wrong here!


Jony


On Tuesday, 9 February 2016 18:19:09 UTC, Nathan Marz wrote:
>
> I was doing some work that involved the use of thread locals, and I 
> noticed that within a REPL session (launched via 'lein repl') my thread 
> locals would reset themselves to their initial value. I did some digging 
> and found that the thread id keeps changing within a single REPL session, 
> e.g.:
>
> user=> (.getId (Thread/currentThread))
> 65
> user=> (.getId (Thread/currentThread))
> 74
> user=> (.getId (Thread/currentThread))
> 78
> user=> (.getId (Thread/currentThread))
> 78
> user=> (.getId (Thread/currentThread))
> 78
> user=> (.getId (Thread/currentThread))
> 82
>
> I'm hoping someone who knows the internals of the REPL could shed some 
> light onto why this is the behavior and why it was designed this way.
>
> Thanks,
> Nathan
>
>

-- 
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/d/optout.


Re: How do threads work in command-line REPL?

2016-02-09 Thread Jony Hudson
Ahem.

"method" -> "message"


Jony

On Wednesday, 10 February 2016 00:35:16 UTC, Jony Hudson wrote:
>
> I'm pretty fuzzy on how nREPL works, so I might be getting it wrong here 
> ... but I think it processes each method through a `future`. See:
>
>
> https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/server.clj#L28
>
> All of the nREPL operations are async, AFAIK, and I think the future is 
> also relied upon to implement interruptible evaluation. See:
>
>
> https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/interruptible_eval.clj#L243
>
> But I can't say I really understand that much of the eval code, so like I 
> say, I could be totally wrong here!
>
>
> Jony
>
>
> On Tuesday, 9 February 2016 18:19:09 UTC, Nathan Marz wrote:
>>
>> I was doing some work that involved the use of thread locals, and I 
>> noticed that within a REPL session (launched via 'lein repl') my thread 
>> locals would reset themselves to their initial value. I did some digging 
>> and found that the thread id keeps changing within a single REPL session, 
>> e.g.:
>>
>> user=> (.getId (Thread/currentThread))
>> 65
>> user=> (.getId (Thread/currentThread))
>> 74
>> user=> (.getId (Thread/currentThread))
>> 78
>> user=> (.getId (Thread/currentThread))
>> 78
>> user=> (.getId (Thread/currentThread))
>> 78
>> user=> (.getId (Thread/currentThread))
>> 82
>>
>> I'm hoping someone who knows the internals of the REPL could shed some 
>> light onto why this is the behavior and why it was designed this way.
>>
>> Thanks,
>> Nathan
>>
>>

-- 
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/d/optout.


Re: How to save gorilla plots to file

2016-01-17 Thread Jony Hudson
It's not very elegant, but if you want a high-quality version you can open 
the web inspector or equivalent in your browser and copy the SVG node into 
a text file. You can then render the SVG to PNG using a variety of tools at 
whatever resolution you need.

I very rarely do this (as you can probably guess, or I would have added a 
better way to do it!). Usually the stuff I generate is just for internal 
notes, and in that case I tend to just take a screenshot which doesn't give 
great resolution, but is ideal for clipping into a lab-book.

There's probably a way you can do it by exporting the vega spec and using 
vega's headless renderer, but I haven't tried that. 
(See https://github.com/vega/vega/wiki/Headless-Mode). Also, this might be 
of interest if you're going to be doing this often and use Chrome 
(http://nytimes.github.io/svg-crowbar/).


Jony

On Saturday, 16 January 2016 18:20:25 UTC, jandot wrote:
>
> Hi all,
>
> I have found the gorilla REPL (http://gorilla-repl.org/) very useful for 
> data analysis in clojure. One of the great benefits is that it can display 
> plots in-line (based on vega). When saving such notebook, these plots are 
> represented as base64 text strings in the .clj file. However, I have not 
> been able so save these images separately as e.g. PNG files.
>
> Does anyone know how to save a plot from a gorilla repl into a file?
>
> Many thanks,
> jan.
>

-- 
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/d/optout.


Re: How to save gorilla plots to file

2016-01-17 Thread Jony Hudson
Nice. In case you're not already familiar with it, this 
(https://github.com/JonyEpsilon/gg4clj) might be useful as well if you want 
to be able to make more complex plots.


Jony

On Saturday, 16 January 2016 18:20:25 UTC, jandot wrote:
>
> Hi all,
>
> I have found the gorilla REPL (http://gorilla-repl.org/) very useful for 
> data analysis in clojure. One of the great benefits is that it can display 
> plots in-line (based on vega). When saving such notebook, these plots are 
> represented as base64 text strings in the .clj file. However, I have not 
> been able so save these images separately as e.g. PNG files.
>
> Does anyone know how to save a plot from a gorilla repl into a file?
>
> Many thanks,
> jan.
>

-- 
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/d/optout.


Re: java.lang.IllegalArgumentException: Parameter declaration make-response should be a vector

2016-01-10 Thread Jony Hudson
This is probably just a copy and paste problem, rather than the solution to 
your real problem, but ... the namespace declaration you've got in your OP 
is missing a couple of closing ).


Jony

On Sunday, 10 January 2016 07:28:00 UTC, Laws wrote:
>
> I've been staring at this for awhile, and moving it around, and re-typing 
> it, without seeing what the real error is. 
>
> I have a file called server.clj which includes this at the top in its 
> namespace declaration: 
>
> (ns salesvoice.server
>   (:require
>[salesvoice.query :as query]
>
>
> In query.clj, I have this: 
>
>
> (defn make-response
>   [company-name outputSpeech-text]
>   {"version"  "1.0"
>"sessionAttributes"  {
>  "company-name"  company-name
>  "user-id" "user-id"
>  }
>"response"  {
> "outputSpeech"  {
>  "type"  "PlainText"
>  "text"  outputSpeech-text
>  }
> "card"  {
>  "type"  "Simple"
>  "title"  (str "Sales Report for " company-name)
>  "content"  outputSpeech-text
>  } 
> "reprompt"  {
>  "outputSpeech"  {
>   "type"  "PlainText"
>   "text"  "Can I help you with 
> anything else?"
>   }
>  }
> "shouldEndSession"  true
> }
>})
>
>
> When I type "lein uberjar" at the command line I get: 
>
>
> Exception in thread "main" java.lang.IllegalArgumentException: Parameter 
> declaration make-response should be a vector, compiling:(server.clj:1:1)
>
> The parameter declaration for make-response is a vector. I am not clear 
> why I am getting this error. 
>
> Things I tried:
>
> 1.) moving this around in the file. It had been in the middle of 
> query.clj, but I moved it to the top, its now the first function defined in 
> that file
>
> 2.) re-typing the parameter declaration
>
> 3.) looking for other functions that have the same name, but grep shows 
> this is the only declaration
>
> So what could the real issue be? 
>
> Also, why does the error seem to show up when server.clj is including 
> query.clj. Shouldn't the error appear when query.clj is compiled? 
>
>
>
>
>
>
>
>
>
>

-- 
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/d/optout.


Re: Practical ways to deal with 'bag-of-properties' syndrome, AKA dynamic typing?

2015-12-01 Thread Jony Hudson
On Monday, 30 November 2015 21:49:09 UTC, Jonathon McKitrick wrote:

 how to go about finding out exactly what those maps contains without 
> slogging through source code.
>

Poke at them in the REPL! I don't think I *ever* write anything that isn't 
immediately ran and inspected at the REPL. I'd say I do almost all of my 
figuring out that way, with the remainder being done by looking at the 
source. I don't find looking at the source such a burden for two reasons: 
Cursive's jump to source is really good (and I think the same is probably 
true for the other development environment's out there); and code if often 
quite self contained, so you can usuallt just read the function you're 
interested in, or maybe it and one or two more up the chain (which, I 
think, is a product of Clojure being oriented around operations on a small 
set of basic data structures, rather than each library having it's own set 
of data structures to comprehend).

Of course, this leaves you vulnerable to a failure of the "worked once, 
will work every time" assumption which is where I'd see many of the tools 
mentioned thus far in the thread being most useful.


Jony

-- 
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/d/optout.


[ANN] Gorilla REPL v0.3.5

2015-11-25 Thread Jony Hudson
There's a new release of Gorilla REPL available on Clojars. The biggest 
change - which should make the lives of students of Clojure a tiny bit 
better - is that exceptions are now displayed with their stack traces 
(thanks to cider-nrepl's stacktrace middleware). There are a number of 
other smaller fixes and enhancements. Thanks to all that contributed :-)

>From the changelog:

## Version 0.3.5

- AT LAST: exceptions show stacktraces!
- Serve resources from less generic location to avoid clashing with project 
files.
- Port files are now configurable (thanks to @mattexx).
- Separate out handlers from embedded HTTPKit to ease embedding (thanks to 
@deas).
- Make URLs relative to support easier embedding (thanks to @deas).
- Viewer properly supports non-ASCII text.
- Update to support CIDER-nrepl version 0.9.1.
- Large worksheets (>8MB) now save successfully.
- Can view worksheets hosted on BitBucket (thanks for @tbrx).
- Command to delete output from the worksheet (thanks to @dasmoth).


Enjoy!


Jony

-- 
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/d/optout.


Re: Pareto's Clojure

2015-11-14 Thread Jony Hudson
Hah, I was just sitting down to do exactly the same thing! Very interesting 
looking down the list ... clearly other people write a lot more tests than 
I do :-o


Jony


On Saturday, 14 November 2015 21:00:53 UTC, Eric Normand wrote:
>
> Hi Sayth,
>
>
> You're welcome. You may also be interested in a recent article I wrote 
> where I analyzed 4 million lines of Clojure to find the most commonly 
> called functions, macros, and special forms. If you order them by 
> frequency, there's definitely a long tail curve where the most common 
> expressions strongly dominate the rest. That means if you learn the most 
> common, say, the 200 most common expressions first, you'll optimize 
> learning things you're likely to use in your code and read in other code.
>
> http://www.lispcast.com/100-most-used-clojure-expressions
>
> Rock on!
> Eric
>

-- 
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/d/optout.


Re: hawk got no events during file watching

2015-10-28 Thread Jony Hudson
Is it possible it's related to this? :

http://feedback.livereload.com/knowledgebase/articles/86239-os-x-fsevents-bug-may-prevent-monitoring-of-certai

You could try renaming and renaming back the folder and see if that makes 
any difference.


Jony


On Wednesday, 28 October 2015 16:05:37 UTC, Jiyin Yiyong wrote:
>
> I have no clue why is not happening anymore. It was working a month ago.
>
> My code.
>
>
> https://github.com/Cirru/lein-cirru-sepal/blob/master/src/leiningen/cirru_sepal.clj#L40
>
> ```clj
> (defn watch-all [dir] (println "Start watching files.") (hawk/watch! [{
> :paths [dir] :handler (fn [context event] (listen-file event) context)}]) 
> (loop [] (Thread/sleep 400) (recur)))
> ```
>
> Any my system:
>
> ```
> ➤➤ uname -a
> Darwin Air-of-Chen.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 16 
> 23:12:31 PDT 2015; root:xnu-2782.20.48~4/RELEASE_X86_64 x86_64
> ➤➤ pwd
> /Users/chen/repo/Cirru/lein-cirru-sepal
> ```
>

-- 
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/d/optout.


Re: State Change Listener in Clojure on a Database

2015-10-21 Thread Jony Hudson
Postgres has LISTEN/NOTIFY that you can use for triggering something like 
this:

http://www.postgresql.org/docs/9.4/static/sql-notify.html
http://www.postgresql.org/docs/9.4/static/sql-listen.html

The Java JDBC drivers support listening, although you have to do it by 
polling:

https://jdbc.postgresql.org/documentation/80/listennotify.html

Are you sure that you want to do this in an event driven way though? Other 
alternatives would be:

- when you add the user, also add their ID to a table of new users. 
Periodically poll this table and handle any new users, marking them as 
handled once you've sent the message to clients.

- use a queue of some sort to manage asynchronous tasks.

The first is simple, and has the advantage that it doesn't require any 
fancy DB features. The second is worth thinking about if you're going to 
have any other kind of triggered tasks, but is probably overkill just for 
this. Both have the advantage that the desire to perform an action (notify 
clients) is explicitly represented somewhere rather than just existing 
implicitly in the state of the running process.


Jony


On Monday, 19 October 2015 16:06:01 UTC+1, Adrian Cooley wrote:
>
> Hi all,
>
> I'm new to Clojure and I've been exploring the possibility of using it to 
> handle a large list of Users stored in a Postgresql Database. I can see 
> that there are some great sql libraries for clojure to query a Postgresql 
> database and this is fine. However, I was wondering if there are any useful 
> Clojure features or libraries that could allow me to 'listen' for changes 
> to a Users Table in the Database. A use case scenario to describe what I 
> want would be as follows: Say someone registers their details on a website 
> and their details are persisted to the Database. I then want some process 
> to pick up that a new user is now in the database and send this user 
> information to a client that has registered to listen for new users. Is 
> something like this possible in Clojure where it can handle listening to 
> state changes and trigger a notification? Thanks in advance to anyone who 
> chimes in with advice,
>
> Regards,
> Adrian.
>

-- 
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/d/optout.


Re: Library suggestions requested for clojure-toolbox.com

2015-10-05 Thread Jony Hudson
Not exactly a library, but Gorilla REPL could fit in there. 
http://gorilla-repl.org . Maybe in the REPL category, although it's not 
really quite that. Probably a bit much to have its own 'notebook' category 
though!


Jony


On Monday, 5 October 2015 20:41:11 UTC+1, James Reeves wrote:
>
> If you've written or know about a Clojure or ClojureScript library, and 
> it's not already on clojure-toolbox.com , 
> I'd like to hear about it.
>
> Post the name and URL (and an optional category) as reply to this message, 
> and I'll add it to the site.
>
> - James
>

-- 
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/d/optout.


Re: Oxford (UK) Clojure Group

2015-09-16 Thread Jony Hudson
You might ping Frank Wood who runs a research group in the engineering 
department at Oxford. I know they use Clojure heavily for their Anglican 
probabilistic programming system.

http://www.robots.ox.ac.uk/~fwood/


Jony


On Tuesday, 15 September 2015 22:04:49 UTC+1, Kévin Etienne wrote:
>
> Hi,
>
> I've seen a previous thread 
> https://groups.google.com/forum/#!topic/clojure/dRPF8bEpjBE
> where a Clojure group in Oxford was mentioned. I don't know what happened 
> to Oxjure but
> I'm interested in running a group and meeting people around Clojure and 
> more extensively
> LISP. I've been to a Clojure in London and really enjoyed a few years ago.
>
> Let me know if you're around and if want to meet. At the moment I'm trying 
> to see if there's
> enough traction and see what we can do.
>
> Thanks,
> Kevin 
>

-- 
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/d/optout.


Re: feedback about solutions

2015-09-01 Thread Jony Hudson
You might find kibit interesting too:

https://github.com/jonase/kibit

In its own words "kibit is a static code analyzer for Clojure, 
ClojureScript, cljx  and other Clojure 
variants. It uses core.logic  to 
search for patterns of code that could be rewritten with a more idiomatic 
function or macro. "

Running it on your file gives:

At test.clj:10:

Consider using:

  (neg? x)

instead of:

  (< x 0)


At test.clj:15:

Consider using:

  (zero? (mod n divisor))

instead of:

  (= (mod n divisor) 0)


Jony

On Monday, 31 August 2015 19:29:21 UTC+1, r/ Wobben wrote:
>
> Hello, 
>
> I did solve the boolean chapter of the ilovehorses git repo.
> My solutions can be found here: 
> https://github.com/rwobben/i-am-a-horse-in-the-land-of-booleans/blob/master/src/i_am_a_horse_in_the_land_of_booleans.clj
>
> Any experts who can give me feedback about the solutions so I can learn 
> from it.
>
> Roelof
>  
>

-- 
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/d/optout.


Re: Is any place to share articles about Clojure?

2015-08-24 Thread Jony Hudson
The Clojure reddit often has interesting articles linked, so you could post 
it there as well, perhaps:

https://www.reddit.com/r/Clojure/


Jony


On Monday, 24 August 2015 13:19:28 UTC+1, Krzysztof Władyka wrote:

 Hello,

 From time to time i am writing article on http://clojure.wladyka.eu/, but 
 the problem is nobody know about this site, because i didn't share it :) 
 Subjectively i am writing there things what some Clojure coders will want 
 to read.

 Is any place where can i share Clojure articles? Anyway maybe i will find 
 there something for me also :)

 Best,
 Krzysztof Władyka


-- 
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/d/optout.


Re: Why does the following Clojure code take 10x the time the C# version does? How to improve the Clojure version?

2015-05-15 Thread Jony Hudson
@puzzler -server is the default mostly, but Leiningen overrides some of the 
important options that -server enables, as detailed by Alex.

@Lee the first 15 minutes of this talk by Tom Crayford has some useful info 
about performance and JVM options in it:

https://skillsmatter.com/skillscasts/6148-opening-the-grimoire-some-things-about-clojure-performance

For the record for my long-running workloads (which I suspect are _very_ 
similar to yours) I use:

:jvm-opts ^:replace [-server
 ;;-XX:+AggressiveOpts
 ;;-XX:+UseFastAccessorMethods
 ;;-XX:+UseCompressedOops
 -Xmx4g]


The commented out options are in there so I don't forget them (I learned 
some of them from Tom's talk), but I haven't found them to make any much 
difference for my jobs.


Jony


On Thursday, 14 May 2015 09:02:42 UTC+1, Amith George wrote:

 I wrote the following code to solve this challenge - 
 https://www.reddit.com/r/dailyprogrammer/comments/35s2ds/20150513_challenge_214_intermediate_pile_of_paper/
 .

 Code - 
 https://github.com/amithgeorge/reddit-dailyprogrammer-clojure/blob/56ce1dbb6a08e96150dc85934caecfeb68108a53/src/rdp/214_intermediate.clj

 I executed the -main function using `lein run 1`. 

 Output

 ;; lein run 1

 0 12605919
 1 3578145
 2 15356894
 3 19134293
 4 2394558
 5 15030409
 6 6424953
 7 14893444
 8 1592254
 9 1914025
 10 7075106
 Elapsed time: 501168.972435 msecs

 The code originally used an immutable hashmap, but I lost patience waiting 
 for the computation to end. With mutable hashmap, it still takes around 8 
 mins.

 I wrote a C# version of the above code - 
 https://gist.github.com/amithgeorge/766b8220f39d48221e58. It finishes 
 under 40secs. The C# exe was built under Release mode and executed directly 
 from the commandline. I expected the Clojure version to perform similarly.

 Any tips on what I am doing wrong?

 -
 Explanation of the code - Create a vector of all paper sheets, such that 
 the sheet placed last is the first element of the vector and the last 
 element is the canvas. To compute the frequency of each visible color - for 
 each point in the canvas find the first sheet in the vector that covers the 
 point. Store/increment its count in the hashmap. I understand there might 
 be better more efficient ways to solve this, but currently I am interested 
 in why the Clojure versions is so slow vis-a-vis the C# version.



-- 
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/d/optout.


[ANN] darwin and algebolic - genetic algorithms, and evolving mathematics

2015-05-15 Thread Jony Hudson
Hi All,

 it's my pleasure to share with you two libraries: darwin and algebolic.

Algebolic is a library for evolving mathematical expressions. You can use 
it to perform what's known as symbolic regression, where a symbolic 
mathematical expression is found that fits a given dataset. More generally, 
you can use it to evolve mathematical expressions that optimise any score 
function. The expressions are implemented so they can be very quickly 
evaluated, as can their derivatives which is useful in more advanced 
applications. We use it in my research lab, for example, to evolve laws of 
physics directly from data.

Repository: https://github.com/JonyEpsilon/algebolic
Getting started example: 
http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=algebolicpath=ws/demo/intro.clj

Algebolic is powered by ...

Darwin is a flexible framework for programming genetic algorithms, aimed at 
research applications. It is representation agnostic, working just as well 
for simple GA examples as it does for complex genetic programming problems. 
It can be configured to perform both single- and multi-objective 
optimisation, including the SPEA2 algorithm. It has facility for adaptive 
evolution where the run parameters evolve in response to changes in the 
population.

Repository: https://github.com/JonyEpsilon/darwin
Getting started example: 
http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=darwinpath=ws/demo.clj


Some of the code is research-quality and in particular the core data 
structures in Darwin are a bit suspect. And the documentation is a bit 
sparse in places. But it works and maybe someone will find it useful :-)

Enjoy!


Jony

-- 
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/d/optout.


Re: flip in clojure

2015-04-30 Thread Jony Hudson
Another option is to use `as-` https://clojuredocs.org/clojure.core/as-%3E 
. It's more verbose ... I kind of like that aspect of it, but it may not be 
to everyone's taste.


Jony

On Friday, 1 May 2015 00:31:05 UTC+1, Vagmi Mudumbai wrote:

 Hi, 

 I was introducing one of my colleagues to clojure[1] and we were 
 trying to parse the reddit json as an exercise. 

 (require '(clj-http.client :as client)) 
 (require '(clojure.data.json :as json)) 

 (def ^:const REDDIT-URL http://reddit.com/r/clojure.json?limit=100;) 
 (def ^:const headers {:headers {User-Agent showoffclojure.core by 
 vagmi}}) 

 (let [entries_ (- REDDIT-URL 
(client/get headers) 
(:body) 
(json/read-str :key-fn keyword) 
(:data) 
(:children))] 
   (map :data entries)) 

 It would have been nice if we were able to write the map as a part of 
 the threading macro. So if there were a flip function like in haskell, 
 we could flip the args to the function hand have the map in the 
 threading macro. I could not find one so I wrote one. 

 (defn flip [fn_] 
   (fn [x y  args] 
 (apply fn_ (into [y x] args 

 Now I can bring in the map as a part of the - threading macro. 

 (- REDDIT-URL 
 (client/get headers) 
 (:body) 
 (json/read-str :key-fn keyword) 
 (:data) 
 (:children) 
 ((flip map) :data)) 

 This seems to be rather easy and useful and gets rid of the let block. 
 Are there any implications to performance or impact to laziness by 
 using flip? This would be useful even on the transduced version of 
 map like ((flip transduce) (map :data)) on the last expression. 

 Regards, 
 Vagmi 


 [1]: (
 http://blog.tarkalabs.com/2015/04/30/experience-report-introducing-an-experienced-ruby-developer-to-clojure/)
  

 and 


-- 
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/d/optout.


Re: Lein repl and Cider repl

2015-04-05 Thread Jony Hudson
Relevant bit of code here:

https://github.com/trptcolin/reply/blob/69c4c6ffe0c8903a193c1e127337832e225335b0/src/clj/reply/initialization.clj#L179


Jony


On Sunday, 5 April 2015 09:47:04 UTC+1, Bozhidar Batsov wrote:

 Maybe reply interns `clojure.repl/doc` in every namespace. I can tell you 
 for a fact that in CIDER the `clojure.repl` functions are interned only in 
 the user namespace. We can always change this, but it doesn't make a lot 
 of sense. CIDER users normally never use functions like doc as they have 
 much more powerful options at their disposal (e.g. `C-c C-d d` (cider-doc) 
 or the `C-c C-d g`).

 On 5 April 2015 at 11:41, andrea crotti andrea@gmail.com 
 javascript: wrote:

 Hi guys, one question about the Repl and Cider.

 When I start the Repl with lein repl, I am in the namespace x.y,
 and if I do (doc swap!) I see the documentation showing up.

 If instead I start the repl with Cider, it looks like I'm in the same
 namespace, however (doc swap!) doesn't work, but if I do
 (clojure.repl/doc swap!) actually works.

 So I wonder what's the difference, how does running lein repl differ
 from using the cider repl?

 Is it possible to have the same behaviour in both?

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com 
 javascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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/d/optout.


Re: clojure, not the go to for data science

2015-04-02 Thread Jony Hudson
I think the credit here has to go to RStudio for doing such a good job of 
making an easy to install complete development environment. I'd say just 
comparing base Clojure to base R, it's a wash. Install java and either 
download the Clojure jar, or the leiningen script, and you're good to go. 
Similar effort with R, just install the R distribution. Either way you 
don't get much more than a REPL prompt.

It is possible to get a working, fully-featured Clojure development 
environment going without *much* more difficulty than RStudio. In fact, I 
did precisely cover install and setup in two easy videos :-) 
See http://gorilla-repl.org/videos.html , bottom of the page.

I would still say that RStudio deserves kudos here though, as they've made 
it really easy to get going. And I think there is value in this, as my 
experience with getting inexperienced programmers started is that they 
easily get stuck on the little set up details. I'd like to make Gorilla 
REPL easier to get started with, but haven't figured out how to do that in 
a way that's compatible with the amount of time I have to work on it!


Jony

On Thursday, 2 April 2015 22:14:08 UTC+1, Sayth Renshaw wrote:
 

 You appear to have vastly misinterpreted my intention regards Emacs. My 
 mention of Emacs (I use emacs with prelude) was not based on my usage but 
 as a perception of those who might be attracted to Clojure For Purely Data 
 Science And wishes to get installed and moving quickly.

 R offers to get you installed in 2 quick point and click installs and 
 gives you the language and R studio .

 What would that person think when looking at Clojure?  If they saw emacs 
 would they know about prelude, how to configure it with so many 
 configuration options? 

 If someone out organisation was running a data science course would they 
 choose R because they can cover install and setup in 2 easy videos compared 
 to current Clojure options which may be less clear.

 Sometimes often times onboarding people to a new language is about as much 
 as ease of install or at least making a default set of optiins clear. 

 Could the default set abs best options be made easier to new comers?

 Sayth

 Emacs can use the native windowing system on every major platform. It 
 still *looks* like a terminal app, but doesn't have to be one.

 Pretty much everything you are saying here doesn't apply to Emacs at all, 
 and you would know it's all false if you knew anything about Emacs.

 On Wednesday, April 1, 2015 at 4:55:08 PM UTC-7, Fluid Dynamics wrote:

 On Tuesday, March 31, 2015 at 8:45:31 AM UTC-4, Phillip Lord wrote:

  The benefit is that Emacs is that its not constantly changing, and it 
 gives you some stability over the years. I like latex, for instance, for 
 the same reason. I can still access a 10 year old document and use it.
  
   First of all, there are other posts in this thread complaining about 
 constantly changing stuff breaking things! One such post is by Colin Yates.

 Second, to the extent that it isn't changing, it is legacy. Which helps to 
 explain the Wordperfect for DOS style of UI, which is dependent on vast 
 numbers of complex key-combinations being memorized by the user, instead of 
 a just-sit-down-and-start-using-it UI like everything originating after, 
 say, 1995 or so has tended to have. Of course, the result is that 
 Wordperfect (and emacs) seemed to require a great deal of specialized 
 training just to accomplish even the most basic tasks, whereas with modern 
 interfaces the way to do such basic tasks (save, open, copy and paste, move 
 around, select, etc.) tends to be obvious and special training can focus 
 exclusively on doing advanced things (scripting, complicated Photoshop 
 filters and tricks, things like those).

 Legacy also, obviously, tends to present problems in other areas besides 
 UI-boneheadedness:

 * I18n and l10n
 * Compatibility, with modern hardware and with modern operating systems, 
 though that can be alleviated by people porting the code
 * Boneheaded internal limits, along the same general lines as 640K ought 
 to be enough for anybody. It may be unable to use more than a small 
 fraction of what modern hardware can offer it in the way of memory, 
 storage, cores, ...
 * Accessibility. Interposing a terminal emulator between the app and 
 screen reading software might cause problems, though on the other hand a 
 text mode app may ultimately have advantages in that area too. On the other 
 hand, it may not play well with accessibility tools
   that rely on standard UI conventions. Anything that responds to some 
 voice command by generating control-V keystrokes to paste, or that relies 
 on the presence of normal menus and/or mouse support is going to blow up 
 spectacularly when used with 1980s-vintage Unix
   (or MS-DOS) software, or at best will end up controlling the 
 xterm/Command Prompt window instead of the underlying app.
 * Interoperation with other (non-operating-system) software. 

Re: clojure, not the go to for data science

2015-04-02 Thread Jony Hudson
On Monday, 30 March 2015 14:46:53 UTC+1, Christian Weilbach wrote:

 -BEGIN PGP SIGNED MESSAGE- 
 Hash: SHA1 

 I have started working on R integration with the help of rinancanter 
 (1) and it was nice to have dedicated R code cells with at least 
 syntax highlighting that I can mix with Clojure code in the same JVM 
 environment. 

 http://viewer.gorilla-repl.org/view.html?source=githubuser=ghubberrepo=cncpath=rincanter.clj
  
 I am not sure whether this fits the design atm. though. I also had a 
 look at renjin, but I think the native plugins mandate an RVM 
 integration atm. 


You might find http://beakernotebook.com interesting, if you haven't seen 
it before. It allows several languages in the same notebook, and has  a 
simple mechanism for sharing data between the language environments. It's 
pretty green at the moment, but it has some serious backing, so could be 
pretty useful once it's got a bit more polish on it. I chatted a little 
with someone who was hoping to implement a Clojure plugin for it, although 
I don't know how they've gotten on since.

 I also have taken a paper I liked and implemented a quick version of 

 SNE, which was fairly nice to do in Gorilla REPL: 

 http://viewer.gorilla-repl.org/view.html?source=githubuser=ghubberrepo=cncpath=stochastic-neighbour-embedding.clj
  
 A problem seems to be unicode support, I tried to use some math 
 symbols from the notation in the paper directly, but the viewer seems 
 to have a problem with it. 


Not sure what the problem is there - my feeling is it should just work, on 
the Gorilla side. If there's a test case you can point to (with an expected 
result) I can take a look at it.


Jony 

-- 
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/d/optout.


Re: [ANN] leaflet-gorilla 0.1.2 released with GeoJSON support

2015-04-02 Thread Jony Hudson
This is lovely. Am now inspired to get around to learning PostGIS over the 
easter break!


Jony

On Wednesday, 1 April 2015 23:19:31 UTC+1, John Wiseman wrote:

 I've add GeoJSON support to leaflet-gorilla, which makes it easy to use 
 with PostGIS.

 Example worksheet online (the PostGIS example is at the bottom): 
 http://viewer.gorilla-repl.org/view.html?source=githubuser=wisemanrepo=leaflet-gorillapath=example-worksheet.cljw

 Code: https://github.com/wiseman/leaflet-gorilla

 I've also attached a screenshot showing a GeoJSON example.

 John


 [image: Inline image 1]


-- 
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/d/optout.


Re: clojure, not the go to for data science

2015-03-30 Thread Jony Hudson
I propose, instead of this discussion, everyone channels their energy into 
writing an open-source data-science library, or blog post/article promoting 
Clojure for data science. In their favourite editor, of course!


Jony


On Sunday, 29 March 2015 10:55:34 UTC+1, Sayth Renshaw wrote:

 Hi 

 I last learned clojure in 1.2. Just curious why Clojure hasn't developed 
 as a go to for data science? 

 It never seems to get a mention R,Python and now Julia get the attention. 
 By design it would appear that Clojure would be a good fit. Is it a lack of 
 libraries, ease of install, no good default environment  (R Rstudio, 
 IPython ) where as you would need to use emacs with clojure, or is there 
 just a better default use of Clojure? 

 Sayth

-- 
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/d/optout.


Re: clojure, not the go to for data science

2015-03-29 Thread Jony Hudson
First, let me shamelessly plug Gorilla REPL http://gorilla-repl.org . It's 
a notebook type REPL, which I think works well as an environment for the 
sort exploratory programming of that's common when analysing data. We use 
it for science-involving-data every day in our research group, and I think 
a few others do too.

Regarding the question, my guess at the answer would be fashion. My 
experience has been that Clojure is a fine environment for technical 
computing. It's not as complete, library wise, as the alternatives, so it's 
sometimes a struggle. But it has some strengths over the others too 
(deployment, in particular - and I find Java is a really nice low-level 
escape hatch, compared to the alternatives). My guess is that it would take 
some high profile organisation to adopt it as a data science platform, and 
talk about it a lot, for it to really catch on, because that seems to be 
how fashion works!


Jony


On Sunday, 29 March 2015 10:55:34 UTC+1, Sayth Renshaw wrote:

 Hi 

 I last learned clojure in 1.2. Just curious why Clojure hasn't developed 
 as a go to for data science? 

 It never seems to get a mention R,Python and now Julia get the attention. 
 By design it would appear that Clojure would be a good fit. Is it a lack of 
 libraries, ease of install, no good default environment  (R Rstudio, 
 IPython ) where as you would need to use emacs with clojure, or is there 
 just a better default use of Clojure? 

 Sayth

-- 
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/d/optout.


Re: Adding directory to classpath in leiningen

2015-03-12 Thread Jony Hudson
Putting them in the working directory does not add them to the classpath. 
Leiningen used to have an 'escape hatch' to allow local libraries to be 
added to the classpath, but that was removed. The right way to do it now is 
to make the artefacts you want on the classpath available to Maven. The 
easiest way to do this is to install them into your local repo. I've found

https://github.com/kumarshantanu/lein-localrepo

is really very helpful for adding arbitrary jars to my local repo in the 
past.


Jony

On Thursday, 12 March 2015 08:10:27 UTC, Cecil Westerhof wrote:

 I have some files in:
 ~/Clojure
 that I want to use in a project I start with:
 lein repl

 But I do not see how to do this. How can I acomplish this?

 -- 
 Cecil Westerhof
  

-- 
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/d/optout.


Re: Name of a function

2015-02-14 Thread Jony Hudson
Unless I'm mistaken, in the output you show:

Exception ERROR: round [:high|:low|:normal] VALUE  user/round 
(repl-startup.clj:30)​
 

user/round is the name of the function, as desired.


Jony

On Saturday, 14 February 2015 19:09:53 UTC, Cecil Westerhof wrote:

 2015-02-14 20:03 GMT+01:00 Jony Hudson jonye...@gmail.com javascript::

 Ah, I see. I don't know how to do that. But, the function name should be 
 in the stack trace associated with the exception. Is there a particular 
 reason you also want to put it in the message?


 ​Well if I enter in the REPL:
 (round :dummy 12.4)
 I only get:
 Exception ERROR: round [:high|:low|:normal] VALUE  user/round 
 (repl-startup.clj:30)​
  

 ​So it is very useful to have it in the message. ;-)


 On Saturday, 14 February 2015 18:45:12 UTC, Cecil Westerhof wrote:



 2015-02-14 18:58 GMT+01:00 Jony Hudson jonye...@gmail.com:

 There might be a neater way, but

 (name (:name (meta (var reduce

 = reduce


 ​That is not what I meant. I have the following function:
 (defn round
   ([x] (round :normal x))
   ([mode x]
 (let [fn (case mode
:high(static-fn Math/ceil)
:low (static-fn Math/floor)
:normal  (static-fn Math/round)
(throw (Exception.
ERROR: round [:high|:low|:normal] 
 VALUE)))]
   (long (fn x)

 I would like to use the function name in the throw. So that when I 
 change the function name to round-long, I do not need to change the throw 
 statement, because the name of the function is automatically filled.

 ​
  

 On Saturday, 14 February 2015 16:11:48 UTC, Cecil Westerhof wrote:

 In Bash I use the following construct:
 printf ${FUNCNAME} needs an expression\n

 In this way I do not have to change the print statement when the name 
 of the function changes. Is something like this also possible in clojure?


 -- 
 Cecil Westerhof
  

-- 
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/d/optout.


Re: Name of a function

2015-02-14 Thread Jony Hudson
There might be a neater way, but

(name (:name (meta (var reduce

= reduce


Jony

On Saturday, 14 February 2015 16:11:48 UTC, Cecil Westerhof wrote:

 In Bash I use the following construct:
 printf ${FUNCNAME} needs an expression\n

 In this way I do not have to change the print statement when the name of 
 the function changes. Is something like this also possible in clojure?

 -- 
 Cecil Westerhof
  

-- 
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/d/optout.


Re: Name of a function

2015-02-14 Thread Jony Hudson
Ah, I see. I don't know how to do that. But, the function name should be in 
the stack trace associated with the exception. Is there a particular reason 
you also want to put it in the message?


Jony


On Saturday, 14 February 2015 18:45:12 UTC, Cecil Westerhof wrote:



 2015-02-14 18:58 GMT+01:00 Jony Hudson jonye...@gmail.com javascript::

 There might be a neater way, but

 (name (:name (meta (var reduce

 = reduce


 ​That is not what I meant. I have the following function:
 (defn round
   ([x] (round :normal x))
   ([mode x]
 (let [fn (case mode
:high(static-fn Math/ceil)
:low (static-fn Math/floor)
:normal  (static-fn Math/round)
(throw (Exception.
ERROR: round [:high|:low|:normal] VALUE)))]
   (long (fn x)

 I would like to use the function name in the throw. So that when I change 
 the function name to round-long, I do not need to change the throw 
 statement, because the name of the function is automatically filled.

 ​
  

 On Saturday, 14 February 2015 16:11:48 UTC, Cecil Westerhof wrote:

 In Bash I use the following construct:
 printf ${FUNCNAME} needs an expression\n

 In this way I do not have to change the print statement when the name of 
 the function changes. Is something like this also possible in clojure?

 -- 
 Cecil Westerhof
  
  -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com 
 javascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




 -- 
 Cecil Westerhof
  

-- 
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/d/optout.


Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-08 Thread Jony Hudson
To put take a different angle on it: you might soon get to *like* that it's 
usual to pass in everything as a parameter explicitly. It has the advantage 
that it's easy to reason about what a function does just by looking at the 
function. In the example above, when reading AccountRepository.Save you 
need to check elsewhere to see how _connection is defined. Whereas with the 
function save, so long as the parameters you feed in are sensible, then you 
can be pretty sure what it will do.

Making the functions self-contained like this is also a boon when it comes 
to working at the REPL. The OO approach you have often makes it difficult 
(for less trivial examples) to run a particular function in the right 
context. But with the self-contained function it's just a case of getting 
the parameters right, which is often easier to think about.


Jony

On Saturday, 7 February 2015 16:07:45 UTC, Dru Sellers wrote:

 Greetings,

 I am trying to convert my mind from OO (C#) to one more functionally 
 friendly. I am increasingly comfortable with simple applications in 
 clojure, but as I start to build more complex applications, I start to fall 
 down about how to structure my application. I don't want to just shove OO 
 ideas into the functional nature of Clojure. I'm looking for any help 
 someone can provide to help shimmy my brain into the right mental patterns.

 Background: Long time C# developer who leans heavily on IoC / DI / 
 Interfaces / Testing / Object Encapsulation.


 *Specific Question: Object Encapsulation*
 I feel like my function parameter lists are much wider than they would 
 be in C#. This is due to the lack of a constructor. So if I previously 
 had a C# class that looked like:


 public class AccountRepository : IAccountRepository
 {
   IDatabaseConnection _connection;

   public AccountRepository(IDatabaseConnection connection)
   {
 _connection = connection;
   }

   public void Save(Account account)
   {
 _connection.Execute(UPDATE accounts SET coupon=@coupon WHERE id=@id, 
 { coupon = account.Coupon, id=account.Id});
   }
 }

 In the above I have encapsulated the _connection, the other methods 
 don't have to deal with it. In Clojure (especially if you are following 
 Sierra's Component pattern) you end up with 

 (defn save [db account]
   (update db (:coupon account) (:id account))
 )

 I end up having to pass this 'db' around all over the place. I think that 
 this is just something I'll have to get used to more than anything. Am I 
 missing anything?

 Thank you for your time.

 -d


-- 
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/d/optout.


Re: [ANN] Introducing semantic-csv, a tool for higher-level CSV parsing/processing functionality

2015-02-06 Thread Jony Hudson
This is great - just what I need!


Jony

On Tuesday, 27 January 2015 09:24:21 UTC, Christopher Small wrote:

 Hi everyone

 I’m pleased to announce the release of semantic-csv 
 https://github.com/metasoarous/semantic-csv, a humble library for 
 working with CSV data.

 Existing Clojure libraries for working with CSV data (clojure.data.csv 
 https://github.com/clojure/data.csv and clojure-csv 
 https://github.com/davidsantiago/clojure-csv being the most notable), 
 only concern themselves with the *syntax* of CSV; They take CSV text, 
 transform it into a collection of vectors of string values (or when 
 writing, write from a sequence of string vectors), and that’s it. Semantic 
 CSV takes the next step by giving you tools for addressing the *semantics* 
 of your data, helping you put it into the form that better reflects what it 
 means, and make it easier to work with.
 Features 

- Absorb header row as a vector of column names, and return remaining 
rows as maps of column-name - row-val 
- Write from a collection of maps, given a header 
- Apply casting/formatting functions by column name, while reading or 
writing 
- Remove commented out lines (by default, those starting with #) 
- Compatible with any CSV parsing library returning/writing a sequence 
of row vectors 
- (SOON) A “sniffer” that reads in N lines, and uses them to guess 
column types 

 Structure 

 Semantic CSV is structured around a number of composable processing 
 functions for transforming data as it comes out of or goes into a CSV file. 
 This leaves room for you to use whatever parsing/formatting tools you like, 
 reflecting a nice decoupling of grammar and semantics. However, a couple of 
 convenience functions are also provided which wrap these individual steps 
 in an opinionated but customizable manner, helping you move quickly while 
 prototyping or working at the REPL.
 Where you come in 

 Semantic CSV is still in alpha, but I’m excited to start getting people 
 using it and providing feedback. I’m particularly interested at this phase 
 in hearing what people think of the overall structure, what pain points 
 come up, and what features would be nice. And bugs of course. Feel free to 
 submit feedback via Github issues 
 https://github.com/metasoarous/semantic-csv/issues or the project chat 
 room https://gitter.im/metasoarous/semantic-csv.

 https://github.com/metasoarous/semantic-csv


 Thanks for your time; I hope you find this useful.

 Chris Small 
 ​


-- 
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/d/optout.


Re: alternatives to component (like) systems

2015-01-28 Thread Jony Hudson
You don't need a global reference that lives in your code to be able to 
interact with the scheduler at the REPL. I'd do it by breaking stuff into 
more bits - it looks convoluted for this simple example, but hopefully the 
idea makes sense:

(defn make-scheduler [] (qs/initialize))

(defn start-scheduler [scheduler] (qs/start scheduler))

(defn start-scheduler-system
  []
  (- (make-scheduler)
   (start-scheduler)))

(defn -main [ args]
  (start-scheduler-system))

The differences are: having a function to make a scheduler that returns the 
scheduler; combining all scheduler related startup into one function; not 
doing much in -main. In general I try to never call -main from the REPL, so 
having as much of the functionality outside it helps.

From the REPL, you can evaluate something like

(def my-scheduler (make-scheduler))
(start-scheduler my-scheduler)

if you want to be able to fiddle with the scheduler, or just 
`(start-scheduler-system)` if you don't need access to it (say you were 
interacting with something else).

Of course, you may find in doing this that you're on your way to inventing 
a less good version of component ... but that's probably not such a bad way 
to learn :-)


Jony

On Wednesday, 28 January 2015 03:43:39 UTC, Huey Petersen wrote:

 Hello,

 I just started writing my first non-toy clojure program and I'm curious 
 how people handle global resources without component (or component like) 
 systems.  I plan to make use of component but I'm trying to add new 
 concepts one by one.

 As an example I have a scheduler (quartzile):

 (def scheduler (qs/intialize))

 (defn -main [ args]
   (qs/start scheduler))

 So this works and I can access the scheduler instance in my REPL to poke 
 at it while I'm developing.

 I then do lein uberjar and it won't compile :).  The compiler is executing 
 the qs/initialize function which is no good.

 So I could move that initialize inside of main:

 (def -main [ args]
   (- (qs/intialize) (qs/start)))

 But I've now lost a global reference to poke at the scheduler.

 Instead I used alter-var-root, which I've seen before, but until now 
 actually had no idea what it really did...

 (def scheduler)

 (def -main [ args]
   (alter-var-root #'scheduler (fn [old] (qs/initialize)))
   (qs/start scheduler))

 So this seems nasty, but lein uberjar is happy.

 Anyways, I'm just curious of what the alternatives are to manage this 
 outside of a component type system (which I plan to use!).

 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 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/d/optout.


Re: remote nrepl/gorilla + port forwarding

2015-01-15 Thread Jony Hudson
Hi Sam,

 I think `lein gorilla :ip 0.0.0.0 :port 5` should work (it works on my 
machine). And if your router is forwarding 5 to that machine correctly 
then it should be accessible from outside. `lein gorilla :ip ROUTER_IP 
:port 5` shouldn't work because ROUTER_IP isn't an IP address bound to 
the machine, so it will not be able to run a server on it.

More importantly, though, DO NOT DO THIS!!! The reason is that this will 
give full access (with the privileges of the user running Gorilla) to 
anyone on the internet. Stuff like reading, deleting all of your files etc 
:-( Gorilla doesn't have any form of authentication mechanism built in, and 
the server mode is really meant for trusted access only. If you want to run 
Gorilla over a non-trusted network then you should set it up to use some 
form of authentication.

The solution I usually use for this sort of thing is to tunnel through SSH. 
So, first of all make sure you can access SSH on THAT_COMPUTER ... if your 
router allows you to forward 5 external to 22 on THAT_COMPUTER then 
that would work. If you can't control the target port then you might need 
to run the SSH server on a different port (5).

Once you've got SSH running then you can run the Gorilla server on the 
internal (loopback) IP i.e. the default setting. This is not accessible 
from outside the machine, but it is accessible by the SSH server which is 
running on the machine. So you can then use ssh tunnelling to access this 
port from the outside machine.

So:

- set up router to forward ssh
- run `lein gorilla :port 6` on THAT_COMPUTER
- on the remote machine `ssh -L 8090:127.0.0.1:6 -p 5 
me@ROUTER_IP`. This connects to the SSH server on 5, and tells it to 
route traffic from the local machine's port 8080 to the remote machine's 
port 6, which is the port that Gorilla is running on. This will be done 
by the ssh server, internal to the remote machine, so does not need Gorilla 
to be externally accessible.
- then you should be able to securely access Gorilla on the remote machine 
at `http://localhost:8090/...`. SSH will route this as described above.

A diagram would really help here with all of the ports, but hopefully you 
get the idea :-)


Jony

On Thursday, 15 January 2015 01:01:56 UTC, Sam Raker wrote:

 I've got a computer with a bunch of clojure code on it, sitting at home on 
 my home network. I've configured my router to forward port 5 on that 
 computer to port 5 on the router itself, so that, at least in theory, 
 ROUTER_IP:5 should be forwarded to THAT_COMPUTER:5, if that makes 
 sense. I've done this same thing for a number of other things, including 
 SSH, MySQL, etc.

 When I'm at home, I can fire up `lein gorilla :ip THAT_COMPUTER :port 
 5` and then go to http://THAT_COMPUTER:5/worksheet.html, or, more 
 directly, `lein repl :headless THAT_COMPUTER:5`/`lein repl :connect 
 THAT_COMPUTER:5`, and it works. I'm trying to do the same from 
 not-at-home, no dice. (For the curious: I can SSH into THAT_COMPUTER, but 
 the connection is REALLY slow.)

 I've tried `lein gorilla :ip ROUTER_IP :port 5` (from THAT_COMPUTER), 
 but get a java.net.BindException about not being able to assign the 
 requested address--which makes sense--but `lein gorilla :ip 0.0.0.0 :port 
 5` doesn't seem to work either. Same with `lein repl :headless :host 
 0.0.0.0.0 :port 5`. 


 Any suggestions? Is this just not a thing I can do with these tools at 
 this point in their development? Is this a thing that should just work and 
 possibly my dumb router or some other thing is screwing it up?



 Thanks!
 -sam


-- 
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/d/optout.


Re: [ANN] Clojure 1.7.0-alpha5 now available

2015-01-12 Thread Jony Hudson
I have a set of micro-benchmarks on a project that is compute-heavy 
(symbolic regression, genetic programming). I see no performance 
regressions :-)

1.6.0
http://viewer.gorilla-repl.org/view.html?source=gistid=3e943292b03755681e50filename=expression-1.6.0.clj

1.7.0-alpha5
http://viewer.gorilla-repl.org/view.html?source=gistid=3e943292b03755681e50filename=expression-1.7.0.clj


Jony

-- 
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/d/optout.


Re: ANN: ClojureScript 0.0-2644, enhanced REPLs

2015-01-03 Thread Jony Hudson
I can't claim to know anything about it, but I did read this a while back 
which was interesting:

https://blogs.oracle.com/nashorn/entry/nashorn_performance_work_in_the


Jony

On Saturday, 3 January 2015 14:02:29 UTC, Max Gonzih wrote:

 Any idea why Nashorn is slower? Is it related to type checks?

-- 
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/d/optout.


Re: [ANN] gg4clj 0.1.0 - ggplot2 in Clojure and Gorilla REPL

2014-12-30 Thread Jony Hudson
That would be great, if possible! I did try looking yesterday with visualvm 
to see what was going on, but some 50,000 findClass calls in, visualvm ran 
out of memory and crashed. And then I got distracted ...


Jony

On Tuesday, 30 December 2014 07:22:02 UTC, Mikera wrote:

 I'm trying to figure out how to get core.matrix to load much faster - I 
 think it's actually some kind of Clojure issue with protocols but I'm not 
 *exactly* sure what is causing

 On Tuesday, 30 December 2014 05:13:24 UTC+8, Jony Hudson wrote:

 @Mike Thinking out loud here ... one option would be to put the 
 core.matrix dependent stuff in gg4clj in a separate ns, like 
 gg4clj.datasets or similar. This would then avoid the loading time for 
 users just wanting to use gg4clj.core. I'm not sure I think this as good a 
 solution, ultimately, as trying to make core.matrix load in a more 
 incremental fashion -  but I do appreciate that it's not so easy to change 
 core.matrix, and that there are good reasons not to. What do you think - 
 does this sound like a reasonable way forward to you? 


 Jony



-- 
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/d/optout.


Re: [ANN] gg4clj 0.1.0 - ggplot2 in Clojure and Gorilla REPL

2014-12-29 Thread Jony Hudson
Hi Mike,

 some numbers on my 2012 MacBook Air (i7):

Making a new namespace that requires gg4clj, in a newly started Gorilla 
REPL session (i.e. a newly started JVM):

(time (ns test
  (:require [gg4clj.core :as gg4clj])))

takes ~80ms.

If I add [clojure.core.matrix :as matrix] to the :require vector of the 
gg4clj.core namespace, then the form above takes ~8200ms to evaluate.

Interestingly, if I only require [clojure.core.matrix.protocols :as cmp] 
then I find it takes ~3500ms, which seems like a very long time given the 
minimal amount of code in, and referred to, by that namespace.

Is this what you'd expect, or am I doing something dopey?

Reason I'm fussing about the load time is that already the time it takes 
from wanting to make a plot to getting Gorilla running is uncomfortably 
long. And I've been thinking recently about how it might be made quicker. 
So, I'm not too keen on anything that makes it longer! (This would add 
about 50% to the Gorilla start-up-to-plot time as it stands, which on my 
machine is about 14s currently).

So, assuming I'm not doing something silly, could we maybe think of any 
easy ways to reduce the load time in a case like this, where the functions 
might never be used? That might be a useful thing to do anyway if the c.m 
dataset API is becoming a standard. [Probably not the right answer here, 
but in Gorilla REPL, the rendering protocol lives in its own project 
gorilla-renderable, which has all of about 5 lines of code. This gives a 
way for other code to add Gorilla renderers without having to depend on 
Gorilla REPL itself (which has many dependencies).]


Jony

On Monday, 29 December 2014 03:02:47 UTC, Mikera wrote:

 core.matrix isn't that big of a dependency itself - it only gets expensive 
 in/when you load the implementations (NDArray, vectorz-clj, Clatrix etc.). 
 Which should be a choice of the ultimate user.

 It is possible to just depend on the protocols, but I think that risks 
 breakage since protocols are really just an implementation detail. Best to 
 depend on the API in clojure.core.matrix (which are mostly just simple 
 functions that delegate to the right protocols)

 On Sunday, 28 December 2014 23:42:18 UTC+8, Jony Hudson wrote:

 @Chris Thanks, hope it's useful for you. I might have a play with ggvis 
 and see how it works out.

 @Mike Yeah, it would definitely be good to support core.matrix datasets. 
 One thing that would be nice would be to avoid the overhead of loading all 
 of core.matrix for those that don't use it. Do you think it would work to 
 just have gg4clj depend on the 'protocols' ns in core.matrix? Would be very 
 happy to take a PR if you've got time to look at it :-)


 Jony

 On Friday, 26 December 2014 15:36:42 UTC, Jony Hudson wrote:

 Hi all,

  from the README:

 gg4clj is a lightweight wrapper to make it easy to use R's ggplot2 
 library from Clojure. It provides a straightforward way to express R code 
 in Clojure, including easy mapping between Clojure data and R's 
 data.frame, 
 and some plumbing to send this code to R and recover the rendered 
 graphics. 
 It also provides a Gorilla REPL renderer plugin to allow rendered plots to 
 be displayed inline in Gorilla worksheets. It is not a Clojure rewrite of 
 ggplot2 - it calls R, which must be installed on your system (see below), 
 to render the plots. You'll need to be familiar with R and ggplot2, or 
 else 
 the commands will seem fairly cryptic.


 Demo worksheet, showing it in action here: 
 http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=gg4cljpath=ws/demo.clj
 Source here: https://github.com/JonyEpsilon/gg4clj

 Works better than I thought it would!


 Jony



-- 
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/d/optout.


Re: [ANN] gg4clj 0.1.0 - ggplot2 in Clojure and Gorilla REPL

2014-12-29 Thread Jony Hudson
@Mike Thinking out loud here ... one option would be to put the core.matrix 
dependent stuff in gg4clj in a separate ns, like gg4clj.datasets or 
similar. This would then avoid the loading time for users just wanting to 
use gg4clj.core. I'm not sure I think this as good a solution, ultimately, 
as trying to make core.matrix load in a more incremental fashion -  but I 
do appreciate that it's not so easy to change core.matrix, and that there 
are good reasons not to. What do you think - does this sound like a 
reasonable way forward to you? 


Jony

-- 
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/d/optout.


Re: [ANN] gg4clj 0.1.0 - ggplot2 in Clojure and Gorilla REPL

2014-12-28 Thread Jony Hudson
@Chris Thanks, hope it's useful for you. I might have a play with ggvis and 
see how it works out.

@Mike Yeah, it would definitely be good to support core.matrix datasets. 
One thing that would be nice would be to avoid the overhead of loading all 
of core.matrix for those that don't use it. Do you think it would work to 
just have gg4clj depend on the 'protocols' ns in core.matrix? Would be very 
happy to take a PR if you've got time to look at it :-)


Jony

On Friday, 26 December 2014 15:36:42 UTC, Jony Hudson wrote:

 Hi all,

  from the README:

 gg4clj is a lightweight wrapper to make it easy to use R's ggplot2 library 
 from Clojure. It provides a straightforward way to express R code in 
 Clojure, including easy mapping between Clojure data and R's data.frame, 
 and some plumbing to send this code to R and recover the rendered graphics. 
 It also provides a Gorilla REPL renderer plugin to allow rendered plots to 
 be displayed inline in Gorilla worksheets. It is not a Clojure rewrite of 
 ggplot2 - it calls R, which must be installed on your system (see below), 
 to render the plots. You'll need to be familiar with R and ggplot2, or else 
 the commands will seem fairly cryptic.


 Demo worksheet, showing it in action here: 
 http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=gg4cljpath=ws/demo.clj
 Source here: https://github.com/JonyEpsilon/gg4clj

 Works better than I thought it would!


 Jony


-- 
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/d/optout.


Re: parsing and chunking large xyz files

2014-12-26 Thread Jony Hudson
I think clojure.csv reads CSV files lazily, line-by-line, so might be 
useful to take a look at:

https://github.com/clojure/data.csv


Jony

On Friday, 26 December 2014 14:49:59 UTC, cej38 wrote:

 In molecular dynamics a popular format for writing out the positions of 
 the atoms in a system is the xyz file format (see: 
 http://en.wikipedia.org/wiki/XYZ_file_format and/or 
 http://www.ks.uiuc.edu/Research/vmd/plugins/molfile/xyzplugin.html).  The 
 format allows for storing the positions of the atoms at different snapshots 
 in time (aka time step).  You may have a few to millions of atoms in your 
 system and you may have thousands of time steps represented in the file. 
  It is easy to end up with a single file that is many GB in size.  Here is 
 a shell command that will create a very simple, and very small, test file 
 (note that the positions of the atoms are completely unrealistic-they are 
 all sitting on top of each other)

 perl -e 'open(F, test1.xyz); for( $t= 1; $t  11; $t = $t +1){print F 
 10\n\n; for( $a = 1; $a  11; $a = $a + 1 ){print F C  0.000 0.000 
 0.\n;}}; close(F);'


 Here is a shell command that will produce a more complicated file 
 structure (note that depending on who wrote the code that output the file 
 there may be other columns of data at the end of each row, also the number 
 of decimal places kept and the type of spacing between elements may 
 change), this file has a different number of atoms with each time step :

 perl -e 'open(F, test2.xyz); for( $t= 1; $t  5; $t = $t +1){my $s= $t 
 + 10; print F $s \n; my $color  = substr (abcd efghij klmno pqrs tuv 
 wxyz, int(rand(10)), int(rand(10))); print F $color; print F \n ;for( $a 
 = 1; $a  (11 +$t); $a = $a + 1 ){print F C10.00   10.0   
 10.0   $a\n;}}; close(F);'
 perl -e 'open(F, test2.xyz); for( $t= 1; $t  5; $t = $t +1){my $s= $t 
 + 10; print F $s \n; myperl -e 'open(F, test2.xyz); for( $t= 1; $t  
 5; $t = $t +1){my $s= $t + 10; print F $s \n; my

 Ok, that is the background to get to my question.  I need a way to parse 
 these files and group the lines into time steps.  I currently have 
 something that works but only in cases where the file size is relatively 
 small-it reads the whole file into memory.  I would like to use something 
 like iota that will allow me lazily parse the file and run reducers on the 
 data.  Any help would be really appreciated.






-- 
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/d/optout.


[ANN] gg4clj 0.1.0 - ggplot2 in Clojure and Gorilla REPL

2014-12-26 Thread Jony Hudson
Hi all,

 from the README:

gg4clj is a lightweight wrapper to make it easy to use R's ggplot2 library 
 from Clojure. It provides a straightforward way to express R code in 
 Clojure, including easy mapping between Clojure data and R's data.frame, 
 and some plumbing to send this code to R and recover the rendered graphics. 
 It also provides a Gorilla REPL renderer plugin to allow rendered plots to 
 be displayed inline in Gorilla worksheets. It is not a Clojure rewrite of 
 ggplot2 - it calls R, which must be installed on your system (see below), 
 to render the plots. You'll need to be familiar with R and ggplot2, or else 
 the commands will seem fairly cryptic.


Demo worksheet, showing it in action 
here: 
http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=gg4cljpath=ws/demo.clj
Source here: https://github.com/JonyEpsilon/gg4clj

Works better than I thought it would!


Jony

-- 
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/d/optout.


Re: Charting Data Format Feedback Requested

2014-12-26 Thread Jony Hudson
So, something of a tangent, I tried this, which works better than I thought:

https://groups.google.com/d/msg/clojure/Mcq3CwSa8lY/93lPjeeDBxMJ

At the moment its dataset support it just the most minimal 
Clojure-map-of-columns. It would be interesting to think about supporting 
other dataset formats ... one thing that comes to mind is whether 
core.matrix datasets could support an associative interface (keys and 
values)? If they did, I think it would probably work as it is.


Jony

-- 
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/d/optout.


Re: [ANN] gg4clj 0.1.0 - ggplot2 in Clojure and Gorilla REPL

2014-12-26 Thread Jony Hudson
Thanks :-)

And thanks for the pointer to ggvis. I've been shying away from interactive 
plots in Gorilla, since I haven't really seen or thought of a way to do it 
that seems satisfactory - and I'm not sure ggvis is there yet. But 
definitely will keep an eye on it though ...


Jony

On Friday, 26 December 2014 19:43:59 UTC, adriaan...@gmail.com wrote:

 Looks beautifull :) Good work

 I don't know if you're also aware of ggvis. The ggplot2 reincarnation from 
 the same developer. It has some extra niceties like interactivity. It also 
 renders it output in vega. So it should ouput render also nicely in gorrila 
 (I guess)
 http://ggvis.rstudio.com/

 Greetz

 Op vrijdag 26 december 2014 16:36:42 UTC+1 schreef Jony Hudson:

 Hi all,

  from the README:

 gg4clj is a lightweight wrapper to make it easy to use R's ggplot2 
 library from Clojure. It provides a straightforward way to express R code 
 in Clojure, including easy mapping between Clojure data and R's data.frame, 
 and some plumbing to send this code to R and recover the rendered graphics. 
 It also provides a Gorilla REPL renderer plugin to allow rendered plots to 
 be displayed inline in Gorilla worksheets. It is not a Clojure rewrite of 
 ggplot2 - it calls R, which must be installed on your system (see below), 
 to render the plots. You'll need to be familiar with R and ggplot2, or else 
 the commands will seem fairly cryptic.


 Demo worksheet, showing it in action here: 
 http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=gg4cljpath=ws/demo.clj
 Source here: https://github.com/JonyEpsilon/gg4clj

 Works better than I thought it would!


 Jony



-- 
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/d/optout.


[ANN] Gorilla REPL 0.3.4

2014-12-17 Thread Jony Hudson
Hi all,

 I'm happy to let you know about a new release of Gorilla REPL. No real big 
features in this release, but a number of small changes. From the changelog 
(not the changeling as my computer keeps correcting it to):

## Version 0.3.4

- Keeping up with the Batsovs. Support CIDER version 0.8.1.
- Cute favicon (thanks to @ticking and @ivan-kleshnin)
- Serve up project files so they can be accessed from markdown code.
- Switch to marked markdown renderer. Now supports tables.
- Save as... command (thanks to @jococo). 
- Running without a 'net connection doesn't crash the app.
- Show all output from segments with multiple top-level forms.
- Improvements to stylesheet for printing (thanks to @kurtharriger).
- Wrap long text lines in output.
- Fix a bug in scrolling long segments.
- Display bound IP on startup (thanks to @ticking).
- Fix dependency problem to allow use of Gorilla without Leiningen (thanks 
to @stuarthalloway).

Instructions at http://gorilla-repl.org
Code at https://github.com/JonyEpsilon/gorilla-repl

Enjoy!


Jony

-- 
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/d/optout.


Re: Charting Data Format Feedback Requested

2014-12-14 Thread Jony Hudson
Hi Lucas,

 I think, regarding integration with Gorilla, the real decision to be made 
is around interactivity. For non-interactive charts, it would be ideal to 
separate out the code that generates the chart from the code that messes 
with the DOM. Gorilla would then just use the charting code, and do its own 
DOM manipulation. It would probably also be ideal if the charting code ran 
server-side (CLJ) for Gorilla's purposes.

It sounds, though, that this is probably not the goal for your library. If 
you are aiming to build something that can handle interactive 
visualisations, and handle changing data, then I guess there's going to be 
much more interaction between the charting code and the DOM manipulation 
code. I'm not sure how that would fit in with Gorilla - but as a general 
design point (which would also ease Gorilla integration) there might be 
some value in making the interface between charting and DOM 
manipulation explicit, so that it is possible to plug in different 
approaches to DOM manipulation. That's not to say that this is 
realistically possible, just that I'd put it on the wishlist :-)

My current plan with Gorilla was to steer clear of interactivity, for two 
reasons: one, that for the sort of stuff I do myself, it's not really that 
useful (or, as I've said before: the interactivity you already get at the 
REPL is plenty); and two, because it looks like it's really, _really_ hard 
to get right! That said ... I recognise that people do do things that would 
be improved by interactivity, so if it is possible to make it work cleanly, 
then it is something I'd be keen to support in Gorilla :-)


Jony

On Sunday, 14 December 2014 12:26:17 UTC, Lucas Bradstreet wrote:

 Hi Jony, 

 I'm a fan of Gorilla REPL. I'd love to have this work supported with 
 it. Is it easy to support Clojurescript based renderers within 
 GorillaREPL? It would be nice to support interactive figures with this 
 kind of use case (in addition to SVG based plots, of course). 

 From the responses thus far, it appears that ggplot is the gold 
 standard for composable, customizable charts. Once we get the 
 dataframe format right, I'll invest some time into learning what I can 
 from it. We certainly want any implementation to be as data driven as 
 possible. 

 Thanks, 

 Lucas 


 On 13 December 2014 at 22:42, Jony Hudson jonye...@gmail.com 
 javascript: wrote: 
  I think it would be great, and a very useful contribution to the Clojure 
  world, to have a flexible plotting library. My perspective, at risk of 
 going 
  a bit off-topic, and from the biased position of a Gorilla REPL author 
 ... 
  
  
  When I think about the sort of programming I do as a scientist - data 
  analysis, modelling, numerics, statistics - I have a few requirements: 
  
  
  - For me, having a notebook interface is essential. It's how I think. 
 It's 
  the interactivity of the REPL, plus rich output, plus note-taking. 
  
  - I'd like to write my code in a civilised language. Ideally one that 
 puts 
  data first, because that's at the heart of the problems I solve. 
  
  - I want to be able to make things run fast when I need to. So I need 
 some 
  ability to write low-level code on occasion. 
  
  - I'd rather not re-write the whole world, so libraries are good. 
  
  - I want to be able to plot things the way I want them. 
  
  
  If I think about the possible contenders, written as (Notebook 
 interface, 
  language, low-level language escape hatch) then the ones I'm familiar 
 with, 
  and are advanced enough to use day-to-day for work, are: 
  
  
  (Gorilla REPL, Clojure, Java) 
  
  (IPython, Python, C) 
  
  (R, R, C) 
  
  (Mathematica notebook, Wolfram language, 
  sort-of-C/sort-of-Java/sort-of-.NET) 
  
  
  In terms of the interface, obviously Gorilla REPL is the best of the 
 bunch 
  :-) From a language perspective, my opinion is Clojure/Java wins this 
  hands-down. Preaching to the choir here, but Clojure is great for 
  data-oriented programming, and importantly for me, it's _really_ easy to 
  drop into Java when it matters. Library-wise, all are strong. Each has 
 their 
  own advantages, but I'd say the Clojure/Java ecosystem has enough that, 
 for 
  what I do, I rarely get stuck. For plotting Mathematica and R are 
 leagues 
  ahead. I'm not familiar with the latest developments in Python, but last 
 I 
  looked I didn’t see anything doing it the way I think it should be done. 
  
  
  Which, brings me to why I’m sharing all of this unsolicited opinion … 
 it’s 
  because I think a really strong plotting library would position Clojure 
  alongside the very best environments to do science and technical 
  computing/data science (or whatever it is we’re calling “thinking about 
 data 
  with a computer” these days). Gorilla/Clojure works great for me, but I 
 do 
  fire up R and Mathematica frequently for more advanced plotting. So, a 
  full-featured plot library is something I’d love to see happen, and 
 would

Re: Charting Data Format Feedback Requested

2014-12-13 Thread Jony Hudson


I think it would be great, and a very useful contribution to the Clojure 
world, to have a flexible plotting library. My perspective, at risk of 
going a bit off-topic, and from the biased position of a Gorilla REPL 
author ... 


When I think about the sort of programming I do as a scientist - data 
analysis, modelling, numerics, statistics - I have a few requirements:


- For me, having a notebook interface is essential. It's how I think. It's 
the interactivity of the REPL, plus rich output, plus note-taking.

- I'd like to write my code in a civilised language. Ideally one that puts 
data first, because that's at the heart of the problems I solve.

- I want to be able to make things run fast when I need to. So I need some 
ability to write low-level code on occasion.

- I'd rather not re-write the whole world, so libraries are good.

- I want to be able to plot things the way I want them.


If I think about the possible contenders, written as (Notebook interface, 
language, low-level language escape hatch) then the ones I'm familiar with, 
and are advanced enough to use day-to-day for work, are:


(Gorilla REPL, Clojure, Java)

(IPython, Python, C)

(R, R, C)

(Mathematica notebook, Wolfram language, 
sort-of-C/sort-of-Java/sort-of-.NET)


In terms of the interface, obviously Gorilla REPL is the best of the bunch 
:-) From a language perspective, my opinion is Clojure/Java wins this 
hands-down. Preaching to the choir here, but Clojure is great for 
data-oriented programming, and importantly for me, it's _really_ easy to 
drop into Java when it matters. Library-wise, all are strong. Each has 
their own advantages, but I'd say the Clojure/Java ecosystem has enough 
that, for what I do, I rarely get stuck. For plotting Mathematica and R are 
leagues ahead. I'm not familiar with the latest developments in Python, but 
last I looked I didn’t see anything doing it the way I think it should be 
done.


Which, brings me to why I’m sharing all of this unsolicited opinion … it’s 
because I think a really strong plotting library would position Clojure 
alongside the very best environments to do science and technical 
computing/data science (or whatever it is we’re calling “thinking about 
data with a computer” these days). Gorilla/Clojure works great for me, but 
I do fire up R and Mathematica frequently for more advanced plotting. So, a 
full-featured plot library is something I’d love to see happen, and would 
be interested in working towards.


In terms of what such a library would look like, while there’s value in 
debating the best way to do it, there’s also value in copying the best 
that’s out there! So I agree with Matt that a ggplot2-alike emitting SVG is 
a good thing to start with. ggplot2 does a great job of making plots 
composable, easily customised etc. And SVG can be rendered to anything, and 
Gorilla supports it natively. The key point, to my mind, would be how to 
make the ggplot API more data-driven, rather than the OO approach that it 
takes.


So, to summarise my ramble: I think this would be great, and it’s something 
I’d like to be involved with. I’d been planning to give some thought to 
just this after the end of term. Although, I don’t know how that will work 
out, realistically … if everyone on this list manages to do what they’re 
planning to do over the holiday break then January will be a golden age of 
Clojure!



Jony

-- 
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/d/optout.


Re: Charting Data Format Feedback Requested

2014-12-13 Thread Jony Hudson
P.s. another compelling argument for a Clojure based ggplot alike emitting 
SVG would be - assuming it was done so that it could be compiled with 
ClojureScript - it would be a great addition to client-side plotting, 
especially if it was wrapped to give a clean JS API 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/d/optout.


Re: Newbie's confusion

2014-12-05 Thread Jony Hudson
I made a couple of videos that might have some useful information in them. 
The first one covers setting up Cursive and Intellij, which it sounds like 
you've already done:

https://vimeo.com/103808402

The second looks a little at what sort of workflow you might use. It 
doesn't go very far, but it does cover the basics, and it might have some 
ideas for you to work with:

https://vimeo.com/103812557


Jony

On Friday, 5 December 2014 09:41:25 UTC, Laye Zhou wrote:

 Hi,

 I started learning Clojure this week and I'm a bit confused about the 
 general development process in the Clojure world. 

 When I write Java there is a main method as the entry of the program, and 
 in the IntelliJ IDEA it's kind of easy to run or debug the program by just 
 clicking the Run or Debug. When I write Clojure code, this process of 
 editing, compiling, debuting/running seems so different because I need to 
 setup a Java application in IDEA + Cursive to start clojure.main -m 
 main-namespace and there is no way to just click that Run button. Is it 
 right I need to enable Compile all namespaces in the Clojure settings in 
 IDEA? And since now we're equipped with REPL, I wonder what is the best way 
 I can debug/run the program before I really build the project. Thank you.


-- 
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/d/optout.


Re: Need advice on algorithm performance

2014-12-03 Thread Jony Hudson
If I understand right, I think you might be able to use the existing 
replace functions in clojure.walk. I find that this is about twice as fast:

(time
 (dotimes
   [_ 10]
   (walk/postwalk-replace
 {exp_1 100 exp_2 20 exp_3 5}
 [:DIV [:ADD [:ID P1 exp_1] [:ID P2 exp_2] exp_2419] [:ID 
P3 exp_3] exp_2418])))


Jony

On Wednesday, 3 December 2014 18:49:01 UTC, Dmitriy Morozov wrote:

 Hi, guys!

 I have an issue with my function where I use zippers to modify data 
 structure. The function modifies a tree (parsed grammar tree) to replace 
 expressions with values from a given map. Sadly, the algorithm I came up 
 with is pretty slow. I would appreciate if anyone can give me a hint on 
 what would be the right approach to do what I'm trying to accomplish. 
 Thanks!

 (defn- transform-values [parse-tree values-map]
   Replaces all expressions in parsed tree with values from a given map.
   (loop [loc (zip/vector-zip parse-tree)]
 (if (zip/end? loc)
 (zip/root loc)
   (if (zip/branch? loc)
   (let [id (last (zip/children loc))]
 (if (contains? values-map id)
 (recur (zip/next (zip/replace loc (zip/node [(get 
 values-map id)]
   (recur (zip/next (zip/edit loc #(into [] (butlast %)))
 (recur (zip/next loc)))
   )))
 (time
  (dotimes
  [_ 10]
(transform-values
 [:DIV [:ADD [:ID P1 exp_1] [:ID P2 exp_2] exp_2419] [:ID P3 
 exp_3] exp_2418]
 {exp_1 100 exp_2 20 exp_3 5})))
  
 Elapsed time: 2317.491 msecs 





-- 
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/d/optout.


Re: CCW bug [SEVERE]

2014-10-26 Thread Jony Hudson
You should demand your money back. Oh, wait ...


Jony

On Sunday, 26 October 2014 02:38:11 UTC, Fluid Dynamics wrote:

 Would somebody mind explaining to me why I just had CCW 0.28.1.STABLE001 
 hang with 100% CPU usage when I edited this line:

   :=  (= v cr

 to this:

   =   (= v cr

 and then hit control-S?

 I do not ever want to see anything purportedly STABLE do something like 
 that ever again, and that goes *one trillionfold* if it's IN THE MIDDLE OF 
 A GODDAMN SAVE. What if my file had been corrupted, or truncated and only 
 the first 42 bytes of the new version written thus far, or something like 
 that at the moment when the hang started? Fortunately, in this instance 
 that had not happened and the file seems to have been saved completely just 
 *before* the hang. I might not be so lucky next time. That is why this 
 cannot be permitted to happen again, and why therefore an explanation is 
 required, and urgently, that I might be perfectly able to avoid triggering 
 this severe, showstopping, and inexcusable bug again until such time as an 
 0.29.1 is published that has it permanently fixed.



-- 
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/d/optout.


Re: Demoralising experience trying to install on Win 7

2014-10-25 Thread Jony Hudson
I recently installed leiningen on some Windows machines, with success, 
although there was a little bit of fiddling. I used the .bat approach.

Did you manage to note the error message that the .bat generated when it 
crashed? That would be the first step (i.e. run it from a command prompt 
window so the error message lingers long enough to read). In my case, the 
error message related to wget, and after I installed that (I used cygwin, I 
believe, but you could use a standalone version as well, I'd imagine) `lein 
self-install` worked.

I just tried the above on a VM (cygwin with wget, adjust path so cygwin 
binaries are available from command prompt, lein self-install) and it 
worked for me.

Hope that helps,


Jony


On Saturday, 25 October 2014 02:44:42 UTC+1, Geoff Caplan wrote:

 Hi

 Wanting to get Clojure running on a Win 7 machine with no diskspace for 
 dual boot. It's been a demoralising experience.

 I tried the Win installer linked from the Leiningen website. It failed to 
 download the Leiningen 1 jar - the shell simply flashed open and crashed.

 Dug around the git site and found a recent .bat file that's supposed to 
 work with the latest Leiningen 2. Again, the shell flashed and crashed.

 Then manually downloaded the latest Leiningen 2 preview. Again running 
 lein simply flashes and crashes the shell.

 There's been a recent open issue on Windows installation but it's supposed 
 to be fixed.

 The lein.bat file is on my path and has exec permissions. I have Java 8 
 SDK installed and healthy.

 Not sure where I go from here - any advice much appreciated.

 I'm dithering between Clojure and Haskell for my next project. The Haskell 
 community provide a well-maintained batteries-included Windows install for 
 GHCi - I was in the Repl 60 seconds after visiting their site. I've been 
 struggling with Leiningen for an hour and getting nowhere. 

 It seems a great pity that the Clojure community seem to be ignoring those 
 of us who are stuck with Windows - it must be having a negative effect on 
 the uptake of the language. I see that this has been an issue for years, 
 but hasn't been addressed. I'm more drawn to Clojure than to Haskell, but 
 if I can't get it running I'll be forced to go elsewhere. Please help.


-- 
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/d/optout.


Re: [ANN] Arcadia, the integration of Clojure and Unity3D

2014-10-24 Thread Jony Hudson

On Friday, 24 October 2014 16:20:41 UTC+1, Fluid Dynamics wrote:


 Really? .NET running on iOS? That'll be the day. :)


http://xamarin.com/faq#q5

:-)


Jony

-- 
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/d/optout.


Re: Adding up numbers, quickly

2014-10-17 Thread Jony Hudson
Thanks all again for the advice. For the record, I ended up writing the 
loop in Java - being constrained on the type of the data (it ultimately 
comes from Java code), and not wanting to pay the (newly reduced!) price of 
converting to vectorz for just this operation, this seemed like the best 
way.


Jony

-- 
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/d/optout.


Re: Adding up numbers, quickly

2014-10-16 Thread Jony Hudson
Thanks @Mikera. I had a look at using core.matrix, but what I couldn't 
figure out is how to quickly get the data into core.matrix form. For 
instance, if I take my PersistentList of Doubles from the example then 
getting it into a vectors array takes:

(criterium/quick-bench (array :vectorz a))

Execution time mean : 70.764422 µs


so for the example above I'm no better off overall. Obviously, the ideal would 
be to use vectorz arrays all through the application, but I'm not sure that's 
going to be so easy in this case. Is there a quick way to marshall data into a 
vectorz vector?



Jony

-- 
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/d/optout.


Adding up numbers, quickly

2014-10-15 Thread Jony Hudson
Hi all,

 another performance question ... this time about arithmetic on vectors :-) 
Let's say I have two vectors of numbers (specifically, things with type 
clojure.lang.PersistentVector, containing things of type java.lang.Double). 
And let's say I want to sum the differences [1] between corresponding 
elements of the lists i.e. (a1 - b1) + (a2 - b2) + ...

Any suggestions on how to do this quickly. What I find is that if I use the 
'obvious' high-level construction:

(reduce + (mapv #(- %1 %2) a b))


then it goes pretty slowly. On my laptop I measure about 180us for 1000 
element lists.

If I try using `loop`:

(loop [sum 0.0 i 0]  
 (if ( i 1000)
   (recur (+ sum (- (nth a i) (nth b i))) (inc i))
   sum))

it does better, at about 100us.

But these are still a ways off what I might think is the best that could be 
done. If I run a similar computation in Java, it takes about 8us, which 
ties up with what my gut feeling would be.

So ... does anyone have any advice on closing the gap here?

Thanks in advance, again,


Jony


[1] Actually I want to sum the absolute differences, but that brings in 
java interop which I want to leave out lest it confuse matters.

-- 
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/d/optout.


Re: Adding up numbers, quickly

2014-10-15 Thread Jony Hudson
Thanks, that's really useful!


Jony


On Wednesday, 15 October 2014 20:53:40 UTC+1, Jony Hudson wrote:

 Hi all,

  another performance question ... this time about arithmetic on vectors 
 :-) Let's say I have two vectors of numbers (specifically, things with type 
 clojure.lang.PersistentVector, containing things of type java.lang.Double). 
 And let's say I want to sum the differences [1] between corresponding 
 elements of the lists i.e. (a1 - b1) + (a2 - b2) + ...

 Any suggestions on how to do this quickly. What I find is that if I use 
 the 'obvious' high-level construction:

 (reduce + (mapv #(- %1 %2) a b))


 then it goes pretty slowly. On my laptop I measure about 180us for 1000 
 element lists.

 If I try using `loop`:

 (loop [sum 0.0 i 0]  
  (if ( i 1000)
(recur (+ sum (- (nth a i) (nth b i))) (inc i))
sum))

 it does better, at about 100us.

 But these are still a ways off what I might think is the best that could 
 be done. If I run a similar computation in Java, it takes about 8us, which 
 ties up with what my gut feeling would be.

 So ... does anyone have any advice on closing the gap here?

 Thanks in advance, again,


 Jony


 [1] Actually I want to sum the absolute differences, but that brings in 
 java interop which I want to leave out lest it confuse matters.


-- 
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/d/optout.


Re: Keyword comparison performance

2014-10-11 Thread Jony Hudson
Thanks all, that makes a lot of sense.

To summarise, if I understand correctly, (on the JVM) comparing with = :
- first checks if the objects are one and the same, returns true if so
- if not, checks whether they are numbers or persistent collections, which 
have special-case checks
- if neither of the above, delegate to the object's .equals method.
Keywords, as best I can tell, don't override Object/equals, so the test is 
the same as identical? in the end i.e. whether they are the same object.

It makes sense, then, that comparing keywords that are the same is fast 
(~4ns, same as an identical? comparison on my machine), as this returns on 
the first step above. And comparison of differing keywords is slower as it 
goes through all of the steps above, as noted by @Mikera.

I also notice that the code for core/case seems to suggest that if the 
cases are labelled by keyword, then an identical check will be used 
(although, I don't yet understand the compiler code well enough to verify 
that this is true in the implementation of case*).

I guess a question that remains is whether this behaviour of keywords, that 
identical? and = give the same result, is something that is guaranteed, or 
whether it should be viewed as an implementation detail? If it is a 
guarantee I wonder whether there should be something on the data structures 
page of clojure.org indicating this, and noting how to do fast keyword 
comparison?

Another question, which is more for my understanding, is given that is 
currently the case that identical? and = are equivalent for keywords (and 
some core code depends on this behaviour), why does it work? Looking at 
Keyword.java I see that weak references are stored to interned keywords in 
a table. But if any of these Keyword objects were garbage-collected, I 
think it would break the parity between identical? and =. So it must be the 
case that something else is holding on to strong references somewhere. 
Which makes me wonder why weak references are used in the table. Anyone 
familiar with the compiler able to shed light on this for my edification? 
:-)


Jony

-- 
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/d/optout.


Keyword comparison performance

2014-10-10 Thread Jony Hudson
Hi All,

 I've been optimising a piece of code lately, and have come to wonder about 
the performance of keyword comparison. Specifically, I'm not sure whether 
the performance I'm seeing is what is expected. The data structures page on 
clojure.org [1] indicates that keywords provide very fast equality tests. If 
I micro-benchmark with criterium, then I find the following:

As a baseline, comparing integers with `(= 0 1)` takes around 4ns.

Comparing keywords with `(= :plus :minus)` takes around 30ns.

This is about the same amount of time it takes to compare strings, `(= 
plus minus)`, which comes in at about 25ns.

This surprised me, as I would have guessed that fast would have been 
closer to the integer performance than the string performance. It's worth 
saying that I don't know a lot about benchmarking, but I do have some 
real code that's performance depends heavily on comparisons, and it seems 
to line up performance-wise with these micro-benchmarks.

So, am I doing something silly (like I don't know about the fast = for 
keywords)? Or, are my expectations wrong, and this is about how long fast 
should be? Or is there a performance bug lurking?

I'm using Clojure 1.6.0 (but have tried 1.5.0 and 1.7.0-alpha1 with similar 
results).
x86_64 Mac OS X 10.9.5 4 cpu(s)

Java HotSpot(TM) 64-Bit Server VM 25.5-b02

Thanks in advance for any input,


Jony

[1] http://clojure.org/data%5Fstructures

-- 
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/d/optout.


Re: ANN: State of Clojure 2014 Survey - please contribute!!

2014-10-10 Thread Jony Hudson
If this is the unofficial survey post of academics using Clojure then I'd 
better add myself to the list :-)

@Bruce do you know what course they're going to be teaching Clojure on at 
Birkbeck?


Jony


On Friday, 10 October 2014 08:08:28 UTC+1, Bruce Durling wrote:

 I also know that Birkbeck College University of London is going to be 
 teaching Clojure this year. 
 On Oct 10, 2014 12:01 AM, Lee Spector lspe...@hampshire.edu 
 javascript: wrote:


 FWIW I'm another person using Clojure mostly for academic research. And 
 for computer science education, e.g. I'm currently teaching a Clojure-based 
 AI course. I'd be curious to know how many others of us are out there. And 
 BTW I think that attention to users in these categories could help to grow 
 the community.

  -Lee

 On Oct 9, 2014, at 12:32 AM, Mars0i mars...@logical.net javascript: 
 wrote:

  Thanks for the survey!
 
  I have a couple of suggestions/questions:
 
  For domains, there are no categories for scientific or other research 
 applications.  For example, I mainly use Clojure for writing agent-based 
 models for academic research.  Would a set of categories in this area be 
 usedful?
 

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com 
 javascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 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+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.



-- 
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/d/optout.


Re: count occurrences of a char in a string or a collection

2014-10-03 Thread Jony Hudson
frequencies : http://clojuredocs.org/clojure.core/frequencies


Jony

On Friday, 3 October 2014 15:22:49 UTC+1, empt...@gmail.com wrote:

 Hi, 

 Is there a higher-order function(s) that count occurrences of characters 
 in either a string or a collection?

 Thanks

 Paul


-- 
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/d/optout.


Re: [PSA] Clojars scp disabled until further notice

2014-09-26 Thread Jony Hudson
FWIW, I followed the lein deploy clojars instructions (around March this 
year) and it did work for me. I recall being a bit confused by the GPG 
stuff, but following the notes on the wiki did do the trick.


Jony

On Friday, 26 September 2014 04:21:41 UTC+1, Phil Hagelberg wrote:

 Carlos Fontes ccfo...@gmail.com javascript: writes: 

  Some immemorial time ago I tried `lein deploy clojars` which lead me to 
  read complex security stuff. I really tried to make it work, I did.. but 
 it 
  didn't just work, it didn't work with some work and even with more 
  work, so now I just use `lein push`. 

 I see. Perhaps if you could use more detail than it didn't work we 
 might be able to help get this working. 

  Btw, is Clojars still down for SCP uploads? Still having trouble here: 
  com.jcraft.jsch.JSchException: Auth fail 

 Yes, the vulnerability has not been patched. 

 -Phil 


-- 
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/d/optout.


Feeding a list of clauses to core.match/match

2014-09-23 Thread Jony Hudson
OK, this is probably simple, but I can't seem to figure it out. Maybe 
someone who understands macros better than me can help :-)

I'd like to be able to write something like the following:

(def some-clauses
  '[[false _] :f
[true _] :t])

(match-clauses [[false 3]] some-clauses)

but I can't figure out how to write `match-clauses`. If `core.match/match` 
were a function it would be easy, but it isn't. Can someone give me a push 
in the right direction?

Thanks,


Jony

-- 
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/d/optout.


Re: Feeding a list of clauses to core.match/match

2014-09-23 Thread Jony Hudson
Mulling on this some more, I think it might be impossible.

My reasoning is: I'm trying to do this so I can determine the list of 
clauses at run-time. But `core.match/match` does its magic at compile time, 
so it seems unlikely that I'm going to get what I want!

Back to the drawing board ...


Jony

On Tuesday, 23 September 2014 15:49:45 UTC+1, Jony Hudson wrote:

 OK, this is probably simple, but I can't seem to figure it out. Maybe 
 someone who understands macros better than me can help :-)

 I'd like to be able to write something like the following:

 (def some-clauses
   '[[false _] :f
 [true _] :t])

 (match-clauses [[false 3]] some-clauses)

 but I can't figure out how to write `match-clauses`. If `core.match/match` 
 were a function it would be easy, but it isn't. Can someone give me a push 
 in the right direction?

 Thanks,


 Jony


-- 
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/d/optout.


Re: Designing API for a Markov Model

2014-09-14 Thread Jony Hudson
It's nice if the function returns the same sort of data as it consumes, 
because then it's easy to repeat it with `iterate` or `reduce`. So, if you 
take your first example, then you could write:

(take 100
  (iterate (partial progress-state markov-model) initial-state))

to get the next 100 states.

If the process takes information at each step, e.g.:

(progress-state-with-input markov-model-2 previous-state current-input) - 
new-state

then you can do a similar thing with reduce:

(take 100
  (reductions (partial progress-state-with-input markov-model-2) 
initial-state inputs))

I'd prefer that to your second approach, as I don't think there's much 
reason to bundle the process and its state.

Another question to ponder is whether there should be a progress-state 
function, or whether the model itself could be a function. If the mechanics 
of the process are somewhat generic, and the `markov-model` is just data, 
then it's good as it is. But I'd make sure that progress-state isn't just 
an empty wrapper.


Jony

On Sunday, 14 September 2014 03:28:10 UTC+1, RJ Nowling wrote:

 Hi all,

 I'm new to Clojure and implementing a Markov Model as part of a larger 
 project.  I'd like some advice on the API for a progress-state function.

 I see two possible options.  In the first option, we always ask the user 
 to provide and keep track of the MSM state themselves:

 (progress-state markov-model previous-state) - new-state

 In the second approach, we create a record that combines a model and a 
 current state:

 (defrecord MarkovProcess [model current-state])

 (progress-state markov-process) - updated-markov-process, new-state

 Which of these approaches is more idiomatic for Clojure?  Are multiple 
 return types an accepted practice in Clojure?  Is there a third, better way?

 Thanks in advance!

 RJ


-- 
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/d/optout.


Re: Productivity tip for code transformations with cider

2014-09-14 Thread Jony Hudson
Why did I never think of using that! Nice :-)


Jony

On Sunday, 14 September 2014 08:35:16 UTC+1, Stathis Sideris wrote:

 Hello all,

 There is some functionality in cider (C-c C-w) that can potentially save 
 you a lot of typing when transforming Clojure code and I haven't seen many 
 people using it, so I made a screencast to demonstrate:

 http://www.youtube.com/watch?v=LXhWW1Yqpt0

 Hopefully you'll find it useful.

 Thanks,

 Stathis



-- 
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/d/optout.


Re: Interop nightmare

2014-09-08 Thread Jony Hudson
Not the answer, but might have some useful clues in ... here's a snippet to 
make a tagger from the Stanford library:

(ns processor.tagger
  (:require [clojure.data.xml :as xml]
[clojure.string :as string])
  (:import (edu.stanford.nlp.tagger.maxent TaggerConfig MaxentTagger)))


;; Configuration information for the Stanford POS tagger
(def conf
  (TaggerConfig.
(into-array [-model 
resources/models/english-caseless-left3words-distsim.tagger
 -outputFormat xml
 -outputFormatOptions lemmatize])))


(def tagger (MaxentTagger. 
resources/models/english-caseless-left3words-distsim.tagger conf))



Jony

-- 
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/d/optout.


Re: Interop nightmare

2014-09-08 Thread Jony Hudson
This worked for me:

http://viewer.gorilla-repl.org/view.html?source=gistid=5baef8ac0f42706e4940filename=parser.clj

I had to download the parser distribution from the Stanford NLP site and 
copy the stanford-parser-3.4.1-models.jar file into the root of my 
Leiningen project, as I couldn't find it on maven.

Hope that helps,


Jony


-- 
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/d/optout.


Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-02 Thread Jony Hudson
On Tuesday, 2 September 2014 01:36:49 UTC+1, Beau Fabry wrote:

 Just a little bit of showing off of the previous post :-) 
 http://i.imgur.com/zpfP9Ja.png


Nice! Would love to hear more about how you use it. I've only tinkered with 
Hadoop locally, so I'm very fuzzy on the concepts - you need to run Gorilla 
in-process on one of the hadoop nodes, rather than connecting to hadoop 
with a client library?


Jony

-- 
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/d/optout.


Re: How to use Java library from sources

2014-09-02 Thread Jony Hudson
I think if you're going to distribute a Leiningen plugin then you'll either 
need to publish pecoff4j to maven/clojars, or include the source in your 
build.


Jony


On Tuesday, 2 September 2014 16:07:32 UTC+1, Wilker wrote:

 Hello,

 I'm trying to use this Java library on my project: 
 https://github.com/kichik/pecoff4j

 But I'm still very new to the whole ecosystem, I was looking for some way 
 to first convert this to a jar, and then to load this jar into my Leiningen 
 project, I found a few posts on internet like this one:


 http://www.elangocheran.com/blog/2013/03/installing-jar-files-locally-for-leiningen-2/

 But they don't cover how to build the jar from the sources in first place, 
 and those seem a bit old.

 How is a good way for me to get the pecoff4j in my project? Another detail 
 is that my project is a Leiningen plugin, so I need to have this dependency 
 shared with the plugin users.

 Thanks.
 ---
 Wilker Lúcio
 http://about.me/wilkerlucio/bio
 Woboinc Consultant
 +55 81 82556600
  

-- 
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/d/optout.


[ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
Hi all,

 there's a new version of Gorilla REPL out :-) The headline feature is that 
the autocomplete UI now shows the docs for the function you're typing/lets 
you browse the docs. It's really handy! Autocomplete itself is also much 
improved, courtesy of the compliment library.

This version also adds compatibility with the latest version of CIDER, and 
a number of other smaller fixes and features (see changelog below).

I must give credit here to the CIDER team, who have done a great job of 
writing CIDER's back-end code in a way that it can be re-used by other 
editors. It must have taken some work to do that, and it's a very useful 
contribution to Clojure tooling. Gorilla now uses CIDER's back-end for 
autocompletion and documentation. Hats off to them!

From the changelog:

## Version 0.3.3

- Look up symbol in ClojureDocs.
- Inline documentation in auto-complete.
- Much better auto-complete, thanks to compliment and cider-nrepl.
- Autoselects a free port by default.
- Upgrade to CodeMirror 4.5.
- Interoperable with Emacs/CIDER  v.0.7.0 i.e. auto-adds cider-nrepl 
middleware.
- Hopefully fix an odd intermittent dependency bug (thanks to @jococo).
- App routes now a var for easier hacking on the server (thanks to 
@ticking).
- Write out web-app port to file on startup to enable other tools to 
interoperate.
- Fix version range warning.



Jony

-- 
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/d/optout.


Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
Ohh, and there are some new docs on how to use Gorilla alongside your 
favourite editor/IDE:

http://gorilla-repl.org/editors.html


Jony

-- 
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/d/optout.


Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
On Monday, 1 September 2014 13:16:36 UTC+1, Bozhidar Batsov wrote:
 

 Thanks! :-) You might also find the var-info middleware quite useful - 
 cider and fireplace use it for code navigation and enhanced documentation 
 (eldoc and a replacement for (doc something) that works for both 
 Clojure(Script) and Java symbols).


Yes, I was hoping to get an eldoc style parameter-hint going in this 
release, but realised that I'll need to (at least at some basic level) 
parse the code being edited to find the enclosing form's function symbol. 
So I decided it might be better to consider that alongside other things 
that need to understand the forms, like paredit etc.


Jony 

-- 
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/d/optout.


Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
Beau, Lee - thanks for the kind words - glad you're enjoying it!

Stu - I've no experience of running Clojure under either maven or gradle, 
but my guess is that it won't work out-of-the-box yet. Currently, Gorilla 
launches by using Leiningen to run its own server process in the classpath 
of the project. The Gorilla server starts up an nREPL server in process and 
connects to that. I've been planning to add the feature to connect to an 
external nREPL server (and also, probably, for local connections to 
launch the nREPL server as a separate process). It would then be 
straightforward, I'd imagine, to run an nREPL server from maven/gradle - 
which would take care of the classpath - and have maven/gradle start up the 
gorilla server and connect to nREPL.

I guess a workaroundy way to do it would be if maven/gradle can output the 
classpath for a project, then it might possibly work to run the Gorilla jar 
with the appropriate classpath. I'm not sure about this though as, in 
truth, I don't know exactly what nREPL does when it starts up!


Jony

On Monday, 1 September 2014 17:33:50 UTC+1, stuart@gmail.com wrote:

 Hi Jony,

 Is there a path for using Gorilla REPL from a maven or gradle project?

 Thanks,
 Stu




-- 
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/d/optout.


Re: [ANN] Gorilla REPL 0.3.3 - inline docs, CIDER compatibility

2014-09-01 Thread Jony Hudson
Ahh, nice, yes that's a simple way to do it if you can manage to add the 
code somewhere.

Regarding the dependencies - Leiningen adds both of the dependencies you 
list. I did declare them explicitly at one point, but I recall having some 
odd error, so I decided to take them back out rather than debug it! It's 
possibly related to this, but like I say I didn't put any time into 
investigating it, so could be a red 
herring: https://github.com/technomancy/leiningen/issues/1569


Jony


On Monday, 1 September 2014 21:57:07 UTC+1, stuart@gmail.com wrote:

 And now, answering part of my own question.  It appears the following 
 almost just works from a maven project that references gorilla:

   (require '[gorilla-repl.core :as gorilla])
   (gorilla/run-gorilla-server {:port 8990})

 The only problem is that gorilla's declaration of its own dependencies 
 appears incomplete.  When I try to run the snippet above, I fail for lack 
 of org.clojure/tools.nrepl and clojure-complete.  Adding them as explicit 
 dependencies in my own project fixes the problem.  My quick guess is that 
 these two libs need to be added to gorilla's own dependencies.  (One 
 wonders why it works inside of lein...)

 Stu



-- 
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/d/optout.


[videos] Getting started with Clojure, IntelliJ, Cursive and Gorilla REPL

2014-08-19 Thread Jony Hudson


Thought I'd share the links to a couple of videos I made for my students on 
how to set up a nice development environment for Clojure with IntelliJ, 
Cursive and Gorilla.

Part 1 on setting up software: https://vimeo.com/103808402

Part 2 on basic workflow:https://vimeo.com/103812557

Probably not much in there for experts, and the setup won't suit everyone 
(*cough* emacs *cough*) but hopefully they're useful for some of those just 
getting started. They're excruciatingly detailed, so should be suitable for 
those with no Clojure experience.


Jony

-- 
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/d/optout.


[ANN] Gorilla REPL 0.3.2 - Important security fix

2014-08-12 Thread Jony Hudson
Hi All,

 there's a new version of Gorilla REPL, version 0.3.2, available on clojars 
that contains an important security fix. I would recommend upgrading 
immediately, if possible. Many thanks to @silasdavis for initially 
reporting this issue, and for @foogoof for highlighting that it was more 
important than I had initially thought.

The problem was that Gorilla, by default, listened on all available IPs 
meaning that if your firewall was open on the Gorilla port then untrusted 
users could execute commands in the clojure REPL (essentially giving them 
the level of access of the user that ran Gorilla). I had not given this the 
highest priority to fix, as a sane firewall configuration would prevent 
this, and rather saw this as a matter of providing safer defaults. However, 
I recently learned that both Windows and MacOS don't have a sane firewall 
configuration :eek:. Specifically, if you've ever given incoming access 
permission to a java program (say IntelliJ, some Oracle abomination that 
you have to use to buy things at work, a bit torrent client etc etc) then 
all java processes, including the Gorilla server, will open a hole in the 
firewall by default :-( A quick sampling of machines around the lab 
suggested that this is pretty likely to be the case.

The fix, contributed by @foogoof, is to only listen on the loopback address 
by default. You can still configure Gorilla to listen to other addresses if 
you want to use it in a server configuration.

My sincere apologies to anyone who's been put at risk by this, both for 
writing the half-assed code in the first place, and then not appreciating 
the severity of the issue when reported!

On a brighter note, this release also has improved 
bracket-match-highlighting which should make it more accessible to those 
with colour vision deficiency.


Jony

-- 
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/d/optout.


Re: [ANN] Gorilla REPL 0.3.1

2014-07-27 Thread Jony Hudson
The save interface should still work as before, as in it will save to any 
path (that exists) relative to the project directory. So typing 
ws/test.clj will save the worksheet in the ws directory, assuming it 
exists. I'll have a bit think on how I can make the UI for the new 
load/save behaviours more self-evident. Any suggestions welcome :-)

Stack-traces on exceptions is a good idea. A nice way to do it could be to 
display the message as now, and have the full stack trace folded under a 
'disclosure' triangle type UI 
element. https://github.com/JonyEpsilon/gorilla-repl/issues/128


Jony


On Friday, 25 July 2014 19:07:33 UTC+1, Paul Mooser wrote:

 Ah, this makes sense. I renamed my worksheets, and it finds them fine. I 
 didn't understand that it was supposed to be showing me a filtered list, 
 since what I was doing worked in a previous version. 

 So, is there now no way to create a worksheet in a subdirectory of the 
 project? I normally keep all of mine in a subdirectory. 

 I have another question regarding how exceptions are rendered. If you 
 happen to evaluate code which generates an exception, the displayed 
 representation contains only a single line. If you try to use clojure.repl 
 and do something like (pst *e), that has the same effect. I have a dumb 
 workaround, but is there a way to get gorilla-repl to show me the full 
 stack trace, so that I can easily debug it in-place ? 

 Thanks again for all of your work on this! 


-- 
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/d/optout.


Re: [ANN] Gorilla REPL 0.3.1

2014-07-25 Thread Jony Hudson
Hi Paul,

 glad you're finding it useful!

As for the problem: I think it's a good example of why I should stick to 
science and not dabble in UI design :-) The idea is that the text-box 
simply filters the list of options below it - it doesn't allow you to type 
in an arbitrary path. I'm guessing that it's particularly confusing in your 
case because the list of options below the box is empty?

The way it's _supposed_ to work is that Gorilla scans your project 
directory for worksheets, and lists them in the menu, and you can use the 
filter box to navigate the list quickly. I think the problem is that I've 
been too strict with the definition of worksheet file: at the moment, it 
has to be either a .cljw file, or a .clj file with the magic Gorilla 
header as it's first line. Would I be right in thinking that your worksheet 
files don't conform to this (unannounced, possibly unwanted) convention?

I think the solution is probably for me to relax the file-naming 
convention, if that's not something people want to be forced into. I was 
worried about the time taken to open and read the header line of all the 
files in a project, but that's perhaps less of a worry now that I've 
implemented excluded directories for the file scan.

I'm rambling: the workaround is to name your worksheets *.clj, if I've 
guessed the problem correctly. The solution is probably that I should 
change the file-name criteria to be less restrictive.

Hope that helps,


Jony


On Friday, 25 July 2014 17:11:01 UTC+1, Paul Mooser wrote:

 I've made gorilla-repl part of my normal workflow recently, and I've been 
 enjoying great results. 

 With this new version, I'm having trouble loading documents using the 
 normal ctrl-g ctrl-l method. When I hit return after typing the path into 
 the load dialog, it simply closes with no feedback or visible effect. If I 
 type the path into the URL (ie, ?filename=foo/bar) it works fine. Any idea 
 what might be causing this or how I might debug it more effectively ? 




-- 
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/d/optout.


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Jony Hudson

It passes the queries through clojure.java.jdbc, so provides the same level 
of protection as that, as far as I am aware.


Jony


On Thursday, 24 July 2014 12:08:52 UTC+1, Paul Butcher wrote:

 I wasn’t aware of yesql - thanks for the pointer.

 My concern with “write your queries in pure SQL” is increased 
 vulnerability to SQL injection. From a quick glance at yesql, it seems 
 likely that it does provide protection against SQL injection, but there’s 
 nothing in the documentation (that I can find at first glance, at least) 
 that explicitly says so.

 Can anyone who understands it confirm or deny?


-- 
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/d/optout.


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Jony Hudson
Pressed send to eagerly! Relevant 
code: https://github.com/krisajenkins/yesql/blob/master/src/yesql/types.clj


Jony

On Thursday, 24 July 2014 12:58:27 UTC+1, Jony Hudson wrote:


 It passes the queries through clojure.java.jdbc, so provides the same 
 level of protection as that, as far as I am aware.


 Jony


 On Thursday, 24 July 2014 12:08:52 UTC+1, Paul Butcher wrote:

 I wasn’t aware of yesql - thanks for the pointer.

 My concern with “write your queries in pure SQL” is increased 
 vulnerability to SQL injection. From a quick glance at yesql, it seems 
 likely that it does provide protection against SQL injection, but there’s 
 nothing in the documentation (that I can find at first glance, at least) 
 that explicitly says so.

 Can anyone who understands it confirm or deny?



-- 
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/d/optout.


[ANN] Gorilla REPL 0.3.1

2014-07-23 Thread Jony Hudson
Hi All,

 it's my pleasure to announce a new version of Gorilla REPL, v0.3.1. The 
focus of this release has been usability and taking off some of the rough 
edges. This version is now much friendlier to those: who like to use the 
mouse; who have short screens; who hate multi-press keyboard shortcuts; who 
use Linux; who use a window manager I've never heard of; who hate 
remembering filenames; and more! I'm pleased that it hopefully makes 
Gorilla usable for a wider range of people, without compromising the 
simplicity that I like about it. The best way to take a look is to download 
it and have a play, see http://gorilla-repl.org/start.html for instructions 
:-)
 
There are many small bugfixes, and a number of other new features. See the 
changelog attached below.

I must send out thanks to @scottdw, @cldellow, @gfredericks and 
@modellurgist who've all contributed code that ended up in this release. 
Also, thanks to the many folks who've contributed to the discussion on 
Github.
 
They've both been around for a while, but it might be worth noting here 
that Incanter and Loom are now both supported with Gorilla renderers:

Incanter example: 
http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=gorilla-testpath=ws/incanter.clj
Code: https://github.com/JonyEpsilon/incanter-gorilla
Loom example: 
http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=gorilla-testpath=ws/loom-test.clj
Code: https://github.com/JonyEpsilon/loom-gorilla

Hope you enjoy it. As always, any comments gratefully received here or on 
the issue tracker.


Jony


# Changelog

## Version 0.3.1

- Generate suggested ns declaration in new file (thanks to @gfredericks and 
@modellurgist).
- Fix a bug when outputting 'list-like' values.
- Fix a bug with record type output.
- Command to re-evaluate all code in a worksheet.
- Configurable keymap.
- Get rid of standalone mode: you now always run Gorilla from inside a 
project. Makes a number of things more consistent.
- Command to reset worksheet.
- Project is shown in title bar. Makes it easier to work with multiple 
Gorilla sessions.
- Prints a message if a newer version is available.
- URL shows filename, and can load worksheet from URL (thanks to 
@gfredericks and @modellurgist).
- New UI for commands and loading files. Mouse-friendly, small-screen 
friendlier, and generally less shoddy.
- Renderer handles Cons sequences correctly.
- Change default Linux command key to alt.
- Add code to support online viewer.
- View images with `image-view` (thanks to @scottdw).
- Plots now don't always include (0,0).
- Renderer for loom graphs https://github.com/JonyEpsilon/loom-gorilla .
- Incanter integration https://github.com/JonyEpsilon/incanter-gorilla .

### Breaking changes

- Vega data now uses keywords rather than strings as keys (thanks to 
@cldellow). This will break any functions written
  to directly manipulate Vega structures. Value copy of Vega structures 
from old worksheets will also break.
- Change the gorilla-plot.core/histogram option fillOpacity to fill-opacity.

-- 
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/d/optout.


Re: Moving average from Java to Clojure

2014-07-20 Thread Jony Hudson
On Sunday, 20 July 2014 12:48:19 UTC+1, Cecil Westerhof wrote:

 or is there a better way?


Probably not the answer you're looking for, but the exponentially-weighted 
moving average doesn't require any state other than the current value:

(defn ewma [alpha] (fn [avg new] (+ (* (- 1 alpha) avg) (* alpha new


Jony

-- 
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/d/optout.


Re: futures and atoms and bears, oh my!

2014-07-15 Thread Jony Hudson
I think that's what you'd expect. This will also evaluate just fine:

(defn foo
  [x y]
  (bar x y))

but will fail at run-time too.


Jony

On Tuesday, 15 July 2014 13:07:43 UTC+1, edw...@kenworthy.info wrote:

 Creating a new project in Lein then opening it in Light Table and with 
 minimal edits:

 (ns test.core)

 (defn bar [a b c])

 (defn foo
   I don't do a whole lot.
   [a b]
   ((let [y (bar(a b))]
 (println a b Hello, World!

 foo evaluates without error despite calling bar with too few parameters.

  

-- 
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/d/optout.


Re: Protocol equivalent of Python's `repr`?

2014-07-13 Thread Jony Hudson
You might also enjoy looking at Gorilla REPL [1], which has an easily 
extensible renderer [2] for just this sort of thing. Disclosure: I'm one of 
its authors!


Jony

[1] http://gorilla-repl.org
[2] http://vimeo.com/89532785

On Sunday, 13 July 2014 18:51:40 UTC+1, Sam Raker wrote:

 I'm working my way through an intro to Clojure book, and I just got to the 
 section on protocols. I might be missing something/committing a category 
 error, but I'm wondering if there's a way to change the way a protocol is 
 represented in the repl, akin to redefining `__repr__`/`__str__` in Python. 
 The example protocol in the book involves a matrix (i.e., a vector of 
 vectors). I can do this

 (extend-protocol Matrix
 clojure.lang.IPersistentVector
 ...
 (pprint [vov] (clojure.pprint/pprint vov)))


 which works fine when I call (pprint m) on a Matrix m:

 (pprint m)
 ; [[0 0 0]
[0 0 0]
[0 0 0]]

 What I'd like is to just have the same behavior calling the variable 
 from the repl, i.e.

 m
 ; [[0 0 0]
[0 0 0]
[0 0 0]]


 Can/should this be done? Is this a job for macros? Am I just being 
 lazy/un-Clojuric and just get over it and use (pprint m)?


-- 
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/d/optout.


Re: When to prefer keywords as functions?

2014-07-03 Thread Jony Hudson
One thing to note is that while it's true keywords can be used as 
functions they can only really do one thing, which is get values from 
maps. That is to say, the keyword-function :foo is equivalent to the 
function #(get % foo). The function :foo has no relationship with the 
function foo, if it is defined. I hope that makes sense!

So, to some approximation, only use keywords as functions as a shorthand 
for getting values from maps. As others have pointed out, although the 
keyword :require is in function position above, that code never actually 
gets executed - it's just data for the ns macro. This can be one of the 
more confusing things to get straight ...


Jony


On Thursday, 3 July 2014 18:11:35 UTC+1, g vim wrote:

 I'm reading Cloujure in Action as an introduction to Clojure and, 
 although, I understand a keyword can be used as a function I don't 
 understand the difference between: 

 (ns org.currylogic.damages.http.expenses 
 (:require [clojure.data.json :as json-lib] 
[clojure.xml :as xml-core])) 

 ... and 

 (ns org.currylogic.damages.http.expenses 
 (require [clojure.data.json :as json-lib] 
   [clojure.xml :as xml-core])) 


 When is it idiomatic or even preferable to substitute a function with a 
 keyword equivalent? 


 gvim 


-- 
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/d/optout.


Re: What's clojure killer app? I don't see any.

2014-06-03 Thread Jony Hudson


On Monday, 2 June 2014 18:42:32 UTC+1, douglas smith wrote:
 

 A killer app for me and I think MANY others like me would be something 
 very similar to a Kovas' 'Session' 'pretty like Light Table'  and beefy 
 like IPythons Notebooks. 


Hope you'll excuse a shameless plug, but have you seen Gorilla REPL 
(http://gorilla-repl.org) ? It may or may not have some of the things 
you're looking for :-)


Jony 

-- 
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/d/optout.


Re: citing Clojure and EDN?

2014-05-16 Thread Jony Hudson


On Thursday, 15 May 2014 14:58:50 UTC+1, Phillip Lord wrote:


 Again, based on the dubious ID that an DOI makes things citable. 

 A URL is already citable! 


Well, there's no shortage of broken links out there to suggest that people 
have trouble keeping content associated with stable URLs. The main value of 
DOI, IMHO, is they're an explicit commitment to make something persistently 
available - just what you want for citations.


Jony

-- 
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/d/optout.


Re: Tools.nrepl middleware-dependency sorting issues

2014-05-05 Thread Jony Hudson
I'm not sure it's relevant, but one thing that caught me out is that the 
interruptible-eval middleware has a hard dependency on the pr-values 
middleware (i.e. it depends 
on #'clojure.tools.nrepl.middleware.pr-values/pr-values). I found this 
caused trouble when I was trying to insert my own pr'ing middleware.


Jony

-- 
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/d/optout.


Re: Proposing a new Clojure documentation system (in Clojure)

2014-04-30 Thread Jony Hudson
On Wednesday, 30 April 2014 19:03:24 UTC+1, Gregg Reynolds wrote:


 The one thing that I think would be genuinely useful and developer 
 friendly with respect to Clojure is a means of making type signatures 
 explicit.  Clojure may be dynamically typed, but everything has an intended 
 type, and I would like to see it.  I'm thinking of something along the way 
 Haskell and other languages express type sigs.  The paradigmatic example is 
 factorial (or fibonacci).  So given a factorial function fact I want to 
 be able to write something like (type-sig fact) and get something like Int 
 - Int.


(I think someone might have mentioned it above, but it doesn't hurt to 
repeat) you might like schema https://github.com/Prismatic/schema/ .


Jony

-- 
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/d/optout.


Re: browser lisp editor

2014-04-22 Thread Jony Hudson
Codemirror is good too for this.

http://codemirror.net


Jony


On Tuesday, 22 April 2014 05:30:23 UTC+1, Brian Craft wrote:

 Slightly off topic.

 Anyone know of a simple browser-based lisp editor that can be embedded in 
 a page? Indenting  matching parens would be sufficient. I don't need 
 evaluation.


-- 
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/d/optout.


Re: lein uberjar much faster as lein run

2014-04-22 Thread Jony Hudson
I recall reading that `lein run` uses JVM options optimised for startup 
time, not performance - as it's intended for use in development, not 
production. I can't seem to find where I read that though ...


Jony

-- 
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/d/optout.


Re: [ANN] Gorilla REPL 0.2.0 - all new extensible renderer

2014-04-16 Thread Jony Hudson
On Wednesday, 16 April 2014 06:26:33 UTC+1, Andrew Chambers wrote:

 Is there a way to rerun the whole notebook top to bottom with a hotkey?


Coming soon :-)

https://github.com/JonyEpsilon/gorilla-repl/issues/93


Jony 

-- 
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/d/optout.


Re: [ANN] Gorilla REPL 0.2.0 - all new extensible renderer

2014-04-15 Thread Jony Hudson
Thanks for the kind words chaps - glad you like it!

@Steve Are you sure your Leiningen is up to date? I've only seen this 
problem when accidentally trying to run Gorilla with Lein 1.7 (as Debian 
seems to have that version as its default install).

@Andrew Probably not what you're looking for, but there should be a 
renderer for Loom graphs soon, which shells out to GraphViz to do the heavy 
lifting. Take a look at this PR: https://github.com/aysylu/loom/pull/20 . 
Even if your data doesn't fit with loom then it might be useful for an idea.

-- 
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/d/optout.


Re: Online Gorilla REPL worksheet viewer

2014-04-07 Thread Jony Hudson
Hi Paul,

 the viewer code is pretty much all in the main project, as it shares much 
of its code with the editor. You can run your own instance of the viewer 
just by serving up the (static) files in the 'resources/public' directory 
of the gorilla-repl jar - no server side code is needed - and visiting 
view.html. At the moment, the viewer page only has functions to load from 
GitHub, but it would be a couple of lines to load data from another source 
(so long as that source talks JSONP), so it would be very easy to set up a 
private viewer. If you have a particular use-case in mind, I'm happy to 
help.


Jony

-- 
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/d/optout.


Re: Leiningen: referring to another project on local disc

2014-04-06 Thread Jony Hudson
Or, you could make a directory called 'checkouts' inside the poker project 
directory, and put a symlink in there to the testgen project directory. 
Lein will look in the checkouts directory before it looks to any 
repository. See  here:

https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies

This way is nice if you're going to work on both projects in parallel as 
you don't need to run lein install every time you change testgen.


Jony


On Sunday, 6 April 2014 14:31:55 UTC+1, Luc wrote:

 Use lein install 

 This command will install your testgen jar in your local repo folder. 
 This local repo is hit first when searching for a dependency before 
 escalating 
 to network repos if the dependency is not found there first. 

 No need for a uberjar. 

 Luc P. 


  I'm trying to reference one of my leiningen projects from another, and 
 not 
  succeeding. My error must be simple and obvious... 
  
  Essentially the projects 'poker' and 'testgen' are both in 
  /home/simon/workspace, and both are standard leiningen projects using 
 just 
  the default project template. I've done 'lein uberjar' in testgen, so 
 there 
  are the following jars: 
  
  simon@engraver:~/workspace/poker$ ls -l 
  /home/simon/workspace/testgen/target/ 
  total 3588 
  drwxr-xr-x 2 simon simon4096 Apr  2 20:04 classes 
  -rw-r--r-- 1 simon simon   5 Apr  6 00:06 repl-port 
  drwxr-xr-x 2 simon simon4096 Apr  2 20:04 stale 
  -rw-r--r-- 1 simon simon   11226 Apr  6 00:10 testgen-0.1.0-SNAPSHOT.jar 
  -rw-r--r-- 1 simon simon 3646079 Apr  6 00:10 
  testgen-0.1.0-SNAPSHOT-standalone.jar 
  
  
  In poker/project.clj I've done the following (added lines highlighted): 
  
  (defproject poker 0.1.0-SNAPSHOT 
:description Poker scoring kata 
:url http://example.com/FIXME; 
:license {:name Eclipse Public License 
  :url http://www.eclipse.org/legal/epl-v10.html} 
  :repositories [[testgen 
  file:///home/simon/workspace/testgen/target]] 
  :dependencies [[org.clojure/clojure 1.5.1] 
  [testgen 0.1.0-SNAPSHOT] 
  ]) 
  
  
  When I try to run lein repl, I get the following: 
  
  simon@engraver:~/workspace/poker$ lein repl 
  Could not find artifact testgen:testgen:jar:0.1.0-SNAPSHOT in clojars 
  (https://clojars.org/repo/) 
  Could not find artifact testgen:testgen:jar:0.1.0-SNAPSHOT in testgen 
  (file:///home/simon/workspace/testgen/target) 
  This could be due to a typo in :dependencies or network issues. 
  
  
  So clearly lein is failing to recognise the jar file(s) as the artefact 
  it's looking for. What do I need to do differently? Do I need a pom 
 file, 
  and if so what should be in it? 
  
  Cheers 
  
  Simon 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient with 
 your first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  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+u...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/d/optout. 
  
 -- 
 Softaddictslprefo...@softaddicts.ca javascript: sent by ibisMail from 
 my ipad! 


-- 
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/d/optout.


Online Gorilla REPL worksheet viewer

2014-04-04 Thread Jony Hudson
Hi folks,

 I've got a very simple online viewer for Gorilla REPL worksheets going 
here:

http://gorilla-repl.org/viewer.html

It's free, with no registration or other burdensome business. You use it by 
uploading your worksheet to GitHub, either as part of a project, or to a 
Gist, and then constructing the appropriate link as detailed on the page 
above.

Here are couple of examples to get the idea:

A symbolic regression tutorial:
http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=sr-basicspath=ws/introduction.clj
Some graph examples:
http://viewer.gorilla-repl.org/view.html?source=githubuser=JonyEpsilonrepo=gorilla-testpath=ws/graph-examples.clj

I think it's a nice easy way 
to evangelise/teach/collaborate/generally-show-off with Clojure! Looking 
forward to seeing what you have to share ...


Jony

-- 
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/d/optout.


Re: Function from a symbolic expression

2014-04-01 Thread Jony Hudson
Thanks all :)

@A. Webb: I knew it must be something dopey, thanks for the advice!

@Lee That is indeed exactly what I'm trying to do, and that method is much 
more elegant and straightforward. In fact, precisely what I'm trying to do 
is write some notes on symbolic regression for some students, which has 
come out looking quite a lot like an inferior version of the code you 
linked! Reminds me of the saying a week in the lab saves an hour in the 
library. Although, truthfully, I think the main benefit in writing the 
notes is to make sure _I_ understand it, not the students :-)


Jony

-- 
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/d/optout.


Function from a symbolic expression

2014-03-31 Thread Jony Hudson
Hi all,

 I've gotten myself stuck with what is probably a simple question, and 
wonder if someone can advise. What I want to be able to do is to take a 
symbolic expression, like '(+ 1 x) say, and turn it in to a function 
programmatically, so that I can call something like:

(def ex '(+ 1 x))
(def exf (functionalise ex 'x))
(exf 3) ;; = 4

where functionalise is the thing I want to implement, and it's taking the 
symbol to treat as an argument/variable in its second place. I can come up 
with a nasty solution:

(defn functionalise [ex var] (fn [xp] (eval (postwalk-replace {var xp} 
ex

but this has the significant downside that it does the walking every time 
the resulting function is called! 

Not being much of a macro-writer, I tried the following:

(defmacro functionalise
  [ex var]
  (let [arg (gensym)
body (postwalk-replace {var arg} ex)]
`(fn [~arg] ~body)))

But it doesn't work, in the sense that evaluating it gives something like (+ 
1 G__6779) .

Like I say I've not got much macro experience, and feel like something 
hasn't clicked in my head yet. Any clues?

Thanks in advance,


Jony

-- 
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/d/optout.


Re: [ANN] Session 0.1.3 - A live-coding environment for Clojure

2014-03-25 Thread Jony Hudson
On Monday, 24 March 2014 21:02:07 UTC, Paul Mooser wrote:

 This looks great - I saw your talk at one of the clojure conferences, and 
 I'm glad you've continued to work on this!

 I'm curious as to whether your approach to rendering is similar to that 
 used in gorilla repl (http://gorilla-repl.org) ? Is it similarly 
 extensible ? 


Let me add my thoughts to this question, and more generally about the 
overlap between Gorilla and Session. I've chatted a bit with Kovas, so 
hopefully I won't misrepresent his ideas too badly here, but if I do he can 
always chime in a tell me I'm full of widgets :-) I'll probably end up 
saying more about Gorilla than Session here, as that's what I know more 
about.

I think broadly, the renderers are going after things in the same 
direction: they both view values as primary, are not driven by side 
effects, and thus seek to capture whatever you want to view as a data 
structure. And they both respect the idea of composition and aggregation of 
values, by which I mean the way you aggregate things in the rendered output 
is just the way you'd aggregate the values. I think these are the core 
ideas which make both of the renderers powerful.

We both abstract away the web-browser, but we do it in different ways. 
Gorilla tries to not replicate anything that the browser already provides, 
so gives Clojure code the power to write arbitrary HTML snippets (and a few 
higher-level pre-baked things like latex, vega), and compose them together 
with a very simple set of high-level operations. Essentially, the only new 
trick I'm teaching the browser is how to aggregate HTML in a way that 
respects and mirrors the way Clojure values work. Session take a different 
approach, which is to completely insulate Clojure code from the 
web-browser, by defining a Clojure-side grammar for everything that can be 
rendered. And then it backs this up by allowing the user to implement the 
elements of this grammar very neatly with Clojurescript/Om. I think both 
are interesting approaches, with different advantages and disadvantages.

Specifically, with respect to extensibility, my aim with Gorilla was to 
make it as extensible as possible from the Clojure side, as I'm primarily 
interested in using it for pure Clojure work. As Kovas noted, this involves 
a compromise, in as much as the amount of interactivity in the rendered 
output is limited. For the sort of work I do (data analysis, statistics, 
modelling), interactivity of that sort is more gimmick than useful. Or to 
put it differently, the enormous amount of interactivity already offered by 
the REPL is enough :-) But I think for applications where this sort of 
interactivity is useful, then Session is really hitting the nail on the 
head. I think we'll see some really cool stuff coming up from it!

More generally, for me at least, the stuff Kovas is doing with loops and 
computations being stored as database transactions is what's really 
exciting about Session. I've deliberately aimed with Gorilla to break no 
new ground, and keep stuff simple (in the Jony Hudson sense of simplicity, 
meaning simple enough that Jony Hudson can implement a working version in 
the small amount of time he has to do this!). I want something I can do my 
work with, and I've been using a notebook interface for long enough that 
I'm used to all of its warts. But I think the idea behind Session has the 
potential to open up new workflows that are more powerful than the 
'notebook workflow'. The idea of notebooks being stored as collections of 
first class, computable data - so the results of one notebook can be used 
in another - and proper versioning of repeated interactions with the code 
are really, really interesting. I think it remains to be seen how they work 
out in practice, as there's also something nice about storing your 
notebooks as files which can go in version control, or attach to an email 
easily. But I think it's very exciting that Session is trying to go beyond 
the standard notebook idea.

So, yeah, congrats to Kovas for getting this release out - I'm looking 
forward to seeing what comes from it :-)


Jony

-- 
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/d/optout.


[ANN] Gorilla REPL 0.2.0 - all new extensible renderer

2014-03-19 Thread Jony Hudson
Hi all,

 I'm happy to announce a new release of Gorilla REPL. The number one 
comment I got from people on the original release was that it looked good, 
but they'd like to see it extended to some library or other. Jeff Rose hit 
the nail on the head with:

Being able to render values of different types is important, and I think 
it deserves a lot of attention in both the design and documentation.

So with that in mind, on to the changes:

- All new renderer. This is the main change. The new renderer is simple and 
predictable, _very_ flexible, supports first-class pluggable custom 
rendering, and really respects the structure of Clojure values. In 
particular it renders aggregates of values as you might hope, so you can 
draw lists of tables, tables of plots, associatives of tables of tables of 
plots etc. I've made a couple of videos walking through its features, and 
how easy it is to extend. I'm really pleased with how it's come out :-)

https://vimeo.com/89529751
https://vimeo.com/89532785

As per the request, there's also documentation on it. Enough to choke a 
horse!

http://gorilla-repl.org/renderer.html

- You can open multiple tabs on the same REPL. This works really nicely - 
they each get they own session, but share the REPL.

- Runs a real nREPL server now, so should work together with things like 
vim-fireplace that make their own connection to the REPL server. (I haven't 
tested this though!)

- As you might have guessed from the above, there's now a website. 
http://gorilla-repl.org 

- Numerous small bug-fixes and feature requests.

There are some minor breaking changes, hence the version bump:

- Old worksheets will need to be re-run to regenerate their output.

- Code that dabbled with the internals of gorilla-plot might need to be 
adjusted.

It's on clojars now, with coordinates [gorilla-repl 0.2.0] .

The new renderer lays the foundation for adding rendering for other 
libraries. I'd love to see support for core.matrix and Incanter, so I think 
this will be the immediate focus of development. If you maintain a library 
and would like to see it supported, then please do get in touch.

As always, all comments and criticism gratefully received.

[Proof-reading this email, I realise I sound rather pleased with myself. My 
apologies for that, but in truth I think I _am_ rather pleased with how 
this version has came together!]

Yours,


Jony

-- 
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/d/optout.


  1   2   >