<jgart>how can I accumulate a list of lists by adding 1 to '(0 1 2) recursively until I reach 12 iterations of that process? <jgart>Here is an example of my input and output <jgart>any help is greatly appreciated <jgart>(map 1+ '(0 1 2)) would give me just the first output: (1 2 3) <mwette>(let loop ((res '()) (i1 0) (i2 1) (i3 3) (cnt 12)) (if (zero? cnt) res (loop (cons (list i1 i2 i3) res) (1+ i1) (1+ i2) (1+ i3) (1- cnt)))) <mwette>"(if (zero? cnt) res" => (if (zero? cnt) (reverse res)" <RhodiumToad>(map (lambda (i) (list i (remainder (+ 1 i) 12) (remainder (+ 2 i) 12))) (iota 12)) <mwette>either works; I guess the named let is faster. <RhodiumToad>if the (0 1 2) is actually an argument and could be anything, then how about <RhodiumToad>(define (transpositions l) (letrec ((rot (lambda (o) (map (lambda (e) (remainder (+ o e) 12)) l)))) (map rot (iota 12)))) <jgart>Thank you RhodiumToad and mwette for the answers! <jgart>I also got this way of solving it from #scheme irc <jgart>(unfold (lambda (xs) (= (car xs) BOUND)) values (lambda (xs) (map 1+ xs)) '(0 1 2)) <jgart>but his solution doesn't account for the modulo 12 wrapping <jgart>RhodiumToad, I will try you last above now with letrec <jgart>RhodiumToad, I imagined it could be solved recursively but wasn't sure. Iteratively recursive call is fine too? <RhodiumToad>for a well-defined number of iterations, recursion seems overkill <RhodiumToad>in my example I'm using (iota n) to generate the n-element list <RhodiumToad>also the letrec there is out of habit, any binding form would work <jgart>the lists that I would need to generate the "transpositions" for in the end won't be so easily formalized so to generated <jgart>RhodiumToad, but I appreciate you elegant solution for generating '(0 1 2) <jgart>eventually that will be the input <RhodiumToad>and for each of those elements, you want a 12-element list result? <jgart>each indexed list will need to be transposed 12 times <jgart>RhodiumToad, Ok I will try now <jgart>there are only 12 pitch classes but many pitches that are multiples of those 12 <jgart>sorry if I was two pedantic with the above. Just wanted to clarify the relationship of pitch and pitch-class <jgart>RhodiumToad, thank you so much! I just tried your code <jgart>that's exactly what I wanted (i.e. (map transpositions 3-1)) <jgart>I will now try to study your solution so that I can assimilate what you just did. Great! <jgart>RhodiumToad, I owe you a virtual beer <jgart>so I can you plain let instead of letrec in your procedure? <jgart>trying to read through it and follow the flow of execution to see everything that happens <jgart>I have a general intuition for what is happening <RhodiumToad>in this example any binding form would be fine. I just use letrec out of habit when binding procedures rather than values <jgart>why do you use letrec when binding procedures? <jgart>I'm still not practiced in using letrec <RhodiumToad>(define (transpositions l) (define (rot o) (map (lambda (e) (remainder (+ o e) 12)) l)) (map rot (iota 12))) <jgart>maybe that way is clearer to me for now <RhodiumToad>letrec allows the bindings to reference themselves, the same way a (define) would <RhodiumToad>i.e. (letrec ((foo (lambda ... (stuff here can reference "foo" for recursive calls)))) ...) <jgart>let* also allows recursive calls? <RhodiumToad>no, let* makes each binding visible to the following bindings, but not to itself. <RhodiumToad>for both let and letrec, bindings are not visible to other bindings in the same form. <RhodiumToad>letrec is normally not used for data because although the bindings are visible, it's not safe to actually try and access the values during binding initialization <RhodiumToad>that's ok for functions, since you're not going to actually call the functions until you're in the body, hopefully (and letrec* is available for when that's not the case) <RhodiumToad>the only real subtlety in this code is the use of l and o from inside (rot) *RhodiumToad didn't know what the data was representing when writing that <jgart>and "o" and "e" in the lambdas where chosen arbitrarily? <jgart>no worries! I'm still working this all out myself <RhodiumToad>the point in this case is that we're using the lexically outer definition of "l" (as a parameter of (transpositions) within the body of the nested define, <RhodiumToad>and in turn within the innermost (lambda) we have a lexical reference to "o" <RhodiumToad>so within the scope of a single call to (transpositions) with some list as parameter, (rot 1) returns that list with all the values rotated by 1, etc. <jgart>the map with lambda having single parameter "e" is consuming the "l" from transpositions <jgart>thank you RhodiumToad! I'm off to take a walk before sunset. Maybe I'll see you in this chat later. Thanks again! ***catonano_ is now known as catonano
***terpri_ is now known as terpri
<pkill9>how do you test if a given list is an association-list? <daviid>i thought i did succeed in programatically (dynamically) perform the same as what is acheived by the #:replace define-module 'option', such as for example, in the (g-golf hl-api signal) connect variable name, which is bind in guile core and needs to be transformed into a generic function - however, what i have seems to have weird corner cases <daviid>here is an example of what worksd, and a 'symptom' of what is or may be a problem <daviid>if you launch a repl and enter connect, guile tels you it is a procedure, here #<procedure connect (_ _ #:optional _ . _)> <chrislck>pkill9: you need to understand how to compare lists first <chrislck>(member lst assoc-list) is the simplest one <daviid>if you ,use (g-golf) and try that again, you'll see it became a generic function, with teo methods -| $3 = #<<generic> connect (2)> - which exactly what is expected <daviid>now, if you import GtkWindow, g-golf should do the same for short name methods, for example close, which the short name method for gtk-window-close <daviid>(gi-import-by-name "Gtk" "Window") -| #<<gobject-class> <gtk-window> 562742d87900> <daviid>however, close -| #<procedure close (_)> <daviid>but it should be a generic function, which it is, but in the (g-golf hl-api gobject) 'only' [it did not replace, as i thought it would, the (current-module) binding] (@@ (g-golf hl-api gobject) close) -| $6 = #<<generic> close (2)> <daviid>if anyone is willing to help .. well, tx! <daviid>what is weird is if you drop the following code - https://paste.gnome.org/pxw4m80m5 - in say 'hello-world.scm', chmod a+x and run it, _without_ any opned guile repl 'anywhere', it will compile execute and display i the terminal these lines (from the dimfi call, which is sort of a peek proc in g-golf ...) <daviid>;; #<directory (guile-user) 559c4a121140> <daviid>but if you launch a guile repl, 'leave it' running, then try the same hello-world example again, if fails displaying these <daviid>; #<directory (guile-user) 55ead365d140> <daviid>and then if you click the quit button, raises an exception of course, since it runs the core close proc over the window, instead of the appopriate method ... <str1ngs>daviid when you have a sec can you take a look at the 'decide-policy signal in this example. http://paste.debian.net/1158525 . I tried to simplify this example as much as possible. run the script then and click on the Try it yourself button in the web page. this call some JavaScript to request a link in a new tab.. This use to work for me but now longer works. here is the documentation for the decide policy <str1ngs>daviid: I'm reading the channel backlog maybe I can look into that abit. <str1ngs>daviid: I could'nt get (run-javascript "window.open('https://gnu.org');" #f #f #f) so the example is more complicated then needed. probably the javascript world won't allow for window.open so you'll just have to click the link. applogies <daviid>str1ngs: give me a bit of time, i actually have to clone g-golf to try your example :) because i am in the middle of this giinterface refactoring and your example neeeds those ... <str1ngs>daviid: if this is something you are aware of it's not a rush. I can work around it for now. mainly i'ts used to create a new <web-buffer> when a link requests a new tab. <str1ngs>daviid I'm reading channel backlog seeing if I can grok they problem you are having <daviid>str1ngs: the example works, i click, nothing happens, but no bug either ... <str1ngs>daviid: check the terminal output I have catch that outputs the error <daviid>david@capac:~/alto/projects/g-golf/examples 92 $ ./decide-policy.scm <daviid>and the window with the example 'is there' <str1ngs>you click the Try this green button to execute the javascript? <str1ngs>it's okay I tried to example in the lable. <str1ngs>I could'nt just call the javacript manuall sorry I needed to use a link. so made the example more complex then I wanted. <daviid>but i need to understand where is the callback code for this button <str1ngs>when something like window.open("https://gnu.org"); it requests to open the link in a new window. in nomad I just open the link in a new buffer. <daviid>this seems to be called a million times, so to spea <str1ngs>if I don't handle the decide-policy the click gets ignored. <str1ngs>the only type I'm worried about is new-window-action <str1ngs>in C you need to cast WebKitPolicyDecision to WebKitNavigationPolicyDecision. see WebKitNavigationPolicyDecision <str1ngs>I could just make a C helper function vi GI. to cast the types. that should get around it quickly if you are too busy <daviid>str1ngs: i'm trying to understand why ... and what it seems to be is a webkit-policy-decision> instance is not what webkit-navigation-policy-decision-get-navigation-action expect as its frist arg <daviid>you have to understand that i know nothong, or next to nothing about webkitgtk itself, so i'm in 'unknowen water' ... i'm fine, but it's not as i knew the answer out of my head just looking at it ... <daviid>importing WebKit2 is not instantaneous, you might wna selectively import things there too .. just saying <daviid>i can't find the method def for webkit-navigation-policy-decision-get-navigation-action <str1ngs>you can't find the method in g-golf? <daviid>str1ngs: it could be yes - we need to find out why, when ... which commit ... <daviid>$3 = #<<generic> get-navigation-action (1)> <daviid>let'1s see what tha cache expect <daviid>so, that method expects a WebKitNavigationPolicyDecision <daviid>but the example you paste pass a webkit-policy-decision>, which a super class instance <daviid>this is a very 'ruff' look at things <daviid>this why you need to cast in C by the way <str1ngs>daviid: this reminds me of the gdk event thing <daviid>(describe get-navigation-action) <daviid>get-navigation-action is a generic function. It's an instance of <generic>. <daviid>Methods defined for get-navigation-action <daviid> Method #<<method> (<webkit-navigation-policy-decision>) 55a76ca50840> <daviid> Specializers: <webkit-navigation-policy-decision> <str1ngs>daviid: btw in your hello-world.scm if you change to exec guile --no-auto-compile -e main -s "$0" "$@" it becomes consistent ;; #<<generic> close (2)> so it some compile bug <daviid>but in your example, you pass a <webkit-policy-decision> <daviid>str1ngs: i don't think it is, but ... let's focus on one thing at a time :) <str1ngs>right in C you would cast this with WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision); <str1ngs>with --no-auto-compile I have consistent <<generic> close (2)> just a FYI <daviid>in g-golf, <webkit-navigation-policy-decision> is undefined, even after importeng the all webkitgtk <daviid>it is a struct, not a 'real' gobject subclass <str1ngs>scheme@(guile-user)> <webkit-navigation-policy-decision> <str1ngs>$1 = #<<gobject-class> <webkit-navigation-policy-decision> 55ab020cbc00> <str1ngs>I got worried and though we had different WebKitGtk versions or something haha <daviid>(make <webkit-navigation-policy-decision>) <daviid>$5 = #<<webkit-navigation-policy-decision> 55a76e2145e0> <daviid>scheme@(guile-user)> (get-navigation-action $5) <str1ngs> “navigation-action” property might not be set with make <daviid>str1ngs: yes i was just 'playing ' with goops ... <str1ngs>though #f is not a goops-error at least :) <daviid>but i was passing the right argument <str1ngs>I can meant time just use C helper function that takes WebKitPolicyDecision and casts then returns WebKitNavigationPolicyDecision. it's pretty simple to do <str1ngs>return WEBKIT_NAVIGATION_POLICY_DECISION (decision); should do it <daviid>but it would be nice to understand and solve in scheme to ... <str1ngs>I hear ya. I don't know what part of g-golf this effects. it's not related to interfaces I gues? <daviid>what is 'casting' a type for another, internally, so we can maybe do it in scheme <str1ngs>in gtk they use C macros to cast types. so WebKitNavigationPolicyDecision has WEBKIT_NAVIGATION_POLICY_DECISION <daviid>it is difficult for me to ask about things i don't know ... let's see <daviid>you are on #introspection as well <str1ngs>WEBKIT_NAVIGATION_POLICY_DECISION is basically (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION, WebKitNavigationPolicyDecision)) <str1ngs>daviid: technically I'am and I get messages. but I don't always connect via znc. reading the backlog now. <str1ngs>daviid: probably for GI we should not cast. since language binding more then likely can't handle something like that normally. I guess #introspection can suggest how to do this. <daviid>we/you could grab the g-inst slot value of the decision arg and use it to make a <webkit-navigation-policy-decision> instance <daviid>then pass that to get-navigation-action <daviid>the pointer points to a webkit-policy-decision and needs to be cast <daviid>str1ngs: by the way you ned to import goops before to set the duplicate handler, then import g-golf ... <str1ngs>my example my need updating. normally I use goops via define-module anyways <daviid>str1ngs: can you write, in your code, a casting func in C, so we could try? <daviid>(np-decision (make <webkit-navigation-policy-decision> <daviid> #:g-inst (cast-to-wnpd (!g-inst decision)))) <str1ngs>hmm for somereason when I GI return WebKitNavigationPolicyDecision * it returns <webkit-policy-decision> <daviid>you should only cast the pointer <daviid>if you write the C func cast2wnpd <str1ngs>I'm doing this via GI so I don't need to use !g-inst <str1ngs>g-golf is already pasing the pointer <daviid>you need to cast the gobject instance pointed by ... <daviid>you cn't just take the <webkit-policy-decision> instance and make a <webkit-navigation-policy-decision> using it ... it will complain 'just the same way' ... <str1ngs>returns ;; #<<webkit-policy-decision> 55606bc3a4a0> <str1ngs>daviid: I'm passing decicsion through g-golf via GI then I'm casing in C <daviid>how about what you suggested above? (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_NAVIGATION_POLICY_DECISION <daviid>can you cast and check the type in C before to return? <str1ngs>I'll check the type but WEBKIT_NAVIGATION_POLICY_DECISION casts to WebKitPolicyDecision to WebKitNavigationPolicyDecision <daviid>ok then if you (make <webkit-navigation-policy-decision> #:g-inst (nomad_get_navigation_policy (!g-inst decision))) it should work <str1ngs>no, I'm calling the C code via g-golf not guile C. so g-golf passes the pointers <str1ngs>(nomad_get_navigation_policy decision) should return webkit-navigation-policy-decision <str1ngs>err <webkit-navigation-policy-decision> <str1ngs>(dimfi (nomad-get-navigation-policy decision)) works just it's returning <webkit-policy-decision> despite the C function casing with return WEBKIT_NAVIGATION_POLICY_DECISION (decision); <str1ngs>so maybe it's only seeing the parent class here? <str1ngs>I could maybe use guile scheme and use pointers. <daviid>I would try to write and ffi a cast2wnpd C snipset, then try what i proposed <daviid>if that works, we can dig on your approach, which i know is more 'beautiful' ... but one step at a time <daviid>you can patch libg-golf.c[h] just to see if it works <daviid>str1ngs: can you describe (gi-cache-ref 'function nomad-get-navigation-policy) and see whast its return arg is? <str1ngs>daviid: that returns #f but nomad-get-navigation-policy returns $4 = #<procedure 55e999382ba0 at g-golf/hl-api/function.scm:128:2 args> <daviid>i thought you were using GI to import it <daviid>(gi-cache-ref 'function 'nomad-get-navigation-policy) <str1ngs>seems to be g-golf is using the parent class and not the child class <daviid> type-desc = (object <webkit-navigation-policy-decision> #f 94830832738512 #f) <daviid>if you call it, it should retur an instance of <webkit-navigation-policy-decision> <str1ngs>right but when I pass decision it still returns ;; #<<webkit-policy-decision> 55be92345720> <str1ngs> (dimfi (nomad-get-navigation-policy decision)) <str1ngs>if I cast and C then get the uri string. and return cons *gchar I get the uri <daviid>you still have the same repl you used to describe the function? <daviid>so you could try (g-type-name 94830832738512)? <str1ngs>where does 94830832738512 come from. that segfaults for me <daviid>in the paste of the describe ... <daviid>i just don't know why your function does return a wrong instance <str1ngs>$6 = "WebKitNavigationPolicyDecision" <daviid>i can't try, that is a problem :) <str1ngs>I'll just get the uri from C for now. I'm not sure why this is'nt working it did work at one point. <daviid>the code that returns the value is here <str1ngs>I don't think the function returns the wrong type. it seems g-golf is <webkit-navigation-policy-decision> handling correctly for some reason. <daviid>no, these are 'object (GObject subclasses) <daviid>the problem is i can't try, it doens't help :) <daviid>the code that returns theinstance is here <str1ngs>this function does need a transfer GI annotation. which I use Returns: (transfer full): <daviid>now, can you add a line there, after 1129 <daviid>before the line (set! (!type-desc funarg) ... <daviid>man debugging this way is the worst situation of my carrer, ever <str1ngs>;; #<<gobject-class> <webkit-navigation-policy-decision> 562988e32e40> <webkit-navigation-policy-decision> 94736371323440 <str1ngs>when I call (nomad-get-navigation-policy decision) <str1ngs>I gave the example that cause issues. my helper function is was just to be a work around. be are getting side track. but I suspect it suffers from the same issue. <daviid>ok, if you call it again, it shold prit these lines anymore, can tyou trry that <str1ngs>as far as i can see it only prints it once <daviid>what it printed, is the class of the instance it returns <daviid>so, the call shoud return an instance of ;; #<<gobject-class> <webkit-navigation-policy-decision> <daviid> 562988e32e40> <webkit-navigation-policy-decision> 94736371323440 <str1ngs>right yet (dimfi (nomad-get-navigation-policy decision)) returns ;; #<<webkit-policy-decision> 5631a6ed45c0> <daviid>you can see by yourself there is no other way, the instance is made line 1132 <daviid>using the class argument, defined by (g-object-find-class foreign) <str1ngs>well it returns <webkit-policy-decision> <daviid>it returns either the reuslt of the line 1127 or 1132 <str1ngs>anyways we are getting side tracked with this function. lets assume it's the function's fault. I still need to get a <webkit-navigation-policy-decision>. if not I can just extend the C to return the URI <daviid>str1ngs: i want to debug, i can not try <daviid>as i said the worst situation ever <str1ngs>you can use the example I gave you. the C helper function is just a work around really <daviid>i can't, i don't have your naoad cast <str1ngs>right but but I can just extend the C function to return the value I really need which is the URI <str1ngs>that does nothing to help for scheme in the long run though. <str1ngs>I can push the to a branch if it helps <daviid>str1ngs: to try i would need to be abe to do <str1ngs>daviid: I pushed to decision-policy branch of nomad if it helps <str1ngs>./pre-inst-env guile will give you a repl. and (gi-import "Nomad") imports the nomad namespace. <str1ngs>make run starts a development browser <daviid>str1ngs: i'm not going to do that <str1ngs>you will need emacsy and shround though to build. the rest of the dependencies are in debina. <str1ngs>well if you can't take time to build nomad. I don't know what to say. <str1ngs>I'll work around the issue in C. meantime you can figure out why the example does not work. <daviid>we know why the exmple does not work <daviid>you write the cast in nomad, i cvan'1yt try it <str1ngs>no, casting is a C concept GI bindings normally do not cast. I could write this example in GIJS and pygobject and I'm confident that they are not going to cast. in fact this code worked then stopped working. I'm just reporting the issue to you. <daviid>it needs a cast you can't just pass the pointer you have from the decision instance <daviid>you can try yourself, as i did paste earleri, doing <daviid>(get-navigation-action (make <webkit-navigation-policy-decision> (!g-inst decision))) will rise an exception ... <str1ngs>daviid: if you use this http://paste.debian.net/1158534 example with g-golf @ hash 30148389eed34a06f16e679be9ae59d9782d559f it will work. so somewhere between that hash and HEAD something broke. <str1ngs>I just switched to long names the example is the same as before <peanutbutterandc>Hello there. Is anybody here today? I have noticed that during the weekends the channel tends to get relatively quiter <peanutbutterandc>And I'd really like to be able to trace some of the recursive procedures that I am learning. I'd really appreciate a few pointers <daviid>str1ngs: i found why it did work and now it's not <daviid>no, but let me confirm a few things nhere first <peanutbutterandc>RhodiumToad, I was hoping it would be just my mis-step... does it look like a simple bug, sir? Or would it requier some serious debugging? <str1ngs>daviid: if it's not an easy fix. I can work around it. atleast you are aware of the problem now. <peanutbutterandc>RhodiumToad, Also, it seemed to me that after a call to (trace-calls-to-procedure proc1) (proc1 x y z) ought to be traced no matter what. They aren't. (Or perhaps my expecations aren't correct?) <daviid>str1ngs: well, the problem is it should not 'have worked' <RhodiumToad>;; Note that because this procedure manipulates the VM trace level <RhodiumToad>;; directly, it doesn't compose well with traps at the REPL. <daviid>and now properly fails ... though i still need to try a few things before i can explain why and how to address these situations in newer versions of g-golf ... <str1ngs>well I just use a C function to handle this meantime <RhodiumToad>trace-calls-to-procedure has this: (define (return-handler frame depth values) <RhodiumToad>looking at the place where that handler is called, in (system vm traps), it is only passed 2 args. <daviid>str1ngs: ok but i really wish i could find out why the previous didn't work <RhodiumToad>(print-return doesn't need to be passed the values, it gets them itself using frame-return-values given the frame parameter) <peanutbutterandc>RhodiumToad, Does this mean that you will be submitting a patch soon, sir? <peanutbutterandc>RhodiumToad, May I also ask why does the procedure have to be turned into a hunk and called with (call-with-trace (lambda () (procedure 1 2 3)) in the first place? <peanutbutterandc>I was really expecting (procedure 1 2 3) to be traced after I did a (trace-calls-to-procedure procedure) call <RhodiumToad>I would guess that the vm trace level is not set to enable traces by default. <RhodiumToad>call-with-trace increments the trace level inside its dynamic context. <peanutbutterandc>RhodiumToad, I see... so it is all just an extra formal argument in the procedure definition that is causing the trouble? <RhodiumToad>(add-trace-at-procedure-call! reverse) might be better <RhodiumToad>(has the same bug, but should avoid needing to play with call-with-trace) <RhodiumToad>looks like this is a regression from 2.2->3.0, in 2.2 the calling convention for the return handler is different, and it looks like the conversion to 3.0 was improperly done and not tested <daviid>str1ngs: here is the exact commit that changes work/doesn't work anymore 2f161c81d99ebe8928ad3da0bfa94e1052152345 <peanutbutterandc>RhodiumToad, I just tried (add-trace-at-procedure-call! reverse) and it took me to a debug prompt. I have yet to learn about debug prompt well enough: with all the things about stack frames and all. Is there any lecture/book/manual that you'd recommend regarding the matter(s)? <daviid>before that commit, methods were imported as procedures, and there were no short name methods <RhodiumToad>peanutbutterandc: you need ,use (system vm trap-state) for that one <daviid>after that commit, (gobject) methods are imported as goops methods, and g-golf provides short name methods <RhodiumToad>peanutbutterandc: if you find yourself in a nested prompt, usually the most useful thing to do is to control-d out of it, unless you actually want to find out where you are <peanutbutterandc>RhodiumToad, I did (use-modules ...) lol Let me try that then. Thank you for the pointer <daviid>str1ngs: so, before, webkit-navigation-policy-decision-get-navigation-action is a procedure, there is no dispatch by goops on its first arguent <RhodiumToad>(use-modules (system vm trap-state)) would have worked too <daviid>after the commit, webkit-navigation-policy-decision-get-navigation-action is a generic function, with one method, the argument of wich <daviid>_must_ be and instance of a <webkit-navigation-policy-decision> <daviid>and can't be a 'blindingly passed pointer' as it was before <peanutbutterandc>RhodiumToad, No sir. It is still just throwing me into a debug repl. Am I supposed to see an actual trace? <daviid>ok, great, now, let's see how to addres this <str1ngs>daviid: my nomad-get-navigation-action is probably not ideal since it returns a pointer for some reason. lol <str1ngs>and (webkit-navigation-action-get-request action) doesnt seem to care <RhodiumToad>peanutbutterandc: add-trace-at..., not add-trap-at... <daviid>let's focus on get-navigation-action and its argument <RhodiumToad>peanutbutterandc: using add-trap-at... tells it you want to actually stop and go to the debug prompt when that function is called. <daviid>it needs an instance of <webkit-navigation-policy-decision> <peanutbutterandc>RhodiumToad, silly me. Sorry for the inconvenience. I will rectify the error right away <daviid>but we know, because it worked before, that the decision instance pointer is/should be accepted, since that is what was passed before the commit <peanutbutterandc>RhodiumToad, Yes, sir. It works. But stumbles upon the same error (I think it might be the same error) as the other one... <daviid>though i would prefer to cast the pointer <str1ngs>daviid: I don't see how to do that in scheme. all I have is <webkit-policy-decision> so without same way in GI to convert to <webkit-navigation-policy-decision> there is not much I can do. <RhodiumToad>you can just edit that line in system/vm/trace.scm and recompile it with guild compile <str1ngs>maybe using glib primitives it can be converted <sneek>wingo?, pretty sure was seen in #guile one month and 7 days ago, saying: all hail godbolt. <sneek>civodul was last seen in #guix 3 days ago, saying: nckx: re truth.png :-). <daviid>yes, if casting there is, it must be by calling a C function, just like we do in libgog-olf for gdk events ... <peanutbutterandc>RhodiumToad, I see. Thank you sir. I will try to do just that. You're super awesome! <str1ngs>daviid: casting is a C concept and Glib has C Macros that do that. I don't know how you would leverage that. #introspection should explain how to do this. <daviid>but the thing is that it seems it should, in this specific case, accept a <RhodiumToad>peanutbutterandc: it's your bug, I'll leave it to you to post the patch <daviid>(make <webkit-navigation-policy-decision> (!g-inst decision)) instance <str1ngs>daviid: its the generic method that causing the issue. for better or worse I guess <daviid>because that 'mimic' what was before the commit <peanutbutterandc>RhodiumToad, Oh no sir. I'm just a n00b. You should post the patch. I'm only an inspector Lestrade to your Sherlock holmes <RhodiumToad>iirc it's not published anywhere? but I could be wrong <daviid>str1ngs: well, we can rgue i gues, but goops is showing how superiror it is here, not the opposite, but let's this argument for academic ... let's try to solve it <peanutbutterandc>RhodiumToad, I see... I hope you will be posting the patch soon, too, sir? I put the matter into your most capable hands. :) And off I go git cloning guile <peanutbutterandc>RhodiumToad, I really don't think I should take credit for your work. One person reporteth. The other fixeth it. Perhaps? But if you insist I will make the change (with the proper credit in the commit message, of course) <RhodiumToad>you don't have to take credit, you can credit me for it all you like <RhodiumToad>what you _don't_ get to do is dictate how I spend my time. <peanutbutterandc>If anything, I am most grateful for you having resolved this issue for me. Thank you very much. I will put in a patch and will credit you in the commit message. <peanutbutterandc>Strange, `info guile` does not have a 'submitting patches' or 'contributing' section (the regex search fails) <peanutbutterandc>RhodiumToad, Please pardon me but https://www.gnu.org/software/guile/contribute/ says that I ought to turn the example that triggers the bug into a test case. I don't know anything about writing test cases in guile. Do you think it is okay to not write a test case since this is only a matter of removing a formal parameter from the definition? <chrislck>(I haven't followed the above bug hunt closely) <peanutbutterandc>chrislck, I am a n00b. May I please be directed to a resource for writing tests in guile please? <chrislck>Write the minimum LOC to trigger the bug <RhodiumToad>(define (foo l) (if (null? l) '() (append (foo (cdr l)) (list (car l)))) (add-trace-at-procedure-call! foo) (foo '(1 2 3)) <RhodiumToad>doesn't matter what the function does as long as it recurses <peanutbutterandc>Since I am a python-n00b too, I remember seeing unit test module in python. And, if used properly, one could only run the tests. I was wondering if there was something similar in guile <chrislck>don't worry about writing unit tests in guile... just minimum LOC to demonstrate a bug, and send to bug-guile@gnu.org, and magically some guile hacker will get round to it <peanutbutterandc>chrislck, Some guile hacker did get round to the issue and did fix it and has told me to send in the patch. And now here I am, feeling like I'm pushed into the Operation Theater in my first year of med school :D But I think I'll learn a bit from this experience. :) *RhodiumToad is just zis guy, you know? <chrislck>IIUC No Rhodium didn't fix it, just pointed out how. The main repo still has bug. <RhodiumToad>though I suppose I do count as a contributor since my name is in the commit log now, indirectly <peanutbutterandc>And that is why I don't want to take the honour from you. You should have your name in the contributor list. Proudly. But that is just my opinion sir. <peanutbutterandc>But I am preparing sending in the patch. Because you have asked me to. And orders are orders. <chrislck>(still no idea what's the bug that's just been found) <RhodiumToad>looks like an editing error when converting 2.2 -> 3.0, and not tested ***jonsger1 is now known as jonsger
<peanutbutterandc>Hmm... there seems to be a bunch of .test files in the repo, under 'tests' sub-dir, that use (test-suite) module... *RhodiumToad compiles up latest guile on his raspberry pi <RhodiumToad>still need to patch the off_t thing for 32-bit freebsd :-( <chrislck>... all this talk of of peanut butter and pie gets me hungry <chrislck>none the files on that repo are loadable as is in guile <chrislck>i.e. although it's finalised, the repo code is not usable <peanutbutterandc>Okay... this is stupid, but how do I compile guile, again? `autoconf && ./configure && make` ? o.O <daviid>str1ngs: so, you/we are being bitten by a fundamental principal/rule/hypothesis and a pillar at the 'heart' of g-golf design: instances are unique - to a gobject instance correspond one and only one goops instance and vis-e-versa <peanutbutterandc>I have done `guix environment guile` then `autoconf` then `./configure` throws an error "can't find install-sh, ... in ./build-aux" ***sputny1 is now known as sputny
<daviid>str1ngs: hence, gobject instance pointers can be and are cached, so when a gobject lib returns an instance, g-golf returns its goops instance ... pretty obvious one could say ... this is 'hard coded' in g-golf using the mop (the meta object protocol), which is good <peanutbutterandc>It appears that `guix environment guile` doesn't give me automake and friends that are required to run autogen.sh. Any ideas as to what might be going wrong here? <daviid>str1ngs: i see two solutions: (1) copy the gobject instance, so it's a new pointer, we can use it to create a new goops instance or (2) remove the instance from the cache, keeping its gobject instance pointer, so we can create a new goops instance as well <daviid>in the second case, one must be sure the instance to be removed is not referenced (a user responsibility I mean) and g-golf could provide a 'cast' method which would do exactly that, keep the gobject pointer, remove the revious instance from the cache, and then create and cache a new instance <daviid>in this scenario, it would be the user responsibility that the 'new' class for the gpointer is 'adequate', like it would be the case for this example we are talking about <daviid>str1ngs: ok, let's think about this a bit more, need to rest <peanutbutterandc>RhodiumToad, I see. It's all right sir. I am trying the normal route now (without guix environment) <RhodiumToad>though you may need to do things like specify the correct libgc library to use according to whether threading is enabled or not <peanutbutterandc>RhodiumToad, I finally got autogen.sh running but it currently gives me AM_GNU_GETTEXT macro not found in library error thingy <ArneBab>RhodiumToad: do I see it correctly that your letrec-solution is equivalent to this? <ArneBab>(define (transpositions l) (define (rot o) (map (lambda (e) (remainder (+ o e) 12)) l)) (map rot (iota 12))) <ArneBab>ah, sorry, you showed that next — sorry for the noise :-( <peanutbutterandc>Okay this might be really stupid... but I can't seem to figure out where is the built guile (built from source) <dsmith>peanutbutterandc: To submit a bug report, send it as an email to the above address <peanutbutterandc>dsmith, Oh... it wasn't a bug... turned out to be my ~/.guile causing the problem. A good little -q and the issue was gone. Thank you nevertheless. <peanutbutterandc>Do I send the patches to the same email thread as the bug report in question? o.O <mwette>yes ; attach the patch to the email going to bug-guile@gnu.org <dsmith>peanutbutterandc: Yes, send in the patches with the bug report <ArneBab>mwette: can we treat the question by peanutbutterand… as bug report about the contributing page? Maybe change from <ArneBab>"Please send a patch and commit log as produced by git format-patch." to <ArneBab>"Please send a patch and commit log as produced by git format-patch to bug-guile@gnu.org." <dsmith>I'd send a patch about fixing how to send a patch but I can't find out how to send a patch... <ArneBab>(point taken, I’ll send a patch when I get to it) <mwette>the instructions are on the guix page IIRC <str1ngs>daviid it keeps the same pointer. with GLib the C macros that cast to type checks etc. it's considerbly safer with GLib then just doing. WebKitNavigationPolicyDecision *navigation_decision = (WebKitNavigationPolicyDecision*) decision. <str1ngs>daviid: what types are effected by this issue. derived interfaces? ***terpri_ is now known as terpri
<ArneBab>it now uses small chunk sizes at the beginning öf the file (32KiB), then 256KiB within the first 2MiB and afterwards 2MiB chunks. <ArneBab>pkill9: wispserve is a small local fileserver I built after I searched fruitlessly for two hours for "simple way to stream local files so I can watch them in a webbrowser on another computer" <dsmith>ArneBab: Why the increasing chunk sizes? <ArneBab>pkill9: not quite as convenient (it shows all files, no folder structure) <ArneBab>dsmith: because when you’re accessing a video from the browser, having a big initial chunk introduces wait times (in my local test 32KiB take 11ms, 256KiB already take 70ms). Afterwards I want to reduce the overhead from additional requests <ArneBab>dsmith: that’s just from local testing, because browsers do not really request the sizes as they are optimal <dsmith>Nice. Initially optmize for latency, later for bandwidth. <ArneBab>dsmith: the reason that got me to check that initially is that I get GC warnings when I access large files. <ArneBab>(that’s the not-that-glorious reason :-) ) <ArneBab>but yes, in hindsight it’s a good idea :-) <ArneBab>though most stuff is still missing — like mime types <ArneBab>do we have a library with extension-to-mime-type mappings? <str1ngs>ArneBab: it's not ideal but you call file -i /path/to/file to get a mime type <str1ngs>which is better then extensions since it uses file magic. just requires file program <str1ngs>though I think file magic is better IMHO :) <a_v_p>Had problems with Emacs Gnus configuration, so my previous messages got lost on the way to the ML. <dsmith>I need to get back to using Gnus. TimeWarner/Spectrum has totally broken their webmail interface. <ArneBab>str1ngs: I now moved to file-magic, but also had to change from checking that for every request to tracking it in the downloadable files, because I cannot afford the second disk-access for every chunk. <ArneBab>I didn’t think that that would have such a big effect, but it does <str1ngs>ArneBab: yeah it's not ideal due to the fork called either. <str1ngs>ArneBab: I'm assuming file-magic using file -i? <ArneBab>it’s now only called when the file is first accessed (which is also when I ran sha256 over the file so it can be accessed via uri-res/raw/urn:sha256:<sha256> <ArneBab>str1ngs: actually file --mime-type, because the content type from file isn’t the one I need in the webserver <ArneBab>(I need "ISO-8859-1", because of reasons?) <ArneBab>(I guess it’s the standard port encoding) <ArneBab>when I pass that as charset the browser correctly decodes what it gets <ArneBab>I’m a bit worried about GC problems, though. <str1ngs>slight offtopic, ironically I'm working on adding download support to nomad for unsupported webkit mime types. <str1ngs>are you using (web server) ArneBab ? <ArneBab>str1ngs: I’m actually using (fibers web server) by wingo <ArneBab>str1ngs: crazy idea: in this server I implemented pre-liminary X-Alt and X-NAlt support so downloads could be retrieved from multiple sources without the need for a tracker <ArneBab>str1ngs: is that something you could pull into nomad? <str1ngs>Assuming it uses handlers like (web server) I guess you might have a static file handler in this case? <str1ngs>it should be cheap to get the mime type just before opening the file. file magic tends to read a limited amount of bytes <ArneBab>it’s actually not cheap, because I serve range requests and separate them <ArneBab>what I do is getting the mime-type for the file if I don’t know it yet <ArneBab>str1ngs: the file-server retrieves the shared files at startup and then checks its vhash path->file to get metadata about the file <ArneBab>str1ngs: and every file is a record: served serverpath accesspath size mimetype sha256 <ArneBab>(port (open-input-file abspath #:binary #t)) → (data (if end (get-bytevector-n port (+ 1 (- end begin))) (get-bytevector-all port)) → bytevector->string data "ISO-8859-1" *ArneBab just saw where he actually gives the encoding explicitly … <facepalm> <str1ngs>ArneBab: do you hash the files are server startup? <ArneBab>yes, or at first access if I pass --lazy <ArneBab>for the future I still need to hash chunks so they can be validated <str1ngs>I guess that is not bad. alternatively you could just hash the restful path for uniquness <ArneBab>The hash is also intended to provide validation of a file downloaded from many sources <str1ngs>hashing chunks seems sophisticated :) <ArneBab>I want to implement a variant of the Gnutella Download Mesh: swarming as with bittorrent but using standard HTTP <str1ngs>interesting idea. I wonder if maybe gnunet would be helpful here? <ArneBab>that it became a video streaming tool is more or less an accident (I wanted to stream videos to our TV) <ArneBab>AFAIK GNUnet is much to complex for that <str1ngs>I thought it had the building blocks for this. ie distributed hash table . whih is what bittorrent is based off of <ArneBab>What I’m missing for full compatibility with actual Gnutella-clients is a TigerTreeHash implementation <ArneBab>That’s all much more complex than what Gnutella used very successfully <str1ngs>I trust your judgment here, it's kinda out of my knowledge base. <ArneBab>Gnutella enabled multi-source downloads with just 4 additional headers <str1ngs>also there is IPFS though that would lake guile bindings. *ArneBab used to be moderator on the gnutella development list when he was still useless at coding … <ArneBab>That’s why I can grab for rough memories to find my way back into the RFCs <str1ngs>btw this might be useful for guix in the context of P2P substitutes :) *ArneBab started giving a spring lecture about distributed systems in 2019 to help keep those developments known <ArneBab>that’s why I started doing it in Scheme, I just didn’t get it to a state yet, where I could integrate it and file a pull-request so Guix substitutes could be swarmed by all those who need them <str1ngs>there was some talk of use IPFS due to NIX's interest in that protocol. not sure where that is at. <ArneBab>IPFS is a nice system, but it needs a tracker. What I like so much about the Gnutella Download-Mesh is that it needs minimal support from the server <ArneBab>The server can even die and all members of the swarm can still complete their downloads (if enough stay active after they finish so the whole file is still available). <ArneBab>It needs a seed-server which hands out the IPs of the most recent requesters <ArneBab>also it needs validation data for the chunks <ArneBab>Gnutella used a merkle-tree to provide that validation <ArneBab>I’m thinking about simplifying that as BitTorrent did it and just providing a list of chunk-hashes, though it won’t be compatible then :( <str1ngs>simple is better. I like the idea regardless. the less centrally the dependent the client's are the better. <ArneBab>In theory I prefer merkle-trees: then the server can simply provide the merkle-tree root and the clients can exchange ranges themselves. <ArneBab>AFAIK that’s merkle-trees by another name :-) <pkill9>is there a way to readlink recursively and get the final directory? <ArneBab>Ah, no "there are no balance requirements" ← DAG vs. Tree <pkill9>str1ngs: I'm not sure that does what i want, I want the functionality of 'realpath' <str1ngs>pkill9: think canonicalize-path can get absolute path, I think that's what you want? <pkill9>yea i realised i can, i'm shelling-out atm <str1ngs>I could have misunderstood what you meant by realink. I assumed you wanted to walk a path then get the absolute path of the last directory. <str1ngs>hopefully I understood that correclty <pkill9>yea, i thought ftw is for going through directories <RhodiumToad>maybe you could convince the ffi to allow you to call that directly <dsmith>The realpath (3) manpage has dire warnings about portabale ways of determining the correct buffer size. Maybe that's why it's absent. <dsmith>Sorry, seems like that's for the earlier posix spec, a later spec makes it all better. <RhodiumToad>does scm_from_stringn always copy the string? the docs aren't 100% clear