<spk121_>So there is a logging library in guile-lib. Does anybody use it? Does anybody use logging in general? ***spk121_ is now known as spk121
<brendyn>amz3: I reverted your patch and ran guix environment -l guix.scm <berndj>correct me if i'm wrong: when SCM_ASSERT signals an error, it unwinds my (C) function, so i don't need to make the rest of the C function robust against assertion-violating runtime conditions? <brendyn>(eq? (list 0 1) (list (list-ref (list 0 0) 0) (+ (list-ref (list 0 0) 1) 1))) => #f <berndj>brendyn, because (list 0 1) and (list (list-ref ...)) are different objects <brendyn>eq? breaks normal evaluation of arguments then, i see <berndj>changin eq? to equal? causes #t to return <berndj>brendyn, no, the two arguments you're giving eq? are two distinct lists that happen to contain equal-valued items in each position. but they're not the *same lists* <berndj>(eq? (list 0 1) (list 0 1)) is also #f <brendyn>Ok but isn't it the case normally that arguments get evaluated first? <berndj>yes, but that isn't the issue here <berndj>eq? doesn't look _inside_ its arguments; it only looks at whether its arguments are the *same thing* <brendyn>Right, seems I misunderstood what eq? was for <berndj>brendyn, (let ((x (list 0 1))) (eq? x x)) returns #t, because in that case eq? is seeing the *same* object as each of its args <brendyn>berndj: I'm trying to make a game of life clone but I'm struggling to figure out how to define the state of a cell and refer to it. it seems i need some kind of table so I can go (cell-state (list 0 0)) => #t to mean its alive. but I cant refer to elements of a list if its just (((0 0) #t) ((0 1) #f) ...) ***pksadiq___ is now known as pksadiq
<rekado_>brendyn: you can use (ice-9 match) to match fields of any data structure <amz3>it's at least 3hours of recording which translates to 3 hours of uploading :( <amz3>I will upload the git repository somewhere and publish the code it will be faster :) <brendyn>amz3: I've written a game of life clone in chickadee <brendyn>at least, they don't seem to be conways rules <brendyn>Another issue is that I'm using (random 2) but it outputs the same numbers each time <brendyn>civodul: But I also what "0" sometimes all the time <amz3>brendyn: that because of the seed <civodul>0 is another find random number, right <brendyn>civodul: You wanna play with chickadee/ <civodul>i'd love to but i'm busy with another project ;-) <brendyn>I'm also busy with Guix too I guess. Lots of packages I'd like to put in. Enlightenment packages need revamping. <amz3>but the algorithm is not game of life algorithm doesn't seem right <amz3>this make me think about a game where you need to program the ai <amz3>it's an evolution of the game of life if rules <amz3>I will try to find a link abou tit <brendyn>I tried to define it so that if a cell was surrounded by 3 live cells, if would come to life, but if you look closely, there are many that don't <brendyn>Or perhaps the cells aren't rendering/disappearing as they should <amz3>I will loook at your code to try to see what happens <amz3>brendyn: maybe separating the rendering of the board and the logic which will apply game of life rules to the rendering <amz3>also I don't know game of life rules proper <amz3>AFAIK the computation should be done at each step on the previous game state, which means you can not update the state in place because each can change several cells <amz3>AFAIK the computation should be done at each step on the previous game state, which means you can not update the state in place because each *step* can change several cells <brendyn>I don't think that is the issue. The (for-each ...) does all the updating in one go <amz3>basically I think the issue comes from the mutation done in the for-each using array-set! <brendyn>It behaves even stranger when I set that to 4 <amz3>seems like a labyrinth to me <brendyn>And it's an optical illusion, if you stare at it heaps @_@ <amz3>what do you think about halite.io? <brendyn>I didn't quite understand what it was <amz3>it's a basically a game like 'age of empire' where you play by programming the ai <brendyn>My game of life is doesn't look like it's going to stop any time this century <brendyn>I removed (sleep 1) so it's going max power too <brendyn>What seems to happen is when there is a row of cells, the end one dies off one by one <amz3>but it re-populated somehow <brendyn>hence worms. but the ones in the middle survive, despite being surrounded only by 2. it should be 3, but i've trippled checked the formula <amz3>where do you read the definition of the algorithm? <brendyn>I think it is in a sort of equilibrium, since 50% of the cells started of alive, it's to chaotic, or "hot". no other patterns forming <amz3>brendyn: where do you define the seed state? <brendyn>under: ;; Assign random(TM) states to each cell <amz3>it seems to me the initial state is the empty state: (define state (make-array 0 (+ 1 blocks-height) (+ 1 blocks-width))) ;; L39 <brendyn>Yes, and then array-set! changes them again <brendyn>Can you understand the for-each bit? It's probably not the sensible way to do such recursion <amz3>you iterate over all the cells and set it them to a random value <brendyn>The man page says some things about changing the seed for the random number generator. <amz3>yeah but that will only introduce a different random seed state <amz3>I really think that the algorithm you use, is not correct since you update the game state in place. I will try to fix you code to show you <amz3>what they call the universe must not be mutated <brendyn>Anyway, I just struggled to make it work in any way possible. <amz3>"the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the preceding one)" <brendyn>That has nothing to do with it, It's just that I run array-set!, and then go on to read that value as if it were an old one <amz3>when you use array-set! the procedure becomes un-pure <brendyn>Yeah, it just hurts my brain less to do it that way first. <brendyn>I tried patching it with a temporary symbol state-new, and then updated it after, but it didn't seem to make a difference <amz3>the key to pure function, is a pure data structure :) <brendyn>But how can one do that with the draw procedure? <amz3>use only draw procedure to render the state, do not change it <amz3>do not use array-set! in draw <amz3>then replace the use of the array, with an alist <amz3>where the key is a position list like you currently do <amz3>and the value the health <amz3>actually it could be a simple list instead of an alist but I prefer to use alist <brendyn>I'll have to see what you post in the morning. It's too late over here in Australia. <amz3>anyway you have to find the correct seed state that reproduce itself <amz3>I will try to copy the seed state of wikipedia, but it's not given since I am lazy <amz3>let's try the glider seems easy to do <amz3>indeed there is an issue <amz3>see you tomorrow brendyn <amz3>I will keep you posted if bacon works <amz3>I don't even understand the rules <brendyn>You have two rules. one for when a cell is alive, and one for when it is dead. if is alive and has 2 or 3 neigbours, it lives, otherwise it dies. if it is dead, i.e., an empty cell, if it has exactly 3 neighbours, it comes to life next round ***nikita1 is now known as nikita
<amz3>the iteration over all cells on my first attempt was wrong, I replace the use of 'zip' with 'carthesian-product' ***nikita is now known as Guest41302
***Guest41302 is now known as nikita1
<Apteryx>When playing at the REPL with Geiser it often locks and I have to C-g C-g to continue. Has anyone been annoyed by that? <Apteryx>Also, any shortcut to exit from a "new" prompt? It gets long quick to have to type ,q (C-d doesn't do it) <amz3>that's just another habit, also there is no way afaik to exit all repl at once <Apteryx>amz3: On dvorak it's particularly annoying (w x ENT) ;) <Apteryx>Well I can make a shortcut to do just that; it's emacs after all. <Apteryx>But C-d would have been natural it seems. <amz3>Apteryx: in emacs I use C-x k <amz3>to kill the buffer than you answer y a few times and it should be ok <Apteryx>amz3: Won't this kill the whole process? I just want to get out of the last "nested debug prompt" quickly. <amz3>but I don't do much geiser, so maybe someone has a more informed idea about that <amz3>yes it will kill the whole process ***Guest38074 is now known as micro`
<amz3>Here is the second video, where I made a mistake while renaming a variable and did not reflect the change everywhere, so not very interesting https://youtu.be/to8vdri82_E <amz3>it's before the previous video <amz3>like i said the last video posted first is more interesting <amz3>I also debug, the 'back' button in forward which was using an API not (anymore?) supported by firefox and chromium... maybe a mistake of mine otherwise <amz3>“You think you know when you can learn, are more sure when you can write, even more when you can teach, but certain when you can program” <amz3>I think the person doing the talk lay around here <amz3>it's the person that did the pamphlet about Scheme vs Python (vs Guile) <amz3>“[Scheme] has the sudo function: call/cc” <amz3>this is so awesome news at the FOX <amz3>“7 year old learns programmign in scheme” ***ertesx is now known as ertes