#+title: Why Wisp?
#+date: 2014
#+OPTIONS: H:1 num:nil toc:nil \n:nil @:t ::t |:t ^:t f:t LaTeX:t
#+BIND: org-export-html-style-include-default nil
#+BIND: org-export-html-style-include-scripts t
#+BIND: org-export-html-auto-preamble nil
#+BIND: org-export-html-auto-postamble nil
#+BIND: org-export-html-style "<!-- configuration parameters --> <meta name='defaultView' content='slideshow' /> <meta name='controlVis' content='hidden' /> <!-- style sheet links --> <link rel='stylesheet' href='ui/default/slides.css' type='text/css' media='projection' id='slideProj' /> <link rel='stylesheet' href='ui/default/outline.css' type='text/css' media='screen' id='outlineStyle' /> <link rel='stylesheet' href='ui/default/print.css' type='text/css' media='print' id='slidePrint' /> <link rel='stylesheet' href='ui/default/opera.css' type='text/css' media='projection' id='operaFix' />"
#+BIND: org-export-html-style-extra "<!-- S5 JS --> <script src='ui/jquery.js' type='text/javascript'></script> <script src='ui/org-slides.js' type='text/javascript'></script> <script src='ui/default/slides.js' type='text/javascript'></script> <script src='ui/default/style.js' type='text/javascript'></script>"
#+BIND: org-export-html-preamble org-s5-html-preamble-function
#+BIND: org-export-html-postamble org-s5-html-postamble-function
# Export as s5 presentation. See http://orgmode.org/worg/org-tutorials/non-beamer-presentations.html

#+BEGIN_SRC elisp :exports none
(require 'ox-s5)
#+END_SRC

* Elegance
#+html: <br />
** =.,":'_#?!;=

/The most common non-letter, non-math characters in prose/

** =()=

/The most common paired characters/

(From letter distributions in newspapers)

* On Words                                           

#+BEGIN_SRC elisp :exports results :results results raw
  (defun shuffle-wordcontent (string)
    (interactive)
    (let ((strings (split-string string)))
      (substring 
       (apply 'concat 
              (loop for s in strings 
                    collect (if (< (length s) 4) 
                                (concat s " ")
                              (concat (substring s 0 1) 
                                      (apply 'concat 
                                             (mapcar 'string 
                                                     (shuffle-vector 
                                                      (string-to-vector 
                                                       (substring s 1 -1)))))
                                      (substring s -1)
                                      " "))))
       0 -1)))
  
  (concat "*" (setq why-wisp-text-scheme-has (shuffle-wordcontent "Scheme follows a minimalist design philosophy")) "*")
#+END_SRC

#+RESULTS:
*Shcmee fowlols a malisimint dsegin plhpoihosy*

- /Defocus a bit/
- /Can you see the meaning?/

* Scheme for Newcomers

#+BEGIN_SRC elisp :exports results :results results raw
  (concat "*€" (combine-and-quote-strings (split-string why-wisp-text-scheme-has) " €") (apply 'concat (loop for word in (split-string why-wisp-text-scheme-has) collect "¥") ) "*")
#+END_SRC

#+RESULTS:
*€Shcmee €fowlols €a €malisimint €dsegin €plhpoihosy¥¥¥¥¥¥*

- /Try it again/
- /Do you see how much harder it got?/
- /€ and ¥ escape your existing filters/


* Summary: Current Lisp

1. Lisp syntax uses the *most common* non-letter, non-math characters.
2. The *first and last characters* are important for text-recognition.

Let’s call these elegance 1 and elegance 2

Any fix for elegance 2 should preserve elegance 1

Elegance 0: generality and homoiconicity: *code is data*

* On Wisp
#+html: <br />
#+BEGIN_SRC scheme
  define : hello
           display "Hello Schemers!\n"
#+END_SRC

becomes

#+BEGIN_SRC scheme
  (define (hello)
          (display "Hello Schemers!\n"))
#+END_SRC

* Why not SRFI-49 (Indentation-sensitive syntax)?

** Scheme

#+BEGIN_SRC scheme
  (+ 5 
     (* 4 3) 
     2 1 0)
#+END_SRC

** SRFI-49

#+BEGIN_SRC scheme
  + 5
    * 4 3
    2
    1
    0
#+END_SRC

- Cannot continue the argument list

* Continuing the argument list in wisp

** Wisp

#+BEGIN_SRC scheme
  + 5
    * 4 3
    . 2 1 0
#+END_SRC

- Complete representation of arbitrary structures
- Generalize =(. x) ⇒ x= to =(. x ...) ⇒ x ...=
- Use =. . x= to get a real =. x= after processing

* Why not SRFI-110 (Sweet-expressions (t-expressions))
** SRFI-110

#+BEGIN_SRC scheme
myfunction 
  x: \\ original-x
  y: \\ calculate-y original-y
#+END_SRC

#+BEGIN_SRC scheme
  a b $ c d e $ f g
#+END_SRC

#+BEGIN_SRC scheme
  let <* x getx() \\ y gety() *>
  ! {{x * x} + {y * y}}
#+END_SRC

/This breaks elegance 1/

/Also the problems of SRFI-49 are preserved/

* Summary: Why wisp?

** Wisp
/minimal indentation-based syntax/
** Wisp vs. SRFI-49: continue the argument list.
** Wisp vs. SRFI-110:
*** use common characters (elegance 1).
*** KISS.

* Wisp syntax 1/4: function calls

** Indentation

#+BEGIN_SRC scheme
display 
  + 3 4 5
newline
#+END_SRC

becomes

#+BEGIN_SRC scheme
(display 
  (+ 3 4 5))
(newline)
#+END_SRC

* Wisp syntax 2/4: Continue Argument list

** The dot

#+BEGIN_SRC scheme
+ 5
  * 4 3
  . 2 1
#+END_SRC

becomes

#+BEGIN_SRC scheme
(+ 5
  (* 4 3)
  2 1)
#+END_SRC

* Wisp syntax 3/4: Double Parens

** The colon

#+BEGIN_SRC scheme
let 
  : x 1
    y 2
    z 3
  body
#+END_SRC

becomes

#+BEGIN_SRC scheme
(let
  ((x 1)
   (y 2)
   (z 3))
  body)
#+END_SRC

* Wisp syntax 4/4: Resilient Indentation

** The underscore (optional)

#+BEGIN_SRC scheme
let 
_ : x 1
__  y 2
__  z 3
_ body
#+END_SRC

becomes

#+BEGIN_SRC scheme
(let
  ((x 1)
   (y 2)
   (z 3))
  body)
#+END_SRC
 

* Summary: Wisp syntax justification

#+html: <small>
http://draketo.de/light/english/wisp-lisp-indentation-preprocessor#sec-4
#+html: </small>

/Required for the goal of wisp: indentation-based lisp with a simple preprocessor/

- =.= to continue the argument list
- =:= for double parens
- =_= to survive HTML

* Wisp mission
#+html: <br /><blockquote>
“I love the syntax of Python, but crave the simplicity and power of Lisp.”
#+html: </blockquote>

See the site for info how to test wisp:

#+html: <small>
http://draketo.de/light/english/wisp-lisp-indentation-preprocessor
#+html: </small>

# Local Variables:
# org-confirm-babel-evaluate: nil
# org-export-allow-bind-keywords: t
# End: