From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Wedekind Newsgroups: gmane.lisp.guile.user Subject: Re: Artanis web REPL Date: Fri, 24 Jun 2016 22:51:04 +0100 (BST) Message-ID: References: <1466788813.1489.61.camel@gmail.com> Reply-To: Jan Wedekind NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1466805108 5596 80.91.229.3 (24 Jun 2016 21:51:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jun 2016 21:51:48 +0000 (UTC) Cc: guile-user@gnu.org To: Nala Ginrut Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jun 24 23:51:37 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bGZ0i-0000fK-1m for guile-user@m.gmane.org; Fri, 24 Jun 2016 23:51:36 +0200 Original-Received: from localhost ([::1]:47430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGZ0e-0000WM-5R for guile-user@m.gmane.org; Fri, 24 Jun 2016 17:51:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGZ0J-0000SL-4j for guile-user@gnu.org; Fri, 24 Jun 2016 17:51:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGZ0F-0007Mj-1M for guile-user@gnu.org; Fri, 24 Jun 2016 17:51:10 -0400 Original-Received: from basicbox4.server-home.net ([195.137.212.26]:33255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGZ0E-0007Me-MW for guile-user@gnu.org; Fri, 24 Jun 2016 17:51:06 -0400 Original-Received: from wedemob.default (unknown [95.150.201.158]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by basicbox4.server-home.net (Postfix) with ESMTPSA id 6DD4E1530668; Fri, 24 Jun 2016 23:51:05 +0200 (CEST) X-X-Sender: jan@wedemob In-Reply-To: <1466788813.1489.61.camel@gmail.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 195.137.212.26 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12701 Archived-At: Actually I had to revert the ":from-post" code as well, because it was=20 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: >> > =C2=A0 =C2=A0 =C2=A0(post "/" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (lambda (rc) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let* [(session (cook= ie-ref=C2=A0 (rc-cookie rc) "sid")) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (post-data (map dot (generate-kv-from-post-qstr (rc- >> body rc)))) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (line=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (uri-decode (assoc= -ref post-data >> "line")))] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (repl ses= sion line) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (editor s= ession)))) > > > 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 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3Dcode=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > (post "/" #:from-post #t #:cookie '(name repl) =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 (lambda (rc) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 (let [(session (:cookies-ref rc 'repl "sid")) =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (line (uri-decode (:from-post rc 'ge= t "line")))] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 (repl session line) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 > =C2=A0 =C2=A0 =C2=A0 (editor session)))) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3Dend=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > Best regards. > >