wisp 1.0.8: wisp2lisp can process stdin
M AUTHORS.in +2 -0
@@ 4,6 4,8 @@ Specific Contributions:
 
 - Mark Weaver and Arne Babenhauserheide: Efficient string-replace-substring
 - Mark Weaver and NalaGinrut and Arne Babenhauserheide: wisp-reader.w
+- Christine Lemmer Webber added functions to interact with geiser, now
+  included in wisp-mode as wisp--eval-with-geiser and wisp--wisp2lisp
 
 Authors Info:
 

          
M Makefile.am +1 -1
@@ 28,7 28,7 @@ guile_install_go_files = install-nobase_
 
 EXTRA_DIST = $(WISP) bootstrap.sh bootstrap-reader.sh language examples tests wisp-repl-guile.sh testrunner.w wisp.py wisp.scm wisp.in m4 ob-wisp.el wisp-mode.el AUTHORS.in
 CLEANFILES = 1 2 $(GOBJECTS)
-DISTCLEANFILES = $(bin_SCRIPTS) $(nobase_site_DATA)
+DISTCLEANFILES = $(bin_SCRIPTS) $(nobase_site_DATA) .wisp-repl
 # don't spout out lots of stuff at each distcheck. Disable for debugging.
 AM_DISTCHECK_CONFIGURE_FLAGS="--quiet"
 

          
M NEWS +4 -0
@@ 1,3 1,7 @@ 
+wisp 1.0.8
+- wisp2lisp can now process stdin when called with - as filename.
+  And it has help output.
+
 wisp-mode 0.3.0
 - provide wisp-color-indentation-minor-mode that highlights the
   indentation levels, following wisp-semantics (period and colon)

          
M configure.ac +1 -1
@@ 1,7 1,7 @@ 
 dnl run `autoreconf -i` to generate a configure script. 
 dnl Then run ./configure to generate a Makefile.
 dnl Finally run make to generate the project.
-AC_INIT([wisp], [1.0.7],
+AC_INIT([wisp], [1.0.8],
         [arne_bab@web.de])
 # Add macros in m4/ to ensure that wisp builds without having Guile in the aclocal path
 AC_CONFIG_MACRO_DIR([m4])

          
M examples/benchmark.w +1 -0
@@ 30,6 30,7 @@ define max-iterations 32 ;; at most 128 
 
 
 ;; stddev from rosetta code: http://rosettacode.org/wiki/Standard_deviation#Scheme
+;; (=> license: cc by-sa)
 define : stddev nums
     sqrt
         -

          
M examples/evaluate-r7rs-benchmark.w +4 -0
@@ 10,6 10,9 @@ exec -a "$0" guile -L $(dirname $(dirnam
 ;; example usage: 
 ;; $ for i in bigloo bones chez chibi chicken- chickencsi- cyclone femtolisp foment gambitc gauche guile ironscheme kawa larceny mit mosh petite picrin racket rhizome rscheme s9fes sagittarius scheme48- stalin tinyscheme vicare ypsilon; do echo $i $(./evaluate-r7rs-benchmark.w guile-ecraven-benchmarks-result-2017-08-13.csv $i | grep Geom -A 2 | grep -v = | grep .); done | sed 's/(//' > evaluate-r7rs-benchmark.data
 ;; $ echo -e 'set xtics rotate by 90 right\nplot "< sort -g -k2 evaluate-r7rs-benchmark.data" using 0:2:xtic(1) with lines title "runtime: geometric mean multiple of fastest", "< sort -g -k2 evaluate-r7rs-benchmark.data" using 0:3:xtic(1) with lines title "successful tests"' | gnuplot -p
+;;
+;; evaluation into a table sorted by slowdown:
+;; $ for i in guile-3.0.5 guile-2 bigloo bones chez chibi- chicken cyclone femtolisp foment gambitc gauche ironscheme kawa loko mit petite racket s7 s9fes sagittarius; do  ./evaluate-r7rs-benchmark.w  ~/Downloads/all.csv $i | grep -A2 '===.*Geometric' | sed s/Geometric.*===// | sed 's/=== //' | xargs ; done 2>/dev/null | column -t | sort -k2 -g
 
 define-module : examples evaluate-r7rs-benchmark
     . #:export : main

          
@@ 113,6 116,7 @@ define project-prefix
        car : cdr : cdr args
 
 define : main args
+    pretty-print args
     when : and {(length args) > 1} : equal? "--help" : second args 
          help args
          exit 0

          
M ob-wisp.el +9 -5
@@ 8,7 8,7 @@ 
 ;; Keywords: literate programming, reproducible research
 ;; Homepage: http://orgmode.org
 
-;; Version: 0.1
+;; Version: 0.2
 ;; Keywords: languages, lisp
 
 ;; This file is not part of GNU Emacs. It is modified from ob-python.el

          
@@ 31,6 31,7 @@ 
 ;; Org-Babel support for evaluating wisp source code.
 
 ;; ChangeLog:
+;;  - 0.2: execute works with noweb references
 ;;  - 0.1: search for modules with .w extension
 
 

          
@@ 89,7 90,7 @@ This function is called by `org-babel-ex
 	 (return-val (when (and (eq result-type 'value) (not session))
 		       (cdr (assoc :return params))))
 	 (preamble (cdr (assoc :preamble params)))
-         (full-body
+     (full-body
 	  (org-babel-expand-body:generic
 	   (concat body (if return-val (format ". %s\n" return-val) "\n"))
 	   params (org-babel-variable-assignments:wisp params)))

          
@@ 261,11 262,14 @@ pretty-print (main) : open-output-file '
 If RESULT-TYPE equals 'output then return standard output as a
 string.  If RESULT-TYPE equals 'value then return the value of the
 last statement in BODY, as elisp."
-  (let ((raw
+  (let* ((full-body
+	      (org-babel-expand-body:generic body
+	       (list) (org-babel-variable-assignments:wisp (list))))
+         (raw
          (case result-type
            (output (org-babel-eval org-babel-wisp-command
                                    (concat (if preamble (concat preamble "\n"))
-                                           body)))
+                                           full-body)))
            (value (let ((tmp-file (org-babel-temp-file "wisp-")))
                     (org-babel-eval
                      org-babel-wisp-command

          
@@ 279,7 283,7 @@ last statement in BODY, as elisp."
                         (lambda (line) (format "    %s" line))
                         (split-string
                          (org-remove-indentation
-                          (org-trim body))
+                          (org-trim full-body))
                          "[\r\n]") "\n")
                        (org-babel-process-file-name tmp-file 'noquote))))
                     (org-babel-eval-read-file tmp-file))))))

          
M wisp-guile.w +21 -10
@@ 1,4 1,5 @@ 
 #!/usr/bin/env guile
+; -*- wisp -*-
 ; !#
 
 ;; This file might need to be licensed permissively for inclusion in

          
@@ 390,16 391,19 @@ define : linestoindented lines
                             . splitindent
 
 
+define : read-all-from-port inport
+    let reader 
+        : text ""
+          nextchar : read-char inport
+        if : eof-object? nextchar
+            . text
+            reader 
+                string-append text : string nextchar
+                read-char inport
+
 define : read-whole-file filename
     let : : origfile : open-file filename "r"
-        let reader 
-            : text ""
-              nextchar : read-char origfile
-            if : eof-object? nextchar
-                . text
-                reader 
-                    string-append text : string nextchar
-                    read-char origfile
+        read-all-from-port origfile
 
 
 

          
@@ 828,7 832,13 @@ define : wisp2lisp text
            join-lisp-lines clean-lines
 
  ; first step: Be able to mirror a file to stdout
-if : < 1 : length : command-line
+cond
+   : equal? '("-") : cdr : command-line
+     display : wisp2lisp : read-all-from-port : current-input-port
+     newline
+   : or (null? (cdr (command-line))) (member "--help" (command-line))
+     format (current-error-port) "~a [ - | <filename> | --help ]\n\nwith '-': read from stdin.\n" : car : command-line
+   : = 2 : length : command-line
     let*
          : filename : list-ref ( command-line ) 1
            text : read-whole-file filename

          
@@ 840,4 850,5 @@ if : < 1 : length : command-line
            lisp : wisp2lisp text
          display lisp
          newline
-    . #f
+   else
+       exit 2 ;; error

          
M wisp-mode.el +30 -1
@@ 42,7 42,7 @@ 
 ;; 
 ;; ChangeLog:
 ;;
-;;  - 0.3.0: provide wisp-color-indentation-minor--mode
+;;  - 0.3.0: provide wisp-color-indentation-minor-mode
 ;;           that highlights the indentation levels, following wisp-semantics (period and colon)
 ;;  - 0.2.9: enabled imenu - thanks to Greg Reagle!
 ;;  - 0.2.8: use electric-indent-inhibit instead of electric-indent-local-mode

          
@@ 647,5 647,34 @@ color of the overlay, the mapped color i
 ;; (add-hook 'post-command-hook 'wisp--highlight-current-indentation-level nil t)
 
 
+(defun wisp--wisp2lisp ()
+  (interactive)
+  (let ((current-line (line-number-at-pos)))
+    (save-excursion
+      (get-buffer-create "*wisp2lisp*")
+      (set-buffer "*wisp2lisp*")
+      (erase-buffer)
+      (scheme-mode))
+    (call-process "wisp2lisp" nil "*wisp2lisp*" nil (buffer-file-name))
+    (when (called-interactively-p)
+      (switch-to-buffer-other-window "*wisp2lisp*")
+      (beginning-of-buffer)
+      (forward-line (- current-line 1)))))
+
+(define-key wisp-mode-map (kbd "C-c C-w") 'wisp--wisp2lisp)
+
+(defun wisp--eval-with-geiser ()
+  (interactive)
+  (require 'geiser)
+  (wisp--wisp2lisp)
+  (save-excursion
+    (set-buffer "*wisp2lisp*")
+    (run-geiser 'guile)
+    (geiser-eval-buffer)))
+
+(define-key wisp-mode-map (kbd "C-c C-b") 'wisp--eval-with-geiser)
+
+
+
 (provide 'wisp-mode)
 ;;; wisp-mode.el ends here