Building PilBox

2017-04-01 Thread Erik Gustafson
Hi Alex,

I'm finally getting around to exploring PilBox. I installed the ready-made
pilBox.apk to my phone and tried it out. Very cool, lots of potential there
:)

I've run into trouble trying to get it setup for myself, however. No issue
preparing the toolchain, but './mk.arm64.linux' fails with the following
(abridged) error messages:

   ../../toolchain/bin/clang38: error while loading shared libraries:
libncurses.so.5: no such file

   ../../toolchain/bin/aarch64-linux-android-strip: {'../bin/picolisp',
'../lib/ext', '../lib/ht'}: no such file

Thoughts? I have ncurses 6.0 installed on my (arch linux) system.

Thanks,
Erik


Re: Is there documentation for the libraries in @lib/ ?

2017-04-01 Thread Joh-Tob Schäg
Yes you can not find any documentation.

2017-04-02 3:36 GMT+02:00 Bruno Franco :

> I can find the documentation for the default functions, and for the form
> functions, but how about libraries like pilog.l or http.l?
>


Is there documentation for the libraries in @lib/ ?

2017-04-01 Thread Bruno Franco
I can find the documentation for the default functions, and for the form
functions, but how about libraries like pilog.l or http.l?


Re: Fixed-point scaling and lookup tables

2017-04-01 Thread Joh-Tob Schäg
I'll wait.

2017-04-01 22:45 GMT+02:00 Lindsay John Lawrence <
lawrence.lindsayj...@gmail.com>:

> My next little picolisp project...
>
> Picolisp's built-in functions for scaled arithmetic are brilliant once you
> understand how they work. Still, it would be great to get more scientific
> functions without have to link an external math lib, and get 'real-time'
> performance when needed as well.
>
> http://wilsonminesco.com/16bitMathTables/ is a nice write-up (link found
> on hacker news) of what you can do with fixed point, scaling and lookup
> tables... Also has links to code to generate the tables.
>
> I think the concepts and technique will transfer quite nicely to
> picolisp.  We'll see...
>
> /Lindsay
>
>


Fixed-point scaling and lookup tables

2017-04-01 Thread Lindsay John Lawrence
My next little picolisp project...

Picolisp's built-in functions for scaled arithmetic are brilliant once you
understand how they work. Still, it would be great to get more scientific
functions without have to link an external math lib, and get 'real-time'
performance when needed as well.

http://wilsonminesco.com/16bitMathTables/ is a nice write-up (link found on
hacker news) of what you can do with fixed point, scaling and lookup
tables... Also has links to code to generate the tables.

I think the concepts and technique will transfer quite nicely to picolisp.
We'll see...

/Lindsay


Re: Evaluation confusion

2017-04-01 Thread Alexander Burger
On Sat, Apr 01, 2017 at 03:00:05PM +0200, Joh-Tob Schäg wrote:
> > So "abc" is less than "abd", and also less than 'abd' (internal symbol).
> 
> ​... as long as the symbols are not bound to other values.​

This has nothing to do with the values.

We are talking here about comparing *symbols*. If you pass the symbol's *values*
to '>' instead of the symbols themselves, you are doing the wrong test.

   : (setq "abc" 2  "abd" 1)
   -> 1

   : (> "abd" "abc")  # Wrong!
   -> NIL

   : (> '"abd" '"abc")  # Correct
   -> T

   : (> '"abd" 'abc)
   -> T

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Evaluation confusion

2017-04-01 Thread Christopher Howard
I expect my code so far will hardly impress you, but you can view it here at

http://git.savannah.nongnu.org/cgit/picolisp-nb.git/tree/text-adventure

When the game is (mostly) complete I'll probably fork it out to a
separate project.

On 04/01/2017 04:11 AM, Joh-Tob Schäg wrote:
> @Christopher Howard,
> 
> I would be interested in seeing the source code for your text adventure
> RPG as i am working on a MOO (MUD (Multi user Dungeon) Object Oriented).
> 
> You may not want to rebalance after every insert. But you can balance a
> 'idx by 'balance . You can always benchmark these combinations it your
> approach is faster the mailing list would be interested in your results
> and the source.
> 
> 2017-04-01 13:56 GMT+02:00 Christopher Howard
> >:
> 
> Ah, okay. Somehow in my mind I had reversed the meaning of "==" and "=".
> 
> @Joh-Tob: I am writing a text-adventure game, using a balanced binary
> tree as the primary data structure for managing game data. I wrote my
> own AA Tree implementation (with guidance from Wikipedia). I see the idx
> and balance functions in PicoLisp reference, but my concern is I don't
> see how you do with those an (efficient) self-balance after single
> inserts to an existing tree, nor how to do self-balancing deletes from
> an existing tree.
> 
> On 04/01/2017 01:46 AM, Alexander Burger wrote:
> > Hi Christopher,
> >
> >> : (aa-search '(("threshold" (("long-description" "You stand in front of
> >> a wooden door, reputed to be the home of one Dr. Theobold. The door has
> >> a small keyhole.") NIL NIL 1)) NIL NIL 1) "threshold")
> >> -> ("threshold" ...
> >
> >> However, if I run this command, I get a different result:
> >>
> >> : (aa-search (rooms) "threshold")
> >> ...
> >
> >
> > The problem is the '==' in
> >
> >>   (if (== Key (car (aa-kv Tree)))
> >
> >
> > You pass a transient symbol "threshold", and '==' checks for exactly 
> this
> > symbol. The scope of transient symbols is per file or REPL instance, so 
> you ran
> > the first test probably in the same instance, while "threshold" in the 
> second
> > was a new, different, symbol.
> >
> > Either use '=' for comparison, or use only internal symbols as keys.
> >
> > ♪♫ Alex
> >
> 
> --
> https://qlfiles.net
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de
> ?subject=Unsubscribe
> 
> 

-- 
https://qlfiles.net
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Evaluation confusion

2017-04-01 Thread Alexander Burger
On Sat, Apr 01, 2017 at 04:04:32AM -0800, Christopher Howard wrote:
> Additional question: Should I expect any weird behavior with transient
> symbols and the '< or '> operators? E.g. (assuming the symbols have not
> been assigned strange values) is it true that "abc" will always be less
> than "abd" regardless of the scope of the transient symbols?

Yes. '<' and '>' are comparison functions just like '=' and '>='. They compare
numbers (their numeric values), symbols (their names) and (recursively) cells
and lists.

'==' and 'n==' are of a differend category, as they only look at the pointer,
checking for identity.

So "abc" is less than "abd", and also less than 'abd' (internal symbol).

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Evaluation confusion

2017-04-01 Thread Alexander Burger
On Sat, Apr 01, 2017 at 03:56:08AM -0800, Christopher Howard wrote:
> tree as the primary data structure for managing game data. I wrote my
> own AA Tree implementation (with guidance from Wikipedia). I see the idx
> and balance functions in PicoLisp reference, but my concern is I don't
> see how you do with those an (efficient) self-balance after single
> inserts to an existing tree, nor how to do self-balancing deletes from
> an existing tree.

Right, 'idx' trees don't balance after every operation. Still, this is often not
a problem, and might be even more efficient than balancing algorithms if the
data are not too un-random.

As Joh-Tob said, you could also consider to 'balance' the list explicitly from
time to time.

A third option (which I would probably choose for such a game) is using the
database. Here you have B-Trees, which are always balanced. And other advantages
like persistence and multi-user synchronization.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Evaluation confusion

2017-04-01 Thread Joh-Tob Schäg
No that is not true.
: (setq "ABC" 3)
-> 3
: "ABC"
-> 3
: (setq "ABD" 2)
-> 2
: (> "ABC" "ABD")
-> T
But it is always true if the transient symbols do not refer to themselves.
See Comparing in the docs.

> Numbers are comparable by their numeric value, strings by their name, and
> lists recursively by their elements (if the CAR's are equal, their CDR's
> are
> compared). For differing types, the following rule applies: Numbers are
> less
> than symbols, and symbols are less than lists.
>


2017-04-01 14:04 GMT+02:00 Christopher Howard <
christopher.how...@qlfiles.net>:

> Additional question: Should I expect any weird behavior with transient
> symbols and the '< or '> operators? E.g. (assuming the symbols have not
> been assigned strange values) is it true that "abc" will always be less
> than "abd" regardless of the scope of the transient symbols?
>
> On 04/01/2017 03:56 AM, Christopher Howard wrote:
> > Ah, okay. Somehow in my mind I had reversed the meaning of "==" and "=".
> >
> > @Joh-Tob: I am writing a text-adventure game, using a balanced binary
> > tree as the primary data structure for managing game data. I wrote my
> > own AA Tree implementation (with guidance from Wikipedia). I see the idx
> > and balance functions in PicoLisp reference, but my concern is I don't
> > see how you do with those an (efficient) self-balance after single
> > inserts to an existing tree, nor how to do self-balancing deletes from
> > an existing tree.
> >
> > On 04/01/2017 01:46 AM, Alexander Burger wrote:
> >> Hi Christopher,
> >>
> >>> : (aa-search '(("threshold" (("long-description" "You stand in front of
> >>> a wooden door, reputed to be the home of one Dr. Theobold. The door has
> >>> a small keyhole.") NIL NIL 1)) NIL NIL 1) "threshold")
> >>> -> ("threshold" ...
> >>
> >>> However, if I run this command, I get a different result:
> >>>
> >>> : (aa-search (rooms) "threshold")
> >>> ...
> >>
> >>
> >> The problem is the '==' in
> >>
> >>>   (if (== Key (car (aa-kv Tree)))
> >>
> >>
> >> You pass a transient symbol "threshold", and '==' checks for exactly
> this
> >> symbol. The scope of transient symbols is per file or REPL instance, so
> you ran
> >> the first test probably in the same instance, while "threshold" in the
> second
> >> was a new, different, symbol.
> >>
> >> Either use '=' for comparison, or use only internal symbols as keys.
> >>
> >> ♪♫ Alex
> >>
> >
>
> --
> https://qlfiles.net
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Evaluation confusion

2017-04-01 Thread Christopher Howard
Additional question: Should I expect any weird behavior with transient
symbols and the '< or '> operators? E.g. (assuming the symbols have not
been assigned strange values) is it true that "abc" will always be less
than "abd" regardless of the scope of the transient symbols?

On 04/01/2017 03:56 AM, Christopher Howard wrote:
> Ah, okay. Somehow in my mind I had reversed the meaning of "==" and "=".
> 
> @Joh-Tob: I am writing a text-adventure game, using a balanced binary
> tree as the primary data structure for managing game data. I wrote my
> own AA Tree implementation (with guidance from Wikipedia). I see the idx
> and balance functions in PicoLisp reference, but my concern is I don't
> see how you do with those an (efficient) self-balance after single
> inserts to an existing tree, nor how to do self-balancing deletes from
> an existing tree.
> 
> On 04/01/2017 01:46 AM, Alexander Burger wrote:
>> Hi Christopher,
>>
>>> : (aa-search '(("threshold" (("long-description" "You stand in front of
>>> a wooden door, reputed to be the home of one Dr. Theobold. The door has
>>> a small keyhole.") NIL NIL 1)) NIL NIL 1) "threshold")
>>> -> ("threshold" ...
>>
>>> However, if I run this command, I get a different result:
>>>
>>> : (aa-search (rooms) "threshold")
>>> ...
>>
>>
>> The problem is the '==' in
>>
>>>   (if (== Key (car (aa-kv Tree)))
>>
>>
>> You pass a transient symbol "threshold", and '==' checks for exactly this
>> symbol. The scope of transient symbols is per file or REPL instance, so you 
>> ran
>> the first test probably in the same instance, while "threshold" in the second
>> was a new, different, symbol.
>>
>> Either use '=' for comparison, or use only internal symbols as keys.
>>
>> ♪♫ Alex
>>
> 

-- 
https://qlfiles.net
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Evaluation confusion

2017-04-01 Thread Christopher Howard
Ah, okay. Somehow in my mind I had reversed the meaning of "==" and "=".

@Joh-Tob: I am writing a text-adventure game, using a balanced binary
tree as the primary data structure for managing game data. I wrote my
own AA Tree implementation (with guidance from Wikipedia). I see the idx
and balance functions in PicoLisp reference, but my concern is I don't
see how you do with those an (efficient) self-balance after single
inserts to an existing tree, nor how to do self-balancing deletes from
an existing tree.

On 04/01/2017 01:46 AM, Alexander Burger wrote:
> Hi Christopher,
> 
>> : (aa-search '(("threshold" (("long-description" "You stand in front of
>> a wooden door, reputed to be the home of one Dr. Theobold. The door has
>> a small keyhole.") NIL NIL 1)) NIL NIL 1) "threshold")
>> -> ("threshold" ...
> 
>> However, if I run this command, I get a different result:
>>
>> : (aa-search (rooms) "threshold")
>> ...
> 
> 
> The problem is the '==' in
> 
>>   (if (== Key (car (aa-kv Tree)))
> 
> 
> You pass a transient symbol "threshold", and '==' checks for exactly this
> symbol. The scope of transient symbols is per file or REPL instance, so you 
> ran
> the first test probably in the same instance, while "threshold" in the second
> was a new, different, symbol.
> 
> Either use '=' for comparison, or use only internal symbols as keys.
> 
> ♪♫ Alex
> 

-- 
https://qlfiles.net
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Evaluation confusion

2017-04-01 Thread Alexander Burger
Hi Christopher,

> : (aa-search '(("threshold" (("long-description" "You stand in front of
> a wooden door, reputed to be the home of one Dr. Theobold. The door has
> a small keyhole.") NIL NIL 1)) NIL NIL 1) "threshold")
> -> ("threshold" ...

> However, if I run this command, I get a different result:
> 
> : (aa-search (rooms) "threshold")
> ...


The problem is the '==' in

>   (if (== Key (car (aa-kv Tree)))


You pass a transient symbol "threshold", and '==' checks for exactly this
symbol. The scope of transient symbols is per file or REPL instance, so you ran
the first test probably in the same instance, while "threshold" in the second
was a new, different, symbol.

Either use '=' for comparison, or use only internal symbols as keys.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Evaluation confusion

2017-04-01 Thread Joh-Tob Schäg
You seem to want to implement a search binary tree.
Take a look at 'idx it already does that for you.
A possible source of the trouble could be related to 'cadr in '(pp 'rooms).

Also what project are you working on?
(Just curious)

2017-04-01 7:46 GMT+02:00 Christopher Howard :

> Hi list, I'm a little confused at a bug in my code.
>
> I have this procedure 'rooms that returns some data:
>
> : (rooms)
> -> (("threshold" (("long-description" "You stand in front of a wooden
> door, reputed to be the home of one Dr. Theobold. The door has a small
> keyhole.") NIL NIL 1)) NIL NIL 1)
>
> Now, if I run a command (another aa-search) on that data (copy and
> pasted) I get the result I expect:
>
> : (aa-search '(("threshold" (("long-description" "You stand in front of
> a wooden door, reputed to be the home of one Dr. Theobold. The door has
> a small keyhole.") NIL NIL 1)) NIL NIL 1) "threshold")
> -> ("threshold" (("long-description" "You stand in front of a wooden
> door, reputed to be the home of one Dr. Theobold. The door has a small
> keyhole.") NIL NIL 1))
>
> However, if I run this command, I get a different result:
>
> : (aa-search (rooms) "threshold")
> -> NIL
>
> Q: Should not the results be the same?
>
> Here are definitions of the various functions:
>
> : (pp 'rooms)
> (de rooms NIL
>(cadr (aa-search World "rooms")) )
>
> : (pp 'aa-search)
> (de aa-search (Tree Key)
>(unless (not Tree)
>   (if (== Key (car (aa-kv Tree)))
>  (aa-kv Tree)
>  (if (< Key (car (aa-kv Tree)))
> (aa-search (aa-left Tree) Key)
> (aa-search (aa-right Tree) Key) ) ) ) )
> -> aa-search
>
>
> --
> https://qlfiles.net
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>