Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-14 Thread Gary Johnson
Yep. Thanks for the patch, Ben. I had set 
org-babel-default-header-args:clojure to '((:noweb . "tangle")) in my 
.emacs, so I was getting the benefit of automatic noweb expansion when 
tangling (but not weaving). It's all fun and games until you break someone 
else's setup!  ;)

  ~Gary

On Wednesday, September 12, 2012 11:46:14 PM UTC-4, Ben Mabey wrote:
>
>  On 9/12/12 9:29 PM, Ben Mabey wrote:
>  
> Thanks for the great example Gary!  I've been meaning to try org-babel out 
> for a while but never got around to it.
>
> I just tried your example and when I run org-babel-tangle the code blocks 
> are not expanded into the source file, but rather the code block names are 
> just inserted into the source destination (e.g. <> 
> instead of the actual function).  Any ideas on what may be wrong?  Do you 
> have global settings that are perhaps making the tangle work differently on 
> your setup?  I was able to export the document to HTML just fine and 
> execute the clojure code, so the only issue appears to be tangling.
>  
>
> I found the problem was a missing :noweb argument:
>
> https://github.com/lambdatronic/org-babel-example/pull/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

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-12 Thread Ben Mabey

On 9/12/12 9:29 PM, Ben Mabey wrote:
Thanks for the great example Gary! I've been meaning to try org-babel 
out for a while but never got around to it.


I just tried your example and when I run org-babel-tangle the code 
blocks are not expanded into the source file, but rather the code 
block names are just inserted into the source destination (e.g. 
<> instead of the actual function).  Any 
ideas on what may be wrong?  Do you have global settings that are 
perhaps making the tangle work differently on your setup?  I was able 
to export the document to HTML just fine and execute the clojure code, 
so the only issue appears to be tangling.


I found the problem was a missing :noweb argument:

https://github.com/lambdatronic/org-babel-example/pull/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

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-12 Thread Ben Mabey
Thanks for the great example Gary! I've been meaning to try org-babel 
out for a while but never got around to it.


I just tried your example and when I run org-babel-tangle the code 
blocks are not expanded into the source file, but rather the code block 
names are just inserted into the source destination (e.g. 
<> instead of the actual function).  Any ideas 
on what may be wrong?  Do you have global settings that are perhaps 
making the tangle work differently on your setup?  I was able to export 
the document to HTML just fine and execute the clojure code, so the only 
issue appears to be tangling.


I'm using Emacs 24 and the only org specific code I have is applying 
your provided patch after requiring ob-clojure.


Thanks again for the example,
Ben

On 9/11/12 2:13 PM, Gary Johnson wrote:
I just put together a simple example repo on GitHub, containing a 
literate programming solution to the Potter Kata 
(http://codingdojo.org/cgi-bin/wiki.pl?KataPotter) using Emacs' 
org-babel mode. You can check it out here:


  https://github.com/lambdatronic/org-babel-example

Also be sure to take a look at the canonical online org-babel docs:

  http://orgmode.org/worg/org-contrib/babel/

In particular the intro section:

  http://orgmode.org/worg/org-contrib/babel/intro.html

And even though it's a little bit dated w.r.t. the current org-mode 
version in Emacs 24, this journal article on Org-Mode's literate 
programming and reproducible research features is really, really cool 
to work through (lots of nice code examples):


  http://www.jstatsoft.org/v46/i03

Happy hacking,
  ~Gary

On Saturday, September 8, 2012 4:24:38 AM UTC-4, Denis Labaye wrote:



On Thu, Sep 6, 2012 at 6:42 PM, lambdatronic > wrote:

For those people (like myself) who do a lot of Literate
Programming in Emacs using Clojure and org-babel, migrating to
nrepl and nrepl.el is somewhat non-trivial. This is because
the existing Clojure support in org-babel (ob-clojure.el)
relies on slime and swank-clojure when running
org-babel-execute-src-block (which redirects to
org-babel-execute:clojure in ob-clojure.el).

So clearly this is actually an issue for both nrepl.el and
ob-clojure.el, not simply one or the other. All the same, I've
hacked together a simple workaround that fixes the problem and
makes Literate Programming under nrepl possible once again. If
there is some slick way this could be worked into nrepl.el's
codebase that wouldn't break its existing behavior (as this
does), I'd be excited to see it.

Here we go:

;; Patch result table rendering bug in ob-clojure (NREPL version)
(defun nrepl-send-request-sync (request)
  "Send a request to the backend synchronously (discouraged).
The result is a plist with keys :value, :stderr and :stdout."
  (with-current-buffer "*nrepl-connection*"
(setq nrepl-sync-response nil)
(nrepl-send-request request (nrepl-sync-request-handler
(current-buffer)))
(while (not (plist-get nrepl-sync-response :done))
  (accept-process-output))
nrepl-sync-response))

(defun org-babel-execute:clojure (body params)
  "Execute a block of Clojure code with Babel."
  (let ((result-plist (nrepl-send-string-sync
(org-babel-expand-body:clojure body params) nrepl-buffer-ns))
(result-type  (cdr (assoc :result-type params
(org-babel-script-escape
 (cond ((eq result-type 'value)  (plist-get result-plist
:value))
   ((eq result-type 'output) (plist-get result-plist
:value))
   (t(message "Unknown
:results type!"))

Have fun!


It seems to be very interesting, I am already using Emacs /
org-mode / clojure a lot, I was aware of org-babel, but never used it.
Would you have a simple example project (on github, ...) on how to
bootstrap this ?

Thanks,

Denis

-- 
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

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 
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 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

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-12 Thread Denis Labaye
On Tue, Sep 11, 2012 at 10:13 PM, Gary Johnson  wrote:

> I just put together a simple example repo on GitHub, containing a literate
> programming solution to the Potter Kata  (
> http://codingdojo.org/cgi-bin/wiki.pl?KataPotter) using Emacs' org-babel
> mode. You can check it out here:
>
>   https://github.com/lambdatronic/org-babel-example
>
> Also be sure to take a look at the canonical online org-babel docs:
>
>   http://orgmode.org/worg/org-contrib/babel/
>
> In particular the intro section:
>
>   http://orgmode.org/worg/org-contrib/babel/intro.html
>
> And even though it's a little bit dated w.r.t. the current org-mode
> version in Emacs 24, this journal article on Org-Mode's literate
> programming and reproducible research features is really, really cool to
> work through (lots of nice code examples):
>
>   http://www.jstatsoft.org/v46/i03
>
> Happy hacking,
>   ~Gary
>


That's very cool, great example !

Thanks


>
> On Saturday, September 8, 2012 4:24:38 AM UTC-4, Denis Labaye wrote:
>>
>>
>>
>> On Thu, Sep 6, 2012 at 6:42 PM, lambdatronic  wrote:
>>
>>> For those people (like myself) who do a lot of Literate Programming in
>>> Emacs using Clojure and org-babel, migrating to nrepl and nrepl.el is
>>> somewhat non-trivial. This is because the existing Clojure support in
>>> org-babel (ob-clojure.el) relies on slime and swank-clojure when running
>>> org-babel-execute-src-block (which redirects to org-babel-execute:clojure
>>> in ob-clojure.el).
>>>
>>> So clearly this is actually an issue for both nrepl.el and
>>> ob-clojure.el, not simply one or the other. All the same, I've hacked
>>> together a simple workaround that fixes the problem and makes Literate
>>> Programming under nrepl possible once again. If there is some slick way
>>> this could be worked into nrepl.el's codebase that wouldn't break its
>>> existing behavior (as this does), I'd be excited to see it.
>>>
>>> Here we go:
>>>
>>> ;; Patch result table rendering bug in ob-clojure (NREPL version)
>>> (defun nrepl-send-request-sync (request)
>>>   "Send a request to the backend synchronously (discouraged).
>>> The result is a plist with keys :value, :stderr and :stdout."
>>>   (with-current-buffer "*nrepl-connection*"
>>> (setq nrepl-sync-response nil)
>>> (nrepl-send-request request (nrepl-sync-request-handler
>>> (current-buffer)))
>>> (while (not (plist-get nrepl-sync-response :done))
>>>   (accept-process-output))
>>> nrepl-sync-response))
>>>
>>> (defun org-babel-execute:clojure (body params)
>>>   "Execute a block of Clojure code with Babel."
>>>   (let ((result-plist (nrepl-send-string-sync
>>> (org-babel-expand-body:clojure body params) nrepl-buffer-ns))
>>> (result-type  (cdr (assoc :result-type params
>>> (org-babel-script-escape
>>>  (cond ((eq result-type 'value)  (plist-get result-plist :value))
>>>((eq result-type 'output) (plist-get result-plist :value))
>>>(t(message "Unknown :results
>>> type!"))
>>>
>>> Have fun!
>>>
>>
>> It seems to be very interesting, I am already using Emacs / org-mode /
>> clojure a lot, I was aware of org-babel, but never used it.
>> Would you have a simple example project (on github, ...) on how to
>> bootstrap this ?
>>
>> Thanks,
>>
>> Denis
>>
>>
>>
>>>  --
>>> 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
>>>
>>> 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
>>>
>>> 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 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 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

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-11 Thread Giorgio Valoti

Il giorno 07/set/2012, alle ore 15:45, lambdatronic ha scritto:

> Thanks, Tim. This looks great.
> 
> For those of you who don't want to go digging through the thread, here's the 
> summary:
> 
> Step 1. Download nrepl-0.1.4-preview from Marmalade or MELPA (depends on 
> clojure-mode 1.11).
> 
> Step 2. Add this code to your .emacs file:

Thank you! Will your patch be needed from now on to use Org with nrepl?

> […]

--
Giorgio Valoti

-- 
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

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-11 Thread Gary Johnson
I just put together a simple example repo on GitHub, containing a literate 
programming solution to the Potter Kata  
(http://codingdojo.org/cgi-bin/wiki.pl?KataPotter) using Emacs' org-babel 
mode. You can check it out here:

  https://github.com/lambdatronic/org-babel-example

Also be sure to take a look at the canonical online org-babel docs:

  http://orgmode.org/worg/org-contrib/babel/

In particular the intro section:

  http://orgmode.org/worg/org-contrib/babel/intro.html

And even though it's a little bit dated w.r.t. the current org-mode version 
in Emacs 24, this journal article on Org-Mode's literate programming and 
reproducible research features is really, really cool to work through (lots 
of nice code examples):

  http://www.jstatsoft.org/v46/i03

Happy hacking,
  ~Gary

On Saturday, September 8, 2012 4:24:38 AM UTC-4, Denis Labaye wrote:
>
>
>
> On Thu, Sep 6, 2012 at 6:42 PM, lambdatronic 
> > wrote:
>
>> For those people (like myself) who do a lot of Literate Programming in 
>> Emacs using Clojure and org-babel, migrating to nrepl and nrepl.el is 
>> somewhat non-trivial. This is because the existing Clojure support in 
>> org-babel (ob-clojure.el) relies on slime and swank-clojure when running 
>> org-babel-execute-src-block (which redirects to org-babel-execute:clojure 
>> in ob-clojure.el).
>>
>> So clearly this is actually an issue for both nrepl.el and ob-clojure.el, 
>> not simply one or the other. All the same, I've hacked together a simple 
>> workaround that fixes the problem and makes Literate Programming under 
>> nrepl possible once again. If there is some slick way this could be worked 
>> into nrepl.el's codebase that wouldn't break its existing behavior (as this 
>> does), I'd be excited to see it.
>>
>> Here we go:
>>
>> ;; Patch result table rendering bug in ob-clojure (NREPL version)
>> (defun nrepl-send-request-sync (request)
>>   "Send a request to the backend synchronously (discouraged).
>> The result is a plist with keys :value, :stderr and :stdout."
>>   (with-current-buffer "*nrepl-connection*"
>> (setq nrepl-sync-response nil)
>> (nrepl-send-request request (nrepl-sync-request-handler 
>> (current-buffer)))
>> (while (not (plist-get nrepl-sync-response :done))
>>   (accept-process-output))
>> nrepl-sync-response))
>>
>> (defun org-babel-execute:clojure (body params)
>>   "Execute a block of Clojure code with Babel."
>>   (let ((result-plist (nrepl-send-string-sync 
>> (org-babel-expand-body:clojure body params) nrepl-buffer-ns))
>> (result-type  (cdr (assoc :result-type params
>> (org-babel-script-escape
>>  (cond ((eq result-type 'value)  (plist-get result-plist :value))
>>((eq result-type 'output) (plist-get result-plist :value))
>>(t(message "Unknown :results 
>> type!"))
>>
>> Have fun!
>>
>
> It seems to be very interesting, I am already using Emacs / org-mode / 
> clojure a lot, I was aware of org-babel, but never used it.
> Would you have a simple example project (on github, ...) on how to 
> bootstrap this ? 
>
> Thanks, 
>
> Denis
>
>  
>
>>  -- 
>> 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
>> 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 
>> 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 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

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-08 Thread Denis Labaye
On Thu, Sep 6, 2012 at 6:42 PM, lambdatronic  wrote:

> For those people (like myself) who do a lot of Literate Programming in
> Emacs using Clojure and org-babel, migrating to nrepl and nrepl.el is
> somewhat non-trivial. This is because the existing Clojure support in
> org-babel (ob-clojure.el) relies on slime and swank-clojure when running
> org-babel-execute-src-block (which redirects to org-babel-execute:clojure
> in ob-clojure.el).
>
> So clearly this is actually an issue for both nrepl.el and ob-clojure.el,
> not simply one or the other. All the same, I've hacked together a simple
> workaround that fixes the problem and makes Literate Programming under
> nrepl possible once again. If there is some slick way this could be worked
> into nrepl.el's codebase that wouldn't break its existing behavior (as this
> does), I'd be excited to see it.
>
> Here we go:
>
> ;; Patch result table rendering bug in ob-clojure (NREPL version)
> (defun nrepl-send-request-sync (request)
>   "Send a request to the backend synchronously (discouraged).
> The result is a plist with keys :value, :stderr and :stdout."
>   (with-current-buffer "*nrepl-connection*"
> (setq nrepl-sync-response nil)
> (nrepl-send-request request (nrepl-sync-request-handler
> (current-buffer)))
> (while (not (plist-get nrepl-sync-response :done))
>   (accept-process-output))
> nrepl-sync-response))
>
> (defun org-babel-execute:clojure (body params)
>   "Execute a block of Clojure code with Babel."
>   (let ((result-plist (nrepl-send-string-sync
> (org-babel-expand-body:clojure body params) nrepl-buffer-ns))
> (result-type  (cdr (assoc :result-type params
> (org-babel-script-escape
>  (cond ((eq result-type 'value)  (plist-get result-plist :value))
>((eq result-type 'output) (plist-get result-plist :value))
>(t(message "Unknown :results
> type!"))
>
> Have fun!
>

It seems to be very interesting, I am already using Emacs / org-mode /
clojure a lot, I was aware of org-babel, but never used it.
Would you have a simple example project (on github, ...) on how to
bootstrap this ?

Thanks,

Denis



>  --
> 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 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

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-07 Thread lambdatronic
Thanks, Tim. This looks great.

For those of you who don't want to go digging through the thread, here's 
the summary:

Step 1. Download nrepl-0.1.4-preview from Marmalade or MELPA (depends on 
clojure-mode 1.11).

Step 2. Add this code to your .emacs file:

;; Patch ob-clojure to work with nrepl
(declare-function nrepl-send-string-sync "ext:nrepl" (code &optional ns))

(defun org-babel-execute:clojure (body params)
  "Execute a block of Clojure code with Babel."
  (require 'nrepl)
  (with-temp-buffer
(insert (org-babel-expand-body:clojure body params))
((lambda (result)
   (let ((result-params (cdr (assoc :result-params params
 (if (or (member "scalar" result-params)
 (member "verbatim" result-params))
 result
   (condition-case nil (org-babel-script-escape result)
 (error result)
 (plist-get (nrepl-send-string-sync
 (buffer-substring-no-properties (point-min) (point-max))
 (cdr (assoc :package params)))
:value

Step 3. Get Literate!
 

-- 
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

Re: Literate Programming in org-babel (ob-clojure.el) is broken under nrepl.el

2012-09-06 Thread Tim King
On Thu, Sep 6, 2012 at 9:42 AM, lambdatronic  wrote:

> For those people (like myself) who do a lot of Literate Programming in
> Emacs using Clojure and org-babel, migrating to nrepl and nrepl.el is
> somewhat non-trivial. This is because the existing Clojure support in
> org-babel (ob-clojure.el) relies on slime and swank-clojure when running
> org-babel-execute-src-block (which redirects to org-babel-execute:clojure
> in ob-clojure.el).
>
> So clearly this is actually an issue for both nrepl.el and ob-clojure.el,
> not simply one or the other. All the same, I've hacked together a simple
> workaround that fixes the problem and makes Literate Programming under
> nrepl possible once again. If there is some slick way this could be worked
> into nrepl.el's codebase that wouldn't break its existing behavior (as this
> does), I'd be excited to see it.
>
>
Hi,
You may want to check out the below thread... there has been some recent
activity in this area and nrepl.el 0.1.4-preview should have better support
for org-babel.

https://groups.google.com/d/topic/nrepl-el/txLYH9tH6AU/discussion

Cheers,
Tim

-- 
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

Re: Literate programming in emacs - any experience?

2012-03-22 Thread Michael O'Keefe
Hey Tim,

Just wanted to say thanks for this post and this is a great discussion. I 
have the privilege of being able to spend a small amount of my time working 
on "official unofficial" projects at my work. I had seen an earlier post by 
you where I think you may have posted the same code to extract source from 
a literate file. I had always been intrigued by literate programming and 
your post especially inspired me to try it out.

I've now written a substantial amount of my project in Clojure in the 
literate style. I'm using the "HTML" version of the literate syntax + 
markdown and writing in vim. I just wanted to chime in that one of the 
biggest things I've noticed was how much more scrutinized my code has 
become. In trying to describe my code to the reader, I'm looking it over 
much more than I ever normally would and it's forcing me to really think 
about my design decisions.

Anyhow, just wanted to thank you for your inspirational words and I'm 
excited to check out your video.

Sincerely,

Michael O'Keefe

On Wednesday, February 1, 2012 5:51:53 AM UTC-7, daly wrote:
>
> On Wed, 2012-02-01 at 10:43 +, Sam Aaron wrote:
> > On 30 Jan 2012, at 17:07, daly wrote:
> > > 
> > > The key result was that I discovered what I call my personal
> > > "irreducible error rate". If I do 100 things I will make 3 errors.
> > > This was independent of the task. So typing 100 characters has
> > > 3 wrong letters which were mostly caught while typing. Writing
> > > 100 lines of code had 3 errors somewhere. Composing email
> > > introduces 3 errors per 100 lines of code.
> > 
> > I wonder if that rate has changed since the time you measured it. 
> > 
> Unfortunately not. However I am now able to identify several
> errors that I continue to make. The 2/3 keys get mistyped.
> The _/+ keys get mistyped. I seem unable to overcome this.
> Which is really bad considering my hobby is computer algebra.
>
> The largest contribution to my errors is using copy/paste.
> It is responsible for about 50% of all errors. If I could
> convince myself to stop using it my error rate would drop.
> On good days I don't use it but I get lazy.
>
> Curiously I do have a lower error rate in Lisp than I do in
> other languages. In C, for instance, I get caught by things
> like float to double conversions on calls, despite knowing
> about it. In Java I miss the null case checks despite being
> aware that Java is brain-dead about null. In Python I skip
> "self"ing things. In Javascript I miss the 'var' occasionally.
>
> Lisp "just works" and works just as I expect. It eliminates
> whole categories of errors. (The most annoying thing about
> Clojure is the "null pointer exceptions" from Java.) When
> I want solid, correct code I reach for Lisp. For random
> segment faults, C. For heap exhaustion or null pointers,
> Java, etc. Rich did a marvelous thing by forcing alter to
> require dosync. It eliminates a whole class of errors. 
>
> When I find a mistake I still try to find the root cause.
> Then I try to change what I do so the mistake cannot exist.
> This changes the type of possible errors but the 3% is still
> there. I just make "more sophisticated, higher level errors".
> I am hoping that Literate Programming will raise my errors
> to truly epic proportions :-)
>
> One of my personal motivations for literate programming is
> to eliminate errors. I have no tool that will catch errors
> in reasoning, missing cases, bad design, mindless stupidity,
> and horrible inefficiency. Writing an explanation of the
> code is the best way I have found to catch errors of this
> kind. 
>
> One of Rich's stated motivations for Clojure was that he
> found concurrent programming in various languages to be
> very error prone and wanted to create a language that would
> eliminate concurrent errors. In some sense, we are trying
> to achieve similar goals.
>
> So Literate Programming is not about tools. It is about a
> change in mindset. I want to be a better programmer and this
> is an effective tool to help me generate higher quality (ie
> less buggy) code.
>
> Tim Daly
>
>
>

-- 
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

Re: Literate programming in emacs - any experience?

2012-03-22 Thread daly
On Tue, 2012-03-20 at 12:27 -0700, Tim Dysinger wrote:
> I'm using org-mode, org-babel & swank for a "living" document I'm
> writing. I'm generating a PDF which includes documentation, working
> clojure code that generates incanter graphs.  Also the generated
> incanter graphs are included in the generated (latex) PDF.
> 
> On Monday, January 23, 2012 3:14:09 AM UTC-10, Colin Yates wrote:
> Hi all,
> 
> 
> There are some excellent resources on this mailing list
> regarding literate resources, but they are more based around
> the theory rather than actual use.
You might find this of interest:

Literate Programming example with Clojure
http://youtu.be/mDlzE9yy1mk

It is a quick video of my normal literate programming workflow
(ignoring the usual git commits)

It shows 3 things:
  1) Extracting Clojure from the book and rebuilding the book PDF
  2) adding code chunks and rebuilding clojure and the book
  3) making text-only modifications and rebuilding only the PDF

> 
> 
> Has anybody got any "real world usage reports" regarding using
> literate programming in emacs?  In particular, does paredit
> and slime work inside the clojure "fragments" when using
> org.babel for example?
> 
> 
> Finally - how are people finding practising TDD with literate
> programming?  I imagine that Clojure's excellent REPL (+
> evaluating clojure forms from within a buffer) mean there are
> far less "type, extract tangled code, run tests" needed.
> Hmmm, not sure that is clear.  What I mean is, do people find
> that the ability to evaluate a clojure form from within
> org.babel (assuming that is possible!) is sufficient for TDD
> or do you find you need to type, extract the tangled code and
> then run lein (for example) to run the tests?

When you run 'make', as shown in the video, it rebuilds the program
and runs all the tests.

> 
> 
> Basically - how do y'all get on with TDDing in emacs following
> the approach of literate programming - any advice welcome!

Here is an interesting quote from Greg Wilson (http://vimeo.com/9270320)

>From a IBM 1970s study: "Hour for hour - the most effective way to get
bugs out of code is to sit and read the code, not to run it and not to
write unit tests. Code review is the best technique known for fixing
bugs. Get somebody else to read your code. Sixty to Ninety percent of
errors can be removed before the very first run of the program. And
hour for hour, if you have a choice of writing unit tests and reading
code, read the code."

Thus, literate programming, which explains the reasoning behind the
code and the issues involved, would seem to make code reviews be much
more effective. I would love to do a study about this but so far I
have not found any professors interested.

Tim Daly
d...@axiom-developer.org


-- 
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


Re: Literate programming in emacs - any experience?

2012-03-21 Thread martin_clausen
Nurullah did an excellent post on org-mode, Clojure and inferior-lisp from 
Emacs a while back:

http://nakkaya.com/2010/12/12/using-clojure-with-org-babel-and-inferior-lisp/

On Tuesday, March 20, 2012 8:27:23 PM UTC+1, Tim Dysinger wrote:
>
> I'm using org-mode, org-babel & swank for a "living" document I'm writing. 
> I'm generating a PDF which includes documentation, working clojure code 
> that generates incanter graphs.  Also the generated incanter graphs are 
> included in the generated (latex) PDF.
>
> On Monday, January 23, 2012 3:14:09 AM UTC-10, Colin Yates wrote:
>>
>> Hi all,
>>
>> There are some excellent resources on this mailing list regarding 
>> literate resources, but they are more based around the theory rather than 
>> actual use.
>>
>> Has anybody got any "real world usage reports" regarding using literate 
>> programming in emacs?  In particular, does paredit and slime work inside 
>> the clojure "fragments" when using org.babel for example?
>>
>> Finally - how are people finding practising TDD with literate 
>> programming?  I imagine that Clojure's excellent REPL (+ evaluating clojure 
>> forms from within a buffer) mean there are far less "type, extract tangled 
>> code, run tests" needed.  Hmmm, not sure that is clear.  What I mean is, do 
>> people find that the ability to evaluate a clojure form from within 
>> org.babel (assuming that is possible!) is sufficient for TDD or do you find 
>> you need to type, extract the tangled code and then run lein (for example) 
>> to run the tests?
>>
>> Basically - how do y'all get on with TDDing in emacs following the 
>> approach of literate programming - any advice welcome!
>>
>> Thanks all.
>>
>> Col
>>
>

-- 
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

Re: Literate programming in emacs - any experience?

2012-03-20 Thread Tim Dysinger
I'm using org-mode, org-babel & swank for a "living" document I'm writing. 
I'm generating a PDF which includes documentation, working clojure code 
that generates incanter graphs.  Also the generated incanter graphs are 
included in the generated (latex) PDF.

On Monday, January 23, 2012 3:14:09 AM UTC-10, Colin Yates wrote:
>
> Hi all,
>
> There are some excellent resources on this mailing list regarding literate 
> resources, but they are more based around the theory rather than actual use.
>
> Has anybody got any "real world usage reports" regarding using literate 
> programming in emacs?  In particular, does paredit and slime work inside 
> the clojure "fragments" when using org.babel for example?
>
> Finally - how are people finding practising TDD with literate programming? 
>  I imagine that Clojure's excellent REPL (+ evaluating clojure forms from 
> within a buffer) mean there are far less "type, extract tangled code, run 
> tests" needed.  Hmmm, not sure that is clear.  What I mean is, do people 
> find that the ability to evaluate a clojure form from within org.babel 
> (assuming that is possible!) is sufficient for TDD or do you find you need 
> to type, extract the tangled code and then run lein (for example) to run 
> the tests?
>
> Basically - how do y'all get on with TDDing in emacs following the 
> approach of literate programming - any advice welcome!
>
> Thanks all.
>
> Col
>

-- 
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

Re: Literate programming in emacs - any experience?

2012-03-18 Thread daly
On Sat, 2012-01-28 at 06:51 -0800, Folcon wrote:
> Hi Tim,
> 
> 
> Personally if you have done or would be interested in doing a quick
> vid cast of how you progress through your workflow, I think that would
> be very interesting.

Sorry for the delay. Here is the answer to your request.
Note that the source and PDF are at:
src: http://daly.axiom-developer.org/clojure.pamphlet
pdf: http://daly.axiom-developer.org/clojure.pdf

I have a quick video of my normal literate programming workflow
(ignoring the usual git commits).

It shows 3 things:
 1) Extracting Clojure from the book and rebuilding the book PDF.
 2) adding code chunks and rebuilding clojure and the book
 3) making text-only modifications and rebuilding only the PDF.

http://youtu.be/mDlzE9yy1mk

Tim



-- 
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


Re: Literate programming in emacs - any experience?

2012-02-01 Thread Hugo Duncan
Fogus  writes:

> I would love to see your .emacs setup around these tools.

I'll put together a blog post - my .emacs files could do with a cleanup,
so this sounds like a good excuse to get it done.

-- 
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


Re: Literate programming in emacs - any experience?

2012-02-01 Thread Fogus
I would love to see your .emacs setup around these tools.

-- 
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


Re: Literate programming in emacs - any experience?

2012-02-01 Thread Hugo Duncan
Mark Engelberg  writes:

> On Wed, Feb 1, 2012 at 5:38 AM, Hugo Duncan  wrote:
>> SLIME works fully within the code blocks. For example C-x C-e can be
>> used to evaluate expressions. Paredit also works.
>
> My understanding is that unless you use C-c C-k to evaluate the entire
> file (which I don't think works in a literate program) the expressions
> evaluate in a way that doesn't provide Clojure with line numbers,
> making stacktraces even more obtuse.  Am I wrong, or has anyone found
> a way around this issue?

I use ritz [1], which keeps track of of both repl source forms, and sets
correct line numbers when compiling functions with C-c C-c. 

Each REPL source form is numbered, and you can list them with M-x
slime-list-repl-forms.

When running a function compiled from a markdown file with C-c C-c
(which is M-x slime-compile-defun), any exception ends up showing the
line number in the markdown file. eg.

  Backtrace:
0: user$f.invoke (2012-01-14-script.md:27)

Also, exceptions land you in the debugger, so it is quite easy to see
where a problem is occurring.


[1] https://github.com/pallet/ritz

-- 
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


Re: Literate programming in emacs - any experience?

2012-02-01 Thread Mark Engelberg
On Wed, Feb 1, 2012 at 5:38 AM, Hugo Duncan  wrote:
> SLIME works fully within the code blocks. For example C-x C-e can be
> used to evaluate expressions. Paredit also works.

My understanding is that unless you use C-c C-k to evaluate the entire
file (which I don't think works in a literate program) the expressions
evaluate in a way that doesn't provide Clojure with line numbers,
making stacktraces even more obtuse.  Am I wrong, or has anyone found
a way around this issue?

-- 
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


Re: Literate programming in emacs - any experience?

2012-02-01 Thread Hugo Duncan
Colin Yates  writes:

> Has anybody got any "real world usage reports" regarding using literate 
> programming in emacs?  In particular, does paredit and slime work inside 
> the clojure "fragments" when using org.babel for example?

For the update in Pallet docs [1], we've been using Jekyll with
markdown. To edit code blocks within the markdown, I've been using
mumamo [2] in emacs, with a variant of jekyll-mumamo.el [3]. An example
of what markdown with clojure blocks looks like is the how-to for using
a server-rack with Pallet [4] (unfortunately, Jekyll doesn't use the
same fencing for code blocks as GitHub).

SLIME works fully within the code blocks. For example C-x C-e can be
used to evaluate expressions. Paredit also works.

Obviously this is not a full literate programming environment, but
someone might find it useful.

Hugo


[1] http://palletops.com/doc/
[2] http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html
[3] https://gist.github.com/1666286
[4] 
https://raw.github.com/pallet/pallet.github.com/master/doc/how-tos/_posts/2012-01-26-using-pallet-with-existing-servers.md

-- 
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


Re: Literate programming in emacs - any experience?

2012-02-01 Thread daly
On Wed, 2012-02-01 at 10:43 +, Sam Aaron wrote:
> On 30 Jan 2012, at 17:07, daly wrote:
> > 
> > The key result was that I discovered what I call my personal
> > "irreducible error rate". If I do 100 things I will make 3 errors.
> > This was independent of the task. So typing 100 characters has
> > 3 wrong letters which were mostly caught while typing. Writing
> > 100 lines of code had 3 errors somewhere. Composing email
> > introduces 3 errors per 100 lines of code.
> 
> I wonder if that rate has changed since the time you measured it. 
> 
Unfortunately not. However I am now able to identify several
errors that I continue to make. The 2/3 keys get mistyped.
The _/+ keys get mistyped. I seem unable to overcome this.
Which is really bad considering my hobby is computer algebra.

The largest contribution to my errors is using copy/paste.
It is responsible for about 50% of all errors. If I could
convince myself to stop using it my error rate would drop.
On good days I don't use it but I get lazy.

Curiously I do have a lower error rate in Lisp than I do in
other languages. In C, for instance, I get caught by things
like float to double conversions on calls, despite knowing
about it. In Java I miss the null case checks despite being
aware that Java is brain-dead about null. In Python I skip
"self"ing things. In Javascript I miss the 'var' occasionally.

Lisp "just works" and works just as I expect. It eliminates
whole categories of errors. (The most annoying thing about
Clojure is the "null pointer exceptions" from Java.) When
I want solid, correct code I reach for Lisp. For random
segment faults, C. For heap exhaustion or null pointers,
Java, etc. Rich did a marvelous thing by forcing alter to
require dosync. It eliminates a whole class of errors. 

When I find a mistake I still try to find the root cause.
Then I try to change what I do so the mistake cannot exist.
This changes the type of possible errors but the 3% is still
there. I just make "more sophisticated, higher level errors".
I am hoping that Literate Programming will raise my errors
to truly epic proportions :-)

One of my personal motivations for literate programming is
to eliminate errors. I have no tool that will catch errors
in reasoning, missing cases, bad design, mindless stupidity,
and horrible inefficiency. Writing an explanation of the
code is the best way I have found to catch errors of this
kind. 

One of Rich's stated motivations for Clojure was that he
found concurrent programming in various languages to be
very error prone and wanted to create a language that would
eliminate concurrent errors. In some sense, we are trying
to achieve similar goals.

So Literate Programming is not about tools. It is about a
change in mindset. I want to be a better programmer and this
is an effective tool to help me generate higher quality (ie
less buggy) code.

Tim Daly


-- 
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


Re: Literate programming in emacs - any experience?

2012-02-01 Thread Sam Aaron

On 30 Jan 2012, at 17:07, daly wrote:
> 
> The key result was that I discovered what I call my personal
> "irreducible error rate". If I do 100 things I will make 3 errors.
> This was independent of the task. So typing 100 characters has
> 3 wrong letters which were mostly caught while typing. Writing
> 100 lines of code had 3 errors somewhere. Composing email
> introduces 3 errors per 100 lines of code.

I wonder if that rate has changed since the time you measured it. 

Sam

---
http://sam.aaron.name

-- 
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


Re: Literate programming in emacs - any experience?

2012-01-30 Thread daly
On Sat, 2012-01-28 at 10:04 -0500, daly wrote:
> On Sat, 2012-01-28 at 06:51 -0800, Folcon wrote:
> > Hi Tim,
> > 
> > 
> > Personally if you have done or would be interested in doing a quick
> > vid cast of how you progress through your workflow, I think that would
> > be very interesting.
> 
> Sort of "extreme pair programming with everybody"? :-)
> There is no such thing as a simple job but I'll see what I can do.
> A watchable video takes time to compose.

I am composing the notes for this video and I realized I have
a piece of programming information about myself that you probably
do not have about yourself.

Years ago I wrote a program (Archive) to allow users of a time
shared mainframe to back up programs to magnetic tape. This was
a single person project. As an experiment I copied every input
at the keyboard and every output of every command. I also kept
a journal of everything I did, why I did it, and what failed.

The key result was that I discovered what I call my personal
"irreducible error rate". If I do 100 things I will make 3 errors.
This was independent of the task. So typing 100 characters has
3 wrong letters which were mostly caught while typing. Writing
100 lines of code had 3 errors somewhere. Composing email
introduces 3 errors per 100 lines of code.

Most of the errors were trivial (spelling), some were syntax
(missing delimiter), some were semantic (wrong action), some
were design (wrong solution). 

As a result of this measurement I have formed habits to look
for the 3 mistakes I know exist. For example, I am writing a
book of Axiom graphics images (a "gallery"). I have written
679 equations so far, which are going to create the images.

I know there are at least 21 uncaught errors lurking in those
equations. So before I attempt to generate the images I will
examine them in detail with an eye toward finding what I know
is there.

Literate programming is both a source of errors and a help.

It is a source of errors because I have more typing to do
and will generate bad latex and meaningless sentences, as 
well as the "standard" coding errors. So in some sense I have
added to the number of errors I WILL introduce. But the tools,
like the compiler, tex and spellcheck will at least warn me of
these failures.

However, literate programming helps because I am explaining
what I am doing to myself as well as others. This really 
reduces the "big", "costly" errors, those in the design and
implementation. There are no tools to help so I have to create
a discipline that will highlight these errors as soon as
possible.

I KNOW my intrinsic error rate. What is yours? 

What discipline can you apply to your work to find your errors?

I'm not sure how to get this important piece of self-knowledge
into the video so I thought I'm mention it here.

Tim Daly



-- 
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


Re: Literate programming in emacs - any experience?

2012-01-28 Thread Folcon
I think I could live with that :)...

-- 
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

Re: Literate programming in emacs - any experience?

2012-01-28 Thread Colin Yates
Fair enough :) - deal.  Assuming I ever get to leave my pit of despair
(trying to get a well-known javascript charting library to render
properly...how hard can these things be!).

On 28 January 2012 15:41, daly  wrote:

> On Sat, 2012-01-28 at 15:27 +, Colin Yates wrote:
> > I know I would find it incredibly helpful, and would consider paying a
> > token sum of money (£5?)...
>
> An amusing thought but no thanks.
> Buy yourself a pint and swear you'll at least try to write
> your next program in some form of literate programming.
> At the next conj I'll buy you a pint.
>
> >
> > On 28 January 2012 15:04, daly  wrote:
> > On Sat, 2012-01-28 at 06:51 -0800, Folcon wrote:
> > > Hi Tim,
> > >
> > >
> > > Personally if you have done or would be interested in doing
> > a quick
> > > vid cast of how you progress through your workflow, I think
> > that would
> > > be very interesting.
> >
> >
> > Sort of "extreme pair programming with everybody"? :-)
> > There is no such thing as a simple job but I'll see what I can
> > do.
> > A watchable video takes time to compose.
> >
> > Tim Daly
> >
> >
> >
> > --
> > 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 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 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 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

Re: Literate programming in emacs - any experience?

2012-01-28 Thread daly
On Sat, 2012-01-28 at 15:27 +, Colin Yates wrote:
> I know I would find it incredibly helpful, and would consider paying a
> token sum of money (£5?)...

An amusing thought but no thanks. 
Buy yourself a pint and swear you'll at least try to write
your next program in some form of literate programming.
At the next conj I'll buy you a pint.

> 
> On 28 January 2012 15:04, daly  wrote:
> On Sat, 2012-01-28 at 06:51 -0800, Folcon wrote:
> > Hi Tim,
> >
> >
> > Personally if you have done or would be interested in doing
> a quick
> > vid cast of how you progress through your workflow, I think
> that would
> > be very interesting.
> 
> 
> Sort of "extreme pair programming with everybody"? :-)
> There is no such thing as a simple job but I'll see what I can
> do.
> A watchable video takes time to compose.
> 
> Tim Daly
> 
> 
> 
> --
> 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 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 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


Re: Literate programming in emacs - any experience?

2012-01-28 Thread Colin Yates
I know I would find it incredibly helpful, and would consider paying a
token sum of money (£5?)...

On 28 January 2012 15:04, daly  wrote:

> On Sat, 2012-01-28 at 06:51 -0800, Folcon wrote:
> > Hi Tim,
> >
> >
> > Personally if you have done or would be interested in doing a quick
> > vid cast of how you progress through your workflow, I think that would
> > be very interesting.
>
> Sort of "extreme pair programming with everybody"? :-)
> There is no such thing as a simple job but I'll see what I can do.
> A watchable video takes time to compose.
>
> Tim Daly
>
>
>
> --
> 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 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

Re: Literate programming in emacs - any experience?

2012-01-28 Thread daly
On Sat, 2012-01-28 at 06:51 -0800, Folcon wrote:
> Hi Tim,
> 
> 
> Personally if you have done or would be interested in doing a quick
> vid cast of how you progress through your workflow, I think that would
> be very interesting.

Sort of "extreme pair programming with everybody"? :-)
There is no such thing as a simple job but I'll see what I can do.
A watchable video takes time to compose.

Tim Daly



-- 
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


Re: Literate programming in emacs - any experience?

2012-01-28 Thread Folcon
Hi Tim,

Personally if you have done or would be interested in doing a quick vid 
cast of how you progress through your workflow, I think that would be very 
interesting.

Regards,
Folcon

-- 
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

Re: Literate programming in emacs - any experience?

2012-01-28 Thread Ulises
Here's a paper that might be interesting to folk discussing in this
thread: http://www.jstatsoft.org/v46/i03/paper

Cheers

U

-- 
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


Re: Literate programming in emacs - any experience?

2012-01-24 Thread Colin Yates
Thanks Stuart.

On 24 January 2012 14:18, Stuart Sierra  wrote:

> With a little hacking, org-babel works with Clojure editing & evaluation
> in SLIME. I've been using it to write Clojure training materials.
>
> You need the latest versions of org-mode, SLIME, and clojure-mode. My
> .emacs has the relevant elisp snippets.
> http://github.com/stuartsierra/dotfiles
>
> -S
>
>  --
> 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 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

Re: Literate programming in emacs - any experience?

2012-01-24 Thread Stuart Sierra
With a little hacking, org-babel works with Clojure editing & evaluation in 
SLIME. I've been using it to write Clojure training materials.

You need the latest versions of org-mode, SLIME, and clojure-mode. My 
.emacs has the relevant elisp snippets. 
http://github.com/stuartsierra/dotfiles

-S

-- 
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

Re: Literate programming in emacs - any experience?

2012-01-24 Thread Colin Yates
The topic is literate programming in emacs, not eclipse ;).

The trivial amount of Clojure I have done so far has all been in emacs and
letting go of paredit, slime, and emacs in general is already pretty hard!

On 24 January 2012 03:06, daly  wrote:

>
> > > For Eclipse I suppose we could invent a chunk syntax
> > > and create a plugin. If people are interested perhaps we
> > > could create a Literate Clojure plugin for Eclipse. See
> > > http://www.eclipse.org/articles/Article-Your%20First%
> > > 20Plug-in/YourFirstPlugin.html
> > > That would make Clojure and Literate much more useful
> > > to Eclipse users.
> >
> > Based on CCW, or a de novo effort?
> >
> Ah. I was unaware of CCW although it has been mentioned here.
>
> I don't use Eclipse. I was just following the principle that
> "advocacy is volunteering" and, since I'm advocating doing
> literate programming and the topic is literate Clojure
> under Eclipse, I felt I needed to set up some kind of
> solution. I try to implement what I advocate (e.g. showing
> tangle for lisp code and HTML code). Otherwise I'd be
> expecting someone else to do stuff I want and that's not
> really how open source should work.
>
> So, no, if CCW is already doing this then follow their lead.
>
> Tim Daly
>
>
> --
> 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 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

Re: Literate programming in emacs - any experience?

2012-01-23 Thread Cedric Greevey
On Mon, Jan 23, 2012 at 10:06 PM, daly  wrote:
>
>> > For Eclipse I suppose we could invent a chunk syntax
>> > and create a plugin. If people are interested perhaps we
>> > could create a Literate Clojure plugin for Eclipse. See
>> > http://www.eclipse.org/articles/Article-Your%20First%
>> > 20Plug-in/YourFirstPlugin.html
>> > That would make Clojure and Literate much more useful
>> > to Eclipse users.
>>
>> Based on CCW, or a de novo effort?
>>
> Ah. I was unaware of CCW although it has been mentioned here.
>
> I don't use Eclipse. I was just following the principle that
> "advocacy is volunteering" and, since I'm advocating doing
> literate programming and the topic is literate Clojure
> under Eclipse, I felt I needed to set up some kind of
> solution. I try to implement what I advocate (e.g. showing
> tangle for lisp code and HTML code). Otherwise I'd be
> expecting someone else to do stuff I want and that's not
> really how open source should work.
>
> So, no, if CCW is already doing this then follow their lead.

CCW isn't, to my knowledge, specifically doing literate-support. But
it is an existing Clojure IDE plugin for Eclipse, so building upon
that might make more sense than creating a whole new Eclipse Clojure
IDE plugin from scratch.

-- 
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


Re: Literate programming in emacs - any experience?

2012-01-23 Thread daly

> > For Eclipse I suppose we could invent a chunk syntax
> > and create a plugin. If people are interested perhaps we
> > could create a Literate Clojure plugin for Eclipse. See
> > http://www.eclipse.org/articles/Article-Your%20First%
> > 20Plug-in/YourFirstPlugin.html
> > That would make Clojure and Literate much more useful
> > to Eclipse users.
> 
> Based on CCW, or a de novo effort?
> 
Ah. I was unaware of CCW although it has been mentioned here.

I don't use Eclipse. I was just following the principle that
"advocacy is volunteering" and, since I'm advocating doing
literate programming and the topic is literate Clojure
under Eclipse, I felt I needed to set up some kind of
solution. I try to implement what I advocate (e.g. showing
tangle for lisp code and HTML code). Otherwise I'd be
expecting someone else to do stuff I want and that's not
really how open source should work. 

So, no, if CCW is already doing this then follow their lead.

Tim Daly


-- 
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


Re: Literate programming in emacs - any experience?

2012-01-23 Thread Cedric Greevey
On Mon, Jan 23, 2012 at 6:23 PM, daly  wrote:
> On Mon, 2012-01-23 at 16:17 -0500, Cedric Greevey wrote:
>> On Mon, Jan 23, 2012 at 11:19 AM, daly  wrote:
>> > It accepts either noweb syntax for chunks, as in:
>> >    <>=
>> >      (this is lisp code)
>> >    @
>>
>> A rather unfortunate choice of delimiter if you wanted to use this
>> with Clojure code, since Clojure code frequently has internal @-signs
>> for other purposes. I don't suppose that noweb syntax was developed
>> with Clojure in mind, though, or vice-versa.
>>
>
> The noweb syntax was chosen by Norman Ramsey, the author.
> Since the tangle program processes the literate document,
> the REPL would never see the chunk syntax.

But the tangle program would, and would interpret the chunk as
stopping at the first use of @my-atom or @some-ref or @a-future...

> Instead I implemented a new latex environment called "chunk"
> so I could use \begin{chunk} as the delimiter. This means
> that the weave step is no longer required and my document
> is straight latex.

That works much better, since \end{chunk} is not valid Clojure, as
\end is not a valid character constant, and {chunk} is not a valid map
(one fewer values than keys!), so the end delimiter should never occur
accidentally inside of Clojure code. Well, there's the minor matter of
the slight chance of "\\end{chunk}" or some similar string literal, I
suppose, but it's a lot less likely than an @ character! And such a
string literal can be broken up using e.g. (str "\\en" "d{chunk}").
Though that's a bit of an ugly hack, it's only likely to arise in
exactly one instance: the Clojure code used to implement tangle
itself.

> In the HTML version I used  so that
> the weave step is not required either.

 being the delimiter, I presume. Another one that ought to be
rare in Clojure code and absent outside of string literals, though
given the frequent use of Clojure with Compojure/etc. to emit HTML,
it'll be more common there than \end{chunk}. I suppose it might also
be a valid symbol, but you'd have to be crazy to have (defn 
[foo] ...) in your code base. :)

> For Eclipse I suppose we could invent a chunk syntax
> and create a plugin. If people are interested perhaps we
> could create a Literate Clojure plugin for Eclipse. See
> http://www.eclipse.org/articles/Article-Your%20First%
> 20Plug-in/YourFirstPlugin.html
> That would make Clojure and Literate much more useful
> to Eclipse users.

Based on CCW, or a de novo effort?

-- 
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


Re: Literate programming in emacs - any experience?

2012-01-23 Thread daly
On Mon, 2012-01-23 at 16:17 -0500, Cedric Greevey wrote:
> On Mon, Jan 23, 2012 at 11:19 AM, daly  wrote:
> > It accepts either noweb syntax for chunks, as in:
> ><>=
> >  (this is lisp code)
> >@
> 
> A rather unfortunate choice of delimiter if you wanted to use this
> with Clojure code, since Clojure code frequently has internal @-signs
> for other purposes. I don't suppose that noweb syntax was developed
> with Clojure in mind, though, or vice-versa.
> 

The noweb syntax was chosen by Norman Ramsey, the author.
Since the tangle program processes the literate document,
the REPL would never see the chunk syntax. The unfortunate
side effect is that latex DOES see the chunk syntax so you
have to use a "weave" program to get straight latex.

Instead I implemented a new latex environment called "chunk"
so I could use \begin{chunk} as the delimiter. This means
that the weave step is no longer required and my document
is straight latex.

In the HTML version I used  so that
the weave step is not required either.

For Eclipse I suppose we could invent a chunk syntax
and create a plugin. If people are interested perhaps we
could create a Literate Clojure plugin for Eclipse. See
http://www.eclipse.org/articles/Article-Your%20First%
20Plug-in/YourFirstPlugin.html
That would make Clojure and Literate much more useful
to Eclipse users.

Tim Daly



-- 
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


Re: Literate programming in emacs - any experience?

2012-01-23 Thread Andy Fingerhut
I've only briefly scanned what I think is the relevant code in tangle.lisp
posted by Tim Daly, but it appears that the @ must be the first character
on a line, which with indenting I've never seen in a Clojure source file.
It would be a tiny change to make the @ required to be on a line by itself,
which would make it even less likely to ever appear in a source file.

Of course, there is nothing magic about the syntax or the tangle.lisp
source code that parses it that says a developer must use them -- I think
one of Tim's points is that these tangle programs are so simple you can
cook up one of your own very easily.  That can be an advantage or a
disadvantage, depending upon whether you want a de facto standard used by
many developers for this purpose.

Andy

On Mon, Jan 23, 2012 at 1:17 PM, Cedric Greevey  wrote:

> On Mon, Jan 23, 2012 at 11:19 AM, daly  wrote:
> > It accepts either noweb syntax for chunks, as in:
> ><>=
> >  (this is lisp code)
> >@
>
> A rather unfortunate choice of delimiter if you wanted to use this
> with Clojure code, since Clojure code frequently has internal @-signs
> for other purposes. I don't suppose that noweb syntax was developed
> with Clojure in mind, though, or vice-versa.
>
> --
> 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 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

Re: Literate programming in emacs - any experience?

2012-01-23 Thread Cedric Greevey
On Mon, Jan 23, 2012 at 11:19 AM, daly  wrote:
> It accepts either noweb syntax for chunks, as in:
>    <>=
>      (this is lisp code)
>    @

A rather unfortunate choice of delimiter if you wanted to use this
with Clojure code, since Clojure code frequently has internal @-signs
for other purposes. I don't suppose that noweb syntax was developed
with Clojure in mind, though, or vice-versa.

-- 
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


Re: Literate programming in emacs - any experience?

2012-01-23 Thread Colin Yates
Excellent - very nice!

-- 
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

Re: Literate programming in emacs - any experience?

2012-01-23 Thread Mark Engelberg
On Mon, Jan 23, 2012 at 5:14 AM, Colin Yates  wrote:
> Has anybody got any "real world usage reports" regarding using literate
> programming in emacs?  In particular, does paredit and slime work inside the
> clojure "fragments" when using org.babel for example?

I had major problems trying to get paredit to work with org.babel
mode, especially when you throw my preference for CUA mode into the
mix.  Too many of the key bindings conflict with one another.  I also
couldn't figure out how to make any of the typical keystrokes (C-c
c-k, for example, to compile a whole file) do anything useful in org
mode.

My top three wishlist for more blog reports:
1. Literate programming workflow within a typical Clojure setup (Tim's
workflow description is interesting, but as far as I can tell his way
of doing things wouldn't transfer over to my setup.  Would also be
nice to see reports from users of Eclipse, etc.).
2. "Here's how I debugged this problem" reports in various IDEs and/or
emacs setups.
3. "Here's how I profiled this program" reports in various IDEs and/or
emacs setups.

--Mark

-- 
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


Re: Literate programming in emacs - any experience?

2012-01-23 Thread daly
On Mon, 2012-01-23 at 07:18 -0800, Sam Ritchie wrote:
> I've been wondering this as well -- I'm specifically curious about how
> one might jump back and forth between literate source like this and
> the REPL. I know you can evaluate code snippets into the repl; I'm
> thinking of early steps like loading an entire namespace into the repl
> when its code exists in separate code blocks. Some command like
> "evaluate all code snippets that'll be tangled into this file."

It is trivial to write a lisp program which reads a literate file,
collects the chunks into a hash table, and writes out the chunks
into a standard text file which you can load. 

I've attached a common lisp file that I use for that purpose.
It accepts either noweb syntax for chunks, as in:
<>=
  (this is lisp code)
@
or latex syntax for chunks, as in:
\begin{chunk}{chunkname}
  (this is lisp code)
\end{chunk}

You could also write one to process straight HTML, as in:
http://axiom-developer.org/axiom-website/litprog.html

I would even be trivial to write an elisp version that runs
as an emacs command, although I've never felt the need.

Tim Daly

-- 
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;  0 AUTHOR and LICENSE
;  1 ABSTRACT
;  2 THE LATEX SUPPORT CODE
;  3 GLOBALS
;  4 THE TANGLE COMMAND
;  5 THE TANGLE FUNCTION
;  6 GCL-READ-FILE (aka read-sequence)
;  7 GCL-HASHCHUNKS
;  8 GCL-EXPAND
;  9 ISCHUNK-LATEX
; 10 ISCHUNK-NOWEB
; 11 ALLCHUNKS
; 12 makeHelpFiles
; 13 makeInputFiles



;;; 0 AUTHOR and LICENSE

;;; Timothy Daly (d...@axiom-developer.org) 
;;; License: Public Domain


;;; 1 ABSTRACT

;;; This program will extract the source code from a literate file

;;; A literate lisp file contains a mixture of latex and lisp sources code.
;;; The file is intended to be in one of two formats, either in latex
;;; format or, for legacy reasons, in noweb format.

;;; Latex format files defines a newenvironment so that code chunks
;;; can be delimited by \begin{chunk}{name}  \end{chunk} blocks
;;; This is supported by the following latex code.


;;; 2 THE LATEX SUPPORT CODE

;;; The verbatim package quotes everything within its grasp and is used to
;;; hide and quote the source code during latex formatting. The verbatim
;;; environment is built in but the package form lets us use it in our
;;; chunk environment and it lets us change the font.
;;;
;;; \usepackage{verbatim}
;;; 
;;; Make the verbatim font smaller
;;; Note that we have to temporarily change the '@' to be just a character
;;; because the \verbatim@font name uses it as a character
;;;
;;; \chardef\atcode=\catcode`\@
;;; \catcode`\@=11
;;; \renewcommand{\verbatim@font}{\ttfamily\small}
;;; \catcode`\@=\atcode

;;; This declares a new environment named ``chunk'' which has one
;;; argument that is the name of the chunk. All code needs to live
;;; between the \begin{chunk}{name} and the \end{chunk}
;;; The ``name'' is used to define the chunk.
;;; Reuse of the same chunk name later concatenates the chunks

;;; For those of you who can't read latex this says:
;;; Make a new environment named chunk with one argument
;;; The first block is the code for the \begin{chunk}{name}
;;; The second block is the code for the \end{chunk}
;;; The % is the latex comment character

;;; We have two alternate markers, a lightweight one using dashes
;;; and a heavyweight one using the \begin and \end syntax
;;; You can choose either one by changing the comment char in column 1
 
;;; \newenvironment{chunk}[1]{%   we need the chunkname as an argument
;;; {\ }\newline\noindent%make sure we are in column 1
;;; %{\small $\backslash{}$begin\{chunk\}\{{\bf #1}\}}% alternate begin mark
;;; \hbox{\hskip 2.0cm}{\bf --- #1 ---}%  mark the beginning
;;; \verbatim}%   say exactly what we see
;;; {\endverbatim%process \end{chunk}
;;; \par{}%   we add a newline
;;; \noindent{}%  start in column 1
;;; \hbox{\hskip 2.0cm}{\bf --}%  mark the end
;;; %$\backslash{}$end\{chunk\}%  alternate end mark (commented)
;;; \par% and a newline
;;; \normalsize\noindent}%and return to the document

;;; This declares the place where we want to expand a chunk
;;; Technically we don't need this because a getchunk must always
;;;

Re: Literate programming in emacs - any experience?

2012-01-23 Thread daly
On Mon, 2012-01-23 at 05:14 -0800, Colin Yates wrote:
> Hi all,
> 
> 
> There are some excellent resources on this mailing list regarding
> literate resources, but they are more based around the theory rather
> than actual use.
> 
> 
> Has anybody got any "real world usage reports" regarding using
> literate programming in emacs?  In particular, does paredit and slime
> work inside the clojure "fragments" when using org.babel for example?

I've been using literate programming for years in Axiom.
Basically I write in a buffer containing latex, my literate tool
of choice. I have a *shell* buffer open running Lisp.

The lisp code is in a "chunk" delimited by
\begin{chunk}{chunkname}
   (this is the lisp code)
\end{chunk}

All I have to do is clip the lisp code, yank it into the *shell*
buffer, and it gets evaluated.

Once I've developed a small piece of program (about 20 lines
or so), I do a complete system rebuild and run all of the tests.
If all of the tests pass I git-commit the result, push it to
the public servers, and start writing again.

> 
> 
> Finally - how are people finding practising TDD with literate
> programming?  I imagine that Clojure's excellent REPL (+ evaluating
> clojure forms from within a buffer) mean there are far less "type,
> extract tangled code, run tests" needed.  Hmmm, not sure that is
> clear.  What I mean is, do people find that the ability to evaluate a
> clojure form from within org.babel (assuming that is possible!) is
> sufficient for TDD or do you find you need to type, extract the
> tangled code and then run lein (for example) to run the tests?

Axiom has a directory of tests, all of which are also literate
documents. When I create a new test I write the new tests, run
the tests, and capture the output. The captured output is part
of the literate test document. 

When I do a system build the new test is run as part of the whole
test suite. The test results are compared against the stored
results and failures are noted.

I've attached an example of a literate test case.
> 
> 
> Basically - how do y'all get on with TDDing in emacs following the
> approach of literate programming - any advice welcome!
> 
> 
> Thanks all.
> 
> 
> Col
> 
> -- 
> 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 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\documentclass{article}
\usepackage{axiom}
\setlength{\textwidth}{400pt}
\begin{document}
\title{\$SPAD/src/input clifford.input}
\author{Timothy Daly}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{Overview}
CliffordAlgebra(n, K, Q) defines a vector space of dimension 2**n
over K, given a quadratic form Q on K**n.
\begin{verbatim}
  If e[i]  1<=i<=n is a basis for K**n then
 1, e[i] 1<=i<=n, e[i1]*e[i2] 1<=i1e3, e2*e3->e1, e3*e1->e2.
\end{verbatim}
\begin{chunk}{*}
--S 30 of 39
dual2 a ==
coefficient(a,[2,3])$Ext * i + _
coefficient(a,[3,1])$Ext * j + _
coefficient(a,[1,2])$Ext * k 
--R 
--R   Type: Void
--E 30

\end{chunk}
The vector cross product is then given by
\begin{chunk}{*}
--S 31 of 39
dual2(x*y)
--R 
--R   Compiling function dual2 with type CliffordAlgebra(3,Fraction 
--R  Polynomial Integer,MATRIX) -> CliffordAlgebra(3,Fraction 
--R  Polynomial Integer,MATRIX) 
--R
--R   (31)  (x2 y3 - x3 y2)e  + (- x1 y3 + x3 y1)e  + (x1 y2 - x2 y1)e
--R 1 2   3
--R  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
--E 31

\end{chunk} 
The Dirac Algebra used in Quantum Field Theory.
\begin{chunk}{*}
)clear p qf
 
--S 32 of 39
K := FRAC INT
--R 
--R
--R   (32)  Fraction Integer
--R Type: Domain
--E 32

--S 33 of 39
g: SQMATRIX(4, K) := [[1,0,0,0],[0,-1,0,0],[0,0,-1,0],[0,0,0,-1]]
--R 
--R
--R +1   000 +
--R ||
--R |0  - 1   00 |
--R   (33)  ||
--R |0   0   - 1   0 |
--R ||
--R +0   00   - 1+
--R   Type: SquareMatrix(4,Fraction Integer)
--E 33

--S 34 of 39
qf: QFORM(4, K) := quadraticForm g
--R 
--R
--R 

Re: Literate programming in emacs - any experience?

2012-01-23 Thread Sam Ritchie
I've been wondering this as well -- I'm specifically curious about how one
might jump back and forth between literate source like
this
and
the REPL. I know you can evaluate code snippets into the repl; I'm thinking
of early steps like loading an entire namespace into the repl when its code
exists in separate code blocks. Some command like "evaluate all code
snippets that'll be tangled into this file."

I will blog the hell out of this once I figure it out. My goal is to
rewrite Cascalog as a literate program.

On Mon, Jan 23, 2012 at 5:14 AM, Colin Yates  wrote:

> Hi all,
>
> There are some excellent resources on this mailing list regarding literate
> resources, but they are more based around the theory rather than actual use.
>
> Has anybody got any "real world usage reports" regarding using literate
> programming in emacs?  In particular, does paredit and slime work inside
> the clojure "fragments" when using org.babel for example?
>
> Finally - how are people finding practising TDD with literate programming?
>  I imagine that Clojure's excellent REPL (+ evaluating clojure forms from
> within a buffer) mean there are far less "type, extract tangled code, run
> tests" needed.  Hmmm, not sure that is clear.  What I mean is, do people
> find that the ability to evaluate a clojure form from within org.babel
> (assuming that is possible!) is sufficient for TDD or do you find you need
> to type, extract the tangled code and then run lein (for example) to run
> the tests?
>
> Basically - how do y'all get on with TDDing in emacs following the
> approach of literate programming - any advice welcome!
>
> Thanks all.
>
> Col
>
> --
> 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




-- 
Sam Ritchie, Twitter Inc
703.662.1337
@sritchie09

(Too brief? Here's why! http://emailcharter.org)

-- 
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

Re: Literate Programming in Emacs?

2012-01-13 Thread Phil Hagelberg
Andrew  writes:

> Eric asks: The only function ob-clojure uses from swank-clojure is
> swank:interactive-eval-region' (used with `slime-eval') in the
> org-babel-execute:clojure' function. Which function would now be used
> to evaluate a region of clojure code? Would `slime-eval-region'
> suffice?

Yes, clojure-test-mode uses both slime-eval and slime-eval-async; he
should pick one of these like so:

(defun clojure-test-eval (string &optional handler)
  (slime-eval-async `(swank:eval-and-grab-output ,string)
(or handler #'identity)))

(defun clojure-test-eval-sync (string)
  (slime-eval `(swank:eval-and-grab-output ,string)))

Actually swank:interactive-eval-region and friends are not elisp
functions; they are Clojure functions.

-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


Re: Literate Programming in Emacs?

2012-01-13 Thread Stuart Sierra
I was able to get org-babel evaluation working with Clojure. Requires 
latest versions of Clojure mode, Org mode, and Lein. Check out my dotfiles 
repo for examples.
https://github.com/stuartsierra/dotfiles

-S

-- 
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

Re: Literate Programming in Emacs?

2012-01-12 Thread Andrew
Eric asks: The only function ob-clojure uses from swank-clojure is 
`swank:interactive-eval-region' (used with `slime-eval') in the 
`org-babel-execute:clojure' function. Which function would now be used to 
evaluate a region of clojure code? Would `slime-eval-region' suffice?

-- 
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


Re: Literate Programming in Emacs?

2012-01-12 Thread Phil Hagelberg
Andrew  writes:

> I found [1] from Eric Schulte which says to add certain package
> archives such that ELPA finds swank-clojure... But what about the
> swank-clojure elisp package being deprecated?

swank-clojure.el is definitely deprecated, but there could still be code
out there in the wild depending upon it. If that's the case then a bug
should be opened for that package.

-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


Re: Literate Programming in Emacs?

2012-01-12 Thread Andrew
I found [1] from Eric Schulte which says to add certain package archives 
such that ELPA finds swank-clojure... But what about the swank-clojure 
elisp package being deprecated? (By the way, I do get further now... the 
clojure code evaluates)

 (setq package-archives
'(("original". "http://tromey.com/elpa/";;)
  ("gnu" . "http://elpa.gnu.org/packages/";;)
  ("marmalade"   . "http://marmalade-repo.org/packages/";;)))


[1] http://lists.gnu.org/archive/html/emacs-orgmode/2011-12/msg00629.html

-- 
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

Re: Literate Programming in Emacs?

2012-01-11 Thread Andrew
As you know, now I get 
org-babel-execute:clojure:Cannot open load file: swank-clojure

The method org-babel-execute:clojure in my 
.emacs.d/elpa/org-2029/ob-clojure.el file says (require 'swank-clojure). 
Given that the swank-clojure elisp package is deprecated and should not be 
used what should I do?

Thanks in advance

-- 
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

Re: Literate programming

2011-12-26 Thread Jay Edwards
Like this?  http://brighterplanet.github.com/flight/impact_model.html

You can see how they handle it (from a Ruby-centric perspective) here: 
https://github.com/brighterplanet/numbers/blob/gh-pages/_posts/2010-12-02-github-pages-rocco-and-rake-file-tasks.markdown

The same approach should work fine for a Clojure project.

J.


On Dec 22, 2011, at 10:14 PM, daly wrote:

> On Thu, 2011-12-22 at 17:53 -0800, nchurch wrote:
>> Firstly, there really needs to be something like a Github for literate
>> programming.  
> 
> What a great idea!
> I'll see what I can do.
> 
> Tim Daly
> 
> 
> -- 
> 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 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


Re: Literate Programming

2011-12-24 Thread daly
On Sat, 2011-12-24 at 12:56 -0600, Jay Edwards wrote:
> Like this?  http://brighterplanet.github.com/flight/impact_model.html

My first reaction, after the first reading was "almost ok".

The task is reasonably mathematical so it seems useful to 
show the equations. Unfortunately, at the end, I have to ask
myself the "Hawaii question" If someone sent me off to
hawaii (so I couldn't talk to the author), would I know enough
to maintain the program?

Well, maybe. 

I really liked that they embedded a link to the impacts web page.
That placed the problem in context.

And I especially liked
   "A multiplier to account for the extra climate impact of 
greenhouse gas emissions high in the atmosphere.

Use 2.0 after Kollmuss and Crimmins (2009)."

I was unhappy with:

=begin
  FIXME TODO date should already be coerced
=end

Really? Coerced to what, by what, for what reason, in what format?
I was just hired and asked to solve this problem.

=begin
  FIXME TODO deal with cities in multiple countries that share a name
  Tried pushing country, which works on a flight from Mexico City to 
  Barcelona, Spain because it does not include flights to Barcelona, 
  Venezuela BUT it doesn't work if we're trying to go from Montreal
  end up with flights to London, United Kingdom. Also pushing country
  breaks addition of cohorts - all 'AND' statements get changed to 'OR' 
  so you end up with all flights to that country e.g. WHERE 
  origin_airport_iata_code = 'JFK' OR origin_country_iso_3166_code =
'US'
=end

So why isn't this part of the dialog? Why does it break? Is the
database improperly structured? Do we need a schema change? Or
do we need program logic to handle this case?

The use of FIXME is horribly jarring. Get rid of it.

Think of a calculus textbook where the source code is the equations.
Now imagine that in the middle of an equation you see the above
comment. Something like:

   area = \sum_i^j x*3 =begin FIXME might be x^4 =end * y

The editor-in-chief would never let the above equation get into
the text. The FIXME should be discussed as part of the prose
rather than "in the equations". 

I don't think it would pass the code review phase with these
"FIXME" things hanging around. FIXME is the programmer's internal
dialog. Discuss the issue in the text as though you were talking
to someone other than yourself. Odds are good this is where a
design mistake (e.g. in the database schema) or a program bug lurks.

The meta-issue is distinguishing "communication" from "documentation".
Literate programming is about communication, not documentation.

Write with your audience in mind and assume that the audience is
NOT your shower committee (a shower committee is the group of people
you talk to in the shower who are not really there).

This example really skates along the border. Overall I think it is
wildly better than most examples I've seen. I'd much rather maintain
this program with the text than without it. I'd certainly place it
on the high side of the curve. 

Tim Daly






-- 
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


Re: Literate programming

2011-12-23 Thread Adam Getchell
On Thu, Dec 22, 2011 at 11:54 AM, daly  wrote:

> On Tue, 2011-12-20 at 00:26 -0800, Adam Getchell wrote:
> > BTW I looked at marginalia+leiningen, which seems to work for my
> > purposes except I'm unclear where to put the .tex files.
>
> I'm not sure what this sentence means. The .tex files ARE the
> literate program. By analogy, you seem to be asking something like
>

Please allow me to elucidate. In the literate programming tool I mentioned,
marginalia, the output is, in fact, raw HTML. A very kind gentlemen
involved with the project pointed me to the source code documentation
wherein I discerned that the LaTeX code was to be embedded directly in the
comments. Unfortunately, at present the moderately complex equations with
which I should like to document have not rendered in a fitting manner so as
to be read or understood clearly.


> "I'm writing a book but I don't know where to put the text".
>

That question, good sir, would seem to depend upon the choice of writing
implement and media. Would not a Victorian gentleman, asked to pen such a
book, eventually display a puzzled comportment were he to be presented a
computer monitor?

Clearly, as a craftsman of computer algebra tools yourself, you must agree
that the selection of implements is of some import, lest you abandon that
enterprise entirely and use Mathematica instead.

> The combination of literate + TDD seems forbidding.
>
> Are you finding it hard to explain why you wrote a test?
>

The difficulties with which I have found myself in relate to some degree to
my extreme inexperience with their methodologies, both theoretical and
practical, as well as some odd discrepancies with the particular set of
tools I have chosen. In another response to a separate missive, a gentlemen
confirmed that there were some strange interactions betwixt midje and
marginalia.

Having received the benefit of your kind reply, I must confess to a
puzzlement which has vexed me ever since I read your missive. It is this:
how should I have read it so as to receive some knowledge or insight with
which I had not formerly possessed in the moments prior? For in truth I
have not been able to discern its helpfulness thereby.

Adam Getchell

-- 
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

Re: Literate programming

2011-12-23 Thread daly
>I'll do everything I can to help.  I have tons of thoughts (as you
>might guess); but I haven't demonstrated myself to be a great coder,
>yet.  I feel like I'm a coder who needs something like literate
>programming to be great, so it's kind of a chicken-and-egg problem.
>I'm already partway there with the existence of Clojure, but although
>it's the most intelligent language I've every come across (and it is
>at least Lisp), it still isn't enough.

Do yourself a favor and lose the "great coder" meme. Or get a job
at google and remain blissfully unaware.

One of the best books I've ever read about programming is called
"Practicing: A Musician's Return to Music" where the author talks
about his development as a musician. He would receive compliments
on how great he was at playing the guitar. At one point he replies
"How would you know?". The better he got, the worse he knew he was.

Your opinion of how great you are at programming will follow a
bell curve. You'll start off coming out of college thinking you're
ok, memorize a few algorithms and order theory ("the google disease")
and think you're "great" ("google only hires great coders"). But as
you learn more you'll discover that you have SO much more to learn
and as you work on larger projects you'll discover the musician's
insight. People would rate you "great" but you'll be able to say
"How would you know?". At which point, the better you get, the worse
you'll know you are.

Anybody who rates themselves as "great" is probably on the uphill
side of the learning curve. 

The fact that you're trying to learn Clojure, moving into areas
that are beyond your comfort zone, and trying to learn literate 
programming to improve your game, all points to the fact that you
will likely reach a point where you feel that being labeled "great"
is a sign that the speaker is clueless. Give it 1 hours.

On Thu, 2011-12-22 at 20:59 -0800, nchurch wrote:
> You can see that I am writing here not only about the current good-
> enough implementation, but a \future implementation, should it ever be
> needed.  In fact, I discovered a bug in my code before I ever wrote
> the code; but the question is what to do about the bug! 

You found it. This is the magic hidden in literate programming.
Writing the natural language explanation, either before or during
coding exposes bugs before they get into the code. It exposes
hidden assumptions that will break boundary cases.

It is hard to demonstrate this effect. You have to try to write a
literate program and wait for the aha! moment to occur.

Lisps in general, and Clojure in particular, have the same aha!
moment where you transition from "how could anyone code like this?"
to "how could anyone code any other way?".

Pick some useful task, like a code-walker that will list all of
the called functions in a Clojure s-expression, and try to write
a literate version. Odds are good that you will learn more than
you ever wanted to know about Clojure. And, oh-by-the-way, 
everyone else can read your literate code and learn Clojure too.
How sweet it that?

Tim Daly


-- 
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


Re: Literate programming

2011-12-23 Thread daly
On Thu, 2011-12-22 at 20:19 -0800, nchurch wrote:
> I'll do everything I can to help.  I have tons of thoughts (as you
> might guess); but I haven't demonstrated myself to be a great coder,
> yet.  I feel like I'm a coder who needs something like literate
> programming to be great, so it's kind of a chicken-and-egg problem.
> I'm already partway there with the existence of Clojure, but although
> it's the most intelligent language I've every come across (and it is
> at least Lisp), it still isn't enough.
> 
> On Dec 22, 11:14 pm, daly  wrote:
> > On Thu, 2011-12-22 at 17:53 -0800, nchurch wrote:
> > > Firstly, there really needs to be something like a Github for literate
> > > programming.
> >
> > What a great idea!
> > I'll see what I can do.
> >
> > Tim Daly
> 
 
I looked into cloning a github into "lithub" but that path won't work.
Github does not publish its source code. Other things like gitorious
are available but the setup is a challenge.

Tim Daly


-- 
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


Re: Literate programming

2011-12-22 Thread Cedric Greevey
On Thu, Dec 22, 2011 at 11:59 PM, nchurch  wrote:
> What I really want you to notice is how we are faced with a choice:
> either we improve the library code (presumably by making split
> optionally return an array of separators matched by the regex for
> later reassembly by join, perhaps in metadata of some sort), or we go
> with a less felicitous abstraction.  There probably should be some
> sort of formal analogue to this decision point in the natural language
> text.

Seems to me that the structure is this:

A string that's written language is some alternating form like

word separator word separator ...

where a "word" consists of consecutive alphanumeric characters and a
"separator" consists of consecutive nonalphanumeric characters. The
separators in this paragraph include " ", " \"", "\" ", ". ", and " \"
\", \" \\\"\", \"\\\" \", \". \", ", as well as one more that I can't
add here without generating one more still.

One tends sometimes to want to split a string in such a fashion,
transform the words only, and then reassemble.

This in turn suggests tools like:

(wordify string) -> a seq of strings starting with a separator and
alternating words and separators. The initial separator may be "".
Something like (map #(apply str %) (group-by alphanumeric? string))
with alphanumeric? testing a character, but if the first character of
the first string in the output seq is alphanumeric, a (cons "" %)
needs to be done on the output before returning it.

(map-words* f wordified-string) -> (interleave (take-nth 2
wordified-string) (map f (take-nth 2 (next wordified-string

(map-words f string) -> (apply str (map-words* f (wordify string)))

or similar.

-- 
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


Re: Literate programming

2011-12-22 Thread nchurch
While we're on the topic of a literate Github, let me just point out
that we might want to go just a little beyond Github to the way we
write code itself.  Look again at the capitalize-every-word function I
defined above.  In my original unshortened commentary, I included also
this:

.
To split a string into words (in the simplest case):
Split the string on a separator, the canonical one being space, but
also including punctuation characters such as ",';:./(){}-+_|\
BUT: Re-assembling the string will not reproduce the old string in
general unless space is the only character that splits.  In order to
preserve this simple abstraction, we would need to rewrite split and
assemble.  We could also change the string in-place.

Ossia: To split a string into words:
Split the string on space.  Use clojure.string/split.
.

You can see that I am writing here not only about the current good-
enough implementation, but a \future implementation, should it ever be
needed.  In fact, I discovered a bug in my code before I ever wrote
the code; but the question is what to do about the bug!

What I really want you to notice is how we are faced with a choice:
either we improve the library code (presumably by making split
optionally return an array of separators matched by the regex for
later reassembly by join, perhaps in metadata of some sort), or we go
with a less felicitous abstraction.  There probably should be some
sort of formal analogue to this decision point in the natural language
text.

What does this mean for a Github?  It may meanand no doubt this
will be controversialthat once we have the capability of a
function search engine, we don't really worry about there being
canonical library code any more.  If I face this particular problem,
maybe I decide to re-write Join and Split to my own specifications.  I
then put them out there under my own namespace, and when someone needs
to use them they just type (use '[nchurch :only join split]) wherever
they are in their file, or whatever the exact incantation is (this is
one place I always need to go to the docs).  They have no trouble
browsing multiple alternatives, because they can see at a glance how
each one differs.

Now we have possibly multiple joins and splits; and so the community
no longer has a standard!  Well, it would seem to me this fits well
with Github's always-fork philosophy.  I do think there is only one
way to write a good library function, but it may be that there will
need to be a proliferation of alternativeseach making its own
argument and tradeoffs across various levels of abstraction, to return
to the theme of literate programmingbefore an optimal basis is
discovered.  (There must have been a time before phillips head vs.
regular.)  And when that happens, perhaps it goes into
clojure.string (modulo legalities about contributor agreements
something that might also be handled at the Github level, by the
way.).








On Dec 22, 11:19 pm, nchurch  wrote:
> I'll do everything I can to help.  I have tons of thoughts (as you
> might guess); but I haven't demonstrated myself to be a great coder,
> yet.  I feel like I'm a coder who needs something like literate
> programming to be great, so it's kind of a chicken-and-egg problem.
> I'm already partway there with the existence of Clojure, but although
> it's the most intelligent language I've every come across (and it is
> at least Lisp), it still isn't enough.
>
> On Dec 22, 11:14 pm, daly  wrote:
>
>
>
>
>
>
>
> > On Thu, 2011-12-22 at 17:53 -0800, nchurch wrote:
> > > Firstly, there really needs to be something like a Github for literate
> > > programming.
>
> > What a great idea!
> > I'll see what I can do.
>
> > Tim Daly

-- 
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


Re: Literate programming

2011-12-22 Thread nchurch
I'll do everything I can to help.  I have tons of thoughts (as you
might guess); but I haven't demonstrated myself to be a great coder,
yet.  I feel like I'm a coder who needs something like literate
programming to be great, so it's kind of a chicken-and-egg problem.
I'm already partway there with the existence of Clojure, but although
it's the most intelligent language I've every come across (and it is
at least Lisp), it still isn't enough.

On Dec 22, 11:14 pm, daly  wrote:
> On Thu, 2011-12-22 at 17:53 -0800, nchurch wrote:
> > Firstly, there really needs to be something like a Github for literate
> > programming.
>
> What a great idea!
> I'll see what I can do.
>
> Tim Daly

-- 
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


Re: Literate programming

2011-12-22 Thread daly
On Thu, 2011-12-22 at 17:53 -0800, nchurch wrote:
> Firstly, there really needs to be something like a Github for literate
> programming.  

What a great idea!
I'll see what I can do.

Tim Daly


-- 
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


Re: Literate programming

2011-12-22 Thread nchurch
Why should I write English in the first place?  Because it helps me to
think; and it helps me to "program" other people to think like me.
But I would never have learned English unless along the way it gave me
near-term results.  It should follow, then, that telling people to
write literate programs for the sake of posterity is never going to be
enough to change mindsets.  Taking an illiterate [sic] program and
making it literate as you are doing with Clojure will be a tour-de-
force, and an intimidating one at that.  I think that making literate
programming incrementally useful, however, is \inevitably going to
involve tooling.

Of two kinds, if you follow the logic above: social, and personal.
Firstly, there really needs to be something like a Github for literate
programming.  Why?  Because a literate program will be easier to
\understand, but also easier to \find (see example below).  Imagine a
sort of "function search engine"code liberated from namespaces and
leiningen projects, annotated and independently useable.  If there
were a community that actually \took \advantage of findability and
understandability, it would greatly speed coding (think of how much
time you have to spend hunting for documentation), and in the process
not only \promote literate programming but make it \advantageous.

On the personal side, writing English as part of coding has to be
maximally efficient for us humans: no retyping.  The identifiers we
use in English should flow into the code, and vice-versa.  Take the
following example:

To CAPITALIZE EVERY WORD in a STRING:
Split the STRING on SPACE into WORDS;
CAPITALIZE the first letter of every WORD, producing CAPITALIZED
WORDS.
Re-assemble[JOIN] the string on SPACE, to make the CAPITALIZED
STRING.

Using functions from clojure.string: split, join, capitalize; see
documentation:
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html
http://clojure.org/other_functions
http://www.fatvat.co.uk/2009/01/regular-expressions-in-clojure.html
http://clojure.github.com/clojure/clojure.string-api.html

(defn capitalize-every-word [m-string]
  (let [m-space " "
regex-space #"\s"
words (split m-string regex-space)
capitalized-words (map capitalize words)
capitalized-string (join m-space capitalized-words)]
capitalized-string))

(defn c-e-w [m-string]
  (join " " (map capitalize (split m-string #"\s"

Now there is actually not that much novel text here, and typing it out
was an enlightening exercise (to really see how enlightening, you'd
have to see the full example; but I've omitted it because the
Internets are already complaining about a long post not written in
their native Twitterese).  But it was  very cumbersome and time-
consuming to do it.  This cumbersomeness was incidental: because my
activities were split among editing, browsing, and coding, for one
thing; and also (not a complaint, Rich!) because our programming
languages do not incorporate basic English concepts like abbreviation
and definition-in-place.

(One of the big advantages of writing English along with code is that
you come up with sensible identifiers.  Without English, it's a
puzzling exercise done completely out of context.)

You can't tell me this isn't a problem for IDE's to handle.  At a
minimum, I want my IDE to link up the identifiers between code and
English.  If they do, look at what happens: the identifiers get
enriched by natural language context (notice, for instance, how JOIN
gets associated with 'assemble'), and if we push everything to our
social tool, the code ends up with more paths to be located by.

We don't yet have Google-level findability for code, of course; but I
would argue that this is not a technological defect, it is simply a
failure of description!  Once we have literate code, Google will build
a function search engine for us.


-- 
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


Re: Literate programming

2011-12-22 Thread Larry Johnson
Probably the most effective way to really hammer the benefits of literate
programming into the clojure community would be to take a manageable but
serious and well known clojure program, module, or library, and render it
into literate form.  As a clojure programmer, I'm not even there.  But as
someone to help with the literate part, I'd be thrilled to help out.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Literate programming/TDD with Leiningen + midje + marginalia

2011-12-22 Thread Linus Ericsson
Yes, it does. I had problems with some midje-facts crashing the rendering
in marginalia, but was able to just give the files as consecutive arguments
as a work around.

lein marg src/app/core.clj src/app/another/file.clj

wildcards works fine as well.

This problem with midje-facts being incompatible with marginalia needs
further investigation from my side though.

btw - is there a possibility to hide comments in emacs/slime? Midje-mode
have this great feature of collapsing fact-clausules for reducing clutter.
Would love to have the same thing when I have pages and pages of comments.

/Linus

2011/12/23 Alex Baranosky 

> Hi Adam,
>
> It seems like making it so that Marginalia allows you to specify which
> directories to use would be the ideal case, instead of feeling a need to
> lump all your tests in the src directory.
>
> I wonder if Marginalia already supports this?
>
> Alex
>
>
> On Wed, Dec 21, 2011 at 11:25 PM, Adam Getchell 
> wrote:
>
>> Thanks for all the replies!
>>
>> I'm trying midje first (keeping expectations in mind for later) as it
>> seems to support writing tests and then code (i.e. top down testing).
>>
>> (This video  was
>> useful, thanks for making it!)
>>
>> In generating documentation with marginalia (particularly useful for when
>> I figure out how to get LaTeX formulae in there), I note that marginalia
>> doesn't pickup files in /test but only /src. So it seems that I need to
>> embed tests directly in my code in order to self-document.
>>
>> Is this a huge no-no, better ways to accomplish this?
>>
>> P.S. (Newbie) what's the difference between (:use [clojure.test])
>> and (:use midje.sweet)? Both seem to work.
>>
>> --
>> "Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu
>>
>> --
>> 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 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 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

Re: Literate programming/TDD with Leiningen + midje + marginalia

2011-12-22 Thread Alex Baranosky
Hi Adam,

It seems like making it so that Marginalia allows you to specify which
directories to use would be the ideal case, instead of feeling a need to
lump all your tests in the src directory.

I wonder if Marginalia already supports this?

Alex

On Wed, Dec 21, 2011 at 11:25 PM, Adam Getchell wrote:

> Thanks for all the replies!
>
> I'm trying midje first (keeping expectations in mind for later) as it
> seems to support writing tests and then code (i.e. top down testing).
>
> (This video  was
> useful, thanks for making it!)
>
> In generating documentation with marginalia (particularly useful for when
> I figure out how to get LaTeX formulae in there), I note that marginalia
> doesn't pickup files in /test but only /src. So it seems that I need to
> embed tests directly in my code in order to self-document.
>
> Is this a huge no-no, better ways to accomplish this?
>
> P.S. (Newbie) what's the difference between (:use [clojure.test])
> and (:use midje.sweet)? Both seem to work.
>
> --
> "Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu
>
> --
> 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 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

Re: Literate programming

2011-12-22 Thread daly
On Thu, 2011-12-22 at 15:35 -0500, Larry Johnson wrote:
> 
> 
> On Thu, Dec 22, 2011 at 2:54 PM, daly 
> wrote:
> 
> >
> > The combination of literate + TDD seems forbidding.
> 
> 
> Are you finding it hard to explain why you wrote a test?
> 
> Tim Daly
> 
> 
> 
> I decided awhile back when trying to answer questions about literate
> programming, that people get caught up in the moving parts, and not in
> what the approach actually yields.  Your statement above puts it
> nicely and succinctly, and hearkens back to Knuths original articles.
> Lately I emphasize the woven text (without inititially calling it
> that)

Untangling woven text is trivial. It can be done in any language. See
http://axiom-developer.org/axiom-website/litprog.html

>  and ask the person I'm talking with to imagine writing an article or
> book about their code, how it works, with proofs where appropriate.
> That article should be written as a work of literature.  Not all
> literature has to be Hugo or Melville (or Jack Kerouac, or Gertrude
> Stein for that matter).  Some programs are more appropriately Mickey
> Spillane or Terry Pratchett, or even in the style of a manual for an
> electric razor.  The point is that it should be satisfying to read and
> comprehensively informative.
> 
> Test code, and descriptions of external libraries are no different
> from any other sections of the article or book.  The most important
> thing is to introduce them into the work at point most conducive to
> the reader's understanding.

If a test is testing something worthwhile, as opposed to the "blindly
testing that 3=3" mindset, then it probably only takes a couple lines
to motivate why you need the test. A test paragraph could contain the
details. So if you're writing a hash table implementation, the test
code of overflow chaining could explain what problems might occur (e.g.
what happens when the table is actually full? How do you detect that
the overflow chain has looped?, etc.)

So if you wrote the hash table implementation code in literate form
then each test could explain (and test) a particular boundary case or
issue that might arise. 

This has the effect of motivating tests that are detailed, based on 
real issues, and handle boundary cases clearly.

> 
> I really believe that there's no programming or engineering
> methodology which doesn't lend itself to literate programming.  If it
> can be described, it can be presented in the form of an article.  If
> it can't be describe in human language it's probably terrible code.

Test cases don't have to appear as "test cases". They appear in the
text as either example code (useful for the reader but also testing)
or as explanations of possible failures, misuse, misapplication, or
boundary cases.

This is especially powerful if you focus your tests on 
precondition/postcondition testing. See Hoare's paper 
"An Axiomatic Basis for Computer Programming"
http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.116.2392

Using Hoare's ideas to focus the development of your test cases means
that your tests have a good theoretical basis. They check for the
conditions that should survive refactoring. Requiring precondition
postcondition tests, along with clearly written natural language
explanations, could be part of the peer code review prior to
accepting new or revised code into the main line.

Better yet, in a literate program, you can explain what the invariant
is, why it is important, and what breaks when you violate it. So
testing now has a good formal basis rather than random 3=3 tests.

We can be so much better programmers. 
Raise your game.
Be literate.

Tim Daly



-- 
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


Re: Literate programming

2011-12-22 Thread Larry Johnson
On Thu, Dec 22, 2011 at 2:54 PM, daly  wrote:

>
> >
> > The combination of literate + TDD seems forbidding.
>
> Are you finding it hard to explain why you wrote a test?
>
> Tim Daly
>
>
I decided awhile back when trying to answer questions about literate
programming, that people get caught up in the moving parts, and not in what
the approach actually yields.  Your statement above puts it nicely and
succinctly, and hearkens back to Knuths original articles.  Lately I
emphasize the woven text (without inititially calling it that) and ask the
person I'm talking with to imagine writing an article or book about their
code, how it works, with proofs where appropriate.  That article should be
written as a work of literature.  Not all literature has to be Hugo or
Melville (or Jack Kerouac, or Gertrude Stein for that matter).  Some
programs are more appropriately Mickey Spillane or Terry Pratchett, or even
in the style of a manual for an electric razor.  The point is that it
should be satisfying to read and comprehensively informative.

Test code, and descriptions of external libraries are no different from any
other sections of the article or book.  The most important thing is to
introduce them into the work at point most conducive to the reader's
understanding.

I really believe that there's no programming or engineering methodology
which doesn't lend itself to literate programming.  If it can be described,
it can be presented in the form of an article.  If it can't be describe in
human language it's probably terrible code.

Larry

-- 
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

Re: Literate programming

2011-12-22 Thread daly
On Tue, 2011-12-20 at 00:26 -0800, Adam Getchell wrote:
> 
> 
> On Fri, Oct 28, 2011 at 2:45 PM, Damion Junk  wrote:
> I have also been using Emacs/Org-mode/Babel/R lately, mostly
> as a way to have easily modifiable write up and source code
> for assignments in statistics courses. I suppose this is one
> valid use, but I'm using it less to communicate code meaning
> and more as a convenient way to perform analysis, look at the
> results, and talk about them all in the same place, and then
> to easily generate documentation of my efforts [LaTeX output].
> 
> 
> I'm interested in how you're including LaTeX in your code, as I'm
> writing models which require LaTeX to express what they're modelling.
> 
> 
> BTW I looked at marginalia+leiningen, which seems to work for my
> purposes except I'm unclear where to put the .tex files. 

I'm not sure what this sentence means. The .tex files ARE the
literate program. By analogy, you seem to be asking something like
"I'm writing a book but I don't know where to put the text".

> 
> 
> The combination of literate + TDD seems forbidding.

Are you finding it hard to explain why you wrote a test?

Tim Daly



-- 
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


Re: Literate programming

2011-12-22 Thread Adam Getchell
On Fri, Oct 28, 2011 at 2:45 PM, Damion Junk  wrote:

> I have also been using Emacs/Org-mode/Babel/R lately, mostly as a way to
> have easily modifiable write up and source code for assignments in
> statistics courses. I suppose this is one valid use, but I'm using it less
> to communicate code meaning and more as a convenient way to perform
> analysis, look at the results, and talk about them all in the same place,
> and then to easily generate documentation of my efforts [LaTeX output].


I'm interested in how you're including LaTeX in your code, as I'm writing
models which require LaTeX to express what they're modelling.

BTW I looked at marginalia+leiningen, which seems to work for my purposes
except I'm unclear where to put the .tex files.

The combination of literate + TDD seems forbidding.

Damion
>

Adam
-- 
"Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu

-- 
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

Re: Literate Programming in Emacs?

2011-12-07 Thread Robert McIntyre
Here's a pew literate programs I've written, as well as the website on
which they are hosted.

http://hg.bortreb.com/abomination/
http://hg.bortreb.com/aurellem/
http://hg.bortreb.com/cortex/

http://www.aurellem.com

I use some emacs scripts to automate tangling and weaving.
http://hg.bortreb.com/org-tools/
http://hg.bortreb.com/repl/

sincerely,
--Robert McIntyre

On Tue, Nov 29, 2011 at 7:31 PM, Stuart Sierra
 wrote:
> Haven't done any recently. A long, long time ago I wrote a Common Lisp
> FFI tool using a Literate Programming tool called noweb.
>
> It's so old it predates GitHub: http://stuartsierra.com/software/perl-in-lisp
>
> -S
>
> --
> 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 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


Re: Literate Programming in Emacs?

2011-11-29 Thread Stuart Sierra
Haven't done any recently. A long, long time ago I wrote a Common Lisp
FFI tool using a Literate Programming tool called noweb.

It's so old it predates GitHub: http://stuartsierra.com/software/perl-in-lisp

-S

-- 
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


Re: Literate Programming in Emacs?

2011-11-29 Thread daly
I would be really interested to see some examples of
literate programs. Please consider releasing them as
open source, possibly pushed to github.

Tim Daly

On Tue, 2011-11-29 at 11:26 -0800, Stuart Sierra wrote:
> Here's the relevant bit of my .emacs for Babel + Clojure:
> https://github.com/stuartsierra/dotfiles/blob/cb88b1ca020fd5beebb3de092f12aa27daddd779/.emacs#L203
> 
> This requires Org mode version 7.7.
> 
> I mostly use inferior-lisp mode instead of SWANK/SLIME.
> 
> -S
> 


-- 
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


Re: Literate Programming in Emacs?

2011-11-29 Thread Stuart Sierra
Here's the relevant bit of my .emacs for Babel + Clojure:
https://github.com/stuartsierra/dotfiles/blob/cb88b1ca020fd5beebb3de092f12aa27daddd779/.emacs#L203

This requires Org mode version 7.7.

I mostly use inferior-lisp mode instead of SWANK/SLIME.

-S

-- 
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


Re: Literate Programming in Emacs?

2011-11-29 Thread Phil Hagelberg
On Tue, Nov 29, 2011 at 8:34 AM, Andrew  wrote:
> How is it that you have swank-clojure in your elpa directory? M-x
> list-packages does not have swank-clojure as an option.

The swank-clojure elisp package is deprecated and should not be used.

> Why does your elpa directory have 1.1.0 and your project file have 1.3.0?

swank-clojure.el was hard-coded to use Clojure 1.1.0 way back in the
day, which is part of the reason it's deprecated.

-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


Re: Literate Programming in Emacs?

2011-11-29 Thread Andrew
Thanks -- it does help somewhat...

   1. How is it that you have swank-clojure in your elpa directory? M-x 
   list-packages does not have swank-clojure as an option.
   2. Why does your elpa directory have 1.1.0 and your project file have 
   1.3.0?
   3. Is there a choice between SLIME and inferior lisp when doing literate 
   programming in emacs? I want to keep all of my crutches like paredit-mode, 
   syntax highlighting, symbol completion, etc. Do I have to be in an inferior 
   lisp and lose all that?
   

-- 
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

Re: Literate Programming in Emacs?

2011-11-24 Thread ck

I did not encounter that particular problem. But to compare, my
project file is

  ...
  :dependencies [[org.clojure/clojure "1.3.0"]]
  :dev-dependencies [[jline "0.9.94"]
 [swank-clojure "1.3.0" :exclusions [org.clojure/
clojure]]]
  ...


and my current ~/.emacs.d/elpha folder contains

  clojure-mode-1.11.4/
  clojure-test-mode-1.6.0/
  durendal-0.2/
  org-2023/
  slime-20100404.1/
  slime-repl-20100404/
  swank-clojure-1.1.0/

using Phil Hagelberg's emacs-starter-kit (https://github.com/
technomancy/emacs-starter-kit).


I would also like to point to this excellent blog by Nurullah Akkaya

  http://nakkaya.com/2010/12/12/using-clojure-with-org-babel-and-inferior-lisp/

for using org-babel-clojure with inferior-lisp.

Hope that helps.

-ck

On Nov 23, 4:36 pm, Andrew  wrote:
> Thanks! Next step: org-babel-execute:clojure:Cannot open load file:
> swank-clojure ...

-- 
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


Re: Literate Programming in Emacs?

2011-11-23 Thread Andrew
Thanks! Next step: org-babel-execute:clojure:Cannot open load file: 
swank-clojure ...

-- 
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

Re: Literate Programming in Emacs?

2011-11-23 Thread ck
Andrew:

Make sure you have

(require 'ob-clojure)

in your controlling emacs file (mine is .el).

-ck

On Nov 23, 12:00 pm, Andrew  wrote:
> Here's my attempt at following the steps 
> athttp://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html. 
> *The
> result is org-babel-execute-src-block: No org-babel-execute function for
> clojure *
>
>    1. The recommendation was to follow "Connecting with SLIME" from
>    https://github.com/technomancy/swank-clojurewhich involves M-x
>    slime-connect, so I looked for that in
>    http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html...
>    It has a section called "Server/Set up Leiningen project.clj file" which
>    says add a dev-dependency in my project.clj file for leiningen/lein-swank.
>    So I picked [leiningen/lein-swank "1.2.0-SNAPSHOT"]
>    2. lein deps
>    3. lein swank
>    4. It said I should add swank-clojure as a dev-dependency too. So I
>    picked [swank-clojure "1.4.0-SNAPSHOT"]
>    5. lein deps
>    6. lein swank
>    7. M-x slime-connect ... connected
>    8. open tmp.org file and place cursor within a block of code and do C-c
>    C-c
>    9. Evaluate this block of code on your system? y
>
> org-babel-execute-src-block: No org-babel-execute function for clojure!
>
> What am I missing? I have the following:
>
>   clojure-mode      1.11.4      installed
>   org               2022    installed
>   slime             20100404.1  installed
>   slime-repl        20100404    installed
>
> ... and lein plugin swank-clojure (1.3.3 I think)

-- 
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


Re: Literate Programming in Emacs?

2011-11-23 Thread Andrew
Here's my attempt at following the steps at 
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html. *The 
result is org-babel-execute-src-block: No org-babel-execute function for 
clojure *
   
   1. The recommendation was to follow "Connecting with SLIME" from 
   https://github.com/technomancy/swank-clojure which involves M-x 
   slime-connect, so I looked for that in 
   http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html ... 
   It has a section called "Server/Set up Leiningen project.clj file" which 
   says add a dev-dependency in my project.clj file for leiningen/lein-swank. 
   So I picked [leiningen/lein-swank "1.2.0-SNAPSHOT"]
   2. lein deps
   3. lein swank
   4. It said I should add swank-clojure as a dev-dependency too. So I 
   picked [swank-clojure "1.4.0-SNAPSHOT"]
   5. lein deps
   6. lein swank
   7. M-x slime-connect ... connected
   8. open tmp.org file and place cursor within a block of code and do C-c 
   C-c
   9. Evaluate this block of code on your system? y
   
org-babel-execute-src-block: No org-babel-execute function for clojure!

What am I missing? I have the following:

  clojure-mode  1.11.4  installed
  org   2022installed
  slime 20100404.1  installed
  slime-repl20100404installed

... and lein plugin swank-clojure (1.3.3 I think)

-- 
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

Re: Literate Programming in Emacs?

2011-11-22 Thread Devin Walters
I have a bit of a weird setup I think. I put clojure-1.3.0.jar in ~/.clojure 
and set a variable for org-mode according to the advanced setup instructions. I 
also run org-mode from source. As a result I make sure to add org-mode's lisp/ 
dir to my load path.

Sent via mobile

On Nov 22, 2011, at 4:28 PM, Andrew  wrote:

> For those who do Literate Programming in Emacs, what do you use? I was 
> looking at org-babel-clojure which says:
>  
> You will need to install the following packages: clojure-mode, swank-clojure, 
> slime, slime-repl
> 
> But when I list-packages, swank-clojure is not in the list... It also says I 
> ought to be able to M-x slime ... but that results in "no such file or 
> directory, lisp"
> -- 
> 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 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

Re: Literate Programming in Emacs?

2011-11-22 Thread Andreas Kostler
It should work as expected if you follow
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html
and use the stand-alone version of swank-clojure (Section Connecting
with SLIME https://github.com/technomancy/swank-clojure).
Looking at ob-clojure.el http://kanis.fr/hg/lisp/org/ob-clojure.el
might give you some clues as well.
Hope that helps
Andreas

On 23 November 2011 09:04, Andrew  wrote:
> I should add that I am starting with a working setup (able to M-x
> clojure-jack-in and compile and execute stuff in the REPL as expected).
>
> --
> 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



-- 
**
Andreas Koestler, Software Engineer
Leica Geosystems Pty Ltd
270 Gladstone Road, Dutton Park QLD 4102
Main: +61 7 3891 9772     Direct: +61 7 3117 8808
Fax: +61 7 3891 9336
Email: andreas.koest...@leica-geosystems.com

www.leica-geosystems.com*

when it has to be right, Leica Geosystems

Please  consider the environment before printing this email.

-- 
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


Re: Literate Programming in Emacs?

2011-11-22 Thread Andrew
I should add that I am starting with a working setup (able to M-x 
clojure-jack-in and compile and execute stuff in the REPL as expected).

-- 
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

Re: Literate Programming example

2011-11-21 Thread Thorsten Wilms

On 11/20/2011 11:18 PM, Daniel Jomphe wrote:

On Sunday, November 20, 2011 5:50:31 AM UTC-5, thorwil wrote:

I'm following one or the other Free Software project where an
incredible
amount of discussions happen regarding work-flow and features. So much
thought, so many decisions on details, but for the most part, the
implementation is all that remains. But the research, concepts and
conscious decisions regarding trade-offs could actually outlive any
implementation, they are portable and could be argued to be more
valuable.

You raised my curiosity. Would you mind sharing a link? ;)


My prime example would be Ardour (ardour.org). Almost all the action 
happens on IRC, where the lead developer has many interactions with a 
few other coders and users, among them professional sound-engineers who 
provide critical insight into certain scenarios/work-flows and the 
features of related hard-and software.


Starting to be off-topic, so this is as far as I will take it on this 
list ;)



--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Literate Programming example

2011-11-20 Thread Daniel Jomphe
On Sunday, November 20, 2011 6:17:13 AM UTC-5, robermann79 wrote:
>
> FYI: some time ago the Opensuse project used such a collaborative tool
> (http://www.co-ment.com) in order to get a shared mindset of its
> goals.
> This was the result, see how clicking on higlight words points to
> their comments:
> https://lite.co-ment.com/text/lNPCgzeGHdV/view/


Interesting. And funny, considering I bought the cochapter.com domain to do 
something similar. I'm yet to deliver the application that's planned to 
power that domain.

-- 
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

Re: Literate Programming example

2011-11-20 Thread Daniel Jomphe
On Sunday, November 20, 2011 5:50:31 AM UTC-5, thorwil wrote:
>
> I'm following one or the other Free Software project where an incredible 
> amount of discussions happen regarding work-flow and features. So much 
> thought, so many decisions on details, but for the most part, the 
> implementation is all that remains. But the research, concepts and 
> conscious decisions regarding trade-offs could actually outlive any 
> implementation, they are portable and could be argued to be more valuable.
>
You raised my curiosity. Would you mind sharing a link? ;) 

-- 
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

Re: Literate Programming example

2011-11-20 Thread Roberto Mannai
FYI: some time ago the Opensuse project used such a collaborative tool
(http://www.co-ment.com) in order to get a shared mindset of its
goals.
This was the result, see how clicking on higlight words points to
their comments:
https://lite.co-ment.com/text/lNPCgzeGHdV/view/

On Sat, Nov 19, 2011 at 10:21 PM, Daniel Jomphe  wrote:
> With the tools available to us today, there's no reason why we at least
> shouldn't have everything needed to make literate programming more seamless,
> more natural. For example, while reading your toy example, I found myself
> wanting to ask a question or comment on your thoughts a few times. If your
> book had been displayed on a dynamic website geared towards literate
> programming, I might have been able to click on a paragraph and write my
> question/comment right there. And then, after a short conversation there,
> you would have integrated the fruits of our conversation directly into the
> end result. Thus each new reader would have been an occasion to improve the
> book. ...It's nothing surprising since this kind of review system already
> exists in some publishers' toolkits.

-- 
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


Re: Literate Programming example

2011-11-20 Thread Thorsten Wilms

On 11/19/2011 10:21 PM, Daniel Jomphe wrote:

With the tools available to us today, there's no reason why we at least
shouldn't have everything needed to make literate programming more
seamless, more natural. For example, while reading your toy example, I
found myself wanting to ask a question or comment on your thoughts a few
times. If your book had been displayed on a dynamic website geared
towards literate programming, I might have been able to click on a
paragraph and write my question/comment right there. And then, after a
short conversation there, you would have integrated the fruits of our
conversation directly into the end result. Thus each new reader would
have been an occasion to improve the book. ...It's nothing surprising
since this kind of review system already exists in some publishers'
toolkits.


Especially with support for discussions and iterations, such 
infrastructure could be used for design in general.


I'm following one or the other Free Software project where an incredible 
amount of discussions happen regarding work-flow and features. So much 
thought, so many decisions on details, but for the most part, the 
implementation is all that remains. But the research, concepts and 
conscious decisions regarding trade-offs could actually outlive any 
implementation, they are portable and could be argued to be more valuable.


So funny as it might sound, there's a need for literate design!


--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Literate Programming example

2011-11-19 Thread Daniel Jomphe
On Saturday, November 19, 2011 2:37:48 PM UTC-5, TimDaly wrote:
>
> However, as Knuth points out and as I've already experienced, writing
> a program in literate form vastly reduces the errors. There are two
> causes I can find. 
>
> First, if I have to write an explanation then I have to justify my
> poor code hacks. Sometimes I find that I rewrite the code because the
> very act of explaining the bad code made me realize that the code is
> bad. I find I have to talk about memory allocations so I catch leaks.
> I have to talk about argument handling so I end up proving that the
> arguments are correct, or I end up checking for possible failures.
>
> Second, because other people can see the reasoning at the code review,
> they can chastise me for failing to explain, or explaining things that
> the code does not do, or just plain failing to implement a correct
> solution.
>
With the tools available to us today, there's no reason why we at least 
shouldn't have everything needed to make literate programming more 
seamless, more natural. For example, while reading your toy example, I 
found myself wanting to ask a question or comment on your thoughts a few 
times. If your book had been displayed on a dynamic website geared towards 
literate programming, I might have been able to click on a paragraph and 
write my question/comment right there. And then, after a short conversation 
there, you would have integrated the fruits of our conversation directly 
into the end result. Thus each new reader would have been an occasion to 
improve the book. ...It's nothing surprising since this kind of review 
system already exists in some publishers' toolkits.

Another thing that appeals to me regarding Tangle, is the fact that it may 
be used to keep things DRY. For example, when we have many arity-overloaded 
implementations of a function, some of their arguments are repeated, and we 
need to duplicate their api docs. Tangle could be leveraged to get rid of 
this duplication.

-- 
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

Re: Literate Programming example

2011-11-19 Thread daly
On Sat, 2011-11-19 at 14:35 +0100, Laurent PETIT wrote:
> Hello,
> 
> 2011/11/19 TimDaly 
> On Fri, 2011-11-18 at 20:02 -0800, Daniel Jomphe wrote:
> > On Friday, November 18, 2011 7:17:08 AM UTC-5, TimDaly
> wrote:
> > Many of you asked me to show an example of a
> literate
> > program and demonstrate the use of the tangle
> function.
> >
> > I usually use Latex for literate work but I've done
> > this example using HTML and  tags.
> >
> > I've written a self-referential literate program
> that
> > explains the details of the tangle function in
> literate
> > form. You can find the web page at
> >
> >
> http://daly.literatesoftware.com/lithtml/litprog.html
> >
> > I have read your literate program, and must recognize that I
> know how
> > tangle works even though I didn't want to really read the
> source code.
> > I read your prose all the way through. I still haven't read
> the source
> > code;
> 
> 
> In fact, that's the whole point. You don't read the equations
> in a
> calculus textbook either. You read the words. The equations
> are icons.
> If you understood the text and "spoke" mathematics you could
> probably
> write the equations.
> 
> In programming we can reach the same level of literacy.
> Reading just
> the words in the literate version it should be possible to
> recreate
> the program in your favorite language. Note that you would be
> creating
> a different program with different design decisions but the
> same
> functionality.
> 
> > I didn't feel the need to read it. Were I to maintain your
> program,
> > I'd have more than enough confidence to start hacking the
> code right
> > now.
> 
> 
> One thing worth trying would be to code the same program in
> Clojure.
> 
> The tangle program is conceptually very simple but there are a
> lot
> of low level design decisions that I would make differently.
> For
> example, there are loops in the C program which would go away.
> 
> Would you map read or would you slurp? Mapping a read function
> allows
> transforming "& lt;" to < at read time. This does not matter
> in the C
> program because the buffer is mutable but it would matter in
> Clojure.
> 
> Would you use the Clojure pattern language to find the 
> tags?
> Would you be able to parse out the string from the id? C
> encourages
> character-level hacking but Clojure would be much more
> powerful.
> 
> >
> >
> > I think this speaks very positively about literate
> programming. What
> > remains to be seen is how much (or not) I'm going to
> practice it in
> > the future.
> 
> 
> If you do try to rewrite it in Clojure please post the
> program. I
> would be very interested to see how Clojure's concise syntax
> and
> semantics get reflected in your design decisions.
> 
> The tangle program in Clojure might turn out to be a single
> s-expression of only a few lines. The code density would be a
> huge win but a literate version would still have to have the
> vitals of the story. Remember that the key test for a literate
> program is the "independence test". Someone can read it
> without
> talking to you, understand how it works, and be able to change
> it.
> 
> >
> >
> > What do you think of marginalia? It's a bit the reverse of
> tangle; it
> > assembles all those 70's files together into this book you
> might want
> > to read. Is it sound or not? Have your thoughts changed from
> what you
> > wrote in [1]?
> >
> >
> > [1] http://goo.gl/cXWzF
> 
> 
> Literate programming is a mindset, not a tool. You can write a
> literate program in anything, including marginalia.
> 
> That said, I have yet to see a Clojure program that lays out a
> story
> so I can sit and read it. For a real challenge, if you try to
> write
> tangle in Clojure, try writing the story in marginalia. I'm
> sure
> Fogus would welcome the feedback.
> 
> 
> The readability aspect is a real feature. Heck, you could even
> give
> your programs to a company so th

Re: Literate Programming example

2011-11-19 Thread Laurent PETIT
Hello,

2011/11/19 TimDaly 

> On Fri, 2011-11-18 at 20:02 -0800, Daniel Jomphe wrote:
> > On Friday, November 18, 2011 7:17:08 AM UTC-5, TimDaly wrote:
> > Many of you asked me to show an example of a literate
> > program and demonstrate the use of the tangle function.
> >
> > I usually use Latex for literate work but I've done
> > this example using HTML and  tags.
> >
> > I've written a self-referential literate program that
> > explains the details of the tangle function in literate
> > form. You can find the web page at
> >
> > http://daly.literatesoftware.com/lithtml/litprog.html
> >
> > I have read your literate program, and must recognize that I know how
> > tangle works even though I didn't want to really read the source code.
> > I read your prose all the way through. I still haven't read the source
> > code;
>
> In fact, that's the whole point. You don't read the equations in a
> calculus textbook either. You read the words. The equations are icons.
> If you understood the text and "spoke" mathematics you could probably
> write the equations.
>
> In programming we can reach the same level of literacy. Reading just
> the words in the literate version it should be possible to recreate
> the program in your favorite language. Note that you would be creating
> a different program with different design decisions but the same
> functionality.
>
> > I didn't feel the need to read it. Were I to maintain your program,
> > I'd have more than enough confidence to start hacking the code right
> > now.
>
> One thing worth trying would be to code the same program in Clojure.
>
> The tangle program is conceptually very simple but there are a lot
> of low level design decisions that I would make differently. For
> example, there are loops in the C program which would go away.
>
> Would you map read or would you slurp? Mapping a read function allows
> transforming "& lt;" to < at read time. This does not matter in the C
> program because the buffer is mutable but it would matter in Clojure.
>
> Would you use the Clojure pattern language to find the  tags?
> Would you be able to parse out the string from the id? C encourages
> character-level hacking but Clojure would be much more powerful.
>
> >
> >
> > I think this speaks very positively about literate programming. What
> > remains to be seen is how much (or not) I'm going to practice it in
> > the future.
>
> If you do try to rewrite it in Clojure please post the program. I
> would be very interested to see how Clojure's concise syntax and
> semantics get reflected in your design decisions.
>
> The tangle program in Clojure might turn out to be a single
> s-expression of only a few lines. The code density would be a
> huge win but a literate version would still have to have the
> vitals of the story. Remember that the key test for a literate
> program is the "independence test". Someone can read it without
> talking to you, understand how it works, and be able to change it.
>
> >
> >
> > What do you think of marginalia? It's a bit the reverse of tangle; it
> > assembles all those 70's files together into this book you might want
> > to read. Is it sound or not? Have your thoughts changed from what you
> > wrote in [1]?
> >
> >
> > [1] http://goo.gl/cXWzF
>
> Literate programming is a mindset, not a tool. You can write a
> literate program in anything, including marginalia.
>
> That said, I have yet to see a Clojure program that lays out a story
> so I can sit and read it. For a real challenge, if you try to write
> tangle in Clojure, try writing the story in marginalia. I'm sure
> Fogus would welcome the feedback.
>
>
> The readability aspect is a real feature. Heck, you could even give
> your programs to a company so they could read them BEFORE the job
> interview. I would strongly favor hiring someone who could
> communicate, who cared about code quality, and who could improve
> the company's maintenance headache in the long term. A Literate
> Clojure programmer would be a real gotta-hire person. Companies
> use many programming languages but all programmers really do need
> good communication skills.
>
>
> In the long view, it would be sweet if the Clojure reader knew how
> to read a literate program. Just call "(literate-load file chunk)"
> and you get the same effect as if you had tangled the program to
> a file.
>
> With literate-load available you would be able to write all of
> your Clojure code in a literate style, making Clojure much
> easier to understand, maintain, and modify.
>

I'd be interested in studies proving that programs written in a litterate
style are easier to maintain.

So far, there has been this metaphore between a "story" and a "program".
How far can this metaphor be pushed ?

Is it easy to write a book with more than a couple people ? To maintain it
? To modify it ?

I can easily understand the appeal: if I were to discover a program for the
first time, I would certain

Re: Literate Programming example

2011-11-18 Thread TimDaly
On Fri, 2011-11-18 at 20:02 -0800, Daniel Jomphe wrote:
> On Friday, November 18, 2011 7:17:08 AM UTC-5, TimDaly wrote:
> Many of you asked me to show an example of a literate
> program and demonstrate the use of the tangle function.
>
> I usually use Latex for literate work but I've done
> this example using HTML and  tags.
>
> I've written a self-referential literate program that
> explains the details of the tangle function in literate
> form. You can find the web page at
>
> http://daly.literatesoftware.com/lithtml/litprog.html
>
> I have read your literate program, and must recognize that I know how
> tangle works even though I didn't want to really read the source code.
> I read your prose all the way through. I still haven't read the source
> code;

In fact, that's the whole point. You don't read the equations in a
calculus textbook either. You read the words. The equations are icons.
If you understood the text and "spoke" mathematics you could probably
write the equations.

In programming we can reach the same level of literacy. Reading just
the words in the literate version it should be possible to recreate
the program in your favorite language. Note that you would be creating
a different program with different design decisions but the same
functionality.

> I didn't feel the need to read it. Were I to maintain your program,
> I'd have more than enough confidence to start hacking the code right
> now.

One thing worth trying would be to code the same program in Clojure.

The tangle program is conceptually very simple but there are a lot
of low level design decisions that I would make differently. For
example, there are loops in the C program which would go away.

Would you map read or would you slurp? Mapping a read function allows
transforming "& lt;" to < at read time. This does not matter in the C
program because the buffer is mutable but it would matter in Clojure.

Would you use the Clojure pattern language to find the  tags?
Would you be able to parse out the string from the id? C encourages
character-level hacking but Clojure would be much more powerful.

>
>
> I think this speaks very positively about literate programming. What
> remains to be seen is how much (or not) I'm going to practice it in
> the future.

If you do try to rewrite it in Clojure please post the program. I
would be very interested to see how Clojure's concise syntax and
semantics get reflected in your design decisions.

The tangle program in Clojure might turn out to be a single
s-expression of only a few lines. The code density would be a
huge win but a literate version would still have to have the
vitals of the story. Remember that the key test for a literate
program is the "independence test". Someone can read it without
talking to you, understand how it works, and be able to change it.

>
>
> What do you think of marginalia? It's a bit the reverse of tangle; it
> assembles all those 70's files together into this book you might want
> to read. Is it sound or not? Have your thoughts changed from what you
> wrote in [1]?
>
>
> [1] http://goo.gl/cXWzF

Literate programming is a mindset, not a tool. You can write a
literate program in anything, including marginalia.

That said, I have yet to see a Clojure program that lays out a story
so I can sit and read it. For a real challenge, if you try to write
tangle in Clojure, try writing the story in marginalia. I'm sure
Fogus would welcome the feedback.


The readability aspect is a real feature. Heck, you could even give
your programs to a company so they could read them BEFORE the job
interview. I would strongly favor hiring someone who could
communicate, who cared about code quality, and who could improve
the company's maintenance headache in the long term. A Literate
Clojure programmer would be a real gotta-hire person. Companies
use many programming languages but all programmers really do need
good communication skills.


In the long view, it would be sweet if the Clojure reader knew how
to read a literate program. Just call "(literate-load file chunk)"
and you get the same effect as if you had tangled the program to
a file.

With literate-load available you would be able to write all of
your Clojure code in a literate style, making Clojure much
easier to understand, maintain, and modify.



Tim Daly


-- 
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


Re: Literate Programming example

2011-11-18 Thread Daniel Jomphe
On Friday, November 18, 2011 7:17:08 AM UTC-5, TimDaly wrote:
>
> Many of you asked me to show an example of a literate
> program and demonstrate the use of the tangle function.
>
> I usually use Latex for literate work but I've done
> this example using HTML and  tags.
>
> I've written a self-referential literate program that
> explains the details of the tangle function in literate
> form. You can find the web page at
>
> http://daly.literatesoftware.com/lithtml/litprog.html
>
I have read your literate program, and must recognize that I know how 
tangle works even though I didn't want to really read the source code. I 
read your prose all the way through. I still haven't read the source code; 
I didn't feel the need to read it. Were I to maintain your program, I'd 
have more than enough confidence to start hacking the code right now.

I think this speaks very positively about literate programming. What 
remains to be seen is how much (or not) I'm going to practice it in the 
future.

What do you think of marginalia? It's a bit the reverse of tangle; it 
assembles all those 70's files together into this book you might want to 
read. Is it sound or not? Have your thoughts changed from what you wrote in 
[1]?

[1] http://goo.gl/cXWzF

-- 
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

Re: Literate Programming example

2011-11-18 Thread daly
On Fri, 2011-11-18 at 07:07 -0800, bernardH wrote:
> 
> On Nov 18, 1:17 pm, daly  wrote:
> > Many of you asked me to show an example of a literate
> > program and demonstrate the use of the tangle function.
> 
> Thanks to your perseverance, I am looking into practicing literate
> programming.
> 
> However, I decided to settle for emacs org-mode environment with the
> literate elisp for the relevant code (abel'part of org-mode)
> being here : http://eschulte.github.com/org-babel/org-babel.org.html
> I found an example of clojure project (research on genetic
> programming) written in literate programming using babel org-mode for
> emacs
> is hosted here :
> http://gitweb.adaptive.cs.unm.edu/asm.git/tree
> 
> I do hope that others find those resources as useful as I found them.

I have nothing against org-mode. Indeed, I've been an emacs user
since I could spell it.

I believe the above examples are not literate programmings. They miss
the point completely. They are using emacs org-mode for DOCUMENTATION.

Literate programming is NOT documentation. It is a way to communicate
from one person to another by starting from ideas and reducing them to
practice.

I may have missed the point but the above programs are just fancier
ways of 1970 style coding using a new format tool.

Compare the example I gave at
http://axiom-developer.org/axiom-website/litprog.html
with the above programs. See if you can spot a qualitative difference.
My literate program tries to motivate the need for tangle, to explain
why it works in a development context, and then gets down to details
of implementation. It is a story.

Where does this happen in the org-mode example? Perhaps I missed
something but the author does not seem to be concentrating on 
communicating their ideas to me. Where did I go wrong? What 
emacs keystrokes get me a copy of the full document to read? 

Literate programming is about communication, not documentation.
The org-mode tool is perfectly fine but be very, very careful
not to miss this fundamental point.

People should be able to just pick up clojure-core and read it
like a novel, from ideas to implementation, and be able to 
understand it enough to change it. If your code can pass this
"independence test" then your code is literate.

Tim


-- 
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


Re: Literate Programming example

2011-11-18 Thread bernardH


On Nov 18, 1:17 pm, daly  wrote:
> Many of you asked me to show an example of a literate
> program and demonstrate the use of the tangle function.

Thanks to your perseverance, I am looking into practicing literate
programming.

However, I decided to settle for emacs org-mode environment with the
literate elisp for the relevant code (abel'part of org-mode)
being here : http://eschulte.github.com/org-babel/org-babel.org.html
I found an example of clojure project (research on genetic
programming) written in literate programming using babel org-mode for
emacs
is hosted here :
http://gitweb.adaptive.cs.unm.edu/asm.git/tree

I do hope that others find those resources as useful as I found them.

Best Regards,

Bernard

-- 
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


Re: Literate Programming example

2011-11-18 Thread László Török
it works for me.
Las

2011/11/18 daly 

> I believe I fixed it.
> Please try it again and let me know.
>
> Tim
>
> On Fri, 2011-11-18 at 07:46 -0500, Chas Emerick wrote:
> > On Nov 18, 2011, at 7:17 AM, daly wrote:
> >
> > > http://daly.literatesoftware.com/lithtml/litprog.html
> >
> > FYI, this is 404 at the moment.
> >
> > - Chas
> >
>
>
> --
> 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
>



-- 
László Török

Skype: laczoka2000
Twitter: @laczoka

-- 
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

Re: Literate Programming example

2011-11-18 Thread daly
I believe I fixed it.
Please try it again and let me know.

Tim

On Fri, 2011-11-18 at 07:46 -0500, Chas Emerick wrote:
> On Nov 18, 2011, at 7:17 AM, daly wrote:
> 
> > http://daly.literatesoftware.com/lithtml/litprog.html
> 
> FYI, this is 404 at the moment.
> 
> - Chas
> 


-- 
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


Re: Literate Programming example

2011-11-18 Thread daly
sigh. Try 

http://daly.axiom-developer.org/lithtml/litprog.html


On Fri, 2011-11-18 at 07:46 -0500, Chas Emerick wrote:
> On Nov 18, 2011, at 7:17 AM, daly wrote:
> 
> > http://daly.literatesoftware.com/lithtml/litprog.html
> 
> FYI, this is 404 at the moment.
> 
> - Chas
> 


-- 
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


Re: Literate Programming example

2011-11-18 Thread Chas Emerick

On Nov 18, 2011, at 7:17 AM, daly wrote:

> http://daly.literatesoftware.com/lithtml/litprog.html

FYI, this is 404 at the moment.

- Chas

-- 
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


Re: Literate programming

2011-10-29 Thread Damion Junk
I have also been using Emacs/Org-mode/Babel/R lately, mostly as a way to 
have easily modifiable write up and source code for assignments in 
statistics courses. I suppose this is one valid use, but I'm using it less 
to communicate code meaning and more as a convenient way to perform 
analysis, look at the results, and talk about them all in the same place, 
and then to easily generate documentation of my efforts [LaTeX output].

I have added the suggested LP readings from earlier in this thread to my 
"reading queue". Looking forward to this meetup!

Best,

Damion

On Friday, October 28, 2011 12:21:47 AM UTC-4, Robert McIntyre wrote:
>
> I've found org-mode in emacs quite acceptable for literate programming
> in clojure.
>
>

-- 
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

Re: Literate programming

2011-10-28 Thread Stefan Kamphausen


Clojure moved off the local optimum of common lisp
>

I can't help, but I really like that quote.  Nice meme :-) 

Stefan

-- 
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

Re: Literate programming

2011-10-28 Thread daly
On Fri, 2011-10-28 at 09:54 -0700, Mark Engelberg wrote:
> On Thu, Oct 27, 2011 at 10:58 AM, daly  wrote:
> >> Have there been any new developments on the literate programming /
> >> Clojure front, in terms of tools that leverage existing build tools,
> >> test suites, generating meaningful line numbers for stack traces and
> >> debugging?
> >>
> >
> > The question is ill-posed in sense that literate programming is not
> > a tool or technology but a change in mindset. To quote Knuth:
> 
> I think my question is legitimate.
> 
> To take an extreme example, if you tell me literate programming is
> great, but that I have to write out my programs by hand on paper and
> scan them into a computer, I'd laugh at you.  Why would I want to give
> up the convenience of typing in my programs via keyboard to do
> literate programming?

I'm not sure what tools you use for development. Straight emacs is
sufficient for my development. Emacs doesn't care what style is used
for development.

> 
> So I'd like an honest appraisal of the state of the art in literate
> programming of Clojure -- what tools and conveniences do I have to
> give up to do LP.  Do I have to give up things like meaningful line
> numbers when I get an error message?
> 

State of the art in literate programming in Clojure?

Hmmm. The pamphlet link is my only example of literate programming
related to Clojure. In order to develop you edit the pamphlet, type
"make" at a command line, and the world is rebuilt. Since the code is
extracted into the same source tree as it originally had, the line
numbers will be related to the file and line as before.

My development style involves changing about 10 lines of code or less
followed by a complete system rebuild and test cycle. Overlapping
rebuild and test is time for writing the literate explanations. 
Almost always, when something fails it is perfectly clear what lines
caused the error. When that isn't the case then a little "navel
debugging" (contemplating what might be wrong) is used. 

I don't use IDEs but I suppose it would be possible to write a
literate plugin of some kind that ignored things that were not in
code chunks. Line numbers could then be interpreted with respect
to the start of the chunk. Most IDEs allow plugins.

To your point, though, it is true that we may have reached a local
optimum of tool development for tiny files. It might be necessary
to move away from this peak in order to climb a different hill.
This would imply making things "worse" for development until the
tools adapt. Clojure moved off the local optimum of common lisp
and broke all my code-walking software, violated quite a few of my
assumptions, and invalidated my manuals but that isn't an argument
for abandoning Clojure.

You might feel that the current toolset is optimal and that
literate programming is not worth the time and effort.
De gustibus non disputandum. (There is no disputing taste).

A literate Clojure would only be of benefit to those who come after.
All it offers now is a lot of time and effort to communicate ideas
to people we will never meet. However the thing that draws people
to Clojure is the ideas, not the code.

We can debate it at length over beers at the Conj.

Tim Daly

-- 
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


Re: Literate programming

2011-10-28 Thread Mark Engelberg
On Thu, Oct 27, 2011 at 10:58 AM, daly  wrote:
>> Have there been any new developments on the literate programming /
>> Clojure front, in terms of tools that leverage existing build tools,
>> test suites, generating meaningful line numbers for stack traces and
>> debugging?
>>
>
> The question is ill-posed in sense that literate programming is not
> a tool or technology but a change in mindset. To quote Knuth:

I think my question is legitimate.

To take an extreme example, if you tell me literate programming is
great, but that I have to write out my programs by hand on paper and
scan them into a computer, I'd laugh at you.  Why would I want to give
up the convenience of typing in my programs via keyboard to do
literate programming?

So I'd like an honest appraisal of the state of the art in literate
programming of Clojure -- what tools and conveniences do I have to
give up to do LP.  Do I have to give up things like meaningful line
numbers when I get an error message?

-- 
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


Re: Literate programming

2011-10-28 Thread daly
On Fri, 2011-10-28 at 11:59 +0200, Tassilo Horn wrote:
> Hi Tim,
> 
> while I agree that good documentation is important for maintaining and
> developing further a given code base, I always wonder how literate
> programming deals with refactoring and larger restructuring.  I mean, in
> basically all software projects I'm involved in, developers have a hard
> time in keeping at least the most integral documentation up-to-date,
> e.g., docstrings, JavaDocs, etc.
> 
> Now I consider a some literate code base, i.e., a book that describes
> the complete system in a very detailed manner including the reasons to
> design it that way.  That's awesome for developers joining the project,
> but doesn't it hinder any further development?
> 
> For example, I'm currently reworking some paper that includes code for
> some model transformation.  If I had the right tools, I could extract
> the source code from the latex files and have a running transformation.
> But now, I had to do some minor modifications to the code which took me
> about 5 minutes, but adapting the surrounding text takes me hours over
> hours.  I think, that's an experience many people have made: changing
> source code of a system that is well-designed and understood by the
> developer is much easier to do than changing a cohesive text in natural
> language.  In code, I have an automated, picky lector that always reads
> the complete "book" after each change I make (also known as compiler).
> In plain text, only a human can verify consistency and only in very
> narrow borders.
> 
> Well, that's more text than I intended to write. ;-) So short story
> long: how do you manage conistency of docs and code in literate code
> bases?

Hard work? Book authors face the same problem. Every new change to
Clojure makes more work for the authors.

One side-effect of Literate Programming is that you re-arrange your
code to fit the presentation. As a result you bring together chunks
that are all related (e.g. the code to support Red-Black tries).

I would claim that refactoring "in the large" is unlikely in a
literate program because you have to think through the code in order
to explain it clearly. But if you do a large refactor then it is 
just hard work. For small refactorings you might not have to change
the explanation at all.

Clojure is pretty well "firmed up" at this point. I don't know if
there is going to be a large rewrite of the fundamentals.

Tim Daly


-- 
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


  1   2   >