[racket-users] repeated code in interactions of scribble

2017-09-22 Thread Jos Koot
Hi,
What would be the easiest way to avoid duplication of code in interactions 
within a scribble/manual document?
I often place examples in such a document.
In some of them I need the same auxiliary procedures.
How to avoid duplicating them?
The most nice solution would be the appearance of a hyperlink within an 
interaction to a procedure in a previous interaction.
In the docs of Racket I see examples that do refer to procedures defined in 
previous examples.
Hence it must be possible.
I have looked around how it is done in the Racket docs, but it has not become 
clear to me how to acheive my goal.
Thanks, Jos.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] tabular text display

2017-09-22 Thread Tony Garnock-Jones
Not yet parameterised or extracted for separate use, but:

  raco pkg install tabular


https://github.com/tonyg/racket-tabular/blob/29e91c9475407da4c5bee03abc2e6043693b3ff6/tabular/main.rkt#L681-L765

Example output:

Welcome to Racket v6.10.1.1.
> (require (submod tabular test))
> (require tabular)




> emp
 last-name  |department-id
--
"Rafferty"  |31
"Jones" |33
"Heisenberg"|33
"Robinson"  |34
"Smith" |34
"Williams"  |#f

> dept
department-id|department-name
-
31   |"Sales"
33   |"Engineering"
34   |"Clerical"
35   |"Marketing"

> (table-natural-join emp dept)
 last-name  |department-id|department-name
--
"Rafferty"  |31   |"Sales"
"Jones" |33   |"Engineering"
"Heisenberg"|33   |"Engineering"
"Robinson"  |34   |"Clerical"
"Smith" |34   |"Clerical"

> (->table #:columns '(X Y Z) '(("a" "bcd" "ef") ("gh" "hhu.thnt" "t")))
 X  |Y | Z

"a" |"bcd" |"ef"
"gh"|"hhu.thnt"|"t"




On 09/21/2017 10:03 PM, 'John Clements' via users-redirect wrote:
> Before I go re-inventing the wheel, I want to ask you folks: has anyone 
> written a library that prints out tabular data in a textual format?
> 
> E.G: given 
> 
> ‘((“a” “bcd” “ef”) (“gh” “hhu.thnt” “t”)
> 
> returns
> 
> "
> --
> | a  | bcd  | ef |
> | gh | hhu.thnt | t  |
> ———
> “
> 
> (sorry about the horrible damage that Apple Mail inflicts upon this message.)
> 
> … in the style of postgresql and similar display engines?
> 
> It’s easy to write one of these, but if someone else has done it, it will 
> probably have nice bells and whistles that mine won’t.
> 
> John
> 
> 
> 
> 
> 
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] tabular text display

2017-09-22 Thread Laurent
There's something like that buried in my bazaar package, maybe it's
sufficient for your needs:
https://github.com/Metaxal/bazaar/blob/master/text-table.rkt

The main submodule prints the examples.

It provides two ways to output tables. The first one 'table->string' is the
simplest one and the example outputs:

  a │   b │c │  d │ e │  f │  g │h
——
123 │ 456 │   77 │ 54 │ 1 │ 5646547987 │ 41 │1
——
111 │  22 │  │ 44 │ 5 │  6 │  7 │ 

The second one is more tweakable but more complicated and the example
produces:
╔╦╦╦╗
║i   ║║f1  ║f2  ║
╠╬╬╬╣
╠╬╬╬╣
║a   ║║b   ║c   ║
╠╬╬╬╣
║x   ║║y   ║z   ║
╚╩╩╩╝

If I had time I would merge the two and make it both simple and tweakable...

On Fri, Sep 22, 2017 at 7:07 AM, 'John Clements' via users-redirect <
us...@plt-scheme.org> wrote:

>
> > On Sep 21, 2017, at 16:10, Jay McCarthy  wrote:
> >
> > `raco pkg show` implements something very close that you could turn
> > into a library
> >
> > https://github.com/racket/racket/blob/master/racket/
> collects/pkg/private/show.rkt#L102
>
> Ah! Nice!
>
> John
>
> >
> > On Thu, Sep 21, 2017 at 5:03 PM, 'John Clements' via users-redirect
> >  wrote:
> >> Before I go re-inventing the wheel, I want to ask you folks: has anyone
> written a library that prints out tabular data in a textual format?
> >>
> >> E.G: given
> >>
> >> ‘((“a” “bcd” “ef”) (“gh” “hhu.thnt” “t”)
> >>
> >> returns
> >>
> >> "
> >> --
> >> | a  | bcd  | ef |
> >> | gh | hhu.thnt | t  |
> >> ———
> >> “
> >>
> >> (sorry about the horrible damage that Apple Mail inflicts upon this
> message.)
> >>
> >> … in the style of postgresql and similar display engines?
> >>
> >> It’s easy to write one of these, but if someone else has done it, it
> will probably have nice bells and whistles that mine won’t.
> >>
> >> John
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> >
> > --
> > -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
> > -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
> > -=[ Moses 1:33: And worlds without number have I created; ]=-
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] tabular text display

2017-09-22 Thread 'John Clements' via users-redirect

> On Sep 21, 2017, at 16:10, Jay McCarthy  wrote:
> 
> `raco pkg show` implements something very close that you could turn
> into a library
> 
> https://github.com/racket/racket/blob/master/racket/collects/pkg/private/show.rkt#L102

Ah! Nice!

John

> 
> On Thu, Sep 21, 2017 at 5:03 PM, 'John Clements' via users-redirect
>  wrote:
>> Before I go re-inventing the wheel, I want to ask you folks: has anyone 
>> written a library that prints out tabular data in a textual format?
>> 
>> E.G: given
>> 
>> ‘((“a” “bcd” “ef”) (“gh” “hhu.thnt” “t”)
>> 
>> returns
>> 
>> "
>> --
>> | a  | bcd  | ef |
>> | gh | hhu.thnt | t  |
>> ———
>> “
>> 
>> (sorry about the horrible damage that Apple Mail inflicts upon this message.)
>> 
>> … in the style of postgresql and similar display engines?
>> 
>> It’s easy to write one of these, but if someone else has done it, it will 
>> probably have nice bells and whistles that mine won’t.
>> 
>> John
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> -- 
> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
> -=[ Moses 1:33: And worlds without number have I created; ]=-
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.