rob_w has quit [Read error: Connection reset by peer]
karswell has joined #picolisp
orivej has quit [Ping timeout: 265 seconds]
_whitelogger has joined #picolisp
rob_w has joined #picolisp
alexshendi_ has quit [Ping timeout: 240 seconds]
freeemint_ has joined #picolisp
karswell_ has joined #picolisp
karswell has quit [Ping timeout: 240 seconds]
<freeemint_>
He is there a better way to do a "weigthed joint" (a joint which has an attribute associated with relation) than introducing a new class with two +Joints and the weights?
<Regenaxer>
What is "attribute associated with relation"?
<Regenaxer>
You mean a +Bag?
<Regenaxer>
A +Joint is always between objects
<cess11_>
Besides '+Bag, '+UB and '+Aux might be useful.
<freeemint_>
yeah i wanted a bag
<Regenaxer>
There is perhaps a problem with a +Joint as bag element
<Regenaxer>
iirc the relation cannot be automatically maintained in some cases
<freeemint_>
which are those cases?
<Regenaxer>
not sure. There is not enough info to create the opposite bag if a joint is added
<Regenaxer>
What model do you have in mind?
<Regenaxer>
You can try anyway, I'm not sure atm
<freeemint_>
+ClassA has an +Number of +ClassB and +ClassB is refered by +ClassA
<Regenaxer>
So this is just (+List +Joint) <-> (+Joint) ?
<freeemint_>
No
<freeemint_>
+ClassA has +Number of +ClassB like A1 has 3 B1 and has 4 B2 and 5B5
<cess11_>
What does your 'rel expressions look like?
<Regenaxer>
You can try with a bag, just not expect such a bag to be built implicitly on the opposing side, because then the count is not known
<freeemint_>
Is is it safe if B asks A to add B to his joint? (B being without bag and A with bag)
<Regenaxer>
You can also use (+Ref +Link) which is equivalent to a +Joint
<freeemint_>
How is that equivalent?
<Regenaxer>
Just play around!
<Regenaxer>
It is
<Regenaxer>
I use +List +Joint for small amounts (< 100)
<Regenaxer>
A +Ref +Link is like a +Joint, bi-directional, right?
<Regenaxer>
Just a little slower, but can handle more data
<Regenaxer>
eg. an +Article would have a (+Ref +Link) to the supplier
<Regenaxer>
you find all articles of that supplier via the index
<Regenaxer>
A +List +Joint in the supplier would be huge
<cess11_>
'bench works fine for measuring performance in the DB-context too, one can set up a couple of alternative schemas or relation types and test some more or less common action patterns.
<freeemint_>
Is the problem the total space or that the complete +Joint has to be loaded if it is processed?
<Regenaxer>
yes
<freeemint_>
*it the object
<Regenaxer>
The supplier may have one million articles
<Regenaxer>
the supplier object would be *huge*
<freeemint_>
ah ...
<Regenaxer>
Each access to that supplier needs to load it into memory
<freeemint_>
I thought so
<Regenaxer>
This applies to all +List relations, not just +Joints
<Regenaxer>
Though you can keep it out of the object with +Swap
<freeemint_>
When you put it into an index you only have to load it up when you search in it
<Regenaxer>
I do that with some long lists or strings
<Regenaxer>
eg. the hashed password
<Regenaxer>
exactly
<Regenaxer>
and then only a part of the index tree is accessed
<Regenaxer>
branch
<freeemint_>
also log(n) vs O(N)
<Regenaxer>
yes
<cess11_>
A good way to get acquainted with these things and the basic pilog is to grab some open data CSV that looks fun and parse it into fairly simple objects and work on those.
<Regenaxer>
T
<freeemint_>
how does +Hook behave?
<Regenaxer>
It is a DB root
<Regenaxer>
base of indexes
<freeemint_>
Is it loaded it to ram with the object
<Regenaxer>
Default is NIL which means the *DB object
<Regenaxer>
It is loaded when such an index is accessed
<freeemint_>
how is it size. is the whole db loaded or just the relvant branches?
<freeemint_>
*sub db
<Regenaxer>
The whole db is never loaded
<Regenaxer>
I was talking of the *DB symbol
<Regenaxer>
which is {1}
<Regenaxer>
it points to the roots of the indexes
<Regenaxer>
and a hook specifies another database root
<Regenaxer>
a sub-db
<freeemint_>
ok (rel supplier (+Ref +Link vs (rel supplier(+Hool +Link)
<Regenaxer>
You may have local unique indexes there
<Regenaxer>
no
<Regenaxer>
The +Hook is additional
<freeemint_>
But that is the doc example
<freeemint_>
(rel sup (+Hook +Link) (+Sup))
<Regenaxer>
yes
<freeemint_>
why no then?
<Regenaxer>
So the value of 'sup' is a hook for other relations
<Regenaxer>
(+Ref +Link vs (rel supplier(+Hool +Link)
<Regenaxer>
+Ref is not "versus" +Hook
<Regenaxer>
you may have both
<Regenaxer>
(rel pro (+Hook +Dep +Ref +Link) # Project
<Regenaxer>
(rel mod (+List +Joint) boq (+mod)) # Modules
<Regenaxer>
So 'nm' is also in a private index
<freeemint_>
i do not get that yet
<Regenaxer>
no problem, then you don't need hooks yet
<Regenaxer>
Just keep all in the global root *DB object
<freeemint_>
maybe i need that still ... i will think a bit
<Regenaxer>
good
orivej has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
<freeemint_>
(class +Thing +Entity)
<freeemint_>
(rel name (+Idx +String))
<freeemint_>
(rel store (+List +Num))
<freeemint_>
(rel store2 (+Swap +List +Num))
<freeemint_>
(dm T (Name Store Swap) (:= name Name) (:= store Store) (:= store2 Swap))
<Regenaxer>
+Num -> +Number
<freeemint_>
ahh
<freeemint_>
Is there a way to disable printing numbers and long list (complettly) in console
<Regenaxer>
(less Lst) ?
<Regenaxer>
Does not disable anything though
<Regenaxer>
but I use it if I expect long output
<Regenaxer>
(more (foo) less)
<Regenaxer>
nonsense the last one
<Regenaxer>
(less (foo))
<Regenaxer>
Has anyone used Server-Sent events?
<Regenaxer>
I don't get the 'onmessage' event
<freeemint_>
afk
<cess11_>
freeemint_: Yes, write your own functions where you have them return something useful rather than just pass on their data to stdout.
<cess11_>
I often use expressions like '(length (setq *Stuffs (make (in Source ... ] or similar.
<cess11_>
For example you could set up a class that keeps the long list in a field and then use a method that only shows a part of it.
<cess11_>
It depends on the situation what fits, sometimes 'let or closure-like use of local variables is enough, sometimes one wants persistence, and so on.
alexshendi_ has joined #picolisp
<Regenaxer>
As I said, I'm trying to utilize Server-Sent Events. It works, but only *once*
<Regenaxer>
Anybody here?
<Regenaxer>
I'm not sure about the message format. Found PHP examples, but I don't know PHP
<Regenaxer>
What exactly does header() do? Does it send the header line immediately to the client, or is it put into the output buffer and sent *every* time in the loop?
<Regenaxer>
But this is in a loop, and does it only once
<Regenaxer>
Perhaps the JS handler needs a return value?
<Regenaxer>
My primary question was whether I need
<Regenaxer>
(while (line T)
<Regenaxer>
(httpHead "text/event-stream" 0)
<Regenaxer>
(ht:Out *Chunked
<Regenaxer>
(prinl "data: " @ "\r\n\r") )
<Regenaxer>
or whether this is enough:
<Regenaxer>
(httpHead "text/event-stream" 0)
<Regenaxer>
(while (line T)
<Regenaxer>
(ht:Out *Chunked
<Regenaxer>
(prinl "data: " @ "\r\n\r") )
<Regenaxer>
ie. send the header only once, since this is a permanent connection
<Regenaxer>
Anyway, I tried both and get the same result (only 1 event)
<freeemint_>
i got (class +SwapTest +Entity) (rel name (+Idx +String)) I can find it with (show '{3}) and it has name "veryfast" (i commited correctly) but not via (select +SwapTest name "veryfast")
<freeemint_>
(also (select +SwapTest) is doing nothing
<Regenaxer>
Does (scan '(name . +SwapTest)) dump a correct tree?
<freeemint_>
no it is nil too
<freeemint_>
using latest tarball with (== 64 64)
<Regenaxer>
So you did not commit correctly
<Regenaxer>
(new! '(+SwapTest) 'name "foo")
<Regenaxer>
or
<freeemint_>
I did (new T
<Regenaxer>
(put!> '{3} 'name ...
<Regenaxer>
ok, and then (commit) ?
<freeemint_>
now it works
<Regenaxer>
ok
<freeemint_>
beforehand i did write my own contructor
<freeemint_>
could that cause trouble?
<Regenaxer>
perhaps
<Regenaxer>
you can always cause trouble ;)
<freeemint_>
it also has (rel fast (+Swap +List +Number)) when i now do (new! '(+SwapTest) 'name "foo" 'fast (1 2 3)) is fails commeting has> --Bad Extra
<freeemint_>
pass it a list instead?
<freeemint_>
or in other words let me rtfm first
<Regenaxer>
hmm, "Bad Extra" refers to a prefix class
<Regenaxer>
try to find where exactly it went wrong
<Regenaxer>
look at the env in the error breakpoint
<Regenaxer>
or do (bt)
<freeemint_>
in extra X is NIL
<Regenaxer>
Which method is being executed?
<freeemint_>
extra
<Regenaxer>
no
<Regenaxer>
extra is the function
<Regenaxer>
it tries to go to the same method in the extra class
<Regenaxer>
so we need the class and the method
<freeemint_>
Maybe i am just doing it wrong
<Regenaxer>
"Bad Extra" means that there is no extra
<Regenaxer>
yep
<Regenaxer>
The method is not found in the hierarchy
<Regenaxer>
afp
<freeemint_>
If i had a +DBEntity with N slots how i fill them?
<freeemint_>
ok
<freeemint_>
quoting helps
judi has joined #picolisp
<judi>
Hello
<judi>
I don't understand why there is a Prolog in PicoLisp?
<freeemint_>
Regenaxer , the sole creator of Picolisp found it helpfull in his daily work
<freeemint_>
judi what puzzles you?
<judi>
why we need another language in PicoLisp system beside Lisp
<freeemint_>
Very simply, prolog allows you to write down some search task based predefined rules very simply and direct
<tankf33der>
judi: is it the only problem you have around picolisp? :)
<judi>
@tankf33der, I'm touching the surface now
<tankf33der>
ok
<judi>
asking about the surface of the iceberg, but no yet the beneath of the iceberg
<freeemint_>
judi: Do you want an example what you can do easily with prolog?
<judi>
I'd love to
<freeemint_>
Do you know Einsteins Puzzle with the houses and cigaretts?