From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: Beginner questions Date: Wed, 28 Nov 2018 16:45:26 +0000 Message-ID: <87o9a9kv6h.fsf@ossau.homelinux.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1543424196 23265 195.159.176.226 (28 Nov 2018 16:56:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Nov 2018 16:56:36 +0000 (UTC) Cc: Guile User To: Catonano Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Nov 28 17:56:32 2018 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gS38a-0005va-07 for guile-user@m.gmane.org; Wed, 28 Nov 2018 17:56:32 +0100 Original-Received: from localhost ([::1]:48711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gS3Ag-0005AD-GP for guile-user@m.gmane.org; Wed, 28 Nov 2018 11:58:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gS2y3-0000Yh-VH for guile-user@gnu.org; Wed, 28 Nov 2018 11:45:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gS2xy-0005Jw-Dw for guile-user@gnu.org; Wed, 28 Nov 2018 11:45:39 -0500 Original-Received: from ossau.homelinux.net ([18.217.239.99]:56602 helo=ip-172-31-40-63.us-east-2.compute.internal) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gS2xy-0005Cx-7o for guile-user@gnu.org; Wed, 28 Nov 2018 11:45:34 -0500 Original-Received: from smaug.ossau.homelinux.net (unknown [213.86.221.35]) by ip-172-31-40-63.us-east-2.compute.internal (Postfix) with ESMTPSA id 6F98CBCC04; Wed, 28 Nov 2018 16:45:27 +0000 (UTC) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 18.217.239.99 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:15021 Archived-At: Catonano writes: > Neil, > > Il giorno lun 19 nov 2018 alle ore 10:02 Neil Jerram < > neil@ossau.homelinux.net> ha scritto: > >> >> >> On 18 November 2018 19:33:31 GMT, Catonano wrote: >> >Il giorno lun 29 ott 2018 alle ore 22:58 swedebugia >> > >> >ha scritto: >> > >> >> Hi >> >> >> >> I would like to learn more scheme and I would like to make a small >> >CLI >> >> program that runs in the terminal and prompts the user for input and >> >> evaluates it. >> >> >> >> Is that possible with guile? In the REPL? >> >> >> >> Can someone point me in the right direction for succeding with that? >> >> >> >> >> >> >> > >> > Hi >> > >> >I am curious: did you manage to put together a prototype of this thing >> >prompting a user in the terminal ? >> >> In case it's of interest, I wrote this kind of thing a few years ago: a >> command loop for Guile where you can register possible commands, and each >> command has a spec like the Emacs 'interactive' form that says what the >> args are and how to prompt for them. >> >> The command loop entry point is at >> http://git.savannah.nongnu.org/cgit/ossaulib.git/tree/ossau/command-loop.scm >> and the dependency modules are all included in that git repo. >> >> Best wishes, >> Neil >> > > thank you > > But I'm a bit overwhelmed by so much code Thanks for taking a look. It is a _lot_ of code, so I can understand it being overwhelming. > a tiny example of reading a short string that a user could type at a prompt > would be more useful to a beginner, I think > > I came up with this short example > > (use-modules (ice-9 rdelim)) > > (let ((str (read-line (current-input-port)))) > (display (string-append str "\n"))) > > it's extremely essential but it demonstrates the usage of the current input > port in association with delimited text reading > > This is a very basic use case, intended as an example, a step 0 for further > developments I started with that (or something very like it), but then gradually added more structure for the specific applications that I had in mind... and surprisingly quickly we can end up with the amount of code that I have in ossaulib. Best wishes, Neil