IRC channel logs

2017-05-06.log

back to list of logs

<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
<brendyn>Why is this false?
<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
<berndj>equal? "looks inside"
<brendyn>I was just testing that!
<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>brendyn: cool
<brendyn>I think I will use vectors
<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
<amz3>brendyn: wow
<amz3>that was fast
<brendyn>I think the rules are wrong though
<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
<civodul>you can optimize it to just "1"
<civodul>1 is a random number, after all
<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
<civodul>*fine
<brendyn>civodul: You wanna play with chickadee/
<brendyn>?
<civodul>i'd love to but i'm busy with another project ;-)
<brendyn>Guix?
<brendyn>0.13?
<civodul>yes
<civodul>well, preparations for 0.13
<brendyn>I'm also busy with Guix too I guess. Lots of packages I'd like to put in. Enlightenment packages need revamping.
<brendyn>amz3 davexunit http://paste.lisp.org/display/345955
<amz3>brendyn: it works!
<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>of such objects
<brendyn>You think it is the same?
<amz3>it's an evolution of the game of life if rules
<amz3>kind of yeah
<amz3>s/if/with/
<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
<brendyn>It even seems asymmetrical
<amz3>brendyn: here is the game I was thinking about https://halite.io/game.php?replay=ar1487297224-1589721797.hlt
<amz3>it's a replay actually
<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>I will read that
<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>I foudn an error i think
<brendyn>(< neighbours 3)
<brendyn>should be
<brendyn>(< neighbours 4)
<brendyn>It behaves even stranger when I set that to 4
<brendyn>It forms worms. Multicellular!
<brendyn>And it's lasting indefinitely!
<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
<amz3>correct! kuddoz!
<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
<brendyn>Oh wait, it's correct.
<amz3>where do you read the definition of the algorithm?
<brendyn> https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
<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
<amz3>oh I see
<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>yep
<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
<amz3>anyway
<amz3>let's code
<brendyn>Oh right, now I see what you mean
<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>to get started
<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>brendyn: http://dpaste.com/2BKXTAR
<brendyn>Doesn't quite work?
<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>beacon is easier
<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>lol
<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
<brendyn>night
<amz3>brendyn: http://paste.lisp.org/display/345970
***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
<amz3>youtube is uploading my videos in the wrong order, here is the last and IMO the most interesting part of the screencast https://www.youtube.com/watch?v=ePiHp1lgbas&feature=youtu.be
<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>Apteryx: I do ,q
<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>ah ok! I use ,q then
<amz3>but I don't do much geiser, so maybe someone has a more informed idea about that
<Apteryx>amz3: OK. Thanks for sharing :)
<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>Here is the first video I recorded which try to present the tools I use https://youtu.be/i47QgE0ihSw
<amz3>this was posted to scheme mailling list https://www.youtube.com/watch?v=wd-2CDWMetc
<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)
<catonano>amz3: you're right, he's Panicz
<amz3>oh
<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”
<amz3>it's on hackernews https://news.ycombinator.com/item?id=14281751
***ertesx is now known as ertes