the scienti c editortexmacs warning: this le contains dynamic … · 2017. 9. 6. · the scienti c...

82
The scientic editor T E X MACS March 28th, 2015 14. Augsburger Linux-Infotag 2015 Miguel de Benito Warning: This le contains dynamic content which will be lost in PDF format. Please use T E X MACS to view the original le

Upload: others

Post on 28-Jan-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

  • The scienti�c editor TEXMACS

    March 28th, 2015 14. Augsburger Linux-Infotag 2015

    Miguel de Benito

    Warning: This �le contains dynamic content which will be lost in PDF format.Please use TEXMACS to view the original �le

  • Plan1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 2/21

    � Intro.

    � Quick demo: math, tables, drawings, scripting.

    � Plugins and sessions.

    � Collaboration.

    � Extending TEXMACS.

  • Plan1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 2/21

    � Intro.

    � Quick demo: math, tables, drawings, scripting.

    � Plugins and sessions.

    � Collaboration.

    � Extending TEXMACS.

  • Plan1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 2/21

    � Intro.

    � Quick demo: math, tables, drawings, scripting.

    � Plugins and sessions.

    � Collaboration.

    � Extending TEXMACS.

  • Plan1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 2/21

    � Intro.

    � Quick demo: math, tables, drawings, scripting.

    � Plugins and sessions.

    � Collaboration.

    � Extending TEXMACS.

  • Plan1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 2/21

    � Intro.

    � Quick demo: math, tables, drawings, scripting.

    � Plugins and sessions.

    � Collaboration.

    � Extending TEXMACS.

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � What it isn't

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � Truly WYSIWYG scienti�c editing and typesetting platform. Structured editor.

    � What it isn't

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � Truly WYSIWYG scienti�c editing and typesetting platform. Structured editor.

    � Open source, GNU project. All major platforms.

    � What it isn't

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � Truly WYSIWYG scienti�c editing and typesetting platform. Structured editor.

    � Open source, GNU project. All major platforms.

    � Fully extensible using Scheme.

    � What it isn't

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � Truly WYSIWYG scienti�c editing and typesetting platform. Structured editor.

    � Open source, GNU project. All major platforms.

    � Fully extensible using Scheme.

    � Mainly C++ and Scheme with mature codebase.

    � What it isn't

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � Truly WYSIWYG scienti�c editing and typesetting platform. Structured editor.

    � Open source, GNU project. All major platforms.

    � Fully extensible using Scheme.

    � Mainly C++ and Scheme with mature codebase.

    � Small team (4-8 active). Lead developer: Joris van der Hoeven, CNRS.

    � What it isn't

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � Truly WYSIWYG scienti�c editing and typesetting platform. Structured editor.

    � Open source, GNU project. All major platforms.

    � Fully extensible using Scheme.

    � Mainly C++ and Scheme with mature codebase.

    � Small team (4-8 active). Lead developer: Joris van der Hoeven, CNRS.

    � What it isn't

    � TEX. Nor Emacs.

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � Truly WYSIWYG scienti�c editing and typesetting platform. Structured editor.

    � Open source, GNU project. All major platforms.

    � Fully extensible using Scheme.

    � Mainly C++ and Scheme with mature codebase.

    � Small team (4-8 active). Lead developer: Joris van der Hoeven, CNRS.

    � What it isn't

    � TEX. Nor Emacs.

    � A frontend to LATEX.

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � Truly WYSIWYG scienti�c editing and typesetting platform. Structured editor.

    � Open source, GNU project. All major platforms.

    � Fully extensible using Scheme.

    � Mainly C++ and Scheme with mature codebase.

    � Small team (4-8 active). Lead developer: Joris van der Hoeven, CNRS.

    � What it isn't

    � TEX. Nor Emacs.

    � A frontend to LATEX.

    � A programming language.

  • Basic facts about TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 3/21

    � What it is

    � Truly WYSIWYG scienti�c editing and typesetting platform. Structured editor.

    � Open source, GNU project. All major platforms.

    � Fully extensible using Scheme.

    � Mainly C++ and Scheme with mature codebase.

    � Small team (4-8 active). Lead developer: Joris van der Hoeven, CNRS.

    � What it isn't

    � TEX. Nor Emacs.

    � A frontend to LATEX.

    � A programming language.

    � Your kitchen robot.

  • Quick demo: math1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 4/21

    � Beautiful math

  • Quick demo: math1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 4/21

    � Beautiful math

    jetAej6 e¡t/"Xn=0

    1 �t"

    �n 1n!

    n"+1= exp

    nt"("¡ 1)

    o:

  • Quick demo: math1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 4/21

    � Beautiful math

    jetAej6 e¡t/"Xn=0

    1 �t"

    �n 1n!

    n"+1= exp

    nt"("¡ 1)

    o:

    � Fast input

    LATEX input emulation but(!) intuitive shortcuts, (structured) variants.

  • Quick demo: math1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 4/21

    � Beautiful math

    jetAej6 e¡t/"Xn=0

    1 �t"

    �n 1n!

    n"+1= exp

    nt"("¡ 1)

    o:

    � Fast input

    LATEX input emulation but(!) intuitive shortcuts, (structured) variants.

    � Semantic editing

    Validation, manipulation, conversion, interfacing.

  • Quick demo: tables and more1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 5/21

    � Tables are easy

  • Quick demo: tables and more1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 5/21

    � Tables are easya b cc d

  • Quick demo: tables and more1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 5/21

    � Tables are easya b cc d

    � And powerful

  • Quick demo: tables and more1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 5/21

    � Tables are easya b cc d

    � And powerful

    Tomaten, 1Kg 5 €Bananen, 2Kg 6 €

    Kekse, 1Pk 2 €=b1+b2+b3 €

    Table 1. A shopping list.

    sin(4x2) cos(4 y2)

    =di�(a1; x) =di�(b1; y)

    Table 2. More computations.

  • Quick demo: tables and more1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 5/21

    � Tables are easya b cc d

    � And powerful

    Tomaten, 1Kg 5 €Bananen, 2Kg 6 €

    Kekse, 1Pk 2 €13 €

    Table 1. A shopping list.

    sin(4x2) cos(4 y2)

    =di�(a1; x) =di�(b1; y)

    Table 2. More computations.

  • Quick demo: tables and more1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 5/21

    � Tables are easya b cc d

    � And powerful

    Tomaten, 1Kg 5 €Bananen, 2Kg 6 €

    Kekse, 1Pk 2 €13 €

    Table 1. A shopping list.

    sin(4x2) cos(4 y2)

    8 x cos(4x2) =di�(b1; y)

    Table 2. More computations.

  • Quick demo: tables and more1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 5/21

    � Tables are easya b cc d

    � And powerful

    Tomaten, 1Kg 5 €Bananen, 2Kg 6 €

    Kekse, 1Pk 2 €13 €

    Table 1. A shopping list.

    sin(4x2) cos(4 y2)

    8x cos(4x2) ¡8 y sin (4 y2)

    Table 2. More computations.

  • Quick demo: Drawings1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 6/21

    d(x; y)>dist (x; Y )

    x

    Y

    y

    Simple vector graphics.

  • Quick demo: Drawings1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 6/21

    d(x; y)>dist (x; Y )

    x

    Y

    y

    Simple vector graphics.

    blah

    User-de�ned graphical macros.

  • Quick demo: External tools1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 7/21

    � Scripting

  • Quick demo: External tools1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 7/21

    � Scripting

    An example with Maxima:

    Let p(x)=x2¡ 9 and q(x)=x2+6x+9. Integrate:

    Zp(x)q(x)

    dx= integrate(p(x)/ q(x); x)+C:

  • Quick demo: External tools1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 7/21

    � Scripting

    An example with Maxima:

    Let p(x)=x2¡ 9 and q(x)=x2+6x+9. Integrate:

    Zp(x)q(x)

    dx=x¡ 6 log (x+3)+C:

  • Quick demo: External tools1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 7/21

    � Scripting

    An example with Maxima:

    Let p(x)=x2¡ 9 and q(x)=x2+6x+9. Integrate:

    Zp(x)q(x)

    dx=x¡ 6 log (x+3)+C:

    � Embedded sessions (later)

  • Quick demo: External tools1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 7/21

    � Scripting

    An example with Maxima:

    Let p(x)=x2¡ 9 and q(x)=x2+6x+9. Integrate:

    Zp(x)q(x)

    dx=x¡ 6 log (x+3)+C:

    � Embedded sessions (later)

    � Many plugins

    Asymptote, Axiom, Cadabra, Coq, Eukleides, Ghostscript, Giac, Gnu-Plot, GTybalt, Macaulay2, Matlab, Maxima, Octave, Pari, Python, Qcl,R, Reduce, Sage, SciLab, TeXgraph, Xfig, Yacas and more...

  • There's much more!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 8/21

    � Native converters

    PDF, XML, HTML+MathML, LATEX.

  • There's much more!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 8/21

    � Native converters

    PDF, XML, HTML+MathML, LATEX.

    � Styles with macro language

    Functional and powerful! (more later)

  • There's much more!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 8/21

    � Native converters

    PDF, XML, HTML+MathML, LATEX.

    � Styles with macro language

    Functional and powerful! (more later)

    � Bibliography

    BibTEX support, custom styles, support for internal databases.

  • There's much more!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 8/21

    � Native converters

    PDF, XML, HTML+MathML, LATEX.

    � Styles with macro language

    Functional and powerful! (more later)

    � Bibliography

    BibTEX support, custom styles, support for internal databases.

    � Beamer presentations

    Live demos, live �xes!

  • There's much more!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 8/21

    � Native converters

    PDF, XML, HTML+MathML, LATEX.

    � Styles with macro language

    Functional and powerful! (more later)

    � Bibliography

    BibTEX support, custom styles, support for internal databases.

    � Beamer presentations

    Live demos, live �xes!

    � Spell checking

    Uses standard aSpell.

  • There's much more!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 8/21

    � Native converters

    PDF, XML, HTML+MathML, LATEX.

    � Styles with macro language

    Functional and powerful! (more later)

    � Bibliography

    BibTEX support, custom styles, support for internal databases.

    � Beamer presentations

    Live demos, live �xes!

    � Spell checking

    Uses standard aSpell.

  • Bonus: Tables abused1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 9/21

    >> (load (url->string (url-append (url-head (buffer-master)) "t-mockup.scm")))

    >> (start-game)

  • Plugins: Gnuplot1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 10/21

    Sessions

    GNUplot] plot [-10:10][-10:10] x+sin(x)

    GNUplot]

  • Plugins: Gnuplot1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 10/21

    Sessions

    GNUplot] plot [-10:10][-10:10] x+sin(x)

    -10

    -5

    0

    5

    10

    -10 -5 0 5 10

    x+sin(x)

    GNUplot]

  • Plugins: Gnuplot1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 10/21

    Easy graphs

    Plot surface

    Function

    f : sin(x) cos(y)Range

    x: ¡3 � 3y: ¡3 � 3

    Figure. A simple surface plot.

  • Plugins: Scilab1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 11/21

    A Scilab session:

    --> A = [0, 1; 0, 0]; B = [1 ; 1]; C = [1, 1];

    --> S1 = syslin ('c', A, B, C)

    --> x= -6.28:0.1:6.28; y= sin(x); plot (x, y);

    -->

  • Plugins: Scilab1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 11/21

    A Scilab session:

    --> A = [0, 1; 0, 0]; B = [1 ; 1]; C = [1, 1];

    --> S1 = syslin ('c', A, B, C)

    --> x= -6.28:0.1:6.28; y= sin(x); plot (x, y);

    -->

  • Plugins: Scilab1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 11/21

    A Scilab session:

    --> A = [0, 1; 0, 0]; B = [1 ; 1]; C = [1, 1];

    --> S1 = syslin ('c', A, B, C)

    S1 =8 x= -6.28:0.1:6.28; y= sin(x); plot (x, y);

    -->

  • Plugins: Scilab1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 11/21

    A Scilab session:

    --> A = [0, 1; 0, 0]; B = [1 ; 1]; C = [1, 1];

    --> S1 = syslin ('c', A, B, C)

    S1 =8 x= -6.28:0.1:6.28; y= sin(x); plot (x, y);

    -->

  • Plugins: Scilab1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 11/21

    A Scilab session:

    --> plotout();

    -->

  • Plugins: Scilab1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 11/21

    A Scilab session:

    --> plotout();

    0−8 −6 −4 −2 2 4 6 8−7 −5 −3 −1 1 3 5 7

    0

    −1

    1

    −0.8

    −0.6

    −0.4

    −0.2

    0.2

    0.4

    0.6

    0.8

    -->

  • Plugins: Python1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 12/21

    >>> import matplotlib as mplmpl.use('PS')import matplotlib.pyplot as plimport numpy as npx = np.linspace(0,3,200)pl.plot(x, x + np.sin(3*x))fig = pl.gcf()

    >>>

  • Plugins: Python1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 12/21

    >>> ps_out(fig)

    >>>

  • Plugins: Python1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 12/21

    >>> ps_out(fig)

    0.0 0.5 1.0 1.5 2.0 2.5 3.00.0

    0.5

    1.0

    1.5

    2.0

    2.5

    3.0

    3.5

    4.0

    >>>

  • Plugins: Python (2)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 13/21

    � A live �gure

    Python

    pl.plot(x, x + np.sin(pow(x, 5)))ps_out(fig)

  • Plugins: Python (2)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 13/21

    � A live �gure

    Busy...

  • Plugins: Python (2)1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 13/21

    � A live �gure

    Busy...

    � A real example

    Gaussian Mixtures and Expectation Maximization

  • Plugins: recap.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 14/21

    � Embedded computations.

  • Plugins: recap.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 14/21

    � Embedded computations.

    � Remote computations.

    (not discussed here)

  • Plugins: recap.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 14/21

    � Embedded computations.

    � Remote computations.

    (not discussed here)

    � Embedded graphics.

  • Plugins: recap.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 14/21

    � Embedded computations.

    � Remote computations.

    (not discussed here)

    � Embedded graphics.

    � Live documents.

  • Plugins: recap.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 14/21

    � Embedded computations.

    � Remote computations.

    (not discussed here)

    � Embedded graphics.

    � Live documents.

    � Easy to extend.

  • Collaboration1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 15/21

    � LATEX

    Conservative conversions.

  • Collaboration1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 15/21

    � LATEX

    Conservative conversions.

    � Versioning

    Tree di� better than line di�. Also: SVN support (GIT available but not integrated yet).

  • Collaboration1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 15/21

    � LATEX

    Conservative conversions.

    � Versioning

    Tree di� better than line di�. Also: SVN support (GIT available but not integrated yet).

    � Remote documents

    TEXMACS server.

  • Collaboration1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 15/21

    � LATEX

    Conservative conversions.

    � Versioning

    Tree di� better than line di�. Also: SVN support (GIT available but not integrated yet).

    � Remote documents

    TEXMACS server.

    � Concurrent editing

    Currently under development.

  • Customizing and extending TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 16/21

    � Preferences & shortcuts

    Through UI and con�g �les.

  • Customizing and extending TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 16/21

    � Preferences & shortcuts

    Through UI and con�g �les.

    � Stylesheet language

    Macros, control structures, variables, dynamic features.

  • Customizing and extending TEXMACS1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 16/21

    � Preferences & shortcuts

    Through UI and con�g �les.

    � Stylesheet language

    Macros, control structures, variables, dynamic features.

    � Scheme

    Coming up next.

  • Extending TEXMACS with Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 17/21

    � Embedded scheme:

    Currently Guile 1.8. Help needed for 2.0!

  • Extending TEXMACS with Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 17/21

    � Embedded scheme:

    Currently Guile 1.8. Help needed for 2.0!

    � Why?

    Any su�ciently complicated C or Fortran program contains an ad hoc,informally-speci�ed, bug-ridden, slow implementation of half of CommonLisp. (Greenspun's tenth rule)

  • Extending TEXMACS with Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 17/21

    � Embedded scheme:

    Currently Guile 1.8. Help needed for 2.0!

    � Why?

    Any su�ciently complicated C or Fortran program contains an ad hoc,informally-speci�ed, bug-ridden, slow implementation of half of CommonLisp. (Greenspun's tenth rule)

    � But... why?!

    � Code is data is code if fed to the evaluator.

    � Easy implementation of (micro) DSLs: menus, widgets, graphics, converters, prefer-ences, ...

    � But it's ugly!

  • Extending TEXMACS with Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 17/21

    � Embedded scheme:

    Currently Guile 1.8. Help needed for 2.0!

    � Why?

    Any su�ciently complicated C or Fortran program contains an ad hoc,informally-speci�ed, bug-ridden, slow implementation of half of CommonLisp. (Greenspun's tenth rule)

    � But... why?!

    � Code is data is code if fed to the evaluator.

    � Easy implementation of (micro) DSLs: menus, widgets, graphics, converters, prefer-ences, ...

    � But it's ugly! Maybe, but �consistently so�.

  • Extending TEXMACS with Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 17/21

    � Embedded scheme:

    Currently Guile 1.8. Help needed for 2.0!

    � Why?

    Any su�ciently complicated C or Fortran program contains an ad hoc,informally-speci�ed, bug-ridden, slow implementation of half of CommonLisp. (Greenspun's tenth rule)

    � But... why?!

    � Code is data is code if fed to the evaluator.

    � Easy implementation of (micro) DSLs: menus, widgets, graphics, converters, prefer-ences, ...

    � But it's ugly! Maybe, but �consistently so�.

    � Basic aids

    Syntax highlighting, code browsing, online help, basic auto-completion.

  • Some Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 18/21

    � Key bindings

    >> (kbd-map(:mode in-math?)("I var" (insert '(big "int"))))

    >>

  • Some Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 18/21

    � Key bindings

    >> (kbd-map(:mode in-math?)("I var" (insert '(big "int"))))

    ("I tab")

    >>

  • Some Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 18/21

    � Key bindings

    >> (kbd-map(:mode in-math?)("I var" (insert '(big "int"))))

    ("I tab")

    >>

    � Widgets

    >> (tm-widget (demo-widget)(resize ("100px" "200px" "1000px") ("300px" "600px" "3000px")(tree-view (lambda (ev t) (if (== ev 1) (tree-select t)))

    (buffer-tree) (tree 'dummy))))

    >> (show demo-widget)

    >>

  • Some Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 18/21

    � Key bindings

    >> (kbd-map(:mode in-math?)("I var" (insert '(big "int"))))

    ("I tab")

    >>

    � Widgets

    >> (tm-widget (demo-widget)(resize ("100px" "200px" "1000px") ("300px" "600px" "3000px")(tree-view (lambda (ev t) (if (== ev 1) (tree-select t)))

    (buffer-tree) (tree 'dummy))))

    ((guile-user))

    >> (show demo-widget)

    >>

  • More Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 19/21

    >> (select (buffer-tree) '(:* screens shown :%1 tit :%1))

    >> (with l (select (buffer-tree) '(:* screens shown :%1 tit :%1))(with t (car l)(tree-set! t (string->tree "Hi there!"))))

  • More Scheme1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 19/21

    >> (select (buffer-tree) '(:* screens shown :%1 tit :%1))

    ()

    >> (with l (select (buffer-tree) '(:* screens shown :%1 tit :%1))(with t (car l)(tree-set! t (string->tree "Hi there!"))))

  • Something to bring home1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 20/21

    Is this truly the state of the art?

  • Something to bring home1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 20/21

    In 2015 ?!?!

  • Thanks!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

    Miguel de Benito 21/21

    Glad to help

    [email protected]

    O�ce L-2020 @

    Many others too

    [email protected] [email protected]