IRC channel logs


back to list of logs

<happy_gnu[m]>can somebody help me with this function
<happy_gnu[m]>I don't understand what am I supposed to pass
<happy_gnu[m]>sbd-time [zone]
<happy_gnu[m]>sbd-time [zone]
<happy_gnu[m]>damn .. stupid riot
<happy_gnu[m]>Scheme Procedure: mktime sbd-time [zone]
<happy_gnu[m]>I am trying to call a function that will give me time on UTC
<happy_gnu[m]>never mind
<happy_gnu[m]>I needed to use localtime
<OrangeShark>happy Wednesday!
<bavier>hello happy_gnu[m]
<happy_gnu[m]>What would you use to create a countdown timer with guile
<happy_gnu[m]>Hi bavier :)
<happy_gnu[m]>Let's say I want a countdown till December 1st 2017
<happy_gnu[m]>And every time I call this function it will tell me how much time left until December 1st
<ArneBab>I forgot to whom I need to talk about getting something into gnulib — can you help me?
<civodul>ArneBab: would be the place
<cmaloney>happy_gnu[m]: Have you checked out SRFI-19?
<cmaloney> ?
<bavier>happy_gnu[m]: or the base (guile) module has some string functions
<bavier>happy_gnu[m]: a little janky, but e.g.: (define (countdown end) (let ((end-secs (car (mktime (car (strptime "%Y-%m-%d" end)))))) (lambda () (format #t "~d seconds left" (- end-secs (current-time))))))
<bavier>(define counter (countdown "2017-12-01"))
<bavier>(counter) => "1949659 seconds left"
<happy_gnu[m]>cmaloney: I did bit I did not understand how to transform those objects into simple 'it is november 18, 2017'
<happy_gnu[m]>bavier: ohhh and then with amount of seconds I can define a function that transforms them into days and hours
<bavier>happy_gnu[m]: right
<happy_gnu[m]>It will divide the seconds by 86,400 and ithat will be days
<happy_gnu[m]>Then the remainder by 3600 and that will be hours
<happy_gnu[m]>And so on
<happy_gnu[m]>I don't really understand mktime
<bavier>happy_gnu[m]: it converts a "broken-down time object" like that returned by strptime and returns the corresponding integer seconds and a normalized time
<bavier>the example I gave used it only for the integer seconds conversion
<happy_gnu[m]>bavier: it converted everything to seconds right?
<happy_gnu[m]>OK I think that I understand better with your example
<happy_gnu[m]>Yesterday I was very confused
<happy_gnu[m]>OK let me try it in my IRC bot :)
<amz3>do you backup?
<amz3>online/offline or rsync?
<amz3>I think I lost some code again!
<amz3>wohaha grep has to go through all stackoverflow database dump again
<amz3>I remember that I already used in my codebase called some kind of encode/decode to handle post submitted
<amz3>the app was anonymous and cool, but nobody used it outside mezbreeze
<amz3>I am looking for the morton code for indexing arbrirary number of spaces using a linear scheme (like forth (no I am kidking)
<amz3>to increase lookup speed in a ordered by key hash map
<amz3>the prefix of the has does narrow down the n dimentional space using a line that progress through the entire n dimensionnal space in a certain way
<amz3>what a time sink can be social networks... some time
<amz3>worse than linkedin, you can't figure
<amz3>but heck, they must be some no silly way to do webapp dev?!
<amz3>the prefix of the has does narrow down the n dimentional space using a line that progress through the entire n dimensionnal space in a certain way
<amz3>(was interupted by twitter)
<amz3>the prefix of the has does narrow down the n dimentional space using a line that progress through the entire n dimensionnal space in a certain way
<amz3>so it deals with a subscape that overlaps the search region, which means you have some space that the curve progress that is not part of the search space
<amz3>the 'future-next-valid-step' will narrow down further the search space to be more accurate
<amz3>and actually match the client intent
<amz3> this is explained with images in
<amz3>this is not my article
<amz3>the wikipedia pages give a good introduction to the technique of space filling curves to linearize a multi-dimensional space
<amz3>but it's not really explained what the engineering application
<amz3>but it's not really explained what the engineering application are
<amz3>the purpose is to speed up database queries that are collocated
<numerobis>Hi! I have a (beginner) question regarding scheme. I would like to implement a function whose purpose is to increment a variable and return its value before incrementation. Right now, the expressions in my function are (set! x (+ x 1)) (- x 1), which doesn't look very elegant. Is there a better way to achieve this? Thank you!
<numerobis>(other than by introducing an auxiliary variable with a 'let'...)
<amz3>numerobis: that is mutation it's not possible
<amz3>that is a mutation
<numerobis>amz3: sorry, I just started using guile. What do you mean by a mutation? There is no other way then?
<numerobis>amz3: And thank you for your response!
<amz3>numerobis: you don't have access to the underlying pointer adress to modify inplace the record of the first variable
<amz3>because doing so, you would also probably change the value of a sibling datastructure that still use that variable
<amz3>this allows to preserve unicity of memory representation of concurrent datastructure without them having to know whether there is someone else using my values or not
<amz3>it actually can save space
<amz3>because for instance, 1 you need only one instance of 1 in the end of the day not hundres of times you add one...
<numerobis>amz3: Thanks, but are you sure? Because my function does work... I should perhaps mention that the varibale x is defined in the function too?
<amz3>they share subspace of their datastructure.
<amz3>numerobis: you get a new value, not the old *value + 1 in C terms
<amz3>so saying your function is doing 'return ++i' is incorrect
<amz3>maybe the underlying compiler is optimizing that particular value because he knows that particular value 'x' won't be used anymore which he can guess statically for instance for symbol-fu procedures
<amz3>which would maybe translate to a realloc in C for the particular case of symbols
<amz3>for integers I don't know
<numerobis>amz3: Thank you! But I'm still not sure that I understand. Am I not doing something similar to what they're doing here ?
<numerobis>and I think what I'm trying to return is "i++" instead of "++i", no?
<amz3>numerobis: can you what is your procedure and what you think it's doing, I think I don't understand what you wnat to do
<amz3>numerobis: that an early optimisation that hurst readability of the code, I don't remember what ++
<amz3>numerobis: tl;dr: prolly :)
<amz3>I am reading the manual page
<numerobis>amz3: there you go :) (that website is great, btw!) Basically, I want to be able to (define a (counter 0 4 1)), and then be able to call (a) repeatedly until I reach the upper bound. Thanks!
<amz3>numerobis: this is a pattern to simulate to simulate states, it's called scheme man OOP or poor man's OOP
<amz3>tx, disclamer: that's not mine
<amz3>with fiber, you can inverse the last two lines (and add a let loop (and run in fiber event loop), it has the same effect
<amz3>it's an infinit sequence
<amz3>some sort lof lazyly compute its values
<amz3>it's what my library does for nodes and links database
<numerobis>amz3: Thanks, but what is fiber? (I can't find that word in the guile manual)
<amz3>disclaimer: I can't put actually write the code that does that ^ but by reading the manual that's what I understood
<amz3>numerobis: wingo is the maintainer :)
<amz3>numerobis: that pattern you are talking about, using a closure to retain state and return a value is used in SICP
<amz3>But I have a very poor memory, so i can not say which where
<amz3>numerobis: what to you want to do with the procedure that you wrote that increments values?
<amz3>btw, morton code lost
<amz3>meh, I hope mark has a copy
<amz3>numerobis: you have SICP?
<numerobis>amz3: Thank you very much, I'll check it out. :) Eventually I want to use it as a kind of iterator, but at the moment I was just playing around and trying to understand how scheme works.
<amz3>numerobis: yeah, it can do what ever you want...
<amz3>like IIRC someone use it but, the procedure that returned by the outter lambda can take a symbol as argument and a rest argument, then based on the symbol it switches, and execute a particular subprocedure
<numerobis>amz3: haha yes, it seems to be a very nice language. Ultimately, I would like to use guix, but I'm warming myself up to guile with small projects first.
<amz3>like (database 'insert "amz3" "is a quiler")
<amz3>that's basically database.insert("amz3", "is a guiler) in javascript or python
<numerobis>amz3: oh sorry, I thought you were talking about Guile, but it was about Fiber. Seems pretty powerful indeed!
<amz3>Fiber is a guile module
<amz3>for guile 2.2
<amz3>like package
<amz3>like +a package
<amz3>numerobis: but if you are getting started, maybe you read this chapter
<numerobis>exactly the kind of resource I was looking for. Thank you! :)
<amz3>numerobis: if you still don't understand comme back!
<amz3>i hope :)
<numerobis>amz3: I will, thanks!
<OrangeShark>numerobis: I don't really see ant other way except what you did or use a let binding.
<numerobis>OrangeShark: Thanks, it's good to have it confirmed.
<OrangeShark>numerobis: just know when you do something like return x++ in a language, it likely saving the x into a temporary variable or register
<happy_gnu[m]>I am a little confused
<happy_gnu[m]>I need some help
<happy_gnu[m]>if I do on REPL
<happy_gnu[m]>(round (/ 260861 86400))
<happy_gnu[m]>it gives
<happy_gnu[m]>=> 3
<happy_gnu[m]>but if I do
<happy_gnu[m]>(define (days-left time) (round (/ time 86400)))
<happy_gnu[m]>and I call (days-left 260861)
<happy_gnu[m]>exactly the same thing with exactly the same code :/
<happy_gnu[m]>I get
<OrangeShark>happy_gnu[m]: which version of guile?
<stis>works for me on 2.2 and 2.0.13
<happy_gnu[m]>mm I must have something wrong then
<happy_gnu[m]>let me check :/
<happy_gnu[m]>ok I was wrong sorry for wasting your time :(
<amz3>what does the VM depends on the size of number
<amz3>+the number
<Romantic>Hello, is there guile support for inotify or other fs notification systems?
<happy_gnu[m]>why is chickadee not in #guix but sly is ?
<happy_gnu[m]>is chickadee not stable?
<civodul>Romantic: there might be inotify bindings floating around
<civodul>otherwise it's "not hard" to create bindings using the FFI
<Romantic>civodul, ok, thanks: I haven't found anything yet, figured I'd ask before putting something together.
<ArneBab>civodul: thank you!
<civodul>Romantic: yes, makes sense :-)
<davexunit>happy_gnu[m]: it's because I never wrote a package for it
<davexunit>sly is a pretty dead project at this time
<davexunit>anyone could add chickadee to guix. it's not hard.
<davexunit>speaking of inotify bindings, that would be nice. I've thought about making them before but never got around to it.
<rekado>davexunit: do you think sly should be removed from Guix?
<civodul>rekado: no no, i've used it with my kids, it's great :-)
<civodul>(is that a valid criterion for non-removal?)
<rekado>hah :)
<rekado>if that is not valid I don’t know what is.
<happy_gnu[m]>davexunit: OK! I will try ta write the package now then
<happy_gnu[m]>I want to make a game :)
<happy_gnu[m]>Yesterday I did an IRC bot with dustyweb's 8sync
<davexunit>rekado: it would be fine to remove it