Commit 72b93ffb authored by erwan's avatar erwan
Browse files

Chore: some fixes in the Lutin tuto

parent 1907f781
Pipeline #67737 passed with stages
in 4 minutes and 47 seconds
(* Time-stamp: <modified the 23/07/2020 (at 15:27) by Erwan Jahier> *)
(* Time-stamp: <modified the 02/04/2021 (at 11:29) by Erwan Jahier> *)
(* Mimick the behavior of 'rdbg -lurette', but without the dependency
on ocaml *)
......@@ -72,7 +72,7 @@ let (gen_reactive_program : string -> RdbgArg.reactive_program) =
(* the following code compile (with adding sasa lib in the dune file)
But there is an issue in practice:
- Dynlink requires that the lurette binary is buildt with -linkall (otherwise
- Dynlink requires that the lurette binary is built with -linkall (otherwise
i cannot use stdlib in my cmxs for instance)
- But if I use -linkall, lurette fails to build because of lutin (or camlidl)
that requires libuid (undefined reference to `IID_IUnknown')
......@@ -146,8 +146,11 @@ let _ =
RdbgRun.clean_terminate();
exit i
| pb ->
Printf.fprintf args.ocr "\n%s\n%!" (Printexc.to_string pb);
RdbgRun.clean_terminate();
output_string args.ocr (Printexc.to_string pb);
close_out args.ocr;
close_out args.ecr;
close_in args.icr;
Printf.printf "bye\n"; flush stdout; exit 2
;;
......
../../examples/lutin/crazy-rabbit/
\ No newline at end of file
../../examples/crazy-rabbit
\ No newline at end of file
;(package-initialize)
(setq load-path (cons (expand-file-name "~jahier/dd/org-mode/share/emacs/site-lisp/") load-path))
(setq load-path (cons (expand-file-name "~jahier/dd/org-mode/lisp/") load-path))
(setq load-path (cons (expand-file-name "/local/jahier/org-mode/") load-path))
(setq load-path (cons (expand-file-name "~/el_files/") load-path))
......@@ -38,7 +38,7 @@
'((emacs-lisp . t)
(ocaml . t)
(lutin . t)
; (rif . t)
(rif . t)
(sh . t)
)
)
......
......@@ -11,7 +11,7 @@
#+LANGUAGE: en
# INFOJS_OPT: view:nil toc:t ltoc:t mouse:underline buttons:t path:http://orgmode.org/org-info.js
#+INFOJS_OPT: buttons:t view:info toc: path:http://orgmode.org/org-info.js
# +INFOJS_OPT: buttons:t view:info toc: path:http://orgmode.org/org-info.js
#+style: <style type="text/css">pre{background-color: #232323; color: #E6E1DC;}</style>
#+style: <style type="text/css">blockquote{border: 1px solid #CCC; background-color: #E6E1DC; color: #232323;}</style>
......@@ -20,13 +20,14 @@
#+OPTIONS: html-postamble:nil
#+BIND: org-export-html-postamble "<div class='footer'> Built with %c. </div>"
#+SETUPFILE: include/theme-readtheorg.setup
#+MACRO: runpdf
#+MACRO: run #+begin_src sh \\n<prompt> $2 \n#+end_src
#+MACRO: nprun $2
#+MACRO: pause
#+MACRO: begin_html
#+MACRO: begin_html
#+MACRO: end_html
#+MACRO: onlyhtml $1
......
......@@ -12,7 +12,7 @@
#+LANGUAGE: en
# INFOJS_OPT: view:nil toc:t ltoc:t mouse:underline buttons:t path:http://orgmode.org/org-info.js
#+INFOJS_OPT: buttons:t view:info toc: path:http://orgmode.org/org-info.js
# +INFOJS_OPT: buttons:t view:info toc: path:http://orgmode.org/org-info.js
#+style: <style type="text/css">pre{background-color: #232323; color: #E6E1DC;}</style>
#+style: <style type="text/css">blockquote{border: 1px solid #CCC; background-color: #E6E1DC; color: #232323;}</style>
......@@ -21,13 +21,14 @@
#+OPTIONS: html-postamble:nil
#+BIND: org-export-html-postamble "<div class='footer'> Built with %c. </div>"
#+SETUPFILE: include/theme-readtheorg.setup
#+MACRO: runpdf
#+MACRO: run #+begin_src sh \\n<prompt> $2 \n#+end_src
#+MACRO: nprun $2
#+MACRO: pause
#+MACRO: begin_html
#+MACRO: begin_html
#+MACRO: end_html
#+MACRO: onlyhtml $1
......@@ -172,7 +173,7 @@ feed it with a ~1~ (type ~1<enter>~), it returns 2. If we enter 41,
it returns 42. To quit this infinite loop gently, just enter the
character ~q~.
#+BEGIN_SRC rif
#+BEGIN_SRC sh
<promt> lutin incr.lut
$ 1
1 #outs 2
......@@ -200,7 +201,7 @@ q# bye!
{{{run(./sh/one-demo.sh, lutin -l 5 one.lut)}}}
#+BEGIN_SRC rif
#+BEGIN_SRC sh
# This is lutin Version 1.54 (9e783b6)
# The random engine was initialized with the seed 931220738
#inputs
......@@ -239,11 +240,11 @@ one to set a maximum number of simulation steps to perform.
{{{run(./sh/one-q-demo.sh, lutin -l 5 -quiet one.lut)}}}
#+BEGIN_SRC rif
1
#+BEGIN_SRC sh
1
1
1
1
1
#+END_SRC
The previous simulation basically produces a (wordy) sequence of five "1". To
......@@ -295,8 +296,10 @@ It is possible to store the lutin RIF output into a file using the
{{{run(./sh/rif-demo.sh, lutin -l 10 -o ten.rif N.lut ; ls -lh ten.rif)}}}
#+INCLUDE: "./N.lut" src lutin
{{{onlyhtml(Produces the [[file:ten.rif][ten.rif]] file [[from file:N.lut][N.lut]].)}}}
......@@ -350,7 +353,7 @@ can use two tools that are part of the ~lutin~ distribution:
#+end_src
{{{run(./sh/lurette-demo.sh,
lurette -sut "lutin decr.lut -n incr" -env "lutin decr.lut -n decr -o res.rif")}}}
lurette -sut "lutin decr.lut -n incr" -env "lutin decr.lut -n decr" -o res.rif)}}}
{{{run(./sh/lurette-demo.sh,
sim2chrogtk -ecran -in res.rif > /dev/null)}}}
......@@ -418,7 +421,7 @@ Now let's have a look at the second program we've seen.
#+INCLUDE: "./N.lut" src lutin
The program [[file:N.lut][N.lut]] illustrates the use of two central Lutin
The program [[file:N.lut][=N.lut=]] illustrates the use of two central Lutin
keywords: ~fby~ and ~pre~.
~fby~ is the trace sequence operator. =b1 fby b2= means: behaves as
......@@ -436,8 +439,8 @@ Again this program is deterministic and runs infinitely.
Of course, this means that =y= should be defined at the previous
instant. This is the reason why we've distinguished the first step
from the others. However, it is possible to set variables previous
values at declarations time. The program [[file:N2.lut][N2.lut]] below behaves
exactly as [[file:N.lut][N.lut]]:
values at declarations time. The program [[file:N2.lut][=N2.lut=]] below behaves
exactly as [[file:N.lut][=N.lut=]]:
#+INCLUDE: "./N2.lut" src lutin
......@@ -737,7 +740,7 @@ In [[file:choice2.lut][choice2.lut]], ~x=42~ is chosen with a probability of 3/4
#+begin_src sh :tangle sh/choice2-demo.sh :exports none :noweb yes
xterm -hold -fa "Liberation Mono:size=15:antialias=false" -e "lutin -l 1000 -q choice2.lut | grep 42 | wc -l";
xterm -hold -fa "Liberation Mono:size=15:antialias=false" -e "lutin -l 10000 -q choice2.lut | grep 42 | wc -l";
#+end_src
{{{run(./sh/choice2-demo.sh, lutin -l 10000 -q choice2.lut | grep 42 | wc -l)}}}
......@@ -1173,7 +1176,7 @@ Moreover in Lutin, the order of equations matters.
#+end_example
The program [[file:run.lut][run.lut]] illustrates the use of the =run/in= statements:
This program uses nodes defined in [[file:N.lut][N.lut]] and [[file:incr.lut][incr.lut]].
This program uses nodes defined in [[file:N.lut][=N.lut=]] and =[[file:incr.lut][incr.lut=]].
Another illustration of the use of =run= can be found in the [[Wearing
......
......@@ -181,8 +181,10 @@ It is possible to store the lutin RIF output into a file using the
{{{run(./sh/rif-demo.sh, lutin -l 10 -o ten.rif N.lut ; ls -lh ten.rif)}}}
#+INCLUDE: "./N.lut" src lutin
{{{onlyhtml(Produces the [[file:ten.rif][ten.rif]] file [[from file:N.lut][N.lut]].)}}}
\pause
......@@ -223,7 +225,7 @@ It is possible to store the lutin RIF output into a file using the
#+end_src
{{{run(./sh/lurette-demo.sh,
lurette -sut "lutin decr.lut -n incr" -env "lutin decr.lut -n decr -o res.rif")}}}
lurette -sut "lutin decr.lut -n incr" -env "lutin decr.lut -n decr" -o res.rif)}}}
{{{run(./sh/lurette-demo.sh,
sim2chrogtk -ecran -in res.rif > /dev/null)}}}
......@@ -390,7 +392,7 @@ In [[file:choice2.lut][choice2.lut]], ~x=42~ is chosen with a probability of 3/4
#+begin_src sh :tangle sh/choice2-demo.sh :exports none :noweb yes
xterm -hold -fa "Liberation Mono:size=15:antialias=false" -e "lutin -l 1000 -q choice2.lut | grep 42 | wc -l";
xterm -hold -fa "Liberation Mono:size=15:antialias=false" -e "lutin -l 10000 -q choice2.lut | grep 42 | wc -l";
#+end_src
{{{run(./sh/choice2-demo.sh, lutin -l 10000 -q choice2.lut | grep 42 | wc -l)}}}
......
......@@ -128,7 +128,7 @@ feed it with a ~1~ (type ~1<enter>~), it returns 2. If we enter 41,
it returns 42. To quit this infinite loop gently, just enter the
character ~q~.
#+BEGIN_SRC rif
#+BEGIN_SRC sh
<promt> lutin incr.lut
$ 1
1 #outs 2
......@@ -156,7 +156,7 @@ html.
{{{run(./sh/one-demo.sh, lutin -l 5 one.lut)}}}
html:
#+BEGIN_SRC rif
#+BEGIN_SRC sh
# This is lutin Version 1.54 (9e783b6)
# The random engine was initialized with the seed 931220738
#inputs
......@@ -195,11 +195,11 @@ html.
{{{run(./sh/one-q-demo.sh, lutin -l 5 -quiet one.lut)}}}
html:
#+BEGIN_SRC rif
1
#+BEGIN_SRC sh
1
1
1
1
1
#+END_SRC
The previous simulation basically produces a (wordy) sequence of five "1". To
......@@ -251,8 +251,10 @@ It is possible to store the lutin RIF output into a file using the
{{{run(./sh/rif-demo.sh, lutin -l 10 -o ten.rif N.lut ; ls -lh ten.rif)}}}
#+INCLUDE: "./N.lut" src lutin
{{{onlyhtml(Produces the [[file:ten.rif][ten.rif]] file [[from file:N.lut][N.lut]].)}}}
\pause
......@@ -374,7 +376,7 @@ Now let's have a look at the second program we've seen.
#+INCLUDE: "./N.lut" src lutin
The program [[file:N.lut][N.lut]] illustrates the use of two central Lutin
The program [[file:N.lut][=N.lut=]] illustrates the use of two central Lutin
keywords: ~fby~ and ~pre~.
~fby~ is the trace sequence operator. =b1 fby b2= means: behaves as
......@@ -392,8 +394,8 @@ Again this program is deterministic and runs infinitely.
Of course, this means that =y= should be defined at the previous
instant. This is the reason why we've distinguished the first step
from the others. However, it is possible to set variables previous
values at declarations time. The program [[file:N2.lut][N2.lut]] below behaves
exactly as [[file:N.lut][N.lut]]:
values at declarations time. The program [[file:N2.lut][=N2.lut=]] below behaves
exactly as [[file:N.lut][=N.lut=]]:
#+INCLUDE: "./N2.lut" src lutin
......@@ -693,7 +695,7 @@ In [[file:choice2.lut][choice2.lut]], ~x=42~ is chosen with a probability of 3/4
#+begin_src sh :tangle sh/choice2-demo.sh :exports none :noweb yes
xterm -hold -fa "Liberation Mono:size=15:antialias=false" -e "lutin -l 1000 -q choice2.lut | grep 42 | wc -l";
xterm -hold -fa "Liberation Mono:size=15:antialias=false" -e "lutin -l 10000 -q choice2.lut | grep 42 | wc -l";
#+end_src
{{{run(./sh/choice2-demo.sh, lutin -l 10000 -q choice2.lut | grep 42 | wc -l)}}}
......@@ -757,7 +759,7 @@ html:
file:png/Screenshot-walk.png
#+BEGIN_QUOTE
*Question:* Write such a randow walk for a real variable
*Question:* Write such a random walk for a real variable
#+END_QUOTE
html.
......@@ -1129,7 +1131,7 @@ html:
#+end_example
The program [[file:run.lut][run.lut]] illustrates the use of the =run/in= statements:
This program uses nodes defined in [[file:N.lut][N.lut]] and [[file:incr.lut][incr.lut]].
This program uses nodes defined in [[file:N.lut][=N.lut=]] and =[[file:incr.lut][incr.lut=]].
Another illustration of the use of =run= can be found in the [[Wearing
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment