A few minor points about Joy libraries
Heiko.Kuhrt@t-online.de — 2002-01-11 22:56:57
Following is a list of points I ran into working with Joy.
I tested on Joy as it was on December 14th, 2001.
"=" - Operator:
[] "text" = => false
"text" [] = => type error
I don't think this is intended.
Abs and sign are still returning float.
1 abs integer => false
1 abs float => true
1 sign integer => false
1 sign float => true
Take seems to have difficulties with strings.
[1 2 3 4 5 6] 4 take => [1 2 3 4]
{1 2 3 4 5 6} 4 take => {1 2 3 4}
"123456" 4 take => "1234->"
"This is a string." 10 take => "This is a "
"This is a string." 11 take => "This is a she"
"This is a string." 12 take => "This is a ste"
"This is a string." 13 take => "This is a str"
"This is a string." 14 take => "This is a stri"
"This is a string." 15 take => "This is a stri->"
"This is a string." 16 take => "This is a string->"
"This is a string." 17 take => "This is a string.>"
"This is a string." 18 take => "This is a string."
agglib:
set2string == ""swap [swons]step;
string2set == {}swap shunt;
I don't know, but I think this is a relict from Joy0.
Anyway, these definitions don't do what they promise.
agglib:
second == rest first;
third == rest rest first;
fourth == 3 drop;
fifth == 4 drop;
Fifth and fourth should be changed, so they are returning the
specified elements, too.
agglib
secondd == [secondd]dip;
Sort of dipdevel.
-Heiko
Manfred von Thun — 2002-01-24 04:02:23
On Fri, 11 Jan 2002
Heiko.Kuhrt@... wrote:
> Following is a list of points I ran into working with Joy.
> I tested on Joy as it was on December 14th, 2001.
>
>
> "=" - Operator:
> [] "text" = => false
> "text" [] = => type error
> I don't think this is intended.
>
> Abs and sign are still returning float.
> 1 abs integer => false
> 1 abs float => true
> 1 sign integer => false
> 1 sign float => true
>
> Take seems to have difficulties with strings.
> [1 2 3 4 5 6] 4 take => [1 2 3 4]
> {1 2 3 4 5 6} 4 take => {1 2 3 4}
> "123456" 4 take => "1234->"
> "This is a string." 10 take => "This is a "
> "This is a string." 11 take => "This is a she"
> "This is a string." 12 take => "This is a ste"
> "This is a string." 13 take => "This is a str"
> "This is a string." 14 take => "This is a stri"
> "This is a string." 15 take => "This is a stri->"
> "This is a string." 16 take => "This is a string->"
> "This is a string." 17 take => "This is a string.>"
> "This is a string." 18 take => "This is a string."
>
> agglib:
> set2string == ""swap [swons]step;
> string2set == {}swap shunt;
> I don't know, but I think this is a relict from Joy0.
> Anyway, these definitions don't do what they promise.
>
> agglib:
> second == rest first;
> third == rest rest first;
>
> fourth == 3 drop;
> fifth == 4 drop;
>
> Fifth and fourth should be changed, so they are returning the
> specified elements, too.
>
> agglib
> secondd == [secondd]dip;
> Sort of dipdevel.
> -Heiko
Oh dear, oh dear. Yes. I can't fix them right now because I'm
halfway through a largish Joy program - would you believe, a
(Eval-Apply) Lisp interpreter written in Joy. When that is done
I'll turn my mind to those bugs.
Thank you very much.
- Manfred
Manfred von Thun — 2002-02-04 06:25:24
On Fri, 11 Jan 2002
Heiko.Kuhrt@... wrote:
> Following is a list of points I ran into working with Joy.
> I tested on Joy as it was on December 14th, 2001.
Thank you very much.
I have fixed some of the bugs on my personal version (under VMS),
but I'll only update the Joy page when I have done all.
> "=" - Operator:
> [] "text" = => false
> "text" [] = => type error
> I don't think this is intended.
Yes, I must still fix this
> Abs and sign are still returning float.
> 1 abs integer => false
> 1 abs float => true
> 1 sign integer => false
> 1 sign float => true
Yes, I must still fix this.
> Take seems to have difficulties with strings.
...
> "This is a string." 10 take => "This is a "
> "This is a string." 11 take => "This is a she"
> "This is a string." 12 take => "This is a ste"
> "This is a string." 13 take => "This is a str"
> "This is a string." 14 take => "This is a stri"
> "This is a string." 15 take => "This is a stri->"
> "This is a string." 16 take => "This is a string->"
> "This is a string." 17 take => "This is a string.>"
> "This is a string." 18 take => "This is a string."
Yes, this was a bad bug. I was lucky, the CC under VMS actually
crashes when one tries to take more from the string than there is.
The crash immediately pointed to the error: I had not malloc'ed
enough for the result string. Fixed, see test file below.
> agglib:
> set2string == ""swap [swons]step;
^^^^^^^^^^ yes, this was wrong, now fixed, see test file below.
> string2set == {}swap shunt;
^^^^^^^^^^ no, this was correct, see test file below.
(Maybe you expected something different.)
...
> fourth == 3 drop;
> fifth == 4 drop;
Yes, how silly of me, both wrong, now fixed, see test file below.
> secondd == [secondd]dip;
> Sort of dipdevel.
I secondd that. Fixedd.
> -Heiko
Thanks again. Will fix the two bugs in interp.c soon.
(Incidentally, Heiko, have you checked whether my wording on the
main Joy page about your rabbit is correct?)
- Manfred
(* test file *)
(* - - - - - TESTING: string2set - - - - - *)
DEFINE
q ==
"Quote #1 :\n\t\"Why do they hate us so much ?\"\n\t\tGeorge W. Bush (2002)\n".
q.
"Quote #1 :
"Why do they hate us so much ?"
George W. Bush (2002)
"
(* lower case *)
q [96 >=] filter .
"uotehydotheyhateussomucheorgeush"
q [96 >=] filter [96 -] map string2set .
{1 3 4 5 7 8 13 15 18 19 20 21 25}
(* upper case *)
q [64 >=] filter [96 <] filter .
"QWGWB"
q [64 >=] filter [96 <] filter [64 -] map string2set .
{2 7 17 23}
(* digits punct *)
q [32 >=] filter [64 <] filter .
" #1 :" ?" . (2002)"
q [33 >=] filter [64 <] filter [32 -] map string2set .
{2 3 8 9 14 16 17 18 26 31}
(* control *)
q [32 <] filter .
"
"
q [32 <] filter string2set .
{9 10}
(* - - - - - TESTING: set2string - - - - - *)
"joy" [96 -] map string2set .
{10 15 25}
"joy" [96 -] map string2set set2string [96 +] map .
"joy"
{10 15 25} set2string [96 +] map.
"joy"
{10 15 25} set2string [64 +] map.
"JOY"
"mississippi" [96 -] map string2set .
{9 13 16 19}
"mississippi" [96 -] map string2set set2string [96 +] map .
"imps"
"mississippi" [96 -] map string2set set2string [64 +] map .
"IMPS"
(* - - - - - TESTING: second third fourth fifth - - - - - *)
"1234567" second.
'2
"1234567" third.
'3
"1234567" fourth.
'4
"1234567" fifth.
'5
{ 1 2 3 4 5 6 7 } second.
2
{ 1 2 3 4 5 6 7 } third.
3
{ 1 2 3 4 5 6 7 } fourth.
4
{ 1 2 3 4 5 6 7 } fifth.
5
[ 1 2 3 4 5 6 7 ] second.
2
[ 1 2 3 4 5 6 7 ] third.
3
[ 1 2 3 4 5 6 7 ] fourth.
4
[ 1 2 3 4 5 6 7 ] fifth.
5
(* - - - - - TESTING: take (with strings) - - - - - *)
"abcde" 3 take.
"abc"
"abcde" 4 take.
"abcd"
"abcde" 5 take.
"abcde"
"abcde" 6 take.
"abcde"
"abcde" 7 take.
"abcde"
"abcde" 8 take.
"abcde"
"abcde" 9 take.
"abcde"
"abcde" 1000 take.
"abcde"
(* end test file *)
John Leuner — 2002-02-04 11:04:19
I didn't get powerlist to work?
And this causes a segfault:
["jewel"] "jewel" some .
John Leuner
On Mon, Feb 04, 2002 at 05:25:24PM +1100, Manfred von Thun wrote:
>
> On Fri, 11 Jan 2002 Heiko.Kuhrt@... wrote:
>
> > Following is a list of points I ran into working with Joy.
> > I tested on Joy as it was on December 14th, 2001.
>
> Thank you very much.
> I have fixed some of the bugs on my personal version (under VMS),
> but I'll only update the Joy page when I have done all.
>
> > "=" - Operator:
> > [] "text" = => false
> > "text" [] = => type error
> > I don't think this is intended.
>
> Yes, I must still fix this
>
> > Abs and sign are still returning float.
> > 1 abs integer => false
> > 1 abs float => true
> > 1 sign integer => false
> > 1 sign float => true
>
> Yes, I must still fix this.
>
> > Take seems to have difficulties with strings.
> ...
> > "This is a string." 10 take => "This is a "
> > "This is a string." 11 take => "This is a she"
> > "This is a string." 12 take => "This is a ste"
> > "This is a string." 13 take => "This is a str"
> > "This is a string." 14 take => "This is a stri"
> > "This is a string." 15 take => "This is a stri->"
> > "This is a string." 16 take => "This is a string->"
> > "This is a string." 17 take => "This is a string.>"
> > "This is a string." 18 take => "This is a string."
>
> Yes, this was a bad bug. I was lucky, the CC under VMS actually
> crashes when one tries to take more from the string than there is.
> The crash immediately pointed to the error: I had not malloc'ed
> enough for the result string. Fixed, see test file below.
>
> > agglib:
> > set2string == ""swap [swons]step;
> ^^^^^^^^^^ yes, this was wrong, now fixed, see test file below.
> > string2set == {}swap shunt;
> ^^^^^^^^^^ no, this was correct, see test file below.
> (Maybe you expected something different.)
> ...
> > fourth == 3 drop;
> > fifth == 4 drop;
> Yes, how silly of me, both wrong, now fixed, see test file below.
>
> > secondd == [secondd]dip;
> > Sort of dipdevel.
> I secondd that. Fixedd.
>
> > -Heiko
>
> Thanks again. Will fix the two bugs in interp.c soon.
>
> (Incidentally, Heiko, have you checked whether my wording on the
> main Joy page about your rabbit is correct?)
>
> - Manfred
>
> (* test file *)
>
>
> (* - - - - - TESTING: string2set - - - - - *)
>
> DEFINE
> q ==
> "Quote #1 :\n\t\"Why do they hate us so much ?\"\n\t\tGeorge W. Bush (2002)\n".
>
> q.
> "Quote #1 :
> "Why do they hate us so much ?"
> George W. Bush (2002)
> "
>
> (* lower case *)
> q [96 >=] filter .
> "uotehydotheyhateussomucheorgeush"
> q [96 >=] filter [96 -] map string2set .
> {1 3 4 5 7 8 13 15 18 19 20 21 25}
>
> (* upper case *)
> q [64 >=] filter [96 <] filter .
> "QWGWB"
> q [64 >=] filter [96 <] filter [64 -] map string2set .
> {2 7 17 23}
>
> (* digits punct *)
> q [32 >=] filter [64 <] filter .
> " #1 :" ?" . (2002)"
> q [33 >=] filter [64 <] filter [32 -] map string2set .
> {2 3 8 9 14 16 17 18 26 31}
>
> (* control *)
> q [32 <] filter .
> "
>
>
> "
> q [32 <] filter string2set .
> {9 10}
>
>
> (* - - - - - TESTING: set2string - - - - - *)
>
> "joy" [96 -] map string2set .
> {10 15 25}
> "joy" [96 -] map string2set set2string [96 +] map .
> "joy"
> {10 15 25} set2string [96 +] map.
> "joy"
> {10 15 25} set2string [64 +] map.
> "JOY"
>
> "mississippi" [96 -] map string2set .
> {9 13 16 19}
> "mississippi" [96 -] map string2set set2string [96 +] map .
> "imps"
> "mississippi" [96 -] map string2set set2string [64 +] map .
> "IMPS"
>
> (* - - - - - TESTING: second third fourth fifth - - - - - *)
>
> "1234567" second.
> '2
> "1234567" third.
> '3
> "1234567" fourth.
> '4
> "1234567" fifth.
> '5
>
> { 1 2 3 4 5 6 7 } second.
> 2
> { 1 2 3 4 5 6 7 } third.
> 3
> { 1 2 3 4 5 6 7 } fourth.
> 4
> { 1 2 3 4 5 6 7 } fifth.
> 5
>
> [ 1 2 3 4 5 6 7 ] second.
> 2
> [ 1 2 3 4 5 6 7 ] third.
> 3
> [ 1 2 3 4 5 6 7 ] fourth.
> 4
> [ 1 2 3 4 5 6 7 ] fifth.
> 5
>
> (* - - - - - TESTING: take (with strings) - - - - - *)
>
> "abcde" 3 take.
> "abc"
> "abcde" 4 take.
> "abcd"
> "abcde" 5 take.
> "abcde"
> "abcde" 6 take.
> "abcde"
> "abcde" 7 take.
> "abcde"
> "abcde" 8 take.
> "abcde"
> "abcde" 9 take.
> "abcde"
> "abcde" 1000 take.
> "abcde"
>
> (* end test file *)
>
>
>
> To unsubscribe from this group, send an email to:
> concatenative-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Manfred von Thun — 2002-02-06 12:45:52
On Mon, 4 Feb 2002, Manfred von Thun wrote:
>
> On Fri, 11 Jan 2002 Heiko.Kuhrt@... wrote:
>
> > Following is a list of points I ran into working with Joy.
> > I tested on Joy as it was on December 14th, 2001.
>
> Thank you very much.
> I have fixed some of the bugs on my personal version (under VMS),
> but I'll only update the Joy page when I have done all.
All the bugs you reported are fixed now.
I have updated the Joy page.
See the joydir.txt for dates of updates.
Thanks again.
- Manfred
Manfred von Thun — 2002-02-06 13:03:00
On Mon, 4 Feb 2002, John Leuner wrote:
> I didn't get powerlist to work?
Sorry, the html papers "tutorial" and "programming" are
badly in need of an update. There are two versions of powerlist
now, powerlist1 and powerlist2, both in the library agglib.joy .
They differ in the order they produce the results.
(It is interesting to see how their definitions differ
in just one small detail.)
> And this causes a segfault:
>
> ["jewel"] "jewel" some .
Yes, thank you. It should produce a type error, because the top
parameter must be a quotation. That is fixed now.
Correct uses look like this:
[ 1 2 3 4 5 ] [ 3 = ] some
[ 1 2 3 4 5 ] [ 7 = ] some
[ 1 2 3 4 5 ] [ 1 < ] some
{ 2 4 6 8 9 } [prime] some
"some string" ['a = ] some
"some string" ['a > ] some
Thanks for pointing out the faulty error detection.
> John Leuner
- Manfred
Heiko.Kuhrt@t-online.de — 2002-02-06 17:21:15
On Monday, 4. February 2002 07:25, Manfred wrote:
>........
> (Incidentally, Heiko, have you checked whether my wording on the
> main Joy page about your rabbit is correct?)
>
> - Manfred
>
> (* test file *)
>..........
Well, what should be wrong with that wording? In my opinion the main point of
rabbit is the HTML docs - you wrote that. Rabbit is about HTML generation, or
Joy to HTML translation - fine. "External": yes, it is external, it is not
from you or La Trobe University.
But please feel free to cut and paste any piece of code out of rabbit into
your programs -- in case you find something useful -- and make it that way
internal. I would like to see rabbit under the same license or as part of Joy
-- again, if you find it useful. ( In my opinion the docs are the important
part of rabbit. Maybe they should be covered by some license.)
As I ALREADY MAILED at Tuesday, January 29th, I think your wording is fine.
Thank you again.
-- Heiko
John Leuner — 2002-02-22 15:45:50
> > > Following is a list of points I ran into working with Joy.
> > > I tested on Joy as it was on December 14th, 2001.
> >
> > Thank you very much.
> > I have fixed some of the bugs on my personal version (under VMS),
> > but I'll only update the Joy page when I have done all.
>
> All the bugs you reported are fixed now.
> I have updated the Joy page.
> See the joydir.txt for dates of updates.
> Thanks again.
Do you have any objection to me making a debian package for Joy and uploading it to the debian distribution?
John Leuner
Manfred von Thun — 2002-02-25 08:56:33
On Fri, 22 Feb 2002, John Leuner wrote:
> Do you have any objection to me making a debian package for Joy and uploading it to the debian distribution?
>
> John Leuner
No objection at all, on the contrary, I would be pleased.
You will have to let me know whether there is anything
that I must/should do, since I have no experience with
Debian.
- Manfred
John Leuner — 2002-02-25 18:14:05
On Mon, Feb 25, 2002 at 07:56:33PM +1100, Manfred von Thun wrote:
>
> On Fri, 22 Feb 2002, John Leuner wrote:
>
> > Do you have any objection to me making a debian package for Joy and uploading it to the debian distribution?
> >
> > John Leuner
>
> No objection at all, on the contrary, I would be pleased.
> You will have to let me know whether there is anything
> that I must/should do, since I have no experience with
> Debian.
> - Manfred
No you don't have to do anything, expect perhaps keep me informed about new releases.
One thing has to be done before it can go into the debian distribution however. You have to choose a license for the source code.
It has to comply with these guidelines:
http://www.debian.org/social_contract.html#guidelines
John Leuner
John Leuner — 2002-02-25 18:33:52
On Mon, Feb 25, 2002 at 07:56:33PM +1100, Manfred von Thun wrote:
>
> On Fri, 22 Feb 2002, John Leuner wrote:
>
> > Do you have any objection to me making a debian package for Joy and uploading it to the debian distribution?
> >
> > John Leuner
>
> No objection at all, on the contrary, I would be pleased.
> You will have to let me know whether there is anything
> that I must/should do, since I have no experience with
> Debian.
> - Manfred
If anyone would like to try it out, here is an x86 build:
http://master.debian.org/~jewel/joy/
John Leuner
Manfred von Thun — 2002-02-26 07:34:45
On Mon, 25 Feb 2002, John Leuner wrote:
> On Mon, Feb 25, 2002 at 07:56:33PM +1100, Manfred von Thun wrote:
...
> > You will have to let me know whether there is anything
> > that I must/should do, since I have no experience with
> > Debian.
> > - Manfred
>
> No you don't have to do anything, expect perhaps keep me informed
> about new releases. One thing has to be done before it can go
> into the debian distribution however. You have to choose a license
> for the source code.
>
> It has to comply with these guidelines:
>
> http://www.debian.org/social_contract.html#guidelines
Done, see the main Joy page, section 3. I picked the BSD license.
I hope this format is satisfactory. Or do I have to include it
in ever source file ?
- Manfred
John Leuner — 2002-02-26 09:33:21
On Tue, Feb 26, 2002 at 06:34:45PM +1100, Manfred von Thun wrote:
>
> On Mon, 25 Feb 2002, John Leuner wrote:
>
> > On Mon, Feb 25, 2002 at 07:56:33PM +1100, Manfred von Thun wrote:
>
> ...
> > > You will have to let me know whether there is anything
> > > that I must/should do, since I have no experience with
> > > Debian.
> > > - Manfred
> >
> > No you don't have to do anything, expect perhaps keep me informed
> > about new releases. One thing has to be done before it can go
> > into the debian distribution however. You have to choose a license
> > for the source code.
> >
> > It has to comply with these guidelines:
> >
> > http://www.debian.org/social_contract.html#guidelines
>
> Done, see the main Joy page, section 3. I picked the BSD license.
> I hope this format is satisfactory. Or do I have to include it
> in ever source file ?
No you don't. But you might want to say that it covers all the software on that page.
John Leuner
John Leuner — 2002-02-26 13:29:08
> From: John Leuner <jewel@...>
> Subject: Re: [stack] Joy debian package
> Date: Mon, 25 Feb 2002 18:33:52 +0000
>
> > If anyone would like to try it out, here is an x86 build:
> >
> > http://master.debian.org/~jewel/joy/
>
> works well, but I expected the libraries to be in the deb as well.
> Should they be?
Yes they should. They will probably go in /usr/lib/joy/20020221/
How can I tell the interpreter where to find them?
John Leuner
Manfred von Thun — 2002-03-14 10:28:50
On Tue, 26 Feb 2002, John Leuner wrote:
> > From: John Leuner <jewel@...>
> > Subject: Re: [stack] Joy debian package
> > Date: Mon, 25 Feb 2002 18:33:52 +0000
> >
> > > If anyone would like to try it out, here is an x86 build:
> > >
> > > http://master.debian.org/~jewel/joy/
> >
> > works well, but I expected the libraries to be in the deb as well.
> > Should they be?
>
> Yes they should. They will probably go in /usr/lib/joy/20020221/
>
> How can I tell the interpreter where to find them?
I'm sorry John, I realised only now that this question was probably
addressed to me. I should have read your post more carefully.
The situation is this: In my daily working area and also on the
Joy page I keep the Joy libraries and at least the Joy executable
in the same directory. So if Joy is run, it will find usrlib.joy
there and include it. Normally that file will also have an include
directive to include at least inilib.joy, and maybe more. All the
test files, *tst.joy currently assume that the corresponding *lib.joy
is also in that same directory. In other words, the entire structure
is completely flat.
If one wanted to have subdirectories, then any include would look
like this:
"/foo/bar/bazlib.joy" include.
or "/foo/bar/bazlib" libload.
However, my own feeling is that the libraries are still subject to
change and experimentation. I probably would prefer the current
flat structure. But I would also like to hear other people's views.
Again, sorry about the delay in answering.
- Manfred
Manfred von Thun — 2002-03-14 10:58:03
New things on the Joy page:
plglib.joy propositional library (semantic tableaux)
plgtst.joy test file
plgtst.out output from the test file
The library has a collection of functions that use semantic tableaux
(also known as truth trees or Wang's algorithm) to determine whether
a formula (in a variety of possible notations) is a tautology.
I have also had to expand the symlib library a bit just for this
application. New tests included.
Whereas truth tables are a bottom up method, semantic tableaux are
a top down method. Truth tables generate possible assignments of truth
values to atomic formulas and then determine whether the given formula is
true in that assignment. Semantic tableaux or truth trees start with
the formula and based on its structure and that of its subformulas
attempts to construct appropriate assignments. Any one attempt may
fail ("closed path" in the terminology). So backtracking is needed.
One way to do that is with continuations. In the case of testing
whether a formula is a tautology, the method tries to construct
one or more lines in the truth table in which the given formula
is false. If it succeeds, then the formula is not a tautology.
Otherwise, if it fails, and the method is complete, then the formula
is a tautology. I have done that sort of thing many times in Pascal.
So here it is in Joy.
(But note that the Joy operator conts which pushes the list of
continuations of a Joy execution is not used at all. Maybe now that
I understand the problem better I shall one day really use conts.
In the meantime, heed the warning in the online manual: "do not use".)
My next project will be a program that can read regular expressions
and "expand" them - i.e. construct all the strings (up to a limit)
which are in the language defined by the expression. That will also
use continuations in the same way as the semantic tableaux program,
but there does not have to be any backtracking. Wish me well.
- Manfred
Nick Forde — 2002-03-14 12:35:58
Manfred von Thun writes:
[...]
>
> The situation is this: In my daily working area and also on the
> Joy page I keep the Joy libraries and at least the Joy executable
> in the same directory. So if Joy is run, it will find usrlib.joy
> there and include it. Normally that file will also have an include
> directive to include at least inilib.joy, and maybe more. All the
> test files, *tst.joy currently assume that the corresponding *lib.joy
> is also in that same directory. In other words, the entire structure
> is completely flat.
>
> If one wanted to have subdirectories, then any include would look
> like this:
> "/foo/bar/bazlib.joy" include.
> or "/foo/bar/bazlib" libload.
>
> However, my own feeling is that the libraries are still subject to
> change and experimentation. I probably would prefer the current
> flat structure. But I would also like to hear other people's views.
I think it is important that new Joy users have a clear distinction
between "standard" libraries and examples or their own code. As the
*lib.joy files bundled with the interpreter effectively define the
language it should be possible to keep these read only in a debian
installation.
My preference would be to have a library lookup mechanism so that
users can have the convenience of a flat interpreter/lib structure or
fall back on the "standard" debian install.
What about something like:
libenvvar == "JOYLIB"; (* ??? *)
libdefdir == "/usr/local/share/joy/lib"; (* ??? *)
libexist == "r" fopen [null] [false] [fclose true] ifte;
libfile == "/" concat swap concat;
libpath1 == libenvvar getenv libfile;
libpath2 == "." libfile;
libpath3 == libdefdir libfile;
libfind == [[[libpath1 libexist] libpath1]
[[libpath2 libexist] libpath2]
[[libpath3 libexist] libpath3]
["library '" swap concat "' not found" concat]] cond;
In this case libfind will search the directory specified with the
JOYLIB environment variable, then in the current working directory,
and finally in /usr/local/share/joy/lib.
*** Warning *** I'm new to Joy and haven't yet been able to test the
above! Sorry if this is bad code.
It is also common in Unix applications to store files such as
usrlib.joy as a "dotfile" in the user's home
directory. e.g. ~/.joyinitrc or ~/.joylibs/usrlib.joy. Perhaps this
should also be added to the above.
Regards,
Nick.
John Leuner — 2002-03-14 16:43:20
> > The situation is this: In my daily working area and also on the
> > Joy page I keep the Joy libraries and at least the Joy executable
> > in the same directory. So if Joy is run, it will find usrlib.joy
> > there and include it. Normally that file will also have an include
> > directive to include at least inilib.joy, and maybe more. All the
> > test files, *tst.joy currently assume that the corresponding *lib.joy
> > is also in that same directory. In other words, the entire structure
> > is completely flat.
> >
> > If one wanted to have subdirectories, then any include would look
> > like this:
> > "/foo/bar/bazlib.joy" include.
> > or "/foo/bar/bazlib" libload.
> >
> > However, my own feeling is that the libraries are still subject to
> > change and experimentation. I probably would prefer the current
> > flat structure. But I would also like to hear other people's views.
>
> I think it is important that new Joy users have a clear distinction
> between "standard" libraries and examples or their own code. As the
> *lib.joy files bundled with the interpreter effectively define the
> language it should be possible to keep these read only in a debian
> installation.
>
> My preference would be to have a library lookup mechanism so that
> users can have the convenience of a flat interpreter/lib structure or
> fall back on the "standard" debian install.
So to summarize we want to provide two modes of operation:
1) The user types "joy" and gets an interpreter with the standard libraries loaded (all libs on the joy page, probably in /usr/share/joyXXX/lib )
2) The user types "joy" and it reads a user-specific config file (eg ~/.joy/joyrc) which controls where to find libraries and which ones to load initially (as Nick mentioned)
You can have different levels of these, such as:
joy first looks in current directory for config file
joy looks in ~/.joy directory for config file
joy looks in /etc/joy directory for config file
And you could also make it a command-line option. In that case the debian package could just install a wrapper script which points to where it has installed the .joy files.
I don't want to use environment variables, I don't think it fits well with Debian.
There are several ways of making this work, but we at least need some mechanism to tell the interpreter where to find the standard libraries.
John Leuner
> What about something like:
>
> libenvvar == "JOYLIB"; (* ??? *)
> libdefdir == "/usr/local/share/joy/lib"; (* ??? *)
>
> libexist == "r" fopen [null] [false] [fclose true] ifte;
> libfile == "/" concat swap concat;
> libpath1 == libenvvar getenv libfile;
> libpath2 == "." libfile;
> libpath3 == libdefdir libfile;
> libfind == [[[libpath1 libexist] libpath1]
> [[libpath2 libexist] libpath2]
> [[libpath3 libexist] libpath3]
> ["library '" swap concat "' not found" concat]] cond;
>
> In this case libfind will search the directory specified with the
> JOYLIB environment variable, then in the current working directory,
> and finally in /usr/local/share/joy/lib.
>
> *** Warning *** I'm new to Joy and haven't yet been able to test the
> above! Sorry if this is bad code.
>
> It is also common in Unix applications to store files such as
> usrlib.joy as a "dotfile" in the user's home
> directory. e.g. ~/.joyinitrc or ~/.joylibs/usrlib.joy. Perhaps this
> should also be added to the above.
>
> Regards,
>
> Nick.
>
>
>
> To unsubscribe from this group, send an email to:
> concatenative-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Nick Forde — 2002-03-14 17:31:20
John Leuner writes:
> So to summarize we want to provide two modes of operation:
>
> 1) The user types "joy" and gets an interpreter with the standard
> libraries loaded (all libs on the joy page, probably in
> /usr/share/joyXXX/lib )
> 2) The user types "joy" and it reads a user-specific config file
> (eg ~/.joy/joyrc) which controls where to find libraries and
> which ones to load initially (as Nick mentioned)
Note that I envisioned your "config" file just being the first library
loaded by the Joy interpreter. I think this is currently hardcoded to
be "usrlib.joy" in the current working directory.
> You can have different levels of these, such as:
>
> joy first looks in current directory for config file
> joy looks in ~/.joy directory for config file
> joy looks in /etc/joy directory for config file
>
> And you could also make it a command-line option. In that case the
> debian package could just install a wrapper script which points to
> where it has installed the .joy files.
I agree that a command-line option would be good for this. In the
bootstrap library I'd like to see the default "libload" implemented to
search through a number of directories (including the current working
directory) so that users can simply copy the debian read-only
libraries to their working directory and have them picked up
automatically. Library inheritance would also be nice but this is
getting a bit off topic.
> I don't want to use environment variables, I don't think it fits well with Debian.
I've certainly no problem with this.
> There are several ways of making this work, but we at least need
> some mechanism to tell the interpreter where to find the standard
> libraries.
Agreed. A command-line option to override the hardcoded ./usrlib.joy
in main.c should be all that is required. Any other details can be
handled in the joy libraries themselves.
John, I should point out that I'm only a Joy user and have nothing to
do with the interpreter/language development so my preferences should
be given much lower priority than others on this list :-)
Regards,
Nick.