removing the other planet requires
This commit is contained in:
parent
fae62e782c
commit
e0e8d720cb
|
@ -1,7 +1,7 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/world)
|
(require whalesong/world
|
||||||
(planet dyoo/whalesong/image))
|
whalesong/image)
|
||||||
|
|
||||||
(define-struct world (x direction))
|
(define-struct world (x direction))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/js))
|
(require whalesong/js)
|
||||||
|
|
||||||
(when (in-javascript-context?)
|
(when (in-javascript-context?)
|
||||||
(viewport-width))
|
(viewport-width))
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
;; my-image-url: (parameterof stx)
|
;; my-image-url: (parameterof stx)
|
||||||
;;
|
;;
|
||||||
;; During the dynamic extent of expand-out-images, this will be defined
|
;; During the dynamic extent of expand-out-images, this will be defined
|
||||||
;; as the unique name for the image-url function in (planet dyoo/whalesong/image).
|
;; as the unique name for the image-url function in whalesong/image.
|
||||||
(define-runtime-path whalesong/image
|
(define-runtime-path whalesong/image
|
||||||
"image.rkt")
|
"image.rkt")
|
||||||
(define my-image-url (make-parameter #f))
|
(define my-image-url (make-parameter #f))
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
;; Does it look like something out of moby or js-vm? Abort early, because if we don't do
|
;; Does it look like something out of moby or js-vm? Abort early, because if we don't do
|
||||||
;; this up front, Racket will try to install the deprecated module, and that's bad.
|
;; this up front, Racket will try to install the deprecated module, and that's bad.
|
||||||
(when (looks-like-old-moby-or-js-vm? module-source-path)
|
(when (looks-like-old-moby-or-js-vm? module-source-path)
|
||||||
(fprintf (current-report-port) "ERROR: The program in ~e appears to be written using the deprecated project js-vm or Moby.\n\nPlease change the lang line to:\n\n #lang planet dyoo/whalesong\n\ninstead.\n"
|
(fprintf (current-report-port) "ERROR: The program in ~e appears to be written using the deprecated project js-vm or Moby.\n\nPlease change the lang line to:\n\n #lang whalesong\n\ninstead.\n"
|
||||||
module-source-path)
|
module-source-path)
|
||||||
(abort-abort))
|
(abort-abort))
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,14 @@
|
||||||
|
|
||||||
;; Provides a mapping of the core bindings in kernel, so that we know statically
|
;; Provides a mapping of the core bindings in kernel, so that we know statically
|
||||||
;; if something is implemented as a primitive or a closure.
|
;; if something is implemented as a primitive or a closure.
|
||||||
(require planet/util)
|
(require syntax/modresolve)
|
||||||
|
|
||||||
|
(provide bound-procedure-names)
|
||||||
|
|
||||||
|
|
||||||
(define ns (make-base-empty-namespace))
|
(define ns (make-base-empty-namespace))
|
||||||
(define bound-procedure-names
|
(define bound-procedure-names
|
||||||
(let ([path (resolve-planet-path `(planet ,(this-package-version-symbol lang/kernel)))])
|
(let ([path (resolve-module-path 'whalesong/lang/kernel #f)])
|
||||||
(parameterize ([current-namespace ns])
|
(parameterize ([current-namespace ns])
|
||||||
(namespace-require path)
|
(namespace-require path)
|
||||||
(for/list ([name (namespace-mapped-symbols)]
|
(for/list ([name (namespace-mapped-symbols)]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
"geo.rkt")
|
"geo.rkt")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/js/world)
|
(require whalesong/js/world
|
||||||
(planet dyoo/whalesong/js)
|
whalesong/js
|
||||||
(planet dyoo/whalesong/web-world))
|
whalesong/web-world)
|
||||||
|
|
||||||
;; Test of getting world events from arbitrary JavaScript function application.
|
;; Test of getting world events from arbitrary JavaScript function application.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,2 @@
|
||||||
#lang s-exp syntax/module-reader
|
#lang s-exp syntax/module-reader
|
||||||
#:language (lambda ()
|
#:language (lambda () 'whalesong/lang/korean)
|
||||||
`(planet ,(this-package-version-symbol lang/korean)))
|
|
||||||
|
|
||||||
(require planet/version)
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
;; A rewrite of the cloth simulation application from the Codea project
|
;; A rewrite of the cloth simulation application from the Codea project
|
||||||
;; into world form.
|
;; into world form.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#lang racket
|
#lang racket
|
||||||
(require (planet dyoo/whalesong/get-module-bytecode)
|
(require whalesong/get-module-bytecode
|
||||||
(planet dyoo/whalesong/parser/parse-bytecode)
|
whalesong/parser/parse-bytecode
|
||||||
(planet dyoo/whalesong/compiler/compiler)
|
whalesong/compiler/compiler
|
||||||
(planet dyoo/whalesong/compiler/compiler-structs)
|
whalesong/compiler/compiler-structs
|
||||||
(planet dyoo/whalesong/js-assembler/assemble))
|
whalesong/js-assembler/assemble)
|
||||||
|
|
||||||
(define bytecode
|
(define bytecode
|
||||||
(get-module-bytecode
|
(get-module-bytecode
|
||||||
(open-input-string
|
(open-input-string
|
||||||
(string-append "#lang planet dyoo/whalesong\n"
|
(string-append "#lang whalesong\n"
|
||||||
"(define (f x)\n"
|
"(define (f x)\n"
|
||||||
" (if (= x 0)\n"
|
" (if (= x 0)\n"
|
||||||
" 1\n"
|
" 1\n"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/storage))
|
(require whalesong/storage)
|
||||||
|
|
||||||
(storage-length)
|
(storage-length)
|
||||||
(storage-ref "whalesong test")
|
(storage-ref "whalesong test")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource)
|
whalesong/resource
|
||||||
(planet dyoo/whalesong/storage))
|
whalesong/storage)
|
||||||
|
|
||||||
;; The world is our TODO list, represented as a list of strings.
|
;; The world is our TODO list, represented as a list of strings.
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
#lang scribble/manual
|
#lang scribble/manual
|
||||||
@(require planet/scribble
|
@(require scribble/eval
|
||||||
planet/version
|
|
||||||
planet/resolver
|
|
||||||
scribble/eval
|
|
||||||
scribble/bnf
|
scribble/bnf
|
||||||
racket/sandbox
|
racket/sandbox
|
||||||
racket/port
|
racket/port
|
||||||
|
@ -76,7 +73,7 @@ Run the following to create the @filepath{whalesong} launcher program in
|
||||||
your current directory.
|
your current directory.
|
||||||
@codeblock|{
|
@codeblock|{
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
(require (planet dyoo/whalesong:1:12/make-launcher))
|
(require whalesong/make-launcher)
|
||||||
}|
|
}|
|
||||||
This may take a few minutes, as Racket is compiling Whalesong, its
|
This may take a few minutes, as Racket is compiling Whalesong, its
|
||||||
dependencies, and its documentation. When it finally finishes,
|
dependencies, and its documentation. When it finally finishes,
|
||||||
|
@ -156,8 +153,8 @@ Let's look at a few of them.
|
||||||
@subsection{Hello world}
|
@subsection{Hello world}
|
||||||
|
|
||||||
Let's try making a simple, standalone executable. At the moment, the
|
Let's try making a simple, standalone executable. At the moment, the
|
||||||
program should be written in the base language of @racket[(planet
|
program should be written in the base language of
|
||||||
dyoo/whalesong/cs019)], as it provides the language features that
|
@racket[whalesong/cs019], as it provides the language features that
|
||||||
you've been using in cs019 (@racket[local], @racket[shared], etc...),
|
you've been using in cs019 (@racket[local], @racket[shared], etc...),
|
||||||
as well as support for the @racketmodname/this-package[web-world]
|
as well as support for the @racketmodname/this-package[web-world]
|
||||||
package described later in this document.
|
package described later in this document.
|
||||||
|
@ -166,7 +163,7 @@ package described later in this document.
|
||||||
Write a @filepath{hello.rkt} with the following content
|
Write a @filepath{hello.rkt} with the following content
|
||||||
@filebox["hello.rkt"]{
|
@filebox["hello.rkt"]{
|
||||||
@codeblock{
|
@codeblock{
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
"hello world"
|
"hello world"
|
||||||
}}
|
}}
|
||||||
This program is a regular Racket program, and can be executed normally,
|
This program is a regular Racket program, and can be executed normally,
|
||||||
|
@ -242,7 +239,7 @@ Once we're happy with the statics of our program, we can inject dynamic behavior
|
||||||
Write a file called @filepath{tick-tock.rkt} with the following content.
|
Write a file called @filepath{tick-tock.rkt} with the following content.
|
||||||
@filebox["tick-tock.rkt"]{
|
@filebox["tick-tock.rkt"]{
|
||||||
@codeblock|{
|
@codeblock|{
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
@ -299,7 +296,7 @@ Finally, let's look at a program that displays our current geolocation.
|
||||||
|
|
||||||
@filebox["where-am-i.rkt"]{
|
@filebox["where-am-i.rkt"]{
|
||||||
@codeblock|{
|
@codeblock|{
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
@ -438,11 +435,11 @@ wants to reset the page.
|
||||||
]
|
]
|
||||||
|
|
||||||
These examples are written in a less featureful language level
|
These examples are written in a less featureful language level
|
||||||
(@litchar{#lang planet dyoo/whalesong}), which is why it uses explicit
|
(@litchar{#lang whalesong}), which is why it uses explicit
|
||||||
@racket[require] statements to pull in support for
|
@racket[require] statements to pull in support for
|
||||||
@racketmodname/this-package[web-world] and
|
@racketmodname/this-package[web-world] and
|
||||||
@racketmodname/this-package[resource]. As long as you use
|
@racketmodname/this-package[resource]. As long as you use
|
||||||
@litchar{#lang planet dyoo/whalesong/cs019}, you shouldn't need to
|
@litchar{#lang whalesong/cs019}, you shouldn't need to
|
||||||
require those particular libraries.
|
require those particular libraries.
|
||||||
|
|
||||||
|
|
||||||
|
@ -768,7 +765,7 @@ can accept the event as an argument.
|
||||||
|
|
||||||
You can construct events for testing purposes by using @racket[make-event].
|
You can construct events for testing purposes by using @racket[make-event].
|
||||||
@codeblock|{
|
@codeblock|{
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
;; Synthesizing a location event
|
;; Synthesizing a location event
|
||||||
(define my-event (make-event '((latitude 41)
|
(define my-event (make-event '((latitude 41)
|
||||||
(longitude -71))))
|
(longitude -71))))
|
||||||
|
@ -794,7 +791,7 @@ Get an list of the event's keys.
|
||||||
We often need to dynamically inject new dom nodes into an existing
|
We often need to dynamically inject new dom nodes into an existing
|
||||||
view. As an example where the UI is entirely in code:
|
view. As an example where the UI is entirely in code:
|
||||||
@codeblock|{
|
@codeblock|{
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
;; tick: world view -> world
|
;; tick: world view -> world
|
||||||
(define (tick world view)
|
(define (tick world view)
|
||||||
|
@ -892,14 +889,14 @@ to the program.
|
||||||
|
|
||||||
For example,
|
For example,
|
||||||
@codeblock|{
|
@codeblock|{
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
(define-resource my-whale-image-resource "humpback.png")
|
(define-resource my-whale-image-resource "humpback.png")
|
||||||
}|
|
}|
|
||||||
}
|
}
|
||||||
Since the name we're using will often match the filename itself,
|
Since the name we're using will often match the filename itself,
|
||||||
as a convenience, we can also write the following:
|
as a convenience, we can also write the following:
|
||||||
@codeblock|{
|
@codeblock|{
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
(define-resource humpback.png)
|
(define-resource humpback.png)
|
||||||
}|
|
}|
|
||||||
which defines a variable named @racket[humpback.png] whose
|
which defines a variable named @racket[humpback.png] whose
|
||||||
|
@ -933,7 +930,7 @@ Given a resource, gets its URL.
|
||||||
|
|
||||||
For example,
|
For example,
|
||||||
@codeblock|{
|
@codeblock|{
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
(define-resource my-whale-image-resource "humpback.png")
|
(define-resource my-whale-image-resource "humpback.png")
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(require (planet dyoo/whalesong/image)
|
(require whalesong/image
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
|
|
||||||
;; color-near? : Color Color Number -> Boolean
|
;; color-near? : Color Color Number -> Boolean
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(provide fact)
|
(provide fact)
|
||||||
(define (fact x)
|
(define (fact x)
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
(define-struct f (x))
|
(define-struct f (x))
|
||||||
(define-struct g (a b))
|
(define-struct g (a b))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
|
|
||||||
(boolean? "t")
|
(boolean? "t")
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
#lang planet dyoo/whalesong/base
|
|
||||||
(require (planet dyoo/whalesong/lang/bool))
|
|
||||||
|
|
||||||
(boolean? "t")
|
|
||||||
(boolean? #t)
|
|
||||||
(boolean? 0)
|
|
||||||
(boolean? #\t)
|
|
||||||
|
|
||||||
(char? "t")
|
|
||||||
(char? #t)
|
|
||||||
(char? 0)
|
|
||||||
(char? #\t)
|
|
||||||
|
|
||||||
(char=? #\a #\b)
|
|
||||||
(char=? #\a #\a)
|
|
||||||
(char=? #\a #\a #\b)
|
|
||||||
(char=? #\a #\b #\a)
|
|
||||||
(char=? #\a #\a #\a)
|
|
||||||
|
|
||||||
true
|
|
||||||
false
|
|
||||||
(false? true)
|
|
||||||
(false? false)
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(require (planet dyoo/whalesong/lang/bool))
|
(require whalesong/lang/bool)
|
||||||
|
|
||||||
(boolean? "t")
|
(boolean? "t")
|
||||||
(boolean? #t)
|
(boolean? #t)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
(char-upcase #\a)
|
(char-upcase #\a)
|
||||||
(char-upcase #\b)
|
(char-upcase #\b)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
(define (greet name)
|
(define (greet name)
|
||||||
(string-append "hello " name))
|
(string-append "hello " name))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(define (greet name)
|
(define (greet name)
|
||||||
(string-append "hello " name))
|
(string-append "hello " name))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/image))
|
(require whalesong/image)
|
||||||
(color 3 4 5 0)
|
(color 3 4 5 0)
|
||||||
(make-color 3 5 7 0)
|
(make-color 3 5 7 0)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(let ()
|
(let ()
|
||||||
|
|
||||||
;; (define (caar l)
|
;; (define (caar l)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(define (puzzle n)
|
(define (puzzle n)
|
||||||
(if (= n 0)
|
(if (= n 0)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
(define (puzzle n)
|
(define (puzzle n)
|
||||||
(if (= n 0)
|
(if (= n 0)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
.. ;; should raise a teaching syntax error
|
.. ;; should raise a teaching syntax error
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(begin
|
(begin
|
||||||
(define make-parser
|
(define make-parser
|
||||||
(lambda (grammar lexer)
|
(lambda (grammar lexer)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(define (fact x)
|
(define (fact x)
|
||||||
(cond
|
(cond
|
||||||
[(= x 0)
|
[(= x 0)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; File: fft.cl
|
; File: fft.cl
|
||||||
; Description: FFT benchmark from the Gabriel tests.
|
; Description: FFT benchmark from the Gabriel tests.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
;; A tree is either a symbol or a node.
|
;; A tree is either a symbol or a node.
|
||||||
(define-struct node (l r))
|
(define-struct node (l r))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
; Modified 2 March 1997 by Will Clinger to add graphs-benchmark
|
; Modified 2 March 1997 by Will Clinger to add graphs-benchmark
|
||||||
; and to expand the four macros below.
|
; and to expand the four macros below.
|
||||||
; Modified 11 June 1997 by Will Clinger to eliminate assertions
|
; Modified 11 June 1997 by Will Clinger to eliminate assertions
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(require (planet dyoo/whalesong/lang/private/shared))
|
(require whalesong/lang/private/shared)
|
||||||
|
|
||||||
;; boxes
|
;; boxes
|
||||||
"boxes"
|
"boxes"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
(hash? 1)
|
(hash? 1)
|
||||||
(hash? "potatoes")
|
(hash? "potatoes")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/bf
|
#lang whalesong/bf
|
||||||
+++++ +++++ [ > +++++ ++ > +++++ +++++ > +++ > + <<<< - ] > ++ . > +
|
+++++ +++++ [ > +++++ ++ > +++++ +++++ > +++ > + <<<< - ] > ++ . > +
|
||||||
. +++++ ++ . . +++ . > ++ . << +++++ +++++ +++++ . > . +++ .
|
. +++++ ++ . . +++ . > ++ . << +++++ +++++ +++++ . > . +++ .
|
||||||
----- - . ----- --- . > + . > .
|
----- - . ----- --- . > + . > .
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(displayln "hello world")
|
(displayln "hello world")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(require (planet dyoo/whalesong/image))
|
(require whalesong/image)
|
||||||
|
|
||||||
(image-color? "red")
|
(image-color? "red")
|
||||||
(image-color? "blue")
|
(image-color? "blue")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(require (for-syntax racket/base
|
(require (for-syntax racket/base
|
||||||
syntax/struct))
|
syntax/struct))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/js))
|
(require whalesong/js)
|
||||||
|
|
||||||
(define js-plus
|
(define js-plus
|
||||||
(js-function->procedure "function(x, y) { return x + y; }"))
|
(js-function->procedure "function(x, y) { return x + y; }"))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
(define web-colors
|
(define web-colors
|
||||||
(shared ([W (cons "white" G)]
|
(shared ([W (cons "white" G)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
'(1 2 3)
|
'(1 2 3)
|
||||||
(list "hello" "world")
|
(list "hello" "world")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
;; Knuth's Man-or-boy-test.
|
;; Knuth's Man-or-boy-test.
|
||||||
;; http://rosettacode.org/wiki/Man_or_boy_test
|
;; http://rosettacode.org/wiki/Man_or_boy_test
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(map (lambda (x y) (+ x y)) (list 1 2 3) (list 4 5 6))
|
(map (lambda (x y) (+ x y)) (list 1 2 3) (list 4 5 6))
|
||||||
(map + (list 1 2 3) (list 4 5 6))
|
(map + (list 1 2 3) (list 4 5 6))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (for-syntax racket/base))
|
(require (for-syntax racket/base))
|
||||||
(provide x x++ x+1 x=0 get-x)
|
(provide x x++ x+1 x=0 get-x)
|
||||||
(define x 0)
|
(define x 0)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require "module-scoping-helper.rkt")
|
(require "module-scoping-helper.rkt")
|
||||||
x ;; 0
|
x ;; 0
|
||||||
(get-x) ;; 0
|
(get-x) ;; 0
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
;; Imperative body:
|
;; Imperative body:
|
||||||
(define (loops n)
|
(define (loops n)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
;;; NQUEENS -- Compute number of solutions to 8-queens problem.
|
;;; NQUEENS -- Compute number of solutions to 8-queens problem.
|
||||||
;; 2006/08 -- renamed `try' to `try-it' to avoid Bigloo collision (mflatt)
|
;; 2006/08 -- renamed `try' to `try-it' to avoid Bigloo collision (mflatt)
|
||||||
;; 2010/04 -- got rid of the one-armed id (stamourv)
|
;; 2010/04 -- got rid of the one-armed id (stamourv)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(require (for-syntax racket/base))
|
(require (for-syntax racket/base))
|
||||||
|
|
||||||
; File: "nucleic2.scm"
|
; File: "nucleic2.scm"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
|
|
||||||
(number? 0)
|
(number? 0)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(current-print-mode "constructor")
|
(current-print-mode "constructor")
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
`(0 ,@(list 1 2) 4)
|
`(0 ,@(list 1 2) 4)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
;; Srinivasa Ramanujan's infinite series for approximating pi.
|
;; Srinivasa Ramanujan's infinite series for approximating pi.
|
||||||
|
|
||||||
(define (sum f a b)
|
(define (sum f a b)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
;;; SCHEME -- A Scheme interpreter evaluating a sort, written by Marc Feeley.
|
;;; SCHEME -- A Scheme interpreter evaluating a sort, written by Marc Feeley.
|
||||||
|
|
||||||
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
(define infinite-ones
|
(define infinite-ones
|
||||||
(shared ([a (cons 1 a)])
|
(shared ([a (cons 1 a)])
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(define infinite-ones
|
(define infinite-ones
|
||||||
(shared ([a (cons 1 a)])
|
(shared ([a (cons 1 a)])
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
|
|
||||||
(define: x : Number$ 3)
|
(define: x : Number$ 3)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
(apply + 2 3 4 5 '())
|
(apply + 2 3 4 5 '())
|
||||||
(apply + 2 3 4 '(5))
|
(apply + 2 3 4 '(5))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
(provide (all-defined-out))
|
(provide (all-defined-out))
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
(let myloop ([i 0] [acc 0])
|
(let myloop ([i 0] [acc 0])
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
(define-struct pair (f r))
|
(define-struct pair (f r))
|
||||||
(define-struct color (r g b))
|
(define-struct color (r g b))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
;; This should invoke the use of inline-variant from 5.2.1
|
;; This should invoke the use of inline-variant from 5.2.1
|
||||||
(provide f)
|
(provide f)
|
||||||
(define (f x) x)
|
(define (f x) x)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(define (make-gen gen)
|
(define (make-gen gen)
|
||||||
(let ([cont (box #f)])
|
(let ([cont (box #f)])
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
(define (make-gen gen)
|
(define (make-gen gen)
|
||||||
(let ([cont #f])
|
(let ([cont #f])
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/base
|
#lang whalesong/base
|
||||||
|
|
||||||
(substring "hello world" 0)
|
(substring "hello world" 0)
|
||||||
(substring "hello world" 1)
|
(substring "hello world" 1)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/web-world))
|
(require whalesong/web-world)
|
||||||
|
|
||||||
(define view (->view (xexp->dom `(html (head)
|
(define view (->view (xexp->dom `(html (head)
|
||||||
(body (p "hello world, this is a test")
|
(body (p "hello world, this is a test")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(define program (lambda () (let ((y (call/cc (lambda (c) c)))) (display 1) (call/cc (lambda (c) (y c))) (display 2) (call/cc (lambda (c) (y c))) (display 3))))
|
(define program (lambda () (let ((y (call/cc (lambda (c) c)))) (display 1) (call/cc (lambda (c) (y c))) (display 2) (call/cc (lambda (c) (y c))) (display 3))))
|
||||||
|
|
||||||
(program)
|
(program)
|
||||||
|
|
|
@ -57,8 +57,8 @@ then it should be trivial to make a program that just shows
|
||||||
that page:
|
that page:
|
||||||
|
|
||||||
|
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world))
|
(require whalesong/web-world)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
@ -106,8 +106,8 @@ such as:
|
||||||
|
|
||||||
and then, in the programming language, add behavior:
|
and then, in the programming language, add behavior:
|
||||||
|
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world))
|
(require whalesong/web-world)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ If index.html contains:
|
||||||
with some appropriate CSS to make the DIV look good, then the program
|
with some appropriate CSS to make the DIV look good, then the program
|
||||||
will be:
|
will be:
|
||||||
|
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world))
|
(require whalesong/web-world)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
@ -236,8 +236,8 @@ handler takes, not only the world, but the current view.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world))
|
(require whalesong/web-world)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
(define-resource style.css)
|
(define-resource style.css)
|
||||||
|
@ -290,8 +290,8 @@ hide.
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world))
|
(require whalesong/web-world)
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
;; make-item: string -> view
|
;; make-item: string -> view
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/resource)
|
(require whalesong/resource
|
||||||
(planet dyoo/whalesong/web-world))
|
whalesong/web-world)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
(define-resource style.css)
|
(define-resource style.css)
|
||||||
|
|
|
@ -24,10 +24,10 @@ This should be animating:
|
||||||
The program for this is:
|
The program for this is:
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<pre>
|
<pre>
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/resource)
|
(require whalesong/resource
|
||||||
(planet dyoo/whalesong/web-world))
|
whalesong/web-world)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
(define-resource style.css)
|
(define-resource style.css)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/js)
|
(require whalesong/js
|
||||||
(planet dyoo/whalesong/image)
|
whalesong/image
|
||||||
(planet dyoo/whalesong/web-world)
|
whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
;; The world is a string, the current color.
|
;; The world is a string, the current color.
|
||||||
(define-resource view.html)
|
(define-resource view.html)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
;; The world is the set of dwarfs.
|
;; The world is the set of dwarfs.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
;; The world is the set of dwarfs.
|
;; The world is the set of dwarfs.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/resource)
|
(require whalesong/resource
|
||||||
(planet dyoo/whalesong/web-world))
|
whalesong/web-world)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
(define-resource style.css)
|
(define-resource style.css)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
|
|
||||||
(require (planet dyoo/whalesong/web-world))
|
(require whalesong/web-world)
|
||||||
|
|
||||||
(big-bang 0 (initial-view "hello world"))
|
(big-bang 0 (initial-view "hello world"))
|
|
@ -1,4 +1,4 @@
|
||||||
#lang planet dyoo/whalesong/cs019
|
#lang whalesong/cs019
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
(define-resource index1.html)
|
(define-resource index1.html)
|
||||||
(define-resource index2.html)
|
(define-resource index2.html)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world))
|
(require whalesong/web-world)
|
||||||
|
|
||||||
;; tick: world view -> world
|
;; tick: world view -> world
|
||||||
(define (tick world view)
|
(define (tick world view)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
;; The world is our TODO list, represented as a list of strings.
|
;; The world is our TODO list, represented as a list of strings.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang whalesong
|
||||||
(require (planet dyoo/whalesong/web-world)
|
(require whalesong/web-world
|
||||||
(planet dyoo/whalesong/resource))
|
whalesong/resource)
|
||||||
|
|
||||||
(define-resource index.html)
|
(define-resource index.html)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
"logger.rkt"
|
"logger.rkt"
|
||||||
"parameters.rkt"
|
"parameters.rkt"
|
||||||
"js-assembler/check-valid-module-source.rkt"
|
"js-assembler/check-valid-module-source.rkt"
|
||||||
planet/version
|
|
||||||
(for-syntax racket/base))
|
(for-syntax racket/base))
|
||||||
|
|
||||||
(provide (all-defined-out))
|
(provide (all-defined-out))
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
(require racket/runtime-path
|
(require racket/runtime-path
|
||||||
racket/path
|
racket/path
|
||||||
planet/util)
|
syntax/modresolve)
|
||||||
|
|
||||||
;; We do things this way to ensure that we're using the latest
|
;; We do things this way to ensure that we're using the latest
|
||||||
;; version of whalesong that's installed, and that the load-relative
|
;; version of whalesong that's installed, and that the load-relative
|
||||||
;; path is in terms of the normalized paths, to avoid a very strange
|
;; path is in terms of the normalized paths, to avoid a very strange
|
||||||
;; low-level bug.
|
;; low-level bug.
|
||||||
(define whalesong.cmd
|
(define whalesong.cmd
|
||||||
(resolve-planet-path '(planet dyoo/whalesong/whalesong-cmd)))
|
(resolve-module-path 'whalesong/whalesong-cmd #f))
|
||||||
|
|
||||||
(dynamic-require (normalize-path whalesong.cmd) #f)
|
(dynamic-require (normalize-path whalesong.cmd) #f)
|
Loading…
Reference in New Issue
Block a user