Quick
index
main
eev
eepitch
maths
angg
blogme
dednat6
littlelangs
PURO
(C2,C3,C4,
 λ,ES,
 GA,MD,
 Caepro,
 textos,
 Chapa 1)

emacs
lua
(la)tex
maxima
 qdraw
git
lean4
agda
forth
squeak
icon
tcl
tikz
fvwm
debian
irc
contact

Pict2e-lua: a library for diagrams that is being developed with eev and test blocks (subtitles)

The main page about this video is here.
Its index is here.
Its subtitles in Lua are here.
The rest of this page contains a conversion of the subtitles in Lua
to a slightly more readable format.


00:01 Hi! My name is Eduardo Ochs - this person
00:03 here - and this video is about a library
00:07 that is being developed using test blocks,
00:09 and that is very easy to test
00:12 using test blocks.

00:14 All the most important information about
00:16 this package is in this page here...
00:18 let me show it in a browser...
00:22 and note that this paragraph says that
00:25 pict2e-lua is an "uninteresting
00:28 library that has been developed in an
00:30 interesting way - with test blocks".

00:32 And this is what we're going to see:
00:34 how I'm developing it, and
00:37 how it can be tested very easily.

00:39 Note that this page has a block that
00:41 says: Try it!
00:43 It says that we need to to run these
00:45 two eepitch blocks here...

00:48 This page has lots of links, so, for
00:50 example, if you click here you get the
00:52 definition of what is an eepitch block...

00:56 and what we have to do is to copy this
00:58 thing here to a buffer.
01:01 I'm going to copy it to a temporary buffer -
01:04 but i'm going to need a smaller font...

01:07 so, here...
01:10 these bullets here are
01:13 equivalent to the red stars...
01:18 and, so... let me execute
01:20 these two eepitch blocks... remember
01:22 that when I execute a line
01:24 that starts with a red star with f8
01:28 the rest of the line after the red star
01:30 is treated as Lisp, and executed as Lisp.

01:35 This is usually used to set up something...
01:39 usually used to set up a target buffer,
01:43 so these things here set up a target buffer
01:46 running a shell...
01:49 these two lines here make sure that I
01:52 have the debian packages that I need...
01:59 this setenv does something weird that
02:02 I'm going to explain later, but all the
02:04 rest is standard.

02:07 So... here I'm going to clone
02:13 this git repository.

02:19 And then the shell treats all these things
02:22 as comments, but we can treat them
02:24 as sexps that can be executed...

02:28 and this one here shows the contents
02:31 of the directory /tmp/pict2e-lua ...
02:35 and we can see that it has some
02:38 screenshots, READMEs, some .tex files,
02:42 and so on, and this weird thing here,
02:46 that is a copy of my init file for lua,
02:50 that I'm mainly going to use
02:52 because the library that we're
02:54 going to test uses some
02:56 pretty-printing functions
02:58 that are defined here.

03:01 So... this (setenv ...)
03:05 tells lua to read the init file from
03:08 this temporary directory here.

03:12 We need this sexp here... it defines
03:15 lots of functions, including this one
03:18 here: find-pict2elua ...
03:22 so now this function is defined, and we
03:24 can open these .lua files and run the
03:26 tests in them.

03:30 Here is one of these files. You can see
03:32 here a kind of index of the file and you
03:34 can see that some of these links here
03:36 point to tests -
03:38 for example if we follow this link here
03:42 we go to a test block, and we can execute
03:44 this test block with
03:46 a series of f8s.
03:49 Note that the f8s create a target buffer
03:51 running Lua, here
03:55 so they create several data structures
03:58 and they print these data structures in
04:00 several ways.
04:02 There's
04:04 one thing that is very tricky and this
04:07 page with details explains it -
04:10 hopefully explains it
04:13 well.
04:16 The thing is that
04:20 in some of the tests we need to show the
04:22 pdf file,
04:25 and we need to run and Emacs command that is
04:27 going to split the screen in this way,
04:29 and show the pdf file in this lower
04:31 right window -
04:33 and the command that does that is this
04:35 (etv) here so we have to define it in the
04:39 right way -
04:40 and the trick is that this header here
04:42 contains two blocks of one-liners
04:47 this is the first one and this is the
04:48 second one
04:50 and we need to execute all the sexps in
04:53 the second one
04:56 I'm going to execute them with M-7
04:58 M-e, that is equivalent to
05:00 M-e .
05:04 So: all done -
05:06 so now hopefully this function here is
05:09 defined in the right way.
05:11 And let me execute the last test in the
05:14 this file that that calls this function
05:17 (etv)
05:20 so the first part of the test is very
05:22 easy
05:24 nothing special - it just sends comments
05:26 to Lua - but then we have this line here
05:29 that calls a class called Show,
05:34 and this class saves
05:36 some TeX code to a .tex file and run
05:38 latex to compile that and to generate a
05:40 pdf
05:42 and this is a bit tricky - and the
05:44 important thing is that this
05:46 takes several seconds to run and we need
05:48 to wait these several seconds.
05:51 So: if I send this this line here to the
05:55 Lua REPL
05:57 you can see that it takes a few seconds -
05:59 until it says blah blah Success!!! and now
06:02 we can run this (etv) here
06:05 and it shows a drawing here with the
06:09 with the bounding box in yellow.
06:15 In this file here the drawings are
06:18 not very interesting -
06:21 this is just the core of my library - so
06:24 let me show how to
06:28 generate this drawing here that
06:30 I'm using in the
06:32 screenshots - this one.
06:40 This defun here defines the function `a'
06:43 as a function that opens the first Lua
06:45 file - with the core definitions - and `b'
06:48 defines b is the function that opens the
06:50 second Lua file
06:52 with some extra classes and some
06:54 stranger drawings.
06:56 So
06:58 let's execute `b'.
07:00 We are in the second file here
07:03 and let's execute this test here
07:07 uh - sorry
07:09 this one: Plot2D-test2.
07:12 So here we have
07:14 a test block -
07:16 it's quite big - it defines...
07:19 it changes the preamble,
07:21 it defines several functions, it uses
07:23 some
07:24 classes that are defined in this file,
07:26 and so on...
07:28 and then after printing the TeX code
07:32 it has this line here that contains a
07:34 show
07:35 if I execute to this line it takes a few
07:38 seconds... it says Success!!! and now we can
07:40 show the .pdf.
07:43 And: ta-da!
07:44 this is the figure that I wanted to show.
07:47 So, that's it.
07:50 Again:
07:51 this is a
07:53 library that is not interesting in
07:55 itself, but
07:56 i think that the way in which it can be
07:58 tested - which is very similar to the way
08:01 in which I'm developing it
08:03 is interesting in itself - so
08:05 if you are interested in test blocks
08:08 please test this,
08:10 and send feedback. That's it! bye =)