guile-user
[Top][All Lists]
Advanced

[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:51:04 +0100 (BST)
User-agent: Alpine 2.11 (DEB 23 2013-08-11)

Actually I had to revert the ":from-post" code as well, because it was always giving the same result for "line" after the first post event.

    (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 "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
"line")))]
           (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

=========================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))))
=========================end==================================


Best regards.




reply via email to

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