IRC channel logs
2018-02-26.log
back to list of logs
<amz3>yet another layer of lasagna... <amz3>ahem I mean another layer of lambda <Apteryx>what's the scheme way to filter out a list of items from another way? <justin_smith>Apteryx: you can use filter which takes a lambda and a list, and inside the lambda use find to see if an element is in your other list <justin_smith>or perhaps remove is simpler here (same as filter, except meaning of predicate is reversed) <amz3>isn't it a list set operation from srfi-1? if the lists are sorted it can be fast <Apteryx>oh, maybe filter-map is even more concise <Apteryx>nah, the only use case for filter-map is getting rid of #f in the resultant list. <Apteryx>justin_smith: I'll check out 'find', I didn't know about it. <amz3>nice, I did not know about filter-map,, I always do (filter values (map proc lst)) <amz3>I never remeber which boolean value must return filter's predicate to retain the value <amz3>I think, that #t means retains the value <justin_smith>sounds right -in clojure it would be anything but false/nil <Apteryx>is there any readily availabel predicate factories? <Apteryx>so that I could concisely do: (remove (any-of my-subset) the-superset) <amz3>Apteryx: maybe srfi-26 might come handy in those cases <amz3>see cut in the procedure index <justin_smith>Apteryx: you don't need to - any non #f value suffices (just verified in my guile repl) <justin_smith>Apteryx: and I was wrong about find, the thing you want is member <justin_smith>(filter (lambda (x) (member x '(0 2 4))) '(0 1 2 3 4 5 6)) => (0 2 4) <justin_smith>and you want remove not filter of course - easy swap out <MaliRemorker>Emacs users, I've noticed that `define*' doesn't follow the standard identation for `define'-like constructs with the scheme major mode. Does anyone have an idea how to fix this behaviour? <MaliRemorker>Turns out, (put 'define* 'scheme-ident-function 1) this command will make define* ident like define, which is nicer. <chrislck>guile users, anyone has any experience in running code-coverage-reports? <amz3>I will be glad to know how it code coverage works in guile <amz3>I will be glad to know how code coverage works in guile <chrislck>not sure who to report to, but the guile manual for code coverage example code has a typo (call-with-values (lambda () <civodul>chrislck: it's not a typo: you're using Guile 2.0 but this manual is about 2.2, which introduced this change <chrislck>ah thank you i've been running the 2.2 manual on my guile-2.0 <muto>Hello, hello! Is there any way to disable the copyright notice on the Guile REPL startup? <muto>It's a trivial reason, nothing important. I just find it a minor annoyance as it takes up a fair amount of screen space. <bavier`>muto: If you use 'run-repl from (system repl repl), you can first override 'repl-welcome in (system repl common) <bavier`>muto: I think you can also do the same from ~/.guile <bavier`>(module-set! (resolve-module '(system repl common)) 'repl-welcome (const #t)) <amz3>const is another form I'd like to use some day <amz3>is there some self balancing tree datastructure that is available in guile? <amz3>I mostly need to compute min / max values <justin_smith>amz3: one classic trick is to use a hash table with the item as its own key to make a set <justin_smith>with the right key function, you should be able to to find min and max items quickly <justin_smith>amz3: specifically this would mean using alist->hashx-table which allows you to supply your own hashing function - maybe this is too complicated <amz3>I am not sure how it works <amz3>what would be the hashing function? <amz3>I never used custom hasing function <justin_smith>amz3: something that takes a value and returns a number, you could look at what the built in "hash" function uses - but the essential bit would be to ensure the value you consider "minimum" would have the lowest returned value from the hash etc. <justin_smith>it could be that the built in hash does works for your data <justin_smith>amz3: for example in my repl (hash 1 1024) => 900 and (hash 100 1024) => 640 <justin_smith>so it wouldn't be a good hash for numbers if keeping things ordered is your goal <justin_smith>this is all speculation, but it's what would work in clojure :P <OrangeShark>amz3: I remember seeing a balanced tree implementation, but can't seem to find it