freemint has quit [Remote host closed the connection]
_whitelogger has joined #picolisp
_whitelogger has joined #picolisp
orivej has joined #picolisp
_whitelogger has joined #picolisp
ubLIX has joined #picolisp
ubLIX has quit [Ping timeout: 246 seconds]
ubLIX has joined #picolisp
ubLIX has quit [Quit: ubLIX]
freemint has joined #picolisp
<freemint>
Regenaxer, i came across something dislike in frac.l f* only takes two arguements, not that i have that out of the way can you tell me what ("Pop" "Cond" "Re" "Mu" "Se") stand for in 'gen in simul.l?
<Regenaxer>
Hi freemint! Right, the f-funs could easily be extended to a variable number of args
<Regenaxer>
Would be more useful and consistent with integer arithmetics
<Regenaxer>
"Pop" is population, "Cond" is termination condition, "Re" is recombination, "Mu" is mutation and "Se" is selection (all functions)
<Regenaxer>
Examples are in misc/trip.l and "Evolutionary algorithm" in rosettaCode
<beneroth>
hi Regenaxer :)
<beneroth>
hi freemint :)
<Regenaxer>
Hi beneroth!
freemint has quit [Ping timeout: 240 seconds]
xkapastel has joined #picolisp
freemint has joined #picolisp
<freemint>
sorry beneroth Regenaxer was a sleep
<Regenaxer>
No hurry
<freemint>
Why can't i store stuff in the 0 property of a symbol?
<Regenaxer>
You can, with 'set', as it is not a true property
<Regenaxer>
Or do you mean '0' as a real propery?
<freemint>
what is a "real propoerty"?
<Regenaxer>
Something in the property list, as opposed to the value
<Regenaxer>
'0' refers to the value in the 'get' functions
<freemint>
Ok why tell the is b = (get 'b 0) true=
<Regenaxer>
It is not
<Regenaxer>
What do you mean?
<freemint>
: (put 'b 0 12)
<freemint>
-> 12
<freemint>
: (setq b 13)
<freemint>
: b
<freemint>
-> 12
<freemint>
-> 13
<Regenaxer>
"b = (get 'b 0) true=" ?
<freemint>
: (get 'b 0)
<freemint>
-> 13
<Regenaxer>
yes
<Regenaxer>
as I said
<Regenaxer>
'0' refers to the value in the 'get' functions
<Regenaxer>
and 'put' of course
<Regenaxer>
For "real" properties numeric keys are not recommended
<Regenaxer>
though they work on pil64
<Regenaxer>
(pointer equality)
<Regenaxer>
So numbers >0 refer to list elements
<Regenaxer>
and 0 to the val of a symbol
<Regenaxer>
I often have things like (; Obj foo bar -1 mumble 0 huck)
<Regenaxer>
Well, *such* long not so often ;)
<Regenaxer>
but 3 or 4 hops
<Regenaxer>
Try to write the above with plain binary 'get'!
<Regenaxer>
It is: (get (val (get (cdr (get (get Obj 'foo) 'bar)) 'mumble)) 'huck)
<Regenaxer>
☺
<freemint>
didn't cache use putting thins in properties?
<Regenaxer>
?
<freemint>
There is 'cache
<Regenaxer>
The function? No, no properties involved
<Regenaxer>
uses 'idx' iirc
<freemint>
ahh
<Regenaxer>
yes, and 'hash' to randomize
razzy has joined #picolisp
<freemint>
I ok it did no behave as i expect
<freemint>
Regenaxer can you explain in plain words what 'gen does in simul.l
<razzy>
freemint: generate text "string" that fit the *target
* razzy
spend some time in it
<Regenaxer>
razzy, how did you get that idea?
<Regenaxer>
It is a genetic algorithm
<freemint>
My questions are, is the Population size constant?
<Regenaxer>
A genetic algorithm is rather simple
<Regenaxer>
yes, constant here, but that could be changed
<freemint>
Is every Pop member mutated every "round"?
<Regenaxer>
I dont think so, would not make sense
<beneroth>
it's basic genetic algorithm that you DON'T mutate the whole pop each round...
<Regenaxer>
Depends on the Mu function
<Regenaxer>
beneroth, yep
<beneroth>
else you have no selection, just randomizing... duuuudeee
<Regenaxer>
freemint, did you look at the examples?
<beneroth>
maybe read about genetic algorithms first...
<Regenaxer>
T
<freemint>
good point, where is it? and why is the example not linked in a comment
<beneroth>
it looks like the lack of understanding seems to be with the concepts, not the code
<beneroth>
Wikipedia?
<beneroth>
DuckDuckGo ?
<beneroth>
AI Text book?
<Regenaxer>
Or just a biology textbook? ;)
<beneroth>
T
<freemint>
beneroth, i find it arrogant that you assume that i do not understand genetic algorithms when i just fail to parse regenaxers implementation
<beneroth>
I assume this from "<freemint> Is every Pop member mutated every "round"?"
<Regenaxer>
'gen' is very short. More interesting are the use cases I think
<beneroth>
I reserve the right to be arrogant. I don't claim otherwise.
<beneroth>
you should read some Dijkstra
<freemint>
This is what a got from the code, i found it stupid but i asked to check my intuition about what the code does.
<beneroth>
(not for genetic algos, I think, but for his wonderful arrogance.)
<beneroth>
I just cannot grasp how you guys always first search the error at other people and not yourself...
<Regenaxer>
Well, in the code of 'gen' this cannot be seen. "Mu" is just called as a black box
<beneroth>
though surely it's a good skill in normal society :(
<freemint>
Regenaxer, is there some documentation or examaple of the use of gen
<Regenaxer>
Eg. in the rosetta task the percentage is 10
<Regenaxer>
'((A) # Mutation function
<Regenaxer>
(mapcar
<Regenaxer>
'((C)
<Regenaxer>
(if (=0 (rand 0 10)) # With a proability of 10%
<Regenaxer>
(randChar) # generate a new char, otherwise
<freemint>
beneroth, i did not blame Regenaxer "that code is stupid" when i got it wrong. I tried to verify my assumption how it works.
<Regenaxer>
(=0 (rand 0 10)) is actually less than 10%
<beneroth>
well if you understand GA, then you should know that the question "Is every Pop member mutated every "round"?" is either bullshit or you are seriously doubting that the code is actually implementing GA
<beneroth>
don't you look up every single word in a text you don't understand? especially when reading a technical piece?
<beneroth>
I do!
<freemint>
beneroth, the mutation function is called on all members of pop, and the algorithm did not contain randomization. People are not called mutated when there gens stay the same, they are mutated when genes change, i was misslead by the naming of "mut" and co. I expected it to do mutation only in which case every member of the population would be mutated.
<freemint>
not often nothing and then maybe mutation
<beneroth>
yeah, so you seriously believed that a picolisp code claiming to implement GA is not implementing GA? that I read as an insult on purpose, sorry mate.
<beneroth>
otherwise you could have prefixed your question with "do I understand correctly that ... e.g. Pop member is mutated every "round"?" ?
<beneroth>
then I would not see as an implicit insult
<freemint>
mhh i consider it
<beneroth>
thanks
<Regenaxer>
In any case, the main work is not done in 'gen' but by its caller
<Regenaxer>
It just simplifies the flow a little
<freemint>
I agree
<freemint>
Do i understand it correctly that all all members in generation n+1 are a "Re" off two members off genreation n?
<Regenaxer>
Oh, I don't remember now
<Regenaxer>
Thats decades ago ;)
<Regenaxer>
Before I need to dig into it again, I suggest you experiment with it
<freemint>
That's fine
<Regenaxer>
Thanks!
<freemint>
It think 'gen needs better documentation ;) How many days of work was that piece of code?
<Regenaxer>
I dont remember, but I think this was very fast
<Regenaxer>
I find other GAs here, for Lifo
<Regenaxer>
much more involved it seems
<Regenaxer>
"differential" genetic algos it seems
<Regenaxer>
I completely forgot meanwhile :)
<Regenaxer>
Seems I did in 1998
<Regenaxer>
There are infinitely many ways to implement a GA
<freemint>
Differential genetic algos are good idea but my problem space is small.
<freemint>
only 34000 different genetic codes
<Regenaxer>
I used much less at that time
<Regenaxer>
iirc I needed it to move an animated arm of an avatar
<Regenaxer>
find the optimal angular movements of an arm
<Regenaxer>
to a given position, turning a small number of joints
<Regenaxer>
(shoulder, elbow, fingers etc)
<freemint>
Is there a count to 100 before you do something and then reset to 0 apperatus in Pil?
<Regenaxer>
'%' ?
<Regenaxer>
or '&'
<freemint>
Ok i was looking if there was away to do it without modulo.
<beneroth>
it's a throw away email service - but I didn't even need to receive the email!
<Regenaxer>
wow! :)
<beneroth>
our luck that this assholes are usually lacking behind with tech knowledge
razzy has quit [Ping timeout: 250 seconds]
<Regenaxer>
haha
<beneroth>
you should put papers like this on your website, Regenaxer !
<beneroth>
and list them on picolisp.com as "success stories" for field use of picolisp ;-)
<beneroth>
that would be some marketing benefit :)
<beneroth>
nice paper!
<Regenaxer>
This was in Lifo in fact
<beneroth>
looks like you were on the fore-front of AI then, no?
<Regenaxer>
Not really
razzy` has quit [Quit: ERC (IRC client for Emacs 25.1.1)]
razzy has joined #picolisp
xkapastel has quit [Quit: Connection closed for inactivity]
<freemint>
How can i add 1 to a property in the least ugly way?
<Regenaxer>
(inc (:: cnt))
<freemint>
So do a with around first that works, how would i do it without OO?
<Regenaxer>
'with' is not limited to OO. But the general function is 'prop'
<Regenaxer>
(inc (prop Sym 'cnt))
<Regenaxer>
(with Sym (inc (:: cnt))) is only 1 cell larger
<Regenaxer>
It pays if you access more than one property at a time
<freemint>
But it does not work if you want to generate cnt in ::
<razzy>
if i run some code in paraell i always get same random number. which is good for debugging. less good if you are trying parael random search. is there way to randomize simple parael stuff?
<Regenaxer>
freemint, right, it does not eval the arg
<freemint>
(doc 'seed)
<Regenaxer>
yep
<Regenaxer>
the same seed is inherited
<razzy>
thx
<Regenaxer>
I recommend /dev/urandom
<Regenaxer>
(in "/dev/urandom" (rd 7))
<Regenaxer>
or larger or smaller than 7 of course
<Nistur>
Hmmmm. Is there any example of doing something like drawing to a framebuffer? I was just wanting to try to write to /dev/fb0
<Regenaxer>
If you use X11, look at z3d
<Nistur>
I don't want to use X11 :P
<Regenaxer>
VGA buffer is used in PilOS
<Regenaxer>
8086 assembly though
<Nistur>
hmmm ok
<Regenaxer>
or @lib/openGl.l ?
<Regenaxer>
See the recent discussion in the mailing list
<Nistur>
I mean, fb0 is just direct access to the framebuffer, so in C I just mmap it to a buffer, and write 32 bit colours directly do it...
<Regenaxer>
yeah, thats why I recommeded to look at @lib/z3d.l
<Nistur>
I was just wondering if there was already an example of how to do this in pil
<Nistur>
ok
<Regenaxer>
I uses a memory buffer
<Nistur>
ok :)
<Regenaxer>
then sends to X11 in the end
<Regenaxer>
This needs to be replaced :)
<Nistur>
most of z3d is C :P
<Nistur>
disgraceful ;)
<Regenaxer>
indeed, just a Lisp wrapper
<Regenaxer>
needs to be fast :)
<Regenaxer>
Not so useful perhaps, too specific
<freemint>
Regenaxer, i find it interesting how PicoLisp leads you to design your solutions more beautifull since it kinda "jams" when you try to force it to do something that is not the best choice.
<Regenaxer>
really?
<freemint>
I had that several times
<Regenaxer>
I think you can still easily do ugly things
<Regenaxer>
How does it "jam"?
<freemint>
I try to implement an gen algorithm that finds winning combinations for some bingo-esqu game
<freemint>
My first intution after gen did not make sense was to build my own where the beings are symbols which store some metadata too which later can be used for better algorithms
<Regenaxer>
Sounds good
<freemint>
The game is that you assign 18 points to 6 slots and a not very random slot is drawn every round and you decrease a slot, who first has all slots to 0 has won.
<freemint>
My ida was to implement these slots as single properties but then the "Recombination" became so ugly that i tought i did it wrong.
<freemint>
Now i started to just pass the a list of the slots and the code is much cleaner
<Regenaxer>
I see
<Regenaxer>
Simpler is better :)
<Regenaxer>
ok
<beneroth>
Simpler is better!
<beneroth>
nice anecdote, freemint :)
<beneroth>
thanks for sharing
razzy has quit [Ping timeout: 246 seconds]
<freemint>
I am AFK thinking about a function that does "first index of a list for which a condition is true"?
<Regenaxer>
'find' with a counter
<freemint>
My most beautiful piece of code today: (de inte (L) (reverse (maplist '((X) (apply + X)) (reverse L)))) it "Integrates" the list
<Regenaxer>
nice
<Regenaxer>
The first 'reverse' could be 'flip'
<freemint>
mhh (make (let I 0 (for X L (link (inc 'I X)))))) is two cells longer
<Regenaxer>
and instead of (apply + X) perhaps (sum prog X) behaves better for long lists (not sure)