Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Getting started with Scribble
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  21 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Engelberg  
View profile  
 More options Mar 16 2012, 8:42 pm
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Fri, 16 Mar 2012 17:42:50 -0700
Local: Fri, Mar 16 2012 8:42 pm
Subject: [racket] Getting started with Scribble

So I'm trying to figure out the simplest way to create a document that is
mostly text with a few Racket snippets.  When I hit Run, I want the code to
be evaluated for the interactions window.  When I hit the scribble button,
I want it to generate html that displays the formatted text along with the
Racket snippets.

First attempt:
Use scribble/base and put an @ in front of any Racket code.
Hitting run evaluates the Racket code, but scribblizing only shows the
formatted text -- the code remains invisible.

Second attempt:
Use scribble/manual and put @racketblock[] around any Racket code.
Looks great when you scribblize, but code doesn't evaluate.
Another nuisance: IDE auto-converts opening bracket after @racketblock into
a paren.

I understand from the documentation that there are techniques that involve
setting up whole project structures and using the raco tool.  But I'm
looking for something lightweight.  Is there a way?

Thanks,

Mark

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Van Horn  
View profile  
 More options Mar 16 2012, 9:41 pm
From: David Van Horn <dvanh...@ccs.neu.edu>
Date: Fri, 16 Mar 2012 21:41:39 -0400
Local: Fri, Mar 16 2012 9:41 pm
Subject: Re: [racket] Getting started with Scribble
On 3/16/12 8:42 PM, Mark Engelberg wrote:

Is this what you're looking for?  -- David

#lang scribble/manual
@(require scribble/eval)

@title{My Scribblings}

I don't always program, but when I do, I program in

@interaction[(banner)]

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Danny Yoo  
View profile  
 More options Mar 16 2012, 10:05 pm
From: Danny Yoo <d...@cs.wpi.edu>
Date: Fri, 16 Mar 2012 22:05:17 -0400
Local: Fri, Mar 16 2012 10:05 pm
Subject: Re: [racket] Getting started with Scribble

> Second attempt:
> Use scribble/manual and put @racketblock[] around any Racket code.
> Looks great when you scribblize, but code doesn't evaluate.
> Another nuisance: IDE auto-converts opening bracket after @racketblock into
> a paren.

Oh!  Try the keybinding: "Altl-[", which should add brackets and put
the cursor in between.
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Mar 16 2012, 10:24 pm
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Fri, 16 Mar 2012 19:24:46 -0700
Local: Fri, Mar 16 2012 10:24 pm
Subject: Re: [racket] Getting started with Scribble

This doesn't appear to do what I'm asking.

I tried this as per your suggestion:
#lang scribble/manual
@(require scribble/eval)

@title{My Scribblings}
I'm going to write a really amazing factorial function now.

@interaction[
(define (factorial n)
   (cond
     [(zero? n) 1]          ;; The zero test
     [else (* n (factorial (sub1 n)))]))
]

But when I hit Run, it doesn't seem to recognize factorial in the
interactions window.

On Fri, Mar 16, 2012 at 6:41 PM, David Van Horn <dvanh...@ccs.neu.edu>wrote:

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robby Findler  
View profile  
 More options Mar 16 2012, 10:32 pm
From: Robby Findler <ro...@eecs.northwestern.edu>
Date: Fri, 16 Mar 2012 21:32:21 -0500
Local: Fri, Mar 16 2012 10:32 pm
Subject: Re: [racket] Getting started with Scribble
What you're asking for is not what Scribble does, mostly speaking.
Running a scribble program just builds a datastructure for the
rendering process.

You might try the scribble/lp library, tho. I think that comes closest.

Robby

On Fri, Mar 16, 2012 at 9:24 PM, Mark Engelberg

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Mar 16 2012, 10:45 pm
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Fri, 16 Mar 2012 19:45:35 -0700
Local: Fri, Mar 16 2012 10:45 pm
Subject: Re: [racket] Getting started with Scribble

I'm sort of thinking along the lines of Haskell's version of literate
programming, where if you use the file suffix of lhs instead of hs, rather
than having a file that is mostly code with occasional comments, you can
easily write a document that is mostly text with occasional code.  In that
mode, by default, a line is treated as text unless it has a > at the
beginning of the line to indicate it is code.

I was under the impression that with Scribble, I could do something similar
(mostly text, but with occasional code blocks), but would have the
additional benefits of Scribble's mark-up capabilities.  I see now that
that's not precisely how Scribble is intended to be used.

I'm interested because I've asked a student to turn a program into a highly
readable document, and I want to give her some simple options.  I thought
this would be the perfect way to have a runnable program, but also be able
to generate a great-looking html page.

scribble/lp is related, but more involved to use.  Specifically, I just
tried it and it doesn't seem to work with the scribble html button that
appears in DrRacket.  I keep getting the following error:
scribble: loading xref
scribble: rendering
reference to an identifier before its definition: doc

Maybe it only works via lp-include?

On Fri, Mar 16, 2012 at 7:32 PM, Robby Findler
<ro...@eecs.northwestern.edu>wrote:

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Mar 16 2012, 10:47 pm
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Fri, 16 Mar 2012 19:47:38 -0700
Local: Fri, Mar 16 2012 10:47 pm
Subject: Re: [racket] Getting started with Scribble

On Fri, Mar 16, 2012 at 7:45 PM, Mark Engelberg <mark.engelb...@gmail.com>wrote:

> scribble/lp is related, but more involved to use.  Specifically, I just
> tried it and it doesn't seem to work with the scribble html button that
> appears in DrRacket.  I keep getting the following error:
> scribble: loading xref
> scribble: rendering
> reference to an identifier before its definition: doc

Scratch that.  I had a typo caused by the bracket paren issue.  It works.
This is definitely an option.

If anyone has any other lighterweight ideas, let me know.

Thanks,

Mark

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Mar 16 2012, 10:48 pm
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Fri, 16 Mar 2012 19:48:47 -0700
Local: Fri, Mar 16 2012 10:48 pm
Subject: Re: [racket] Getting started with Scribble

Ugh, scratch my scratching that.  I'm still getting the error.

On Fri, Mar 16, 2012 at 7:47 PM, Mark Engelberg <mark.engelb...@gmail.com>wrote:

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tom Maynard  
View profile  
 More options Mar 16 2012, 10:57 pm
From: Tom Maynard <t...@maynard.com>
Date: Fri, 16 Mar 2012 21:57:14 -0500
Local: Fri, Mar 16 2012 10:57 pm
Subject: Re: [racket] Getting started with Scribble
On 3/16/2012 9:24 PM, Mark Engelberg wrote:

> when I hit Run, it doesn't seem to recognize factorial in the
> interactions window.

I think you're missing the point a little: don't do this in DrRacket, do
it at the command line using "scribble" as your command:

/usr/foo/scribble ./lit-scrib.rkt    ;; For example

YPMV (Your Pathspec May Vary)

Tom.
____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robby Findler  
View profile  
 More options Mar 16 2012, 11:22 pm
From: Robby Findler <ro...@eecs.northwestern.edu>
Date: Fri, 16 Mar 2012 22:22:41 -0500
Local: Fri, Mar 16 2012 11:22 pm
Subject: Re: [racket] Getting started with Scribble
The example from the beginning of the docs works for me when I run it
in DrRacket. Can you say more about what's going wrong when you try?

Thanks,
Robby

On Fri, Mar 16, 2012 at 9:48 PM, Mark Engelberg

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Mar 17 2012, 1:03 am
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Fri, 16 Mar 2012 22:03:54 -0700
Local: Sat, Mar 17 2012 1:03 am
Subject: Re: [racket] Getting started with Scribble

OK, I pasted in the code from the docs just to make sure it wasn't
something in my code.  Then I hit the "Scribble HTML" button that appears
in the upper-right corner of DrRacket.  I see the following in the
interactions window:

Welcome to DrRacket, version 5.2 [3m].
Language: scribble/lp; memory limit: 2000 MB.
scribble: loading xref
scribble: rendering
reference to an identifier before its definition: doc

On Fri, Mar 16, 2012 at 8:22 PM, Robby Findler
<ro...@eecs.northwestern.edu>wrote:

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Mar 17 2012, 3:52 am
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Sat, 17 Mar 2012 00:52:21 -0700
Local: Sat, Mar 17 2012 3:52 am
Subject: Re: [racket] Getting started with Scribble

I'm still curious to get scribble/lp working, but I've figured out an
immediate solution to my question.  I was able to get the behavior I want
with just a simple macro:
@(define-syntax-rule (code l)
   (begin
     @schemeblock[l]
     l))

Below is a sample of its use to get the behavior I want where you can hit
run and have your code execute, or hit the scribble-html button to have it
scribbled.  If others like this idea as much as I, maybe this macro would
be something worth including in scribble/manual?

One thing I still haven't figured out is how to get a comment (introduced
with a semicolon) that is in the code block to show up in the scribbled
output.  (In the example below, the comment ";; the zero test" doesn't show
up in the scribble output).

------- Example -----

#lang scribble/manual
@(define-syntax-rule (code l)
   (begin
     @schemeblock[l]
     l))

@title{This is the title of my document}

Welcome to my test of the scribble system.  Above, I gave the document a
title.  Here is some introductory text.

@section{Factorial}

I'm going to define the factorial function.

@code[
(define (factorial n)
   (cond
     [(zero? n) 1]          ;; The zero test
     [else (* n (factorial (sub1 n)))]))
]

@section{Conclusion}

To turn this file into pretty HTML, just push the Scribble HTML button in
the upper-right corner.

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robby Findler  
View profile  
 More options Mar 17 2012, 8:36 am
From: Robby Findler <ro...@eecs.northwestern.edu>
Date: Sat, 17 Mar 2012 07:36:05 -0500
Local: Sat, Mar 17 2012 8:36 am
Subject: Re: [racket] Getting started with Scribble
That is now how scribble/lp works. You need to make another file and
use @lp-include on the first to get a document that actually
scribbles. There is more explanation of this in the docs, right below
that first example.

Robby

On Sat, Mar 17, 2012 at 12:03 AM, Mark Engelberg

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vincent St-Amour  
View profile  
 More options Mar 17 2012, 8:43 am
From: Vincent St-Amour <stamo...@ccs.neu.edu>
Date: Sat, 17 Mar 2012 08:43:36 -0400
Local: Sat, Mar 17 2012 8:43 am
Subject: Re: [racket] Getting started with Scribble
At Sat, 17 Mar 2012 00:52:21 -0700,

Mark Engelberg wrote:
> One thing I still haven't figured out is how to get a comment (introduced
> with a semicolon) that is in the code block to show up in the scribbled
> output.  (In the example below, the comment ";; the zero test" doesn't show
> up in the scribble output).

You probably want `code:comment'.

http://docs.racket-lang.org/scribble/scribble_manual_code.html?q=code...

Vincent

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eli Barzilay  
View profile  
 More options Mar 17 2012, 2:44 pm
From: Eli Barzilay <e...@barzilay.org>
Date: Sat, 17 Mar 2012 14:44:51 -0400
Local: Sat, Mar 17 2012 2:44 pm
Subject: Re: [racket] Getting started with Scribble

Yesterday, Mark Engelberg wrote:
> I'm sort of thinking along the lines of Haskell's version of
> literate programming, where if you use the file suffix of lhs
> instead of hs, rather than having a file that is mostly code with
> occasional comments, you can easily write a document that is mostly
> text with occasional code.  In that mode, by default, a line is
> treated as text unless it has a > at the beginning of the line to
> indicate it is code.

Note that what Haskell does is *semi*-literate-programming, something
that has little to do with literate programming.  Neil Van Dyke is
working on a tool that is going to be more like
semi-literate-programming.

Also, in both cases the main difficulty is how to make both aspects of
the code available: you want to usually run the code, but in other
cases you want just the documentation.  With the new submdules, this
is now possible to do in a single module, so perhaps its time to add a
semi-literate thing...

--
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Van Dyke  
View profile  
 More options Mar 17 2012, 3:24 pm
From: Neil Van Dyke <n...@neilvandyke.org>
Date: Sat, 17 Mar 2012 15:24:54 -0400
Local: Sat, Mar 17 2012 3:24 pm
Subject: Re: [racket] Getting started with Scribble
Eli Barzilay wrote at 03/17/2012 02:44 PM:

> Note that what Haskell does is *semi*-literate-programming, something
> that has little to do with literate programming.  Neil Van Dyke is
> working on a tool that is going to be more like
> semi-literate-programming.

My forthcoming tool, McFly, is for *documenting the usage/API* of
reusable packages, similar in purpose to javadoc.  It's decidedly not
literate programming, which I think of as a practice for implementing
programs.

(I will have to release McFly soon.  It's called "McFly" because you say
"doc" a lot.  My previous documentation tool, Funcelit, was so-named as
a pun, and short for "functionally-illiterate programming".)

Neil V.

--
http://www.neilvandyke.org/
____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eli Barzilay  
View profile  
 More options Mar 17 2012, 3:29 pm
From: Eli Barzilay <e...@barzilay.org>
Date: Sat, 17 Mar 2012 15:29:26 -0400
Local: Sat, Mar 17 2012 3:29 pm
Subject: Re: [racket] Getting started with Scribble
Just now, Neil Van Dyke wrote:

> Eli Barzilay wrote at 03/17/2012 02:44 PM:
> > Note that what Haskell does is *semi*-literate-programming, something
> > that has little to do with literate programming.  Neil Van Dyke is
> > working on a tool that is going to be more like
> > semi-literate-programming.

> My forthcoming tool, McFly, is for *documenting the usage/API* of
> reusable packages, similar in purpose to javadoc.It's decidedly
> not literate programming, which I think of as a practice for
> implementing programs.

The way to do the markup (or other) with code which is what javadoc
does *is* exactly semi-literate-programming.  (And that's why it's
very different from literate programming.)

--
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!
____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Mar 17 2012, 5:02 pm
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Sat, 17 Mar 2012 14:02:22 -0700
Local: Sat, Mar 17 2012 5:02 pm
Subject: Re: [racket] Getting started with Scribble

On Sat, Mar 17, 2012 at 11:44 AM, Eli Barzilay <e...@barzilay.org> wrote:
> Note that what Haskell does is *semi*-literate-programming, something
> that has little to do with literate programming.  Neil Van Dyke is
> working on a tool that is going to be more like
> semi-literate-programming.

I understand that literate programming in the Knuth-defined sense allows
separation of function bodies into smaller chunks, and allows complete
freedom over organization.  In a language like Racket where function
definitions can be in any order, you have pretty good flexibility to
organize your code top-down or bottom-up, moving things where it makes
sense to build an explanation.  So the main thing you lose with a
lighterweight tool is the ability to break up functions into smaller
pieces.  Racket functions are often so small, that's not a huge
limitation.  So yes, lp is more powerful, but just being able to invert the
relative importance of documentation vs code and read the file both ways in
a linear top-to-bottom fashion is valuable.

semi-literate-programming seems an apt name.

I don't think Javadoc would even qualify for that label though.  In my
mind, "semi-literate" at least implies a focus on building a narrative
exposition of why the functions work the way they do, not just API
documentation.

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Engelberg  
View profile  
 More options Mar 17 2012, 5:03 pm
From: Mark Engelberg <mark.engelb...@gmail.com>
Date: Sat, 17 Mar 2012 14:03:00 -0700
Subject: Re: [racket] Getting started with Scribble

On Sat, Mar 17, 2012 at 5:36 AM, Robby Findler
<ro...@eecs.northwestern.edu>wrote:

> That is now how scribble/lp works. You need to make another file and
> use @lp-include on the first to get a document that actually
> scribbles. There is more explanation of this in the docs, right below
> that first example.

> Robby

OK, thanks.  I saw that, but since the Scribble HTML button popped up in
DrRacket, I expected it to work.

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robby Findler  
View profile  
 More options Mar 17 2012, 8:25 pm
From: Robby Findler <ro...@eecs.northwestern.edu>
Date: Sat, 17 Mar 2012 19:25:30 -0500
Local: Sat, Mar 17 2012 8:25 pm
Subject: Re: [racket] Getting started with Scribble
On Sat, Mar 17, 2012 at 4:03 PM, Mark Engelberg

<mark.engelb...@gmail.com> wrote:
> On Sat, Mar 17, 2012 at 5:36 AM, Robby Findler <ro...@eecs.northwestern.edu>
> wrote:

>> That is now how scribble/lp works. You need to make another file and
>> use @lp-include on the first to get a document that actually
>> scribbles. There is more explanation of this in the docs, right below
>> that first example.

>> Robby

> OK, thanks.  I saw that, but since the Scribble HTML button popped up in
> DrRacket, I expected it to work.

Ah, right. Good point. I've disabled that now.

Thanks,
Robby

____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hendrik Boom  
View profile  
 More options Mar 18 2012, 1:20 pm
From: Hendrik Boom <hend...@topoi.pooq.com>
Date: Sun, 18 Mar 2012 13:20:36 -0400
Local: Sun, Mar 18 2012 1:20 pm
Subject: Re: [racket] Getting started with Scribble

On Sat, Mar 17, 2012 at 02:02:22PM -0700, Mark Engelberg wrote:

> semi-literate-programming seems an apt name.

> I don't think Javadoc would even qualify for that label though.  In my
> mind, "semi-literate" at least implies a focus on building a narrative
> exposition of why the functions work the way they do, not just API
> documentation.

Anyone looking at semiliterate programming should lave a look at
Modula 3's Trestle dicumentation.  It reads like a well-written
reference manual, but somehow manages to be generated from the Modula 3
interface files.  

http://modula3.elegosoft.com/cm3/doc/src_reports/vbtkit.ps

-- hendrik
____________________
  Racket Users list:
  http://lists.racket-lang.org/users


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »