<fnstudio>i was expecting it to terminate when it gets to 100, but it does not <fnstudio>my (clearly mistaken) expectation is based on some (only apparently) similar pattern that i've seen elsewhere <fnstudio>ah, no, wait, i think i see it now... it never leaves the recursion <mwette>misplaced paren maybe the (counter ....) should in the (if ...) ***amiloradovsky1 is now known as amiloradovsky
<RhodiumToad>so I did another attempt at that cartesian product macro, using only syntax-rules <RhodiumToad>I'm pretty sure this doesn't have the memory allocation issues of the previous attempt. ***srandon111 is now known as suchablyat
***suchablyat is now known as sookablyat
<daviid>weinholt: (and any guile-lib users) hello! I pushed 4 patches to guile-lib devel branch, so make distcheck pass with both 2.2 and 3.0.4 <daviid>I didn't solve the deprecated related msg yet, nor the other 'unbound variable c warnings' (as it appears in 2.2 'as is' as well <daviid>there are quite a few additional warnings running make (when building the doc) while using guile-3.0, but make distcheck pass - so, please feel free to check, clone and checout the devel branch ... when everything is proved ok, i could merge to master, bump to 0.2.7 and release <fnstudio>the underlying problem is that i'm not sure i've a clear understanding of the way strings and expressions are handled <fnstudio>so, there's something that's printed on the screen as `abc` but then apparently that doesn't match with `abc` in a case statement <fnstudio>but i'm having similar problems beyond case-statements so i must be missing some understanding <fnstudio>ok, i think i see what the problem is or what it is related to at least <fnstudio>i suppose case uses eqv? instead of equal? <tohoyn>fnstudio: What is the value of 'item'? <tohoyn>fnstudio: according to R6RS 'case' uses 'eqv?' <fnstudio>tohoyn: `number`, in particular, is shown as above, with no quotes <fnstudio>however, if i display (string? key) i'm told it's a string <fnstudio>(and thanks for confirming case uses eqv?) <fnstudio>so i guess i now have two questions: the first is whether there's a common pattern to use case with a different equality <tohoyn>fnstudio: define an own macro for that <fnstudio>the second would be about investigating why key and "number" are not reported as eqv but only as equal <tohoyn>fnstudio: eqv? returns #t for two strings if the strings are the same object, i.e. they have the same address <tohoyn>The debianized version of g-golf gives the following error with test-case test-g-property-object: FAIL: tests/hl-api.scm <tohoyn>Unable to init server: Yhdistäminen ei onnistunut: Yhteys torjuttu <tohoyn>(guile:10754): Gtk-WARNING **: 12:34:21.150: cannot open display: <tohoyn>error message in English: "Connecting did not succeed. Connection rejected." <tohoyn>all the tests work fine when run normally (not building a Debian package) <fnstudio>and might there be a way of reducing two strings to a canonical form so that they result eqv? (not just equal?) <tohoyn>fnstudio: what should the reduction return if the strings are not equal? <fnstudio>tohoyn: what i mean is that the strings are equal? but reported as not eqv? (probably for the reason you explained above); i was wondering if there's a way to reduce both strings to a third "thing" so that they'll then be reported as eqv? <tohoyn>I tried to build the Debian package with debuild. I suppose it does not use a chroot environment. <tohoyn>fnstudio: (if (equal? str1 str2) str1 ...) <fnstudio>tohoyn: yeah, i'm probably overcomplicating it, i suppose i can switch to an if-statement and use equal? straightaway <tohoyn>fnstudio: I suggest using a hash table with equality predicate 'equal?'. <fnstudio>i just thought there might be an idiom to do this with case <tohoyn>fnstudio: when you use hash-ref for that kind of hash table you always get the same object for two identical strings <tohoyn>see section 6.6.22 in the guile 2.2 info pages <fnstudio>cool, more in general, you mentioned R6RS above, what do you think my points of references should be when learning scheme? http://www.r6rs.org/ ? together with the guile docs? <tohoyn>fnstudio: R6RS is the most important document. You should also look at R7RS. <tohoyn>does anybody have an idea why GTK can't open a display? <tohoyn>fnstudio: Theme-D is a strongly typed language resembling Scheme <RhodiumToad>leoprikler: do you mean that in a good way or a bad way? :-) <leoprikler>it's nice to have this in pure syntax-rules, but the let-bindings are super confusing if you don't know what Scheme does to keep them hygienic <tohoyn>daviid: could you help me with the failing test case? <RhodiumToad>leoprikler: this seemed to me to be a case where the hygienic stuff could be used to advantage <RhodiumToad>so, yes, the inner call ends up as (proc i i i) or whatever, but the i's are different bindings (and this is visible if, for example, you decompile the tree-il back to scheme) <leoprikler>a good example for why macros should wash their hands and wear masks :) <tohoyn>daviid: the problem is that gtk-init fails to make a connection <fnstudio>i have this long chain of if-s that i would like to transform in a case statement <fnstudio>the main reason for that is that i'd like my procedure to return the value provided by the first matching if statement <fnstudio>say if key is aaa do this, if key is bbb then do that <fnstudio>but i'd like it to terminate as soon as key is matched with, say, aaa <RhodiumToad>you can use case as long as all the conditions are (eqv? key someconstant) <fnstudio>i don't seem to be able to use case because of its reliance on eqv? as opposed to equal? - at least i think that's the issue there <RhodiumToad>if the conditions are more general, then cond rather than case would be the thing to use <fnstudio>RhodiumToad euandreh, ok, cool, that's great, i'm going to give cond a try then *RhodiumToad first learned lisp on an implementation where cond was literally the only conditional construct, so tends to use it fairly often <leoprikler>if conditions are really dire, you should try ice-9 match <leoprikler>RhodiumToad: now you know how to implement case in terms of cond :) <sookablyat>RhodiumToad, i learned lisp on a dragonflybsd on powerpc64le where i had to code my lisp interpreter in powerpc assembly <sneek>Welcome back spk121, you have 1 message! <sneek>spk121, leoprikler says: the documentation for scheme bindings has apparently been merged <sookablyat>RhodiumToad, start to hack with the DragonFly on A powerPC dude <sookablyat>you will discover the wonders of using a REAL unix <mwette>RhodiumToad: that looks promising but when I copy and try to run I get: Unbound variable: #{\x200b;}# <spk121>mwette: #x200b is ZERO WIDTH SPACE (U+200B) which usually means that you copied an HTML line break or something like that <mwette>Got it now. The display had some junk. <mwette>RhodiumToad: Clever. Looks nice. <mwette>sneek: later tell RhodiumToad That looks nice. Clever job! <mwette>I didn't have javascript enabled for dpaste.org. Enabled, now the copy works. <mwette>sneek: later tell RhodiumToad I need a fold also: (cartesian-fold proc 1 '(a b c) '(d e f) '(g h i)) -- I will take a shot but you might get it faster. <daviid>sneek: later tell tohoyn I am afraid I can't help you, it is a debian 'package building environment' problem, which I know nothing about, but it appears that the building environment does not to have a X11/Wayland server available, hence gtk-init fails ... you should ask for help to 'debian', maybe #debian-next (irc.oftc.net), might help or suggest 'where' to ask ... <fnstudio>hi, can anyone suggest an obvious "translation" of python's group-by to guile? (i'm not even sure the question makes sense, maybe i'm supposed to use a particular idiom/pattern instead of a function) <ArneBab>fnstudio: what do you mean by group-by? <fnstudio>ArneBab: i have a list of pairs and would like to group them together, depending on one of their elements <fnstudio>actually, i'd be fine in just counting them, i.e. how many there are for each coordinate x (suppose the pairs are (x, y)) <ArneBab>do you mean something like '((1 . 2) (1 . 5) (2 . 4) (1 . 3)) to '((1 2 5 . 3) (2 . 4)) ? <fnstudio>ArneBab: i was thinking of '(1 . 1)(1 . 2)(1 . 3)(2 . 1)(2 . 2) to '(1 . (1 2 3))(2 . (1 . 2)) <fnstudio>(not sure if i got the formatting right though) <ArneBab>that’s what my version boils down to, only with less overead :-) <ArneBab>Scheme is typically somewhat more low-level than Python, or rather more abstract <fnstudio>yeah it looks great, i find it very interesting for that reason <ArneBab>it’s not complete and 2-3 years out of date on my own progress, but it should get you over the initial bumps <fnstudio>"You must unlearn what you have learned" :) <ArneBab>I am, yes — and I’m glad you like it :-) <fnstudio>great stuff, thanks, i'll let you know how it goes with that <ArneBab>fnstudio: you might be able to do something elegant with a map <ArneBab>One more hint that I learned after py2guile: Use info (standalone or info-mode in Emacs) and look for tools with full-text-search. <ArneBab>fnstudio: how much efficiency do you need? Is memory an issue? <fnstudio>ArneBab: i was able to find a quick and dirty solution - for now <ArneBab>(define (assoc-increment! key alist) <ArneBab> "Increment the value of the key in the alist, set it to 1 if it does not exist." <ArneBab> (assoc-set! alist key (or (and=> (and=> res cdr) 1+) 1))) <ArneBab>(fold assoc-increment! '() (map car xydata)) <ArneBab>(define xydata '((1 . 1)(1 . 2)(1 . 3)(2 . 1)(2 . 2))) <ArneBab>fnstudio: this should do the counting <fnstudio>ArneBab: thanks, efficiency is not a major concern, it's more using this an excuse to get a bit more familiar with guile <fnstudio>which includes the fact that i want to improve, therefore also aim for efficiency, but it's not top priority <fnstudio>ArneBab: thanks for your snippet - i'm going to save it and study <ArneBab>I’ll put it on my site — that’s an issue that will come up more often. In Python I’d have used collections.Counter <fnstudio>thanks for the tips about reduce and emacs/info as well, by the way, i didn't miss those as well <fnstudio>it's very rewarding; i really wish i had encountered lisp earlier in my life <ArneBab>would you like to be referenced as person who asked? <fnstudio>ArneBab: well, i'm totally happy with that, but i feel i have contributed so little! :) <ArneBab>Asking a question at the right time is a skill of its own :-) <fnstudio>ArneBab: feel free to reference my name and this bit of the chat (if logged) if you like, but don't feel obliged <ArneBab>the name fnstudio is ok? (that’s all I see from you) <ArneBab>thanks :-) — will be updated in a few minutes