Skip to content

Commit

Permalink
Use aif macro from planet, thus removing utils.rkt.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchest committed Nov 23, 2010
1 parent 24bf9c2 commit a227c82
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
6 changes: 3 additions & 3 deletions LICENSE
Expand Up @@ -2,7 +2,7 @@ License for "I Write Like" source code and data
===============================================

1. Source code (*.rkt, *.html, *.css)
--------------------------------------------------------------------------------
-------------------------------------------------------------------------------

Copyright (c) 2010, Dmitry Chestnykh. All rights reserved.

Expand Down Expand Up @@ -31,13 +31,13 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
-------------------------------------------------------------------------------

2. All images (located in /static/ directory) are in public domain.

3. Data corpus (located in /data/ directory) is in public domain.

--------------------------------------------------------------------------------
-------------------------------------------------------------------------------

4. Not a license, but a trademark notice: you cannot call your own publicly
running version of the program (modified or not) "I Write Like" without my
Expand Down
19 changes: 10 additions & 9 deletions app.rkt
Expand Up @@ -8,9 +8,10 @@
racket/runtime-path
mzlib/defmacro)

(require (planet schematics/macro/aif))

(require "bayes.rkt"
"crc32.rkt"
"utils.rkt")
"crc32.rkt")

(define *app-version* 8)
(define *app-date* "November 2010")
Expand Down Expand Up @@ -49,9 +50,9 @@
(string-append "/b/" (string->crc32/hex author)))

(define (show-index req)
(aif (dict-ref (request-bindings req) 'text #f)
(aif (get-author it)
(redirect-to (badge-url it))
(aif text (dict-ref (request-bindings req) 'text #f)
(aif url (get-author text)
(redirect-to (badge-url url))
(index-template #t))
(index-template #f)))

Expand All @@ -77,8 +78,8 @@
[client-id (dict-ref bindings 'client_id #f)] ; unused, but required
[permalink (dict-ref bindings 'permalink #f)]) ; -"-
(if (and text client-id permalink)
(aif (get-author text)
(json-result wrapper it)
(aif writer (get-author text)
(json-result wrapper writer)
(json-error "text is too short or doesn't have words"))
(json-error "not enough arguments"))))

Expand All @@ -103,12 +104,12 @@
(badge-template req crc "templates/show-shared.html"))

(define (show-writer req crc)
(aif (crc->author crc)
(aif writer (crc->author crc)
(redirect-to
(format (string-append
"http://www.amazon.com/gp/search?ie=UTF8&keywords=~a"
"&tag=blogjetblog-20&index=books&linkCode=ur2"
"&camp=1789&creative=9325") it))
"&camp=1789&creative=9325") writer))
(not-found req)))

(define (show-newsletter req)
Expand Down
9 changes: 0 additions & 9 deletions utils.rkt

This file was deleted.

0 comments on commit a227c82

Please sign in to comment.