***aweinsto1k is now known as aweinstock
***duncanm_ is now known as duncanm
***sneek_ is now known as sneek
***berndj-blackout is now known as berndj
*wingo just landed ,optimize-cps, finally <wingo>is quite verbose; could be better perhaps <wingo>scheme@(guile-user)> ,opt (let ((x (cons (cons "x" (cons 42 '())) '()))) (string? (car (car x)))) <wingo>$1 = (let ((x (list (list "x" 42)))) <wingo>scheme@(guile-user)> ,optimize-cps (let ((x (cons (cons "x" (cons 42 '())) '()))) (string? (car (car x)))) <wingo> v1 := const "x" ; arg at <unknown>:2:35 <wingo> heap-object?(v1) ? L4() : L7() ; at <unknown>:2:61 <wingo> string?(v1) ? L5() : L7() ; at <unknown>:2:61 <wingo> v3 := const #f ; val at <unknown>:2:61 <wingo> return v3 ; at <unknown>:2:61 <wingo> v2 := const #t ; val at <unknown>:2:61 <wingo> return v2 ; at <unknown>:2:61 <wingo>i guess that string? test should have folded too <civodul>i guess we'll find new optimization opportunities :-) <wingo>that failure to optimize turns out to be that we lack alias analysis <wingo>in theory we should be able to optimize (let ((x (list (list (list (list "x")))))) (car (car (car (car x))))) => "x" <wingo>but in practice the way we lower "cons" as allocate + set-car! + set-cdr! confuses the cse pass <wingo>so we only get to strip off the outer level each time it runs. cse happens to run two times in the optimizer, so we get two levels stripped off, exposing the string? but then the branch folder doesn't run after that <wingo>sometimes i think that we really should ditch the LICM + CSE + DCE thing and "just" do one global code motion pass (the sea of nodes thing) -- but it's maybe not magical and what we have is pretty good <wingo>(the idea being, instead of laboriously trying to move expressions around from their initial orders, just throw away the initial order and compute a new one based on a graph of each expression's data and side-effect dependencies <civodul>wingo: intuitively if one pass can replace three passes, that's good :-), but i have no idea if it's this "simple" <wingo>it is simple but not easy :) <wingo>also am unsure that we would be able to preserve the "online cse" optimizations. <wingo>so, probably not in the cards in the near term. but funny to think about <dthompson>dsmith-work: I believe it is "dead code elimination" <lloda>wish 'reference to identifier outside its scope' told you WHICH identifier <sneek>Welcome back vijaymarupudi, you have 1 message! <sneek>vijaymarupudi, daviid says: could you paste the code that lead to this statproof, i'd like to check something, then i'll get back ... <roptat>I'm trying to play with timezones in guile, but I don't understand how it works... <roptat>I'm trying to find the current time in different timezones, but it all returns the same result: (tm:hour (localtime (current-time) "CEST")) and (tm:hour (localtime (current-time) "ET")) is the same? <roptat>(well, more precisely, I want to convert a time to different timezones) <RhodiumToad>try "Europe/Berlin" and "America/New_York" for timezone names <RhodiumToad>abbreviations of timezones aren't unique (there's like three timezones called "IST") <RhodiumToad>also everything about timezones is horrible and the tzdata maintainer is making it worse <roptat>that doesn't work, it still gives me the same results <roptat>looks like it's giving me UTC time *RhodiumToad wots not of guix <roptat>maybe I'm missing something in my environment? <roptat>I see a TZDIR variable which seems to be set correctly (it points to timezone data) <roptat>looks like I can use "UTC+5" and co, but that won't work with daylight saving <roptat>I just straced it, and it's not looking there <roptat>it's looking in /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/share/zoneinfo/Europe/London but TZDIR is set to /gnu/store/kl68v5mclwp511xgpsl2h1s9gmsdxpzh-tzdata-2021a/share/zoneinfo <roptat>(sorry for the long hash: it's looking in glibc, but TZDIR is set to tzdata) <RhodiumToad>whether TZDIR is respected is probably down to glibc. *RhodiumToad not linux user <roptat>mh... though timezones work outside of guile <RhodiumToad>anyway, the fact that it's looking in the wrong place explains the issue <civodul>otherwise the date API in srfi-19 also gives the current timezone <roptat>civodul, tm:gmtoff always answers 0, unless I don't specify any timezone, in which case it gives my timezone's offset <roptat>and it's also 0 if I set TZ before that <roptat>does that work for you: (tm:gmtoff (localtime (current-time) "Europe/Paris"))? <civodul>but (tm:gmtoff (localtime (current-time))) gives me the expected offset <roptat>yeah, because then it doesn't have to lookup the timezone (even if you probably have set the timezone to Europe/Paris) <roptat>now, if you run TZ=Europe/Paris guile, that won't work anymore <RhodiumToad>note that tm_gmtoff is an extension to the posix spec <civodul>woow the code in libguile/stime.c is terrible <civodul>it works by setting the TZ env var temporarily <RhodiumToad>I don't think there's any other way that's even slightly portable <civodul>yes, but it's not even calling setenv(3), it's modifying 'environ' <roptat>maybe, in setzone it says it's creating a new environment with only TZ, so that's how it ignores TZDIR? <RhodiumToad>everything about timezones is at best aesthetically unpleasant