[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Slightly more complex Lisp Program

gengyangcai

8/19/2015 7:50:00 AM

So now that I have done some simple programs in Lisp and gotten used to how it looks like, I feel like it's time to build something slightly more complex to gradually increase my mastery of Lisp. This is a description of the idea I have in mind that I want to build :

Create a "system" on a webpage that allows the user to keep track of his or her daily and monthly expenses and earnings in realtime. Preferably this should be done mostly, if not entirely in Lisp. So this is how it works --- each time you make or spend money (let's say you are a trader at a bank), you key it into the system :

20th August 2015

Expenses :

1) 200 dollars on food (nice, expensive steak dinner with the family!)
2) 300 dollars on mattress
3) 50 dollars (travelling costs)
4) 50 dollars (some nice Hello Kitty toys for the kids)

Earnings :

1) 3,000 dollars earned trading the markets at the bank (some nice USD-SGD , oil and silver trends that yielded nice profits)

When you manually key it into the website, an animated textbox with a smiley face pops up and updates you on your financial status for 20th August and also for the entire month and year up to this point.

Also should have the flexibility to allow addition of other features in the future as I test it on other users, get some feedback and iterate the program ...

How do I start building a project like this in Lisp ?

Thanks a lot, appreciate it .. !

Gengyang
14 Answers

rpw3

8/19/2015 11:06:00 AM

0

CAI GENGYANG <gengyangcai@gmail.com> wrote:
+---------------
| Create a "system" on a webpage that allows the user to keep track
| of his or her daily and monthly expenses and earnings in realtime.
....
| How do I start building a project like this in Lisp ?
+---------------

How would you start with any other language you know?


-Rob

-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <http://rpw...
San Mateo, CA 94403

Pascal J. Bourguignon

8/19/2015 11:48:00 AM

0

CAI GENGYANG <gengyangcai@gmail.com> writes:

> Create a "system" on a webpage that allows the user to keep track of
> his or her daily and monthly expenses and earnings in
> realtime. Preferably this should be done mostly, if not entirely in
> Lisp. [â?¦]

Basically, you want a text-based transactionnal system.

The web is rather ill-adapted for this purpose, because of its strong
GUI orientation (even with a terminal web browser, the keyboard
interaction with web application is rather un-ergonomic, because of the
fundamentally GUI model underlying it).

Therefore I would suggest using a terminal embedded in the web browser
to access to your application written as a normal lisp terminal
application. I would suggest using shellinabox.
https://code.google.com/p/sh...
https://help.ubuntu.com/community/s...
There you even have to choice of making it a line-mode application, or a
screen-mode application using curses (cl-charms).

For a couple of example, cf. http://iplwcl.informat...
or: http://nasium-lse.ogamita...
both written in lisp.

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

Frank GOENNINGER

8/19/2015 2:36:00 PM

0

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

> For a couple of example, cf. http://iplwcl.informat...
> or: http://nasium-lse.ogamita...
> both written in lisp.

Cool! Est-ce qu'on peut changer la langue de ces programmes? Je préfère
Allemand ...

// Frank

Pascal J. Bourguignon

8/19/2015 4:26:00 PM

0

Frank DG1SBG <dg1sbg@googlemail.com> writes:

> "Pascal J. Bourguignon" <pjb@informatimago.com> writes:
>
>> For a couple of example, cf. http://iplwcl.informat...
>> or: http://nasium-lse.ogamita...
>> both written in lisp.
>
> Cool! Est-ce qu'on peut changer la langue de ces programmes? Je préfère
> Allemand ...

LSE est un langage de programmation français, alors non.
http://nasium-lse.og...

But I guess you could write a Plankalkül implementation in lisp.
https://en.wikipedia.org/wiki/Plank...

I've got a longer email about programming language translations if
you're interested, but it's written in French. In short, it depends on
the context: given free software and the Internet, there's no advantage
at all to translate programming languages. But this might be a thing
for other classes of programs.

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

gengyangcai

8/20/2015 10:02:00 PM

0

On Wednesday, August 19, 2015 at 7:47:54 PM UTC+8, informatimago wrote:
> CAI GENGYANG <gengyangcai@gmail.com> writes:
>
> > Create a "system" on a webpage that allows the user to keep track of
> > his or her daily and monthly expenses and earnings in
> > realtime. Preferably this should be done mostly, if not entirely in
> > Lisp. [...]
>
> Basically, you want a text-based transactionnal system.
>
> The web is rather ill-adapted for this purpose, because of its strong
> GUI orientation (even with a terminal web browser, the keyboard
> interaction with web application is rather un-ergonomic, because of the
> fundamentally GUI model underlying it).
>
> Therefore I would suggest using a terminal embedded in the web browser
> to access to your application written as a normal lisp terminal
> application. I would suggest using shellinabox.
> https://code.google.com/p/sh...
> https://help.ubuntu.com/community/s...
> There you even have to choice of making it a line-mode application, or a
> screen-mode application using curses (cl-charms).
>
> For a couple of example, cf. http://iplwcl.informat...
> or: http://nasium-lse.ogamita...
> both written in lisp.
>
> --
> __Pascal Bourguignon__ http://www.informat...
> "The factory of the future will have only two employees, a man and a
> dog. The man will be there to feed the dog. The dog will be there to
> keep the man from touching the equipment." -- Carl Bass CEO Autodesk

Hi Pascal Bourguignon,

Ok, so I believe I downloaded Shell_in_A_Box successfully, I can see a bunch of files like shell_in_a_box.js, and shellinaboxd.c in my "All My Files" Folder ...

This is how I imagine the prototype would look like:

MediciNotes.com

User Name:
User Log In:
Time and Date today:
Expenses and Source:
Earnings and Source:
Net earnings for the month:
Net earnings for the year:

$$$$$ An animated video of a banker showing the updated statistics $$$$

How do I use shell_in_a_box to build this ?


Cai Gengyang
http://www.paulgraham.com/am...
http://www.paulgraham.com/...

Pascal J. Bourguignon

8/20/2015 11:07:00 PM

0

CAI GENGYANG <gengyangcai@gmail.com> writes:

> Ok, so I believe I downloaded Shell_in_A_Box successfully, I can see a
> bunch of files like shell_in_a_box.js, and shellinaboxd.c in my "All
> My Files" Folder ...
>
> This is how I imagine the prototype would look like:
>
> MediciNotes.com
>
> User Name:
> User Log In:
> Time and Date today:
> Expenses and Source:
> Earnings and Source:
> Net earnings for the month:
> Net earnings for the year:
>
> $$$$$ An animated video of a banker showing the updated statistics $$$$
>
> How do I use shell_in_a_box to build this ?

1- You write your lisp program using normal I/O (don't forget
finish-output before read-line).

2- You save an executable image named /PATH/TO/YOUR/SERVER/PROGRAM

3- Edit the folowing file, substituting all the uppercase YOUR_SOMETHING
by your actual data.

----(siab-YOUR-SERVER-NAME)-----------------------------------------------------
#!/bin/bash
exec shellinaboxd --background=/var/run/YOUR_SERVER_NAME.pid --port=YOUR_PORT --disable-ssl --user=YOUR_SERVER_USER --group=YOUR_SERVER_GROUP --service="/:YOUR_SERVER_USER:YOUR_SERVER_GROUP:/PATH/TO/YOUR/SERVER/DIRECTORY:/PATH/TO/YOUR/SERVER/PROGRAM ${peer}"
--------------------------------------------------------------------------------

4- Run this script (chmod 755 it first).

5- Then go to: http://YOUR_SERVER_HOST:YOUR_PORT/


When it's good, you can call this script in /etc/rc.local to have it
start automatically when your server boots.


To save the lisp image, I use something like:

#+ccl (ccl:save-application
"/PATH/TO/YOUR/SERVER/PROGRAM"
:toplevel-function (function your.program.package:main)
:init-file nil
:error-handler :quit-quietly
:purify nil
:mode #o755
:prepend-kernel t)

#+clisp (ext:saveinitmem
"/PATH/TO/YOUR/SERVER/PROGRAM"
:quiet t
:verbose t
:norc t
:init-function (lambda ()
(ext:exit (handler-case
(your.program.package:main)
(error ()
1))))
:script t
:documentation "Your Program"
:start-package "COMMON-LISP-USER"
:keep-global-handlers nil
:executable t)

See also: http://www.cliki.net/creating%20e...



(defpackage "YOUR.PROGRAM"
(:use "COMMON-LISP"))
(in-package "YOUR.PROGRAM")

(defun do-something-with-the-data (data)
(declare (ignore data))
(terpri)
(write-line "$$$$$ An animated video of a banker showing the updated statistics $$$$")
(finish-output))

(defun main ()
(do-something-with-the-data
(mapcar (lambda (prompt)
(terpri) (write-string prompt) (finish-output)
(read-line))
'("User Name:"
"User Log In:"
"Time and Date today:"
"Expenses and Source:"
"Earnings and Source:"
"Net earnings for the month:"
"Net earnings for the year:")))
0)

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

gengyangcai

8/21/2015 3:26:00 AM

0

On Friday, August 21, 2015 at 7:07:16 AM UTC+8, informatimago wrote:
> CAI GENGYANG <gengyangcai@gmail.com> writes:
>
> > Ok, so I believe I downloaded Shell_in_A_Box successfully, I can see a
> > bunch of files like shell_in_a_box.js, and shellinaboxd.c in my "All
> > My Files" Folder ...
> >
> > This is how I imagine the prototype would look like:
> >
> > MediciNotes.com
> >
> > User Name:
> > User Log In:
> > Time and Date today:
> > Expenses and Source:
> > Earnings and Source:
> > Net earnings for the month:
> > Net earnings for the year:
> >
> > $$$$$ An animated video of a banker showing the updated statistics $$$$
> >
> > How do I use shell_in_a_box to build this ?
>
> 1- You write your lisp program using normal I/O (don't forget
> finish-output before read-line).
>
> 2- You save an executable image named /PATH/TO/YOUR/SERVER/PROGRAM
>
> 3- Edit the folowing file, substituting all the uppercase YOUR_SOMETHING
> by your actual data.
>
> ----(siab-YOUR-SERVER-NAME)-----------------------------------------------------
> #!/bin/bash
> exec shellinaboxd > --background=/var/run/YOUR_SERVER_NAME.pid > --port=YOUR_PORT > --disable-ssl > --user=YOUR_SERVER_USER > --group=YOUR_SERVER_GROUP > --service="/:YOUR_SERVER_USER:YOUR_SERVER_GROUP:/PATH/TO/YOUR/SERVER/DIRECTORY:/PATH/TO/YOUR/SERVER/PROGRAM ${peer}"
> --------------------------------------------------------------------------------
>
> 4- Run this script (chmod 755 it first).
>
> 5- Then go to: http://YOUR_SERVER_HOST:YOUR_PORT/
>
>
> When it's good, you can call this script in /etc/rc.local to have it
> start automatically when your server boots.
>
>
> To save the lisp image, I use something like:
>
> #+ccl (ccl:save-application
> "/PATH/TO/YOUR/SERVER/PROGRAM"
> :toplevel-function (function your.program.package:main)
> :init-file nil
> :error-handler :quit-quietly
> :purify nil
> :mode #o755
> :prepend-kernel t)
>
> #+clisp (ext:saveinitmem
> "/PATH/TO/YOUR/SERVER/PROGRAM"
> :quiet t
> :verbose t
> :norc t
> :init-function (lambda ()
> (ext:exit (handler-case
> (your.program.package:main)
> (error ()
> 1))))
> :script t
> :documentation "Your Program"
> :start-package "COMMON-LISP-USER"
> :keep-global-handlers nil
> :executable t)
>
> See also: http://www.cliki.net/creating%20e...
>
>
>
> (defpackage "YOUR.PROGRAM"
> (:use "COMMON-LISP"))
> (in-package "YOUR.PROGRAM")
>
> (defun do-something-with-the-data (data)
> (declare (ignore data))
> (terpri)
> (write-line "$$$$$ An animated video of a banker showing the updated statistics $$$$")
> (finish-output))
>
> (defun main ()
> (do-something-with-the-data
> (mapcar (lambda (prompt)
> (terpri) (write-string prompt) (finish-output)
> (read-line))
> '("User Name:"
> "User Log In:"
> "Time and Date today:"
> "Expenses and Source:"
> "Earnings and Source:"
> "Net earnings for the month:"
> "Net earnings for the year:")))
> 0)
>
> --
> __Pascal Bourguignon__ http://www.informat...
> "The factory of the future will have only two employees, a man and a
> dog. The man will be there to feed the dog. The dog will be there to
> keep the man from touching the equipment." -- Carl Bass CEO Autodesk


Ok sounds good.

Feeling lazy now, gonna get something to eat and come back later to start working on step 1) to step 5)


gengyangcai

8/25/2015 7:22:00 AM

0

On Friday, August 21, 2015 at 7:07:16 AM UTC+8, informatimago wrote:
> CAI GENGYANG <gengyangcai@gmail.com> writes:
>
> > Ok, so I believe I downloaded Shell_in_A_Box successfully, I can see a
> > bunch of files like shell_in_a_box.js, and shellinaboxd.c in my "All
> > My Files" Folder ...
> >
> > This is how I imagine the prototype would look like:
> >
> > MediciNotes.com
> >
> > User Name:
> > User Log In:
> > Time and Date today:
> > Expenses and Source:
> > Earnings and Source:
> > Net earnings for the month:
> > Net earnings for the year:
> >
> > $$$$$ An animated video of a banker showing the updated statistics $$$$
> >
> > How do I use shell_in_a_box to build this ?
>
> 1- You write your lisp program using normal I/O (don't forget
> finish-output before read-line).
>
> 2- You save an executable image named /PATH/TO/YOUR/SERVER/PROGRAM
>
> 3- Edit the folowing file, substituting all the uppercase YOUR_SOMETHING
> by your actual data.
>
> ----(siab-YOUR-SERVER-NAME)-----------------------------------------------------
> #!/bin/bash
> exec shellinaboxd > --background=/var/run/YOUR_SERVER_NAME.pid > --port=YOUR_PORT > --disable-ssl > --user=YOUR_SERVER_USER > --group=YOUR_SERVER_GROUP > --service="/:YOUR_SERVER_USER:YOUR_SERVER_GROUP:/PATH/TO/YOUR/SERVER/DIRECTORY:/PATH/TO/YOUR/SERVER/PROGRAM ${peer}"
> --------------------------------------------------------------------------------
>
> 4- Run this script (chmod 755 it first).
>
> 5- Then go to: http://YOUR_SERVER_HOST:YOUR_PORT/
>
>
> When it's good, you can call this script in /etc/rc.local to have it
> start automatically when your server boots.
>
>
> To save the lisp image, I use something like:
>
> #+ccl (ccl:save-application
> "/PATH/TO/YOUR/SERVER/PROGRAM"
> :toplevel-function (function your.program.package:main)
> :init-file nil
> :error-handler :quit-quietly
> :purify nil
> :mode #o755
> :prepend-kernel t)
>
> #+clisp (ext:saveinitmem
> "/PATH/TO/YOUR/SERVER/PROGRAM"
> :quiet t
> :verbose t
> :norc t
> :init-function (lambda ()
> (ext:exit (handler-case
> (your.program.package:main)
> (error ()
> 1))))
> :script t
> :documentation "Your Program"
> :start-package "COMMON-LISP-USER"
> :keep-global-handlers nil
> :executable t)
>
> See also: http://www.cliki.net/creating%20e...
>
>
>
> (defpackage "YOUR.PROGRAM"
> (:use "COMMON-LISP"))
> (in-package "YOUR.PROGRAM")
>
> (defun do-something-with-the-data (data)
> (declare (ignore data))
> (terpri)
> (write-line "$$$$$ An animated video of a banker showing the updated statistics $$$$")
> (finish-output))
>
> (defun main ()
> (do-something-with-the-data
> (mapcar (lambda (prompt)
> (terpri) (write-string prompt) (finish-output)
> (read-line))
> '("User Name:"
> "User Log In:"
> "Time and Date today:"
> "Expenses and Source:"
> "Earnings and Source:"
> "Net earnings for the month:"
> "Net earnings for the year:")))
> 0)
>
> --
> __Pascal Bourguignon__ http://www.informat...
> "The factory of the future will have only two employees, a man and a
> dog. The man will be there to feed the dog. The dog will be there to
> keep the man from touching the equipment." -- Carl Bass CEO Autodesk


So I tried writing a simple program that calculates net earnings in a day (earnings-expenses) and this is the error message I got :

CL-USER 9 : 2 > ; this program inputs earnings and expenses and calculates net earnings (earnings-expenses)
(defun NetEarnings()
(terpri)
(princ "Earnings : ")
(setq n1 (read))
(setq NetEarnings (n1-n2))
(princ "Expenses : ")
(write n2)
(terpri)
(princ "Earnings - Expenses: ")
(write NetEarnings)
)
NETEARNINGS

CL-USER 10 : 2 > (NetEarnings)

Earnings : 4000

Error: Undefined operator N1-N2 in form (N1-N2).
1 (continue) Try invoking N1-N2 again.
2 Return some values from the form (N1-N2).
3 Try invoking something other than N1-N2 with the same arguments.
4 Set the symbol-function of N1-N2 to another function.
5 Set the macro-function of N1-N2 to another function.
6 (abort) Return to level 2.
7 Return to debug level 2.
8 Return to level 1.
9 Return to debug level 1.
10 Return to level 0.
11 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

How do you a refine this piece of code so that the operator (n1-n2) , i.e. (earnings-expenses) works correctly and also why do I get the prompting for Earnings (to type in the value of 4000) , but not the prompting for Expenses ?

Hope you don't mind my bad english skills and can understand what I am asking.

Thanks a lot !

Gengyang

Piotr Chamera

8/25/2015 8:35:00 AM

0

W dniu 2015-08-25 o 09:21, CAI GENGYANG pisze:
> On Friday, August 21, 2015 at 7:07:16 AM UTC+8, informatimago wrote:
>> CAI GENGYANG <gengyangcai@gmail.com> writes:
>>
>>> Ok, so I believe I downloaded Shell_in_A_Box successfully, I can see a
>>> bunch of files like shell_in_a_box.js, and shellinaboxd.c in my "All
>>> My Files" Folder ...
>>>
>>> This is how I imagine the prototype would look like:
>>>
>>> MediciNotes.com
>>>
>>> User Name:
>>> User Log In:
>>> Time and Date today:
>>> Expenses and Source:
>>> Earnings and Source:
>>> Net earnings for the month:
>>> Net earnings for the year:
>>>
>>> $$$$$ An animated video of a banker showing the updated statistics $$$$
>>>
>>> How do I use shell_in_a_box to build this ?
>>
>> 1- You write your lisp program using normal I/O (don't forget
>> finish-output before read-line).
>>
>> 2- You save an executable image named /PATH/TO/YOUR/SERVER/PROGRAM
>>
>> 3- Edit the folowing file, substituting all the uppercase YOUR_SOMETHING
>> by your actual data.
>>
>> ----(siab-YOUR-SERVER-NAME)-----------------------------------------------------
>> #!/bin/bash
>> exec shellinaboxd >> --background=/var/run/YOUR_SERVER_NAME.pid >> --port=YOUR_PORT >> --disable-ssl >> --user=YOUR_SERVER_USER >> --group=YOUR_SERVER_GROUP >> --service="/:YOUR_SERVER_USER:YOUR_SERVER_GROUP:/PATH/TO/YOUR/SERVER/DIRECTORY:/PATH/TO/YOUR/SERVER/PROGRAM ${peer}"
>> --------------------------------------------------------------------------------
>>
>> 4- Run this script (chmod 755 it first).
>>
>> 5- Then go to: http://YOUR_SERVER_HOST:YOUR_PORT/
>>
>>
>> When it's good, you can call this script in /etc/rc.local to have it
>> start automatically when your server boots.
>>
>>
>> To save the lisp image, I use something like:
>>
>> #+ccl (ccl:save-application
>> "/PATH/TO/YOUR/SERVER/PROGRAM"
>> :toplevel-function (function your.program.package:main)
>> :init-file nil
>> :error-handler :quit-quietly
>> :purify nil
>> :mode #o755
>> :prepend-kernel t)
>>
>> #+clisp (ext:saveinitmem
>> "/PATH/TO/YOUR/SERVER/PROGRAM"
>> :quiet t
>> :verbose t
>> :norc t
>> :init-function (lambda ()
>> (ext:exit (handler-case
>> (your.program.package:main)
>> (error ()
>> 1))))
>> :script t
>> :documentation "Your Program"
>> :start-package "COMMON-LISP-USER"
>> :keep-global-handlers nil
>> :executable t)
>>
>> See also: http://www.cliki.net/creating%20e...
>>
>>
>>
>> (defpackage "YOUR.PROGRAM"
>> (:use "COMMON-LISP"))
>> (in-package "YOUR.PROGRAM")
>>
>> (defun do-something-with-the-data (data)
>> (declare (ignore data))
>> (terpri)
>> (write-line "$$$$$ An animated video of a banker showing the updated statistics $$$$")
>> (finish-output))
>>
>> (defun main ()
>> (do-something-with-the-data
>> (mapcar (lambda (prompt)
>> (terpri) (write-string prompt) (finish-output)
>> (read-line))
>> '("User Name:"
>> "User Log In:"
>> "Time and Date today:"
>> "Expenses and Source:"
>> "Earnings and Source:"
>> "Net earnings for the month:"
>> "Net earnings for the year:")))
>> 0)
>>
>> --
>> __Pascal Bourguignon__ http://www.informat...
>> "The factory of the future will have only two employees, a man and a
>> dog. The man will be there to feed the dog. The dog will be there to
>> keep the man from touching the equipment." -- Carl Bass CEO Autodesk
>
>
> So I tried writing a simple program that calculates net earnings in a day (earnings-expenses) and this is the error message I got :
>
> CL-USER 9 : 2 > ; this program inputs earnings and expenses and calculates net earnings (earnings-expenses)
> (defun NetEarnings()
> (terpri)
> (princ "Earnings : ")
> (setq n1 (read))
> (setq NetEarnings (n1-n2))
> (princ "Expenses : ")
> (write n2)
> (terpri)
> (princ "Earnings - Expenses: ")
> (write NetEarnings)
> )
> NETEARNINGS
>
> CL-USER 10 : 2 > (NetEarnings)
>
> Earnings : 4000
>
> Error: Undefined operator N1-N2 in form (N1-N2).
> 1 (continue) Try invoking N1-N2 again.
> 2 Return some values from the form (N1-N2).
> 3 Try invoking something other than N1-N2 with the same arguments.
> 4 Set the symbol-function of N1-N2 to another function.
> 5 Set the macro-function of N1-N2 to another function.
> 6 (abort) Return to level 2.
> 7 Return to debug level 2.
> 8 Return to level 1.
> 9 Return to debug level 1.
> 10 Return to level 0.
> 11 Return to top loop level 0.
>
> Type :b for backtrace or :c <option number> to proceed.
> Type :bug-form "<subject>" for a bug report template or :? for other options.
>
> How do you a refine this piece of code so that the operator (n1-n2) , i.e. (earnings-expenses) works correctly and also why do I get the prompting for Earnings (to type in the value of 4000) , but not the prompting for Expenses ?

use (- n1 n2) instead of (n1-n2)

or define function named ?n1-n2?

(defun n1-n2
(- n1 n2))






gengyangcai

8/25/2015 9:45:00 AM

0

On Tuesday, August 25, 2015 at 4:35:06 PM UTC+8, Piotr Chamera wrote:
> W dniu 2015-08-25 o 09:21, CAI GENGYANG pisze:
> > On Friday, August 21, 2015 at 7:07:16 AM UTC+8, informatimago wrote:
> >> CAI GENGYANG <gengyangcai@gmail.com> writes:
> >>
> >>> Ok, so I believe I downloaded Shell_in_A_Box successfully, I can see a
> >>> bunch of files like shell_in_a_box.js, and shellinaboxd.c in my "All
> >>> My Files" Folder ...
> >>>
> >>> This is how I imagine the prototype would look like:
> >>>
> >>> MediciNotes.com
> >>>
> >>> User Name:
> >>> User Log In:
> >>> Time and Date today:
> >>> Expenses and Source:
> >>> Earnings and Source:
> >>> Net earnings for the month:
> >>> Net earnings for the year:
> >>>
> >>> $$$$$ An animated video of a banker showing the updated statistics $$$$
> >>>
> >>> How do I use shell_in_a_box to build this ?
> >>
> >> 1- You write your lisp program using normal I/O (don't forget
> >> finish-output before read-line).
> >>
> >> 2- You save an executable image named /PATH/TO/YOUR/SERVER/PROGRAM
> >>
> >> 3- Edit the folowing file, substituting all the uppercase YOUR_SOMETHING
> >> by your actual data.
> >>
> >> ----(siab-YOUR-SERVER-NAME)-----------------------------------------------------
> >> #!/bin/bash
> >> exec shellinaboxd > >> --background=/var/run/YOUR_SERVER_NAME.pid > >> --port=YOUR_PORT > >> --disable-ssl > >> --user=YOUR_SERVER_USER > >> --group=YOUR_SERVER_GROUP > >> --service="/:YOUR_SERVER_USER:YOUR_SERVER_GROUP:/PATH/TO/YOUR/SERVER/DIRECTORY:/PATH/TO/YOUR/SERVER/PROGRAM ${peer}"
> >> --------------------------------------------------------------------------------
> >>
> >> 4- Run this script (chmod 755 it first).
> >>
> >> 5- Then go to: http://YOUR_SERVER_HOST:YOUR_PORT/
> >>
> >>
> >> When it's good, you can call this script in /etc/rc.local to have it
> >> start automatically when your server boots.
> >>
> >>
> >> To save the lisp image, I use something like:
> >>
> >> #+ccl (ccl:save-application
> >> "/PATH/TO/YOUR/SERVER/PROGRAM"
> >> :toplevel-function (function your.program.package:main)
> >> :init-file nil
> >> :error-handler :quit-quietly
> >> :purify nil
> >> :mode #o755
> >> :prepend-kernel t)
> >>
> >> #+clisp (ext:saveinitmem
> >> "/PATH/TO/YOUR/SERVER/PROGRAM"
> >> :quiet t
> >> :verbose t
> >> :norc t
> >> :init-function (lambda ()
> >> (ext:exit (handler-case
> >> (your.program.package:main)
> >> (error ()
> >> 1))))
> >> :script t
> >> :documentation "Your Program"
> >> :start-package "COMMON-LISP-USER"
> >> :keep-global-handlers nil
> >> :executable t)
> >>
> >> See also: http://www.cliki.net/creating%20e...
> >>
> >>
> >>
> >> (defpackage "YOUR.PROGRAM"
> >> (:use "COMMON-LISP"))
> >> (in-package "YOUR.PROGRAM")
> >>
> >> (defun do-something-with-the-data (data)
> >> (declare (ignore data))
> >> (terpri)
> >> (write-line "$$$$$ An animated video of a banker showing the updated statistics $$$$")
> >> (finish-output))
> >>
> >> (defun main ()
> >> (do-something-with-the-data
> >> (mapcar (lambda (prompt)
> >> (terpri) (write-string prompt) (finish-output)
> >> (read-line))
> >> '("User Name:"
> >> "User Log In:"
> >> "Time and Date today:"
> >> "Expenses and Source:"
> >> "Earnings and Source:"
> >> "Net earnings for the month:"
> >> "Net earnings for the year:")))
> >> 0)
> >>
> >> --
> >> __Pascal Bourguignon__ http://www.informat...
> >> "The factory of the future will have only two employees, a man and a
> >> dog. The man will be there to feed the dog. The dog will be there to
> >> keep the man from touching the equipment." -- Carl Bass CEO Autodesk
> >
> >
> > So I tried writing a simple program that calculates net earnings in a day (earnings-expenses) and this is the error message I got :
> >
> > CL-USER 9 : 2 > ; this program inputs earnings and expenses and calculates net earnings (earnings-expenses)
> > (defun NetEarnings()
> > (terpri)
> > (princ "Earnings : ")
> > (setq n1 (read))
> > (setq NetEarnings (n1-n2))
> > (princ "Expenses : ")
> > (write n2)
> > (terpri)
> > (princ "Earnings - Expenses: ")
> > (write NetEarnings)
> > )
> > NETEARNINGS
> >
> > CL-USER 10 : 2 > (NetEarnings)
> >
> > Earnings : 4000
> >
> > Error: Undefined operator N1-N2 in form (N1-N2).
> > 1 (continue) Try invoking N1-N2 again.
> > 2 Return some values from the form (N1-N2).
> > 3 Try invoking something other than N1-N2 with the same arguments.
> > 4 Set the symbol-function of N1-N2 to another function.
> > 5 Set the macro-function of N1-N2 to another function.
> > 6 (abort) Return to level 2.
> > 7 Return to debug level 2.
> > 8 Return to level 1.
> > 9 Return to debug level 1.
> > 10 Return to level 0.
> > 11 Return to top loop level 0.
> >
> > Type :b for backtrace or :c <option number> to proceed.
> > Type :bug-form "<subject>" for a bug report template or :? for other options.
> >
> > How do you a refine this piece of code so that the operator (n1-n2) , i.e. (earnings-expenses) works correctly and also why do I get the prompting for Earnings (to type in the value of 4000) , but not the prompting for Expenses ?
>
> use (- n1 n2) instead of (n1-n2)
>
> or define function named "n1-n2"
>
> (defun n1-n2
> (- n1 n2))

I still get an error message after changing the code to (- n1 n2), but this time it says that the variable "NetEarnings" is unbound ... how can I get this to work ? This is so frustrating ...

CL-USER 9 : 4 > ; this program inputs earnings and expenses and calculates net earnings (earnings-expenses)
(defun NetEarnings()
(terpri)
(princ "Earnings : ")
(setq n1 (read))
(setq NetEarnings ( -n1 n2))
(princ "Expenses : ")
(write n2)
(terpri)
(princ "Earnings - Expenses: ")
(write NetEarnings)
)
NETEARNINGS

CL-USER 10 : 4 > NetEarnings

Error: The variable NETEARNINGS is unbound.
1 (continue) Try evaluating NETEARNINGS again.
2 Specify a value to use this time instead of evaluating NETEARNINGS.
3 Specify a value to set NETEARNINGS to.
4 Return the result of calling (NETEARNINGS) instead.
5 (abort) Return to level 4.
6 Return to debug level 4.
7 Return to level 3.
8 Return to debug level 3.
9 Return to level 2.
10 Return to debug level 2.
11 Return to level 1.
12 Return to debug level 1.
13 Return to level 0.
14 Return to top loop level 0.

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.