lambdaway
::
start
2
|
list
|
login
|
load
|
|
{{block} {PICT} {center {img {@ src="data/D1E45870-3B45-4813-A9BA-A9B5148473C1.jpeg" width="50px"}}} {center it's me} {div {@ style="text-align:center; font-size:4.5em;"}the {i '{λy}} project } {center ( {i S-expression based writing, styling & coding hypertext editor} )} {center {i alain marty | marty.alain_at_free.fr}} {center {i last update: 2024/10/01}} {blockquote {@ style="transform:rotate(-2.5deg)"} _p {b Note:} This wiki page is a lambdatalk program evaluated in realtime (less than 100ms on my MacBook Air, iPad Pro, or smartphone). Please, don’t be disoriented by this page splitted in narrow columns lost in a large format. {b Like any spreadsheet} (Excel, ...) it can be comfortably consulted and edited on any screens, wide and narrow, just use zooms +/- or dblclicks, sliders and fingers, it's easy and safe. } _p You are welcome in the '{lambda way} project, a light framework built on a wiki, '{lambda tank}, and a programming language, '{lambda talk}, working in any web browser. _p At the end of the 70's I bought a [[HP67 pocket calculator|https://en.wikipedia.org/wiki/HP-67/-97]] and discovered that adding {b 1} and {b 2} was done using the strange {i [[reverse Polish notation|https://en.m.wikipedia.org/wiki/Reverse_Polish_notation]]}, "{b 1 2 +}". Much later I came across [[LISP|https://en.wikipedia.org/wiki/Lisp_(programming_language)]] and discovered prefixed parenthesized expressions., {b (+ 1 2)}, i.e. the [[normal Polish notation|https://en.m.wikipedia.org/wiki/Polish_notation]] in parentheses. _p Then, thanks to [[Steven Levithan|?view=levithan]], I discovered that an HTML expression like {pre <{span}b><{span}i><{span}u>Hello World<{span}/u><{span}/i><{span}/b> -> {b {i {u Hello World}}} } _p requiring that closing brackets be written in the reverse order, could be better written in a LISP style ({i … Lot of Insane and Silly Parenthesis …}) {pre '{b {i {u Hello World}}} -> {b {i {u Hello World}}} } _p without boring anymore with the order of closing brackets. And the evaluator was easy to write, a single regular expression called by a single javascript function. Finally I improved this evaluator : if writing {b '{u 1 2 3 4 5 6}} displays "{b {u 1 2 3 4 5 6}}" in underline style, {b as awaited}, writing {b '{* 1 2 3 4 5 6}} displays the product, "{b 720}", and writing {b '{u {* 1 2 3 4 5 6}}} displays "{b {u 720}}" in underline style. _p {b And so, mixing {u text AND code} became obvious}. _p This made me want to write a {b text editor with a programming language} and its current state is in this wiki. _p Let's remember that the father of LISP, [[John McCarthy|https://en.wikipedia.org/wiki/John_McCarthy_(computer_scientist)]], lamented the W3C's choice of [[SGML|https://en.wikipedia.org/wiki/Standard_Generalized_Markup_Language]] as the basis for HTML : « {i An environment where the markup, styling and scripting is all s-expression based would be nice.} » Answers like [[BBcode|https://en.wikipedia.org/wiki/BBCode]] or [[SexpCode|https://corebloc.neocities.org/sexpcode.html]] solve part of the problem. The {b '{lambda way}} project {i could be} a better one, a small {b wiki} easy to [[install|?view=download]] with a true {b programming language}. _p A detailed introduction to the '{lambda way} project can be found in {div {@ style="text-align:center; font:bold 2.0em arial;"} [[λ-calc|?view=coding]], [[λ-talk|?view=coding2]], [[λ-tank|?view=coding3]]} _p where _ul 1) in {b [[λ{sup calc}|?view=coding]], the core}, using only an extremely reduced core of its features, (words, abstractions, applications), and an empty dictionary, (no primitives, no numbers, nothing), I build and progressively discover some essential data structures, (booleans, pairs, lists, numbers), as well as a tool to deal with them, {b recursion} ; _ul 2) in {b [[λ{sup talk}|?view=coding2]], special forms & primitives}, I introduce a list of {b 9} special forms, (lambda, def, if, let, quote, macro, script, style, require), making the code faster and easier to write, as well as a set of about {b 200} primitives, (words, numbers, arrays, html, svg, ...), and a first set of libraries, (big numbers, complex numbers, ...), opening the language to the rich ecosystem provided for free by web browsers ; _ul 3) in {b [[λ{sup tank}|?view=coding3]], the environment}, I present the IDE, interactive development environment, the wiki {b lambdatank} and its installation on any web browser, as a {i dwarf on the shoulders of giants}. _p You could see also the homepage of the previous workshop [[lambdaspeech|http://lambdaway.free.fr/lambdaspeech]], pages [[whynot]], [[concepts]], [[simply]], [[digest]], [[imerir|http://lambdaway.free.fr/workshop/index.php?view=imerir_20180515]], [[reflexions_20201219]], ... and also a gentle introduction in 5 pages in [[prime_pattern]]. Or [[lambdatalk at rosettacode.org|https://rosettacode.org/wiki/Category:Lambdatalk]] and its [[popularity|http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity/Full_list]], 100{sup th} of 926 languages. Please, take a few minutes to read one of them, depending on your preferences, before you venture into the labyrinth of this current workshop, called {b lambdawalks}, and for ever under construction... _p You can [[download]] the engine, test {b lambdatalk} safely in the [[sandbox]] page, write a message in the [[agora]] page or send me an email at {b marty.alain_at_free.fr}. {center ( {date} )} } {{block} {uncover data/bibliotheque_virtuelle.jpg 100 400 Open to the huge WWW library ...} _h3 short in time {center « {i I have always wished for my computer to be as easy to use
as my telephone; my wish has come true because
I can no longer figure out how to use my telephone.} »
(Bjarne Stroustrup)} _p If you are short in time, this is in a few words the core of the syntax. _p You are in a wiki called {b lambdatank}. Now, look at the title of this wiki page: {b lambdaway :: start} _ul 1) Click on the word {b start} to open the text editor's frame _ul 2) Write some words and see how they are displayed in real time in the wiki page's frame. _p What kind of words? Let's go on more precisely: _h4 1) words _p A word is any group of characters except spaces and curly braces. Away from curly braces {b words} are just {b words}. {pre Hello World // input (in the text editor frame) -> Hello World // output (in the wiki page) } _p So, you write words as they are and you get them unchanged as in a standard text editor. You are not writing in a "programming console" where words must be quoted and strings concatenated using some "print()" function. _p Let's go further, words can be assembled in more or less complex {b expressions}. _h4 2) expressions _p In lambdatank you wont find the {b [B], [I], [U], ...} buttons to boldify, italicize, underline words. Yo will use {b expressions} to do so and much more. {b Expressions} are written in a prefixed parenthesized notation using curly braces, '{}. {pre '{u Hello World} // underline words -> {u Hello World} '{+ 1 2} // compute 1+2 -> {+ 1 2} '{sqrt {+ {* 3 3} {* 4 4}}} // compute √{span {@ style="border-top:1px solid #fff"}3{sup 2}+4{sup 2}} -> {sqrt {+ {* 3 3} {* 4 4}}} '{/ {+ 1 {sqrt 5}} 2} // (1+√5)/2 -> {/ {+ 1 {sqrt 5}} 2} // the golden ratio Φ '{u {* 1 2 3 4 5 6}} // underline 1*2*3*4*5*6 -> {u {* 1 2 3 4 5 6}} 2+3 is '{u equal} to '{+ 2 3} // mixing words & expressions -> 2+3 is {u equal} to {+ 2 3} '{* {S.serie 1 20}} // product of 1 to 20 -> {* {S.serie 1 20}} } _p A coherent and {b uniform} syntax making mixing text and calculus easy. And everything is evaluated and displayed in {b realtime}, allowing the greatest interactivity. _p Expressions are evaluated {b from inside out}. Let's follow the evaluation of the third nested expression computing the diagonal of a triangle rectangle whose sides are {b 3 & 4}, ( {i yes you do know that it's {b √{span {@ style="border-top:1px solid #fff"}3{sup 2}+4{sup 2}}}, and yes, the lambdatalk syntax is easy to read, just say « take the square root of the sum of the product of 3 by 3 and the product of 4 by 4 ».} ) {pre 0: '{sqrt {+ {* 3 3} {* 4 4}}} 1: '{sqrt {+ 9 16}} 2: '{sqrt 25} 3: 5 } _p Note that [{b +, *, sqrt, u}] are lambdatalk primitive functions allowing to add and mutltiply numbers, take the square root of a number, underline words, ... And {b '{S.serie 1 20}} just outputs the sequence {b 1 2 3 ... 19 20}. These primitives are stored in a {b dictionary} and this dictionary can be extended on demand. _p {b Note for geeks}: It may be interesting to know that the lambdatalk evaluator is built on a single line of javascript using this single regular expression: {div {@ style="font:normal 1.3em courier; text-align:center;"} /\'{([^\s{}]*)(?:[\s]*)([^{}]*)\}/g} _p More about that in « [[Less is more!|?view=levithan]] » _h4 3) functions _p Sometimes an expression can be unevaluable, for instance {pre '{sqrt {+ {* a a} {* b b}}} -> {sqrt {+ {* x x} {* y y}}} } _p The result is {b NaN}, a gentle error message meaning {i Not a Number}, because {b sqrt, *, +} are waiting for numbers and {b a & b} are not numbers. One would like to be able to write such an expression without having to define once and for all the values of {b a & b} and be able to assign numerical values to them as needed. {b Functions} are created for this purpose. _p In lambdatalk {b functions} are created with {b lambda} and named with {b def}, using this syntax {pre '{def myfunction {lambda {words} expression }} -> myfunction } _p were words are "slots", called {b variables}, waiting for future words, called {b values}. For instance {pre '{def sqr {lambda {:a} {* :a :a}}} // sqr(a) = a*a = a{sup 2} -> {def sqr {lambda {:a} {* :a :a}}} '{def hypo {lambda {:a :b} {sqrt {+ {sqr :a} {sqr :b}}} }} // hypo(a,b) = √{span {@ style="border-top:1px solid #fff"}a{sup 2}+b{sup 2}} -> {def hypo {lambda {:a :b} {sqrt {+ {sqr :a} {sqr :b}}}}} '{def smart_hypo {lambda {:a :b} The hypotenuse of a right triangle with sides :a and :b is equal to {hypo :a :b} }} -> {def smart_hypo {lambda {:a :b} The hypotenuse of a right triangle with sides :a and :b is equal to {hypo :a :b} }} } _p It's a good practice to prefix variables by a special character, say a colon "{b :}". If you didn't do so in the {b smart_hypo} function you would get strange results. Try it! _p Constants can be created too {pre '{def HW Hello World} -> {def HW Hello World} '{def Φ {/ {+ 1 {sqrt 5}} 2}} // evaluated once -> {def Φ {/ {+ 1 {sqrt 5}} 2}} // the golden ratio } _p Function's names and constants are added to the dictionary, extending the existing set of primitives and can be used the same way {prewrap '{HW} -> {HW} '{Φ} -> {Φ} '{hypo 3 4} -> {hypo 3 4} '{hypo 1 1} -> {hypo 1 1} '{smart_hypo 3 4} -> {smart_hypo 3 4} } _p You are welcome in {b lambdatalk}, the programming language of this wiki, {b lambdatank}. _p Technical note {div {@ style="transform:rotate(-2deg); border:1px dashed; padding:10px; "} _p Not only lambdatalk functions {b accept partial application} but most of them {b accept an undefined number of values}. For instance {pre '{def HI {lambda {:a :b} My name is :b, :a :b }} -> {def HI {lambda {:a :b} My name is :b, :a :b }} } _p is a function waiting for two words. _ul 1) when only 1 word is given an anonymous function is created and returned, memorizing this word and waiting for the missing one {pre '{HI James} -> {HI James} // reference of an anonymous function } _p This anonymous function, {b '{lambda {:b} James :b}} can be applied to a second word {pre '{{HI James} Bond} // equivalent to '{_LAMB_25 Bond} -> My name is Bond, James Bond // now it's OK } _ul 2) when 2 words are given everything works as expected {pre '{HI James Bond} -> {HI James Bond} } _ul 3) when more than 2 words are given the last variable simply takes all the rest, here {b :b} will take "Duchess of Windsor" {pre '{HI Wallis Duchess of Windsor} -> {HI Wallis Duchess of Windsor} } _p Partial application and variadicity are two strong points of the lambdatalk functions. } _h4 4) forks _p Sometimes you have to make choices, to do something according to some condition. Lambdatalk comes with a third special form, {b if} {pre '{if condition then do this ... else do that ... } } _p and a set of functions returning {b true} or {b false}, for instance {b =, <, >, ...} allowing to build some useful functions, for instance {pre '{def sign {lambda {:n} {if {< :n 0} then :n is negative else {if {> :n 0} then :n is positive else :n is nul }}}} -> {def sign {lambda {:n} {if {< :n 0} then :n is negative else {if {> :n 0} then :n is positive else :n is nul }}}} '{sign -123} -> {sign -123} '{sign 123} -> {sign 123} '{sign 0} -> {sign 0} } _p Note that {b if}s can be nested and how mixing words and numbers is done in a natural way. _h4 5) loops {center « [[Iteration|?view=recursion]] is human, [[recursion|?view=divine_recursion]] is divine.} _p Sometimes it is necessary to repeat an action and you will use either {b iteration} or {b recursion}. _ul 1) To repeat an action a certain number of times and so build an {b iterative process} you can use the {b S.map} and {b S.serie} primitives, for instance {pre '{S.map sqr {S.serie 1 16}} -> {S.map sqr {S.serie 1 16}} '{S.map sqrt 1 2 3 4 5} -> {S.map sqrt 1 2 3 4 5} } _ul 2) To repeat an action under a certain condition you will preferably build a {b recursive function}, calling itself until the problem is solved (or not), dividing the problem into a sub-problem easier to solve until it can be solved. {i The divide & conquer method}. _p For instance here is the well known factorial function computing the product of numbers form {b 1} to {b n} defined this way {pre factorial(n) = if n > 1 then n * factorial( n-1 ) // n * (do it again on n-1) else 1 // the product of 1 by 1 is 1 } _p immediately translated into this lambdatalk code {pre '{def factorial {lambda {:n} {if {> :n 1} then {* :n {factorial {- :n 1}}} else 1 }}} -> {def factorial {lambda {:n} {if {> :n 1} then {* :n {factorial {- :n 1}}} else 1 }}} '{factorial 6} -> {factorial 6} '{factorial 20} -> {factorial 20} } _h4 6) let it be _p Let's go back to the expression {pre '{sqrt {+ {* 3 3} {* 4 4}}} -> 5 } _p {b abstracted} as a function {pre '{def hypo {lambda {:a :b} {sqrt {+ {* :a :a} {* :b :b}}} }} -> hypo } _p and {b applied} like this {pre '{hypo 3 4} -> 5 } _p In fact this last expression is an easy way to write {pre '{{lambda {:a :b} {sqrt {+ {* :a :a} {* :b :b}}}} 3 4} -> 5 } _p where an anonymous function - here we don't give it a name - is created and immediately applied to two values. We call {b IIFE} this expression, {i Immediately Invoked Function Expression}, whose general form is the following {pre '{{lambda {vars} expression} values} } _p Basically a lambdatalk code is nothing but a sequence of {b IIFE}s. _p IIFEs being rather dificult to write and read, lambdatalk provides a fourth special form, {b let} {pre '{let { {variable_1 value_1} {variable_2 value_2} ... } expression } } _p which is a {i syntactic sugar} of an IIFE, highlighting the binding between {b variables} and {b values} and introducing what is called a {b local context} where {b expression} is evaluated. _p For instance '{{lambda {:a :b} {sqrt {+ {* :a :a} {* :b :b}}}} 3 4} can be rewritten as {pre '{let { {:a 3} {:b 4} } {sqrt {+ {: a :a} {* :b :b}}} } } _p where we understand that we define two variables {b :a} and {b :b}, we assign them two values {b 3} and {b 4} and we use them in an expression. _p From now on, when you will meet some javascript code like this IIFE {pre let c = (function(a,b) '{ // an anonymous function return Math.sqrt( a*a + b*b ) // immediately applied } ) (3,4); // to two values } _p or like this sequence of local definitions and assignments {pre let a = 3, b = 4, c = Math.sqrt( a*a + b*b ); } _p which is its "syntaxtic sugar" equivalent, you should not be surprised ... and even you could fall in love with s-expressions revealed in LISP, {i Lot of Insane and Silly Parentheses}. _p See this page [[closure]] to learn more about local contexts. _h4 7) and so what? _p And {b that's it} for the most part! That's all is needed to build a programming language and to explore lots of algorithms. _p Let's look at some of them. } {{block} ;;{uncover http://lambdaway.free.fr/lambdaspeech/data/session_1.jpg 100 280 ... a small text editor ...} {uncover data/start_screen.jpg 100 350 ... a small text editor ...} _h3 on the road {center « {i Any fool can write code that a computer can understand.
Good programmers write code that humans can understand.} »
(Kent Beck)} _h4 1) hilbert _p For instance let's draw the [[Hilbert curve|?view=hilbert]], which fills a square {prewrap '{def left {lambda {:d :n} {if {< :n 1} then else T90 {right :d {- :n 1}} M:d T-90 {left :d {- :n 1}} M:d {left :d {- :n 1}} T-90 M:d {right :d {- :n 1}} T90 }}} -> {def left {lambda {:d :n} {if {< :n 1} then else T90 {right :d {- :n 1}} M:d T-90 {left :d {- :n 1}} M:d {left :d {- :n 1}} T-90 M:d {right :d {- :n 1}} T90}}} '{def right {lambda {:d :n} {if {< :n 1} then else T-90 {left :d {- :n 1}} M:d T90 {right :d {- :n 1}} M:d {right :d {- :n 1}} T90 M:d {left :d {- :n 1}} T-90 }}} -> {def right {lambda {:d :n} {if {< :n 1} then else T-90 {left :d {- :n 1}} M:d T90 {right :d {- :n 1}} M:d {right :d {- :n 1}} T90 M:d {left :d {- :n 1}} T-90}}} } _p The word {code Tθ} rotates the drawing direction of a pen from {b θ} degrees and the word {code Md} moves it on {b d} pixels. Writing {b '{left 18 5}} produces 2387 words begining with [T90 T-90 T90 T-90 T90 M10 T-90 M10 T-90 M10 T90 M10 T90 T-90 M10 T90 M10 T90 M10 T-90 M10 T-90 M10 T90 M10 T90 M10 T-90 T90 M10 T90 M10 T-90 M10 T-90 ...] which are sent to a graphic primitive, {b turtle}, which draws the curve in a SVG context. {center {svg {@ width="395px" height="395px"} {path {@ id="spline" d="M {turtle 10 10 0 {left 12 5}}" fill="transparent" stroke="#fff" stroke-width="3" }} °°° {circle {@ cx="0" cy="0" r="5" fill="#0ff" stroke="#f00"} {animateMotion {@ dur="500s" repeatCount="indefinite" rotate="auto"} {mpath {@ xlink:href="#spline"}} }} °°° }} _h4 2) hanoï _p Let's play with the [[Towers of Hanoï|?view=hanoi]] _img data/AnimeHanoiNB.gif {pre '{def hanoi {lambda {:n :from :to :temp} {if {= :n 0} then stop else {hanoi {- :n 1} :from :temp :to} {br}move :n from :from to :to {hanoi {- :n 1} :from :temp :to}}}} -> {def hanoi {lambda {:n :from :to :temp} {if {= :n 0} then else {hanoi {- :n 1} :from :temp :to}
move :n from :from to :to {hanoi {- :n 1} :from :temp :to}}}} '{hanoi 4 A B C} -> {hanoi 4 A B C} } _h4 3) cyclics _p and draw beautiful [[cyclic curves|?view=cyclics]] that randomly change shape each time the page is refreshed. Try it out! {{SVG 600} {g {AXES 600 600} {polyline {@ points="{S.map CYCLIC {S.serie -10 10 0.05}}" {stroke #fff 2}}} }} {center {b P(t) = e{sup it} + {sup 1}/{sub 2}e{sup A*it} + {sup i}/{sub 3}e{sup B*it}, where A = {AA} & B = {BB}}} _h4 4) love _p You may be a poet, not a mathematician, and you don't know how to declare your love to a "fair lady". Lambdatalk can help you: {prewrap '{def inject {lambda {:x :a} {if {A.empty? :a} then {A.new {A.new :x}} else {let { {:c {{lambda {:a :b} {A.concat {A.new {A.first :a}} :b}} :a}} {:d {inject :x {A.rest :a}}} {:e {A.concat {A.new :x} :a}} } {A.concat {A.new :e} {A.map :c :d}}}}}} -> {def inject {lambda {:x :a} {if {A.empty? :a} then {A.new {A.new :x}} else {let { {:c {{lambda {:a :b} {A.concat {A.new {A.first :a}} :b}} :a}} {:d {inject :x {A.rest :a}}} {:e {A.concat {A.new :x} :a}} } {A.concat {A.new :e} {A.map :c :d}}}}}} '{def permut {lambda {:a} {if {A.empty? :a} then {A.new :a} else {let { {:c {{lambda {:a :b} {inject {A.first :a} :b}} :a}} } {A.reduce A.concat {A.map :c :d}}}}}} -> {def permut {lambda {:a} {if {A.empty? :a} then {A.new :a} else {let { {:c {{lambda {:a :b} {inject {A.first :a} :b}} :a}} {:d {permut {A.rest :a}}} } {A.reduce A.concat {A.map :c :d}}}}}} '{def A.reduce {lambda {:f :a} {if {A.empty? :a} then {A.new} else {:f {A.first :a} {A.reduce :f {A.rest :a}}}}}} -> {def A.reduce {lambda {:f :a} {if {A.empty? :a} then {A.new} else {:f {A.first :a} {A.reduce :f {A.rest :a}}}}}} '{S.replace (\[|\]) by in {S.replace \]\s\[ by {br} in {S.replace , by space in {S.replace \],\[ by space in {A.disp {permut {A.new {A.new Fair lady} {A.new your sweet eyes} {A.new make me die} {A.new of love} }}}}}}} -> {center {S.replace (\[|\]) by in {S.replace \]\s\[ by
in {S.replace , by space in {S.replace \],\[ by space in {A.disp {permut {A.new {A.new Fair lady} {A.new your sweet eyes} {A.new make me die} {A.new of love}}} }}}}} }} _h4 5) mandel _p You can play interactively in a canvas with the [[mandelbrot]] set or draw [[it|?view=mandel_canvas]] directly in the wiki page as a string of "{b o}" and "{b .}" {center {pre . . . . . . . . . . . . . . . o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . o o o . . . . . . . . . . . . . . . . . . . . . . . . . . . . o o o . . . . . . . . . . . . . . . . . . . . . . . . . . . o o o o o . . . . . . . . . . . . . . . . . . . . . . . . . o o o o o o o . . . . . . . . . . . . . . . . . . . . . . o o o o o o o o o o o . . . . . . . . . . . . . . . . . . . . o o o o o o o o o o o . . . . . . . . . . . . . . . . . . . . o o o o o o o o o o o . . . . . . . . . . . . . . . . . . . o o o o o o o o o o o o o . . . . . . . . . . . . . . . . . . . o o o o o o o o o o o . . . . . . . . . . . . . . . . . . . . o o o o o o o o o o o . . . . . . . . . . . . . . . . . . . . . o o o o o o o o o . . . . . . . . . . . . . . . . . . . . . . . o o o o o o o . . . . . . . . . . . . . . . . . . . . . . . . o o o o o o o . . . . . . . . . . . . . . . . . . o . o o o o o o o o o o o o o o o . o . . . . . . . . . . . . o . o o o o o o o o o o o o o o o . o . . . . . . . . . . . . o o o o o o o o o o o o o o o o o o o . . . . . . . . o o o o o o o o o o o o o o o o o o o o o o o o o o o . . . . . o o o o o o o o o o o o o o o o o o o o o o o o o . . . . . . . o o o o o o o o o o o o o o o o o o o o o o o . . . . . . o o o o o o o o o o o o o o o o o o o o o o o o o o o . . . . . o o o o o o o o o o o o o o o o o o o o o o o o o . . . . . o o o o o o o o o o o o o o o o o o o o o o o o o o o . . o . o o o o o o o o o o o o o o o o o o o o o o o o o o o . o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o . o o o o o o o o o o o o o o o o o o o o o o o o o o o . o . . o o o o o o o o o o o o o o o o o o o o o o o o o o o . . . . . o o o o o o o o o o o o o o o o o o o o o o o o o . . . . . o . o o o o o o o o o o o o o o o o o o o o o o o . o . . . . . . o o o o o o o o o o o o o o o o o o o o o o o . . . . . . . . o o o o o o o o o o o o o o o o o o o o o o o . . . . . . . . o o o o o o o o o o o . o o o o o o o o o o o . . . . . . . . o . . . o o o o o o . . . o o o o o o . . . o . . . . . . . . . . . . o . . o o . . . . . o o . . o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . }} _p with {pre '{S.map {lambda {:i} {br} // loop on y {S.map {{lambda {:i :j} // loop on x {mandel 20 :i :j}} :i} // compute with iter=20 {S.serie 0 30}}} // x resolution {S.serie 0 40}} // y resolution '{def mandel {def mandel.r {lambda {:iter :cx :cy :norm :x :y :count} {if {> :count :iter} // then norm < 4 then o // inside the set else {if {> :norm 4} // then iter > max then . // outside the set else {let { {:cx :cx} {:cy :cy} {:iter :iter} // remember... {:X {+ {* :x :x} -{* :y :y} :cx}} // compute {:Y {+ {* 2 :x :y} :cy}} // z = z^2+c {:count {+ :count 1}} } {mandel.r :iter :cx :cy // unchanged {+ {* :X :X} {* :Y :Y}} // new norm :X :Y // new x & y :count} }}}}} // next count {lambda {:iter :cx :cy} {mandel.r :iter {+ {* :cx 0.05} -1.50} // centering the set {+ {* :cy 0.05} -0.75} // inside the frame 0 0 0 0} }} } _h4 6) watch _p Or just write {b '{linear_watch}} to display a linear watch {linear_watch} _h4 7) dirac _p And a beautiful equation, the [[dirac equation|?view=maxwell]], for the fun: {div {@ style="font:italic 1.2em georgia; text-align:center;"} i{del h}{quotient 30 ∂ψ ∂t}(x,t) = {paren 3 (}mc{sup 2}α{sub 0} - i{del h}c {sigma 30 j=1 3} α{sub j}{quotient 30 ∂ ∂x{sub j}}{paren 3 )} ψ(x,t) } _p writing {pre '{div {@ style="font:italic 1.2em georgia; text-align:center;"} i{del h}{quotient 30 ∂ψ ∂t}(x,t) = {paren 3 (}mc{sup 2}α{sub 0} - i{del h}c {sigma 30 j=1 3} α{sub j} {quotient 30 ∂ ∂x{sub j}} {paren 3 )} ψ(x,t) } } _p where {b quotient, sigma} and {b paren} are three user defined functions playing with standard HTML/CSS {pre '{def quotient {lambda {:s :num :denom} {table {@ style="width::spx; display:inline-block; vertical-align:middle; text-align:center;"} {tr {td {@ style="border:0 solid; border-bottom:1px solid;"}:num}} {tr {td {@ style="border:0 solid;"}:denom}} }}} -> {def quotient {lambda {:s :num :denom} {table {@ style="width::spx; display:inline-block; vertical-align:middle; text-align:center;"} {tr {td {@ style="border:0 solid; border-bottom:1px solid;"}:num}} {tr {td {@ style="border:0 solid;"}:denom}} }}} '{def sigma {lambda {:s :one :two} {table {@ style="width::spx; display:inline-block; vertical-align:middle; text-align:center;"} {tr {td {@ style="border:0 solid;"}:two}} {tr {td {@ style="border:0 solid; font-size:2em; line-height:0.7em;"}Σ}} {tr {td {@ style="border:0 solid;"}:one}} }}} -> {def sigma {lambda {:s :one :two} {table {@ style="width::spx; display:inline-block; vertical-align:middle; text-align:center;"} {tr {td {@ style="border:0 solid;"}:two}} {tr {td {@ style="border:0 solid; font-size:2em; line-height:0.7em;"}Σ}} {tr {td {@ style="border:0 solid;"}:one}} }}} '{def paren {lambda {:s :p} {span {@ style="font:normal :sem arial; vertical-align:-0.15em;"} :p} }} -> {def paren {lambda {:s :p} {span {@ style="font:normal :sem arial; vertical-align:-0.15em;"}:p} }} } _p Nothing but standard HTML/CSS code whose rules are explained in deep anywhere on the web. Pages like [[pocket_calculator]] and [[pub]] should help you to think you are a smart webdesigner ... ~¿~ _h4 8) continuous fractions _p [[Continuous fractions|?view=rationals2]] are a monument of mathematics. I never tire of contemplating it. The most remarkable of the continued fractions contains only {b 1} {pre φ = [1;1,1,1,1,...] = 1 + 1 {{bt}1 + 1} {{bt}1 + 1} {{bt}1 + 1} {{bt}1 + ...} } {{hide} {def bt span {@ style="border-top:1px solid;"}})} _p and is nothing other than the golden ratio, {b φ = {/ {+ 1 {sqrt 5}} 2}}. This one is no less so {pre π = 4 {{bt}1 + 1{sup 2}} {{bt}2 + 3{sup 2}} {{bt}2 + 5{sup 2}} {{bt}2 + 7{sup 2}} {{bt}2 + 9{sup 2}} {{bt}2 + ...} } _p leading to {b π = {PI}}, the strangest of transcendental numbers whose decimals are totally randomly distributed, (high entropy), and captured in a beautiful, perfectly determined serie, (high neguentropy). Our (decimal) representation of numbers is decidedly poor and one could imagine that in the [[noosphere|?view=anges2]] minds use continued fractions to manipulate them ... why not? _p It's endless. ;; You are welcome in the marvelous world of code. } {{block} {uncover data/lambdaway_logo.png 100 600 ... to write and code in a coherent & simple way.} _h3 the workshop {center « {i Perfection is finally attained
not when there is no longer anything to add,
but when there is no longer anything to take away.} »
(Saint Exupery)} _h4 1) special forms _p Currently lambdatalk comes with {b 9} special forms making it a true programming language {pre {b lambda, def, let, if, quote, macro, style, script, require }} _p You could see interesting things about the first four special forms in the page [[concepts]]. _h4 2) primitives _p Accompanying the set of special forms there is an extendable set of primitives dealing with words, sentences, arrays, maths, html/css, the dom and a few more things: {uncover data/amelie_poulain.jpg 100 500 {center {prewrap DICT: [180] [unquote, include, lib, @, div, span, a, ul, ol, li, dl, dt, dd, table, tr, td, h1, h2, h3, h4, h5, h6, p, b, i, u, center, br, hr, blockquote, del, sup, sub, code, img, pre, textarea, audio, video, source, select, option, object, canvas, svg, line, rect, circle, ellipse, polygon, polyline, path, text, g, mpath, use, textPath, pattern, image, clipPath, defs, animate, set, animateMotion, animateTransform, title, desc, input, iframe, hide, prewrap, +, *, -, /, %, <, >, <=, >=, =, not, or, and, abs, acos, asin, atan, ceil, cos, exp, floor, pow, log, random, round, sin, sqrt, tan, min, max, PI, E, date, W.equal?, W.empty?, W.length, W.get, W.first, W.rest, W.last, W.slice, W.reverse, W.sort, W.lib, S.equal?, S.empty?, S.length, S.first, S.rest, S.last, S.get, S.slice, S.serie, S.map, S.reduce, S.replace, S.reverse, S.sort, S.lib, A.new, A.disp, A.join, A.split, A.array?, A.null?, A.empty?, A.in?, A.equal?, A.length, A.get, A.first, A.last, A.rest, A.slice, A.duplicate, A.reverse, A.concat, radic, A.map, A.set!, A.addlast!, A.sublast!, A.addfirst!, A.subfirst!, A.reverse!, A.sort!, A.swap!, A.lib, P.new, cons, P.pair?, P.left, car, P.right, cdr, P.disp, P.lib, LS.display, LS.setItem, LS.getItem, LS.removeItem, LS.clear, show_last_code, turtle, long_add, long_mult, uncover, drag, editable] }} } {center Please click on Amélie Poulain to see the 180 primitives.} _p everything built on the underlying powerful tools coming with any web browsers and opening lambdatalk to {b the huge library} of the World Wide Web. _h4 3) libraries _p Lambdatalk comes with an extensible set of [[libraries]] dealing with complex numbers, big numbers, 3D graphics, ... the essential point being that theoretically any free HTML/CSS/DOM/JS libraries found on the web can be used in lambdatalk via interfaces easy to implement. _h4 4) explorations _p In this workshop I'am going on, continuously exploring various algorithms with a unique goal: « {i synthesize all the exploratory work in a stronger language's core, more coherent sets of primitives and better designed libraries.} » _p So, starting again, I'm {i refactoring} everything, randomly as usual, dispatched in more than 1000 [[pages]]. Amongst others, you might have a look to these recent pages, the last one being the most recent created or edited. {center [[lambda factory|http://lambdaway.free.fr/workshop/data/cpu_intel.jpg]], [[fromroots2canopy]], [[λy|?view=bilingue2]], [[book]], [[coding]], [[lambda]], [[crypt]], [[fibonacci]], [[FFT]], [[pub]], [[bilingue]], [[meta10]], [[lambdacode]], [[iife]], [[oops]], [[oops4]], [[oops6]], [[pablo_rauzy]], [[Ycombinator]], [[binary_digit]], [[scheme]], [[fr2c]], [[exponent]], [[stairs]], [[prime_pattern]], [[block_edit]], [[reflexions_20201219]], [[WSAP]], [[castel]], [[coques]], [[eric_dobbs]], [[divine_recursion]], [[pict]], [[fr2c]], [[fun calc|?view=meta6]], [[story]], [[trampoline]], [[tromp]], [[timegoeson]], [[details]], [[radotages]], [[Y]], [[coder]], [[meta5]], [[BN]], [[scratch]], [[binaries]], [[bigint]], [[traverse]], [[habiter]], [[nostalgie]], [[fractions]], [[rationals]], [[scramble]], [[pocket_calculator]], [[match]], [[janus]], [[racket]], [[funstacker2]], [[florilège|?view=Y_en2]], [[even_odd]], [[string_sort]], [[bezier_3]], [[intersection]], [[simpson]], [[textanddraw]], [[perm3]], [[replace]], [[binary_search]], [[string_matching]], [[fac2iife]], [[words_numbers]], [[essais]], [[concepts]], [[cyclics]], [[scheme]], [[pforms5]], [[RISC]], [[janus]], [[lib_plot]], [[simply]], ... [[fast fourier transform|?view=fft]], [[de casteljau algorithm|?view=decasteljau2]], [[quicksort]], [[big numbers in lambda-calculus|?view=oops6]], [[scratch]], [[pforms|http://lambdaway.free.fr/workshop/?view=pforms]], [[story3]], [[thelambdawayproject]], [[pocket_calculator]], [[pub]], [[pforms5]], [[levithan]], [[story]], [[rationals]], [[IA]], [[rationals]], [[relativite_complexe]], [[insomnies]], [[break]], [[janus]], [[barycentre]], [[horner]], [[trombinoscope]], [[poo]], [[randomwalk]], [[function]], [[partition]], [[janus]], [[sierpinsky3]], [[unclosure]], [[musical_scales]], [[sierpinsky_compare]], [[viewing_trees]], [[concepts]], [[verlet]], [[towards oop|?view=poo4]], [[gamma]], [[laura]], [[lib_plot]], [[simply]], [[bigint]], [[curzon_numbers]], [[reduce3]], [[simply_scheme]], [[erato3]], [[agm]], [[middle_square]], [[rare_numbers]], [[powerset]], [[fr2c]], [[scheme]], [[happy_number]], [[pell]], [[euler_constant]], [[primes]], [[counter2]], [[spigot]], [[harshad]], [[ASCII]], [[loop_increments]], [[catalan_numbers]], [[hamming_numbers3]], [[super_ellipse]], [[anti_primes]], [[semiprime]], [[lcs]], [[additive_primes]], [[matrix3]], [[egyptian_division2]], [[cuboid]], [[find_in_unixdict]], [[line_intersection]], [[modular_inverse]], [[tablesort]], [[babbage]], [[root_mean_square]], [[factorions]], [[kernel]], [[deceptive]], [[haversine]], [[median]], [[stack & queue|?view=queue]], [[hanoi4]], [[concepts]] | [[divine_recursion]], [[florilege|?view=Y_en2]], [[from Y to Ω|?view=Y_en]], [[reflexions_20201219]], [[pablo_rauzy]], [[color_bar_display]], [[chatGPT]], [[quicksort5]], [[noosphere]], [[ceci-nest-pas-une-pipe]], [[jules_verne]], [[whynot]], [[musique]], [[echelle|http://lambdaway.fr/modulor/?view=echelle]], [[intrication_quantique]], [[divine_recursion]], [[abstraction_application]], [[acceleration]], [[essais]], [[fr2c]], [[barycentre]], ... } _p See also more than 200 tasks solved using lambdatalk in [[rosettacode.org|http://rosettacode.org/wiki/Category:Lambdatalk]]. Once again, for a global presentation see [[lambdaspeech|http://lambdaway.free.fr/lambdaspeech]] and [[λ-calc, λ-talk, λ-tank|?view=coding]]. _p Remember that all algorithms presented in this wiki are active and evaluated in real time, which allows everyone to test them at will, to understand them thoroughly and, why not, to improve them. _h4 5) and so what? _p {b Good news:} '{lambda talk} can live outside its alma mater, '{lambda tank}, and is recently hosted in a wiki {sup v2.0}, [[ustawi.wiki|http://alain.lambda.ustawi.wiki/]], led by the father of wikis, Ward Cunningham, making a small place for itself there. _p And finally you should know that this wiki page - like all others - is a {b lambdatalk program}, the text that composes it is written in lambdatalk, the titles, paragraphs, images and of course every code examples are lambdatalk code, evaluated in real time. This page is computed in less than 100ms on my iPad Pro. ;; Without the funny CSS animation of the small circle running along the Hilbert curve, the non negligible CPU cost could be reduced to zero. _p You can safely enter the page editor (click on the word "start" at the top left of the page) and modify what you want, test algorithms, modify values. Just try it. It's by "tinkering" with the code that you'll eventually understand it. You can at least test anything in the [[sandbox]]. Feel free to tell me your opinion in the [[agora]] or via an [[e-mail|mailto:marty.alain@free.fr]]. _p You can [[download]] the '{lambda way} project for free. You can analyse the '{lambda talk}'s [[JS engine|meca/JS.js]], and the '{lambda talk} code of this page clicking on the name "{b start}" on top of this page. _p You are welcome in my playground, full of funny colors. ;; _img http://lambdaway.free.fr/lambdawalks/data/cat-infinity.gif {{hide} {def rgba {lambda {:y :x :w :h :c} {div {@ style="position:absolute; top::ypx; left::xpx; width::wpx; height::hpx; background::c; border:5px solid #000;" }}}} } {div {@ style="position:relative; top:0; left:0; width:310px; height:310px; margin:auto; background:#000;"} {rgba 90 10 200 200 #0f0} {rgba 50 90 200 200 #00f} {rgba 10 50 200 200 #f00} {rgba 50 90 160 160 #f0f} {rgba 90 50 40 120 #ff0} {rgba 210 90 120 40 #0ff} {rgba 90 90 120 120 #fff} } ;; {center The eight primary colors} _p These eight primary colors are displayed writing {pre '{div {@ style="position:relative; top:0; left:0; width:310px; height:310px; margin:auto; background:#000;"} {rgba 90 10 200 200 #0f0} {rgba 50 90 200 200 #00f} {rgba 10 50 200 200 #f00} {rgba 50 90 160 160 #f0f} {rgba 90 50 40 120 #ff0} {rgba 210 90 120 40 #0ff} {rgba 90 90 120 120 #fff} } where '{def rgba {lambda {:y :x :w :h :c} {div {@ style="position:absolute; top::ypx; left::xpx; width::wpx; height::hpx; background::c; border:5px solid #000;" }}}} } _p And thanks to [[Aude Picault|https://www.audepicault.com/fanfare/fanfare.htm]], without Flash's burden, a sweetened version, yet so fun to orchestrate. And if you have annoying neighbors that you want to move, have fun all night long by turning the sound up to the max... {uncover data/fanfare/fanfare.png 100 370 La fanfare, the brass band} {pre {instrument Tuba.mp3 tuba} {instrument Trompette.mp3 trompette} {instrument Grosse.mp3 grosse caisse} {instrument Caisse.mp3 caisse claire} {instrument Souba.mp3 soubassophone} {instrument Trombone.mp3 trombone} } {{hide} {def instrument {lambda {:sound :name} {audio {@ controls preload loop style="width:80%; height:20px;"} {source {@ src="data/fanfare/sounds/:sound"}}} {b :name} }} } _p Nothing but HTML/CSS plus a few small ingredients. _p ... and javascript is always there for you. {canvas {@ id="matrix" width="600px" height="600px"}} {script var matrix = function() { const canvas = document.getElementById('matrix'); const ctx = canvas.getContext('2d'); const w = canvas.width; const h = canvas.height; const cols = Math.floor(w / 20) + 1; const ypos = Array(cols).fill(0); ctx.fillStyle = '#000'; ctx.fillRect(0, 0, w, h); var render = function() { ctx.fillStyle = '#0001'; ctx.fillRect(0, 0, w, h); ctx.fillStyle = '#0f0'; ctx.font = '15pt monospace'; ypos.forEach(function(y, x) { const text = String.fromCharCode(Math.random() * 128); ctx.fillText(text, 20*x, y); ypos[x] = (y > 100 + Math.random() * 10000) ? 0 : y + 20; }); }; setInterval(render, 100); } setTimeout( matrix, 1 ) } } {{block} ;;{uncover data/gandhi_adami.jpg 100 700 Gandhi} {uncover data/escher_hands.jpg 100 600 Escher hands} _h3 conclusion {center « {i Live as if you were to die tomorrow.
Learn as if you were to live forever.} ”
(Gandhi)} _p What to think of the lambdaway project? _p This is what [[Ward Cunningham|https://en.wikipedia.org/wiki/Ward_Cunningham]] told me on March 29, 2014: {blockquote _p « I am impressed with this work and understand its uniqueness better now. I have also rambled through other pages you have made, many as experiments I would guess, and have been summarized by you in this single work. Bravo. » } _p And also, a few months later: {blockquote _p « I was surprised that the technique worked so well in so many cases. I knew that regex are highly optimized and the cpus themselves optimize sequential access to memory which the regex must have at its core. [..] Yes, this has at its heart the repeated application of a text transformation. The fact that it is repeated application of the same transformation makes it exceptional. [..] Repeated application of Regular Expressions can perform Touring Complete computations. This works because the needed "state" is in the partially evaluated text itself. » All is said! } _p and more recently (19/07/2020) {blockquote _p « I’ve always admired your work, both the interpreter and your exploration of its capabilities. In the wiki tradition it offers clear passage into the networking and graphic capabilities of the browser. Thompson sees it as a philosophical artifact rooted in history and uncovered anew by you. » } _p You could read some other more or less positive comments on the lambdaway project, for instance [[here|http://lambdaway.free.fr/workshop/?view=comments]] and [[there|?view=comments]]. This one was premonitory {blockquote _p « Oh please nooooo! There are hundred of wiki engines and hundred of languages! Why yet another wiki and another language nobody will ever want to use? » } _p This other one was more kind {blockquote _p « I like it when I find this simple yet powerful ideas implemented, these are the things that when you see them you think, Why didn't I think of that? » ({b [[reddit|http://redd.it/1xfsd3]]/maufdez)} } _p and this one too {blockquote _p « This is brilliant by the way. Definitely show it to more people and get feedback, it is so outside of the norm that it will take time for the idea to spread. » } _p This guy had therefore seen right, this project is probably very outside of the norm ... and the idea has no yet found where to spread. _p This is a recent one: {blockquote _p « I’m not quite sure how to describe '{lambda way}. It’s a wiki based on a very simple programming language written in JS which looks like a lisp (it does have macros) but based on term rewriting (I think it’s just implemented using regular expressions, which is why it doesn’t have closures) that outputs HTML. If you press the start button (on top of this page) you can see that the pages of this wiki are '{lambda talk} programs that can be edited in real time. _p It’s a very idiosyncratic project, but it has a lot of interesting ideas. » } _p I couldn't say better! _p A short email exchange: {blockquote _p Dear Alain Marty _p As per lambdatalk – I'm afraid it will never become popular enough to see any widespread usage. The reason is simple – the common programmer's aversion towards functional programming, and even more towards lambda calculus. People like programming languages which mimick natural language. As a side note, this is precisely the reason why object-oriented programming is so popular, and will be for a long time. --Dick de Bill (talk) 13:35, 29 May 2020 (UTC) } _p and my answer: {blockquote _p Dear Dick de Bill, _p I understand the aversion one can have to functional programming when reading some codes in Haskell or even Javascript. I understand that one can run away from "academic and/or obscure" presentations of lambda-calculus. I understand that some Lisp codes cluttered with parentheses may look like a dish of spaghetti. _p I thought I escaped that with lambdatalk. I guess not, or at least the first impression repulses the reader who fears to find an nth Lispian avatar with a functional and lambda-calculus sauce. This is probably the case. _p I remember the [[Hypertalk|?view=hypercard]] language as a rather successful - and rather cumbersome - attempt at syntax close to natural language. I thought that lambdatalk was pretty close, just adding (grey) brackets in the background. I think that anyone can understand that if you ask somebody to {pre {b replace} :x & :y {b in} hello :x :y world {b by} brave & new } _p the answer will be {b hello brave new world}. _p And I thought that anyone could guess that rhe following expression {pre '{{lambda {:x :y} hello :x :y world } brave new} } _p is a code which can be used to "talk" to a computer in order to get the same answer. It's a kind of lambda-calculus at level zero. But I'm probably wrong. _p Thank you for your attention. -- Alain Marty } _p Finally, I remember that, 7 years ago, for the {b SCHEME & FUNCTIONAL PROGRAMMING WORKSHOP 2017 | OXFORD UK | 2017/09/03}, I could directly generate from a [[wiki page|http://lambdaway.free.fr/workshop/?view=oxford]], used as a workshop, a [[PDF paper|http://lambdaway.free.fr/workshop/data/lambdatalk_20170728.pdf]], and the [[slides|http://lambdaway.free.fr/workshop/?view=oxford_slides]] for the presentation. Without any return, neither good nor bad. Nada! _p Well, I'll deal with that, and the show will go on, even if the theater is empty. Even if I am alone, I enjoy the trip, exploring algorithms of anything. The quest of minimalism is endless. {uncover data/IMG_0311.jpeg 100 400 The quest of minimalism is endless.} {uncover data/entree_nyls.jpg 100 1000 « Less is more » (Mies van der Rohe){div} [[The Nyls house|http://b2b3.free.fr/am/?view=nyls]] (AM architect)} {uncover data/ali.jpg 100 600 These days, most of the time, I'm working in the [[noosphere|http://lambdaway.fr/workshop/?view=noosphere]]} {uncover data/IMG_20231220_215511.jpg 100 1400 Goodbye.} } ;; _ul [[HN|https://news.ycombinator.com/item?id=32449130]] | [[HN|https://news.ycombinator.com/item?id=32865680]] | [[HN|https://news.ycombinator.com/item?id=33462454#33465268]] ;; _ul [[an intuition for lisp syntax|https://stopa.io/post/265]] ;; _ul [[what is lisp enlightment?|https://news.ycombinator.com/item?id=32383525]] ;; _ul The page's source code contains 26707 characters, about 29 kbytes. ;; _ul {input {@ type="button" value="show html" onclick="htmlcode()"}} ;; {textarea {@ id="htmlcode" style="display:none; width:100%; height:1000px; border:0; "}} ;; ======= coder's corner ======= ;; 1) lambdatalk user defined functions {{hide} {def block div {@ style="display:inline-block; width:600px; vertical-align:top; padding:20px; "}} {def HMS {lambda {:hms :back :col} {div {@ id=":hms" style="width:0px; height:5px; text-align:right; padding-right:5px; background::back; color::col; line-height:0.4em; text-shadow:0 0 8px #000; font-weight:bold;"}}}} {def linear_watch {div {@ style="box-shadow:0 0 8px #000; background:#444; border:1px solid #fff; margin-top:10px;"} {HMS linear_watch_hours #f00 #fff} {HMS linear_watch_minutes #0f0 #fff} {HMS linear_watch_seconds #00f #fff} }} {def PICT {div {@ style="position:relative; top:0px; left:50%; margin-left:-200px; height:400px; text-align:center; color:#fff;"} {div {@ style="position:absolute; left:0px; bottom:0px; width:400px; height:350px; padding-top:50px; box-shadow:0 0 8px #000; border-radius:200px; font-size:72px; background:#ccc; "} {div {@ style="position:absolute; left:50%; margin-left:-125px; bottom:0px; width:250px; height:210px; padding-top:40px; border:1px solid #000; border-radius:125px; font-size:48px; background:#aaa; color:#0ff; "} {div {@ style="position:absolute; left:50%; margin-left:-75px; bottom:0px; width:150px; height:110px; padding-top:40px; border:1px solid #000; border-radius:75px; font-size:24px; background:#888; color:#0f0; "} {div {@ style="position:absolute; left:50%; margin-left:-37px; bottom:0px; width:75px; height:65px; padding-top:10px; border:1px solid #000; border-radius:37px; font-size:36px; background:#666; color:#f00; "} '{λy} }primitives}libraries}'{www}} }} {def AA {floor {* 10 {random}}}} {def BB {floor {* 5 {random}}}} {def CYCLIC {lambda {:t} {* 150 {+ {cos :t} {* {/ 1 2} {cos {* {AA} :t}}} {* {/ 1 -3} {sin {* -{BB} :t}}}}} {* 150 {+ {sin :t} {* {/ 1 2} {sin {* {AA} :t}}} {* {/ 1 3} {cos {* -{BB} :t}}}}} }} {def SVG {lambda {:h} svg {@ width="600px" height=":hpx" style="background:#444"} }} {def AXES {lambda {:w :h} {@ transform="translate({/ :w 2},{/ :h 2}) scale(1,-1)"} {line {@ x1="-{/ :w 2}:w" y1="0" x2="{/ :w 2}" y2="0" stroke="red" fill="transparent"}} {line {@ x1="0" y1="-{/ :h 2}" x2="0" y2="{/ :h 2}" stroke="green" fill="transparent"}} }} {def stroke {lambda {:col :w} stroke=":col" fill="transparent" stroke-width=":w" }} ;; {def CODE pre {@ style="text-align:center; font:normal 1.5em optima;"}} } ;; 2) CSS rules {style @font-face { font-family: 'Quicksand'; src: url(data/quicksand.woff) format('woff'); } body { background:#444; } #page_frame { border:0; background:transparent; width:600px; margin-left:0; } #page_content { background:transparent; color:#fff; border:0; width:3300px; box-shadow:0 0 0; font:normal 1.1em Quicksand, optima; } .page_menu { background:transparent; color:#fff; } a { color:#fa0; } pre { box-shadow:0 0 4px #000; padding:5px; background:#555; color:#fff; font:normal 0.9em courier; } b { color:cyan; } h1 { font-size:4.0em; margin:0; text-align:center;} h2 { font-size:3.0em; margin:0; text-align:center;} h3 { font-size:2.5em; margin:0; text-align:center;} h4 { font-size:2.0em; margin:0; } blockquote { border:0px solid #fff; padding:10px; font:italic 0.9em courier; box-shadow:0 0 8px #000 } a[href^="http://"]:after { content: " ➚"; } } ;; 3) javascript {script ;; function htmlcode() { var code = document.getElementById('page_textarea').value; var id = document.getElementById('htmlcode'); id.innerHTML = LAMBDATALK.evaluate(code).val; id.style.display = (id.style.display === 'none')? 'block' : 'none' }; var HMS = function ( w ) { // used by the linear watch var d = new Date(), h = d.getHours(), m = d.getMinutes(), s = d.getSeconds(); document.getElementById('linear_watch_hours').style.width = (w/24*h) + 'px'; document.getElementById('linear_watch_hours').innerHTML = h; document.getElementById('linear_watch_minutes').style.width = (w/60*m) + 'px'; document.getElementById('linear_watch_minutes').innerHTML = m; document.getElementById('linear_watch_seconds').style.width = (w/60*s) + 'px'; document.getElementById('linear_watch_seconds').innerHTML = s; }; setInterval( HMS, 1000, 600 ); }
lambdaway v.20211111