[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Artanis web REPL

From: Jan Wedekind
Subject: Re: Artanis web REPL
Date: Fri, 24 Jun 2016 22:40:28 +0100 (BST)
User-agent: Alpine 2.11 (DEB 23 2013-08-11)

Cheers for the simplifying the code [1]. That's really useful.
However I only got part of the improvements working (I am using Artanis version 0.1.2). When using the following code ...

    (post "/" #:from-post #t #:cookie '(name repl)
      (lambda (rc)
        (let* [(session (:cookies-ref rc 'repl "sid"))
               (line    (uri-decode (:from-post rc 'get "line")))]
          (repl session line)
          (editor session))))

... the session value is 'repl instead of the desired value. The code with the other improvements works though:

    (post "/" #:from-post #t
      (lambda (rc)
        (let* [(session (cookie-ref (rc-cookie rc) "sid"))
               (line    (uri-decode (:from-post rc 'get "line")))]
          (repl session line)
          (editor session))))


On Sat, 25 Jun 2016, Nala Ginrut wrote:

Hi Jan!
First, thanks for sharing this code.
I've tried, it's sweet that I love it!
And I'm looking forward to someone could finish it as a complete
project just like IPython notebook or similar.

On Fri, 2016-06-24 at 12:43 +0100, Jan Wedekind wrote:

     (post "/"
       (lambda (rc)
         (let* [(session (cookie-ref  (rc-cookie rc) "sid"))
                (post-data (map dot (generate-kv-from-post-qstr (rc-
body rc))))
                (line      (uri-decode (assoc-ref post-data
           (repl session line)
           (editor session))))

It is embarrassing when I'm trying to point out the fancy "shortcut"
for saving code, but finally I realized there're bugs. ;-(
Anyway, they're just syntax sugar for convenience, it won't be harm if
you dismiss it. I'm working on the server core of Artanis, so I may fix
it next release.
But I still put my code here to shed some light. ;-P

(post "/" #:from-post #t #:cookie '(name repl)                        
  (lambda (rc)                                                        
    (let [(session (:cookies-ref rc 'repl "sid"))                      
          (line (uri-decode (:from-post rc 'get "line")))]            
      (repl session line)                                              
      (editor session))))

Best regards.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]