<beneroth>
Regenaxer, do you have some time? pilog questions, but not related to DB
<Regenaxer>
A little later perhaps" I'm on the road atm
<Regenaxer>
s/"/?
<beneroth>
ok
<beneroth>
np
<beneroth>
maybe it's even a topic for pilcon :)
<Regenaxer>
ok, back
<Regenaxer>
Perhaps it is a topic, or perhaps I don't know the answer
Seteeri has quit [Read error: Connection reset by peer]
Seteeri has joined #picolisp
<beneroth>
I think topics are allowed even when you don't know the answer ;-)
<Regenaxer>
sure
<Regenaxer>
What are the pilog questions?
<beneroth>
how to test for non-NIL?
<beneroth>
(of a pilog variable)
<beneroth>
(not (nil @X)) ?
<Regenaxer>
yes
<Regenaxer>
Not sure about a better way
<Regenaxer>
eg (^ @ (-> @X))
<Regenaxer>
(^ ) is faster probably
<Regenaxer>
Testing for NIL is not normal, as a variable is always unified with something
<beneroth>
it can be unified with nil in my use case, because I do (or ((foo @X)) ((bar @X)) (nil @X))
<beneroth>
so @X defaults to NIL if the other predicates fail
<beneroth>
ok to do so?
<Regenaxer>
I think there must be a more Prolog-like way
<Regenaxer>
But such cases occur
<Regenaxer>
when data came from Lisp (or DB)
<beneroth>
I believe this is such a one, because I practically want to try multiple things
<beneroth>
matching data
<beneroth>
yep exactly
<beneroth>
one of the 'foo predicates is a pilog (db)
<beneroth>
testing if @X is string would be (be str (@X)
<beneroth>
(^ @ (str? (-> @X))) ) ?
<Regenaxer>
yes
<Regenaxer>
Is the above correct?
<Regenaxer>
(or ((foo @X)) ((bar @X)) (nil @X)) ?
<Regenaxer>
not ((nil .. ?
<beneroth>
how do you mean
<Regenaxer>
The parens
<beneroth>
foo, bar and nil exclude each other
<beneroth>
ah I think one is missing at the end
<beneroth>
well
<beneroth>
I tried (or (foo @X) (bar @X) (nil @X)) first
<Regenaxer>
(or ((foo @X)) ((bar @X)) ((nil @X)))
<beneroth>
that doesn't work
<Regenaxer>
yes
<beneroth>
I think the double parens are needed, because or takes lists
<Regenaxer>
'or' needs lists of clauses
<beneroth>
yep
<beneroth>
thx
<Regenaxer>
'or' is like three separate rules here
<beneroth>
I want the 'or' to be true as long as one of the three rules is true
<Regenaxer>
ok
<beneroth>
order has no affect, right?
<beneroth>
not like picolisp or
<Regenaxer>
It is different, as it triggers backtracking
<Regenaxer>
so the clauses may be evaluated more than once
<Regenaxer>
i.e. if bar fails, foo is retried
<beneroth>
yep
<beneroth>
so I have to ensure somehow that not all three predicates in or can be true, or I get multiple results
<beneroth>
right?
<Regenaxer>
Yes, or use the cut operator
<Regenaxer>
(or ((foo @X)) T ((bar @X)) ((nil @X)))
<Regenaxer>
Will not backtrace back to foo
<beneroth>
aah
<beneroth>
why do I put the T after the foo clause, and not after bar ?
* beneroth
hasn't really prolog knowledge
<Regenaxer>
I think it is wrong above
<Regenaxer>
nees something like ((bar) T)
<Regenaxer>
or ((bar) T (fail))
<Regenaxer>
:)
<Regenaxer>
I *hate* Prolog
<Regenaxer>
Anyway, the T on the 'or' level is wrong
<beneroth>
ok
<Regenaxer>
I should re-read about Prolog
<beneroth>
so I need to learn about the prolog cut operator to optimize my pilog queries
<Regenaxer>
been many years
<beneroth>
you forgot more about it than I ever knew ;-)
<Regenaxer>
hmm
<Regenaxer>
The cut is critical sometimes
<Regenaxer>
not so much for performance
<Regenaxer>
but gives difficult results
<beneroth>
well without cut it could end up in endless loops or too many results?
<Regenaxer>
in some cases, yes
<beneroth>
I'm confident with pilog database queries (select/3 etc). but now I've got the idea to use pilog to do data import / data fusion, e.g. deciding what values to keep after merging input with the current data in the database even when the input is incomplete or conflicting with the db
<Regenaxer>
sounds interesting
<beneroth>
so now I want to learn non-db pilog in a few hours
<beneroth>
what still confuses me
<Regenaxer>
:)
<beneroth>
the pilog environment, so to say, is the facts/rules stored in T properties of global symbols, right?
<Regenaxer>
right, DB uses only a subset usually
<beneroth>
T
<Regenaxer>
yes, typically global
<Regenaxer>
they are stored in the 'T' property
<Regenaxer>
(show 'append) for example
<beneroth>
could be fully local by defining all facts/rules as clauses into a pilog query before passing it to prove etc?
<beneroth>
yeah, I now use a picolisp namespace for this globales to avoid potential symbol name clashing
<Regenaxer>
local means local symbols, not value bindings
<beneroth>
T
<Regenaxer>
the values are not used in Pilog
<beneroth>
T
<beneroth>
so I could have multiple pilog environments by having (let'ed) symbols for all rule names?
<Regenaxer>
Not 'let'ed, as this handles only values
<beneroth>
ah
<beneroth>
so namespacing
<Regenaxer>
yes
<Regenaxer>
or dynamically set and reset the T property, but that is tedious
<Regenaxer>
concerning PilCon, I could talk a little about data structures
<Regenaxer>
some basic stuff
<beneroth>
what about never calling (be) or (clause) but building a list with all these statements as picolisp query? before handing it to (goal) ?
<beneroth>
ah we already have topics for pilcon? ok
<Regenaxer>
this is fine
<Regenaxer>
'be' is just a frontend te 'assertz'
<beneroth>
this is fine = would this result in the pilog environment being transient to the pilog call, not setting T on any global variables?
<Regenaxer>
What is "this" here?
<beneroth>
yeah I know I should not ask you to explain the internals of the pilog query data structure ;-)
<Regenaxer>
assertz?
<Regenaxer>
why not? :)
<Regenaxer>
it is simple, a list of clauses stored in 'T'
<beneroth>
yeah that part I see
<beneroth>
the stuff (goal) creates
<Regenaxer>
ah
<beneroth>
hihi
<Regenaxer>
right, thats involved
<Regenaxer>
the bindings are assoc lists
<Regenaxer>
lists of such lists for the backtracking levels
<Regenaxer>
So a query does a lot of consing
<beneroth>
T
<Regenaxer>
What do you think if I don't do a screen share today
<beneroth>
so picolisp namespacing is the way to "isolate" a pilog environment, yes?
<Regenaxer>
and give R/O ssh access?
<Regenaxer>
yes
<Regenaxer>
the symbols
<beneroth>
understood! thx
<Regenaxer>
with their properties
<Regenaxer>
:)
<beneroth>
one could save them in pilDB. but there is a conflict about the use of the T property ;-)
<beneroth>
so better e.g. save rules explicitly, and build an pilog environment by calling (be) etc.
<Regenaxer>
why a conflict?
<beneroth>
T property means object is deleted in pilDB ?
<beneroth>
ofc doesn't have to save as object, but as external symbols directly
<beneroth>
that would work,y eah
<Regenaxer>
yes, in E/R context only
<beneroth>
T
<beneroth>
not on key-value level
<Regenaxer>
but using assetz is more clear
<Regenaxer>
'be' is not good as it does not eval
<beneroth>
currently I use (be) and (clause)
<beneroth>
(be) for hardcoded pilog predicates in the loaded source file
<Regenaxer>
'clause' is fine too
<Regenaxer>
ok
<beneroth>
(clause) for dynamically created rules through picolisp function calls
<beneroth>
and I wipe a list of all rule-names to reset the environment
<beneroth>
and the environment (symbols) are in a namespace
<beneroth>
that sounds ok, yeah?
<Regenaxer>
yes, good
<beneroth>
:)
<beneroth>
thanks
<Regenaxer>
:)
<beneroth>
basic use case working now
<beneroth>
will now try to implement complex rules
<Regenaxer>
great
<beneroth>
let's see how far I can get without understanding cut operator ;-)
<beneroth>
likely I've to ask some more questions, but lets see how far I can go myself :)
<Regenaxer>
ok, I should study the Prolog way of thinking again
<beneroth>
thank you very much!
<beneroth>
yeah I think I've here a use cause where it is perfect
<beneroth>
use case
<beneroth>
alternative would be a very big list of if statements, with repeated calls through them in some cases, and high probability that some edge cases are not handled
<Regenaxer>
As I said last time, the idea of persistent Pilog was the initial trigger for the Pil DB
<beneroth>
really?
<Regenaxer>
but I never used it that way
<beneroth>
so you worked with pilog before PilDB ?
<beneroth>
woooow
<beneroth>
yeah I see
<beneroth>
nice idea
<Regenaxer>
yes, it was already in 8kLisp
<Regenaxer>
Pilog
<Regenaxer>
Back to PilCon: What do you think if I don't do a screen share today, and open a read-only ssh?
<Regenaxer>
I don't want to use the desktop pc
<beneroth>
ah so everyone can connect to that ssh? or what do you mean?
<Regenaxer>
in the dark cold cellar today ;)
<Regenaxer>
yes
<beneroth>
I don't understand what you mean by "open read-only ssh" ?
<Regenaxer>
I do that often when working with Josef
<beneroth>
some probably don't have linux or capable ssh clients.. but sure, give it a try
<Regenaxer>
or the kids
<beneroth>
oh
<beneroth>
do it, let's see how it works
<Regenaxer>
Could be PuTTY
<beneroth>
T
<Regenaxer>
ok
<beneroth>
or MobaXTerm
<Regenaxer>
let's try
<beneroth>
MobaXTerm is a better putty, everything in a single tool
<beneroth>
yeah sure
<Regenaxer>
most have Windows probably
<Regenaxer>
not sure
<Regenaxer>
I just start and try
<Regenaxer>
Screen share from Jitsi/Android does not work with older desktop browsers yet
<beneroth>
wat? so you can share, and other mobile clients can receive it, but some browsers cannot receive the stream?
<Regenaxer>
yes
<beneroth>
I'll probably join by mobile today
<beneroth>
weird
<Regenaxer>
they show a blaack screen
<beneroth>
stream should be stream, independent of source
<beneroth>
so different encoding or so
<Regenaxer>
Here on Debian Chromium works fine, but not Firefox
<beneroth>
weird
<beneroth>
sounds like codes
<beneroth>
codecs
<Regenaxer>
yes, strange
<Regenaxer>
handling of screens
<beneroth>
would make sense that android and chrome use similiar codecs
<beneroth>
both google
<Regenaxer>
maybe in the future
<beneroth>
then on jitsi level the stream is just a container
<beneroth>
yeah
<beneroth>
well firefox will die.. not for a while, but eventually :(
<Regenaxer>
So encoding for video and screen is different
<Regenaxer>
yes :(
<beneroth>
@streaming: I assume, I have no knowledge of how it is done in detail
<Regenaxer>
me neither, not at all
<beneroth>
I think I have to learn about cut
<beneroth>
I manage already to build infinite loops :D
<Regenaxer>
hehe
<beneroth>
afk, time to listen some youtube and do some chores ;-)
<Regenaxer>
youtube is a good idea, did not try
<Regenaxer>
will do soon
m_mans has joined #picolisp
<m_mans>
Hi all
<Regenaxer>
Cheers m_mans!
<Regenaxer>
I'll probably not see here during PilCon
m_mans has quit [Ping timeout: 256 seconds]
orivej has quit [Ping timeout: 256 seconds]
Seteeri has quit [Remote host closed the connection]