lambdaspeech
::
whitepage
2
|
list
|
login
|
load
|
|
{uncover data/amelie_poulain.jpg 100 500} {center _h1 the '{lambda way} project} {{title} _h2 What the hell is that? ... }{{content} _p The '{lambda way} project is a light framework built on a wiki, '{lambda tank}, and a functional programming language, '{lambda talk}. _p « {i 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 Please, let's talk about that! } {{title} _h2 1) Let's write our first functions ... }{{content} {prewrap '{def smart_swap {lambda {:x :y} Swapping :x and :y displays :y :x}} -> {def smart_swap {lambda {:x :y} Swapping :x and :y displays :y :x}} '{smart_swap hello world} -> {smart_swap hello world} '{def smart_add {lambda {:x :y} adding :x and :y displays {+ :x :y}}} -> {def smart_add {lambda {:x :y} adding :x and :y displays {+ :x :y}}} '{smart_add 3 4} -> {smart_add 3 4} } } {{title} _h2 2) Let's write some HTML/CSS ... }{{content} {prewrap '{def color {lambda {:col :text} {span {@ style="color::col"}:text}}} -> {def color {lambda {:col :text} {span {@ style="color::col"}:text}}} '{color #f00 hello world} -> {color #f00 hello world} '{color #0ff hello brave new world} -> {color #0ff hello brave new world} '{def randcol {lambda {:w} {span {@ style="color:rgb({round {* {random} 255}}, {round {* {random} 255}}, {round {* {random} 255}})"}:w}}} -> {def randcol {lambda {:w} {span {@ style="color:rgb({round {* {random} 255}}, {round {* {random} 255}}, {round {* {random} 255}})"}:w}}} '{map randcol {serie 1 100}} -> {map randcol {serie 1 100}} } _p See how uncovering Amélie Poulain at the top of this page is done writing the expression {code '{uncover data/amelie_poulain.jpg 50 500}} built on the following user defined function {pre '{def uncover {lambda {:im :h1 :h2} {img {@ src=":im" style="width: 100%; height: :h1px; object-fit: cover; -webkit-transition: all 1s; -moz-transition: all 1s; -o-transition: all 1s; transition: all 1s;" onclick="this.style.height= (this.style.height===':h1px')? ':h2px' : ':h1px'"}}}} } _p And so on. } {{title} _h2 3) Let's compute ... }{{content} _p Let's compute the product of the first hundred natural numbers using the factorial function {prewrap '{def fac // let's call "fac" the factorial function {lambda {:op :n} // computing 1*2*3 ... n {if {= :n 1} // if n = 1 then 1 // then the value of fac(1) is 1 else {:op :n {fac :op {- :n 1}}} // else n * fac(n-1) }}} // close until balance -> {def fac {lambda {:op :n} {if {= :n 1} then 1 else {:op :n {fac :op {- :n 1}}}}}} '{fac * 100} // calling fac on 100 with * -> {fac * 100} '{fac long_mult 100} // calling fac on 100 with long_mult -> {fac long_mult 100} } } {{title} _h2 And so what? ... }{{content} {center If you're curious you'll find out more [[here|?view=start]], {br}otherwise I wish you a {b Merry Christmas!}} } {center {i Alain Marty (2019/12/25)}} ;; the following coder's corner should be externalized in a library: {{hide} {def title div {@ onclick=" this.nextSibling.style.transform= (this.nextSibling.style.transform==='scale(0)')? 'scale(1)' : 'scale(0)'; this.nextSibling.style.height= (this.nextSibling.style.height==='0px')? 'auto' : '0px';"}} {def content div {@ style="transform:scale(0); height:0px; transition:all 1s;"}} {def uncover {lambda {:im :h1 :h2} {img {@ src=":im" style="width: 100%; height: :h1px; object-fit: cover; -webkit-transition: all 1s; -moz-transition: all 1s; -o-transition: all 1s; transition: all 1s;" onclick="this.style.height= (this.style.height===':h1px')? ':h2px' : ':h1px'"}}}} } {style ;; @import url(https://fonts.googleapis.com/css?family=Quicksand); body, #page_frame { padding:0; margin:0; border:0; background:#000; color:#fff; } .page_menu { background:transparent; } #page_content { margin:0; font-family: Quicksand; font-size:1.5em; background:transparent; box-shadow:0 0 0; } #page_frame { width:100%; margin:0; padding:0; } #page_textarea { font:normal 1.2em courier; color:#fff; background:#000; } }
lambdaspeech v.20200126