IRC channel logs
2017-11-08.log
back to list of logs
<happy_gnu[m]>I am trying to call a function that will give me time on UTC <happy_gnu[m]>What would you use to create a countdown timer with guile <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: bug-gnulib@gnu.org would be the place <cmaloney>happy_gnu[m]: Have you checked out SRFI-19? <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 <happy_gnu[m]>It will divide the seconds by 86,400 and ithat will be days <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 <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 culturia.one 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>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 <numerobis>amz3: sorry, I just started using guile. What do you mean by a mutation? There is no other way then? <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>and I think what I'm trying to return is "i++" instead of "++i", no? <amz3>numerobis: can you http://hastebin.com/ 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: https://hastebin.com/icokopowek.lisp 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>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! <numerobis>exactly the kind of resource I was looking for. Thank you! :) <amz3>numerobis: if you still don't understand comme back! <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 <stis>works for me on 2.2 and 2.0.13 <amz3>what does the VM depends on the size of number <Romantic>Hello, is there guile support for inotify or other fs notification systems? <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. <davexunit>happy_gnu[m]: it's because I never wrote a package for it <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>if that is not valid I don’t know what is.