Skip to content

Instantly share code, notes, and snippets.

@jacius
Last active December 12, 2015 08:59
Show Gist options
  • Select an option

  • Save jacius/4748506 to your computer and use it in GitHub Desktop.

Select an option

Save jacius/4748506 to your computer and use it in GitHub Desktop.

Revisions

  1. jacius revised this gist Feb 10, 2013. 3 changed files with 5 additions and 15 deletions.
    15 changes: 3 additions & 12 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    generated = hello.html hello.js spock-runtime.js
    generated = hello.html hello.js spock-runtime-min.js

    all: $(generated)

    @@ -13,14 +13,5 @@ clean:
    chicken-spock $< > $@


    spock-runtime.js:
    chicken-spock -runtime > spock-runtime.js

    spock-runtime-min.js:
    chicken-spock -runtime | jsmin > spock-runtime-min.js

    spock-runtime-debug.js:
    chicken-spock -runtime -debug > spock-runtime-debug.js

    spock-runtime-debug-min.js:
    chicken-spock -runtime -debug | jsmin > spock-runtime-debug-min.js
    spock-runtime-%.js:
    cp `chicken-spock -library-path`/$@ $@
    2 changes: 1 addition & 1 deletion hello.html.scm
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,6 @@
    (display
    (<html>
    (<head>
    (<spock-header> minified: #f)
    (<spock-header>)
    (<script> type: "text/javascript" src: "hello.js"))
    (<body>)))
    3 changes: 1 addition & 2 deletions hello.js.scm
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    (define (alert message)
    (%inline "alert" message))
    (define-native alert)

    (alert "Hello, Vulcan.")
  2. jacius revised this gist Feb 10, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hello.js.scm
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    (define (alert message)
    (%inline "alert" message))

    (alert "Hello, world!")
    (alert "Hello, Vulcan.")
  3. jacius revised this gist Feb 10, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hello.html.scm
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,6 @@
    (display
    (<html>
    (<head>
    (<spock-header>)
    (<spock-header> minified: #f)
    (<script> type: "text/javascript" src: "hello.js"))
    (<body>)))
  4. jacius revised this gist Feb 10, 2013. 1 changed file with 0 additions and 12 deletions.
    12 changes: 0 additions & 12 deletions README.textile
    Original file line number Diff line number Diff line change
    @@ -1,12 +0,0 @@
    Barebones example of using "Chicken Scheme":http://call-cc.org/ to generate HTML and JS, using the "html-tags":http://wiki.call-cc.org/eggref/4/html-tags and "spock":http://wiki.call-cc.org/eggref/4/spock eggs.

    You will need:

    * Chicken Scheme
    * html-tags: @chicken-install html-tags@
    * spock: @chicken-install spock@
    * Make

    Run @make@ to generate the HTML and JS files, then open "hello.html" in a web browser.

    Of course, you would realistically never use spock for something this simple. spock adds significant overhead, both in terms of downloads (the non-minified spock-runtime.js file is over 200K) and runtime speed / memory use.
  5. jacius created this gist Feb 10, 2013.
    26 changes: 26 additions & 0 deletions Makefile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    generated = hello.html hello.js spock-runtime.js

    all: $(generated)

    clean:
    rm $(generated)


    %.html: %.html.scm
    csi -s $< > $@

    %.js: %.js.scm
    chicken-spock $< > $@


    spock-runtime.js:
    chicken-spock -runtime > spock-runtime.js

    spock-runtime-min.js:
    chicken-spock -runtime | jsmin > spock-runtime-min.js

    spock-runtime-debug.js:
    chicken-spock -runtime -debug > spock-runtime-debug.js

    spock-runtime-debug-min.js:
    chicken-spock -runtime -debug | jsmin > spock-runtime-debug-min.js
    12 changes: 12 additions & 0 deletions README.textile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    Barebones example of using "Chicken Scheme":http://call-cc.org/ to generate HTML and JS, using the "html-tags":http://wiki.call-cc.org/eggref/4/html-tags and "spock":http://wiki.call-cc.org/eggref/4/spock eggs.

    You will need:

    * Chicken Scheme
    * html-tags: @chicken-install html-tags@
    * spock: @chicken-install spock@
    * Make

    Run @make@ to generate the HTML and JS files, then open "hello.html" in a web browser.

    Of course, you would realistically never use spock for something this simple. spock adds significant overhead, both in terms of downloads (the non-minified spock-runtime.js file is over 200K) and runtime speed / memory use.
    9 changes: 9 additions & 0 deletions hello.html.scm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    (require-library html-tags spock)
    (import html-tags spock)

    (display
    (<html>
    (<head>
    (<spock-header>)
    (<script> type: "text/javascript" src: "hello.js"))
    (<body>)))
    4 changes: 4 additions & 0 deletions hello.js.scm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    (define (alert message)
    (%inline "alert" message))

    (alert "Hello, world!")