IRC channel logs

2020-12-27.log

back to list of logs

<daviid>ruffni: here it failed with a 1020 error (iirc - I run tor with a few extensions, no-script did block one or more script(s) on that page ... I had to restart tor since and now it worked - no idea why, but debian and gnome are much better services, no script, no tracking, no none free js ... and, last but not least, they have a 'scheme' language renderer ...
<daviid>ruffni: anyway, others did help i see ...
<daviid>ruffni: the snipset you pasted is incomplete, your code already triggers error compiing, then you do not shoe the class intantiation, nor the method call, and did not pste the error either .. :):)
<spk121>civodul: what's the best strategy for making patches to Guile happen these days?
<daviid>ruffni: to much to guess :) - no pun, but I kindely invite you to write complete, smallest possible 'self contained' examples, so one can copy/paste(drop in a tmp file, compile/execute and reproduce the error ...
<daviid>ruffni: fwiw here is goops tutorial - https://www.wedesoft.de/software/2014/03/02/oop-with-goops/
<daviid>sneek: goops?
<daviid>sneek: goops-tutorial?
<sneek>Someone once said goops-tutorial is https://www.wedesoft.de/software/2014/03/02/oop-with-goops/
<daviid>ruffni: fwiw as well :), gauche (scheme), which also implements a (large) subset of the clos protocol (also based on stklos, like guile), precisly uses a <2d-point> and <2d-vector> classes for its introduction manual - http://practical-scheme.net/gauche/man/gauche-refe/Introduction-to-the-object-system.html#Introduction-to-the-object-system (the syntax used by gauche, is (sometimes) a bit different, but you should be able to easily
<daviid>adapt, ask for help otherwise ...)
<tohoyn>sneek: botsnack
<sneek>:)
<fnstudio>hi :) if created with make-vector or vector-copy, a vector seems to be modifiable at a later stage; if created with `#(0 1 2 ...)` however, it seems it can't be modified?
<fnstudio>i've tested this with vector-move-left!, for example
<fnstudio>if i try to "move-left" onto a #()-created vector, i get "Wrong type (expecting mutable vector)"
<fnstudio>things seem to work as expected (as *i* expected :)), if trying with a "make-vector-created" vector
<RhodiumToad>yes, literal things constructed by the reader are not supposed to be mutable
<leoprikler>it should also work if you create your vector using (vector )
<leoprikler>but maybe that's just in the interpreter ._.
<RhodiumToad>that should work too, (vector ...) is like (list ...) in that it returns a new object
<fnstudio>RhodiumToad: i see, that makes sense (well, not yet completely as i still need to wrap my head around these details, but i think i'll get there)
<fnstudio>thanks
<chrislck>'() and #() create immutable objects
<chrislck>IIRC there are optimization opportunities but I'm likely wrong
<RhodiumToad>because if they were mutable then it would be weird to have the program scribbling on its own literals
<fnstudio>chrislck: right, i see
<fnstudio>there don't seem to be much procedures to search values within a vector, by looking at the docs here https://www.gnu.org/software/guile/manual/html_node/Vector-Accessors.html
<chrislck>the lack of vector search api means it's probably the wrong data structure to use
<chrislck>did you read The Little Schemer?
<RhodiumToad>fnstudio: srfi-43
<RhodiumToad>though that doesn't necessarily make it the right data structure.
<fnstudio>chrislck RhodiumToad: very interesting... yes i was just wondering whether i should use a vector or a list or a hashtable
<fnstudio>and i thought of trying and familiarising myself with vectors a little bit
<fnstudio>but i might have chosen the wrong case
<fnstudio>to be honest, it's for this exercise https://adventofcode.com/2020/day/23
<fnstudio>i need a data-structure to handle 10 numbers (actually 0-9) and to modify it and iterate on it
<fnstudio>i suppose everything would do, as it doesn't seem to be a very resource intensive exercise
<fnstudio>but i wanted to take it as an opportunity to use the most suited structure
<fnstudio>s/most/best
<fnstudio>i also thought of a circular list
<chrislck>for 10 agree any is ok; vector is simplest
<fnstudio>chrislck RhodiumToad: cool, tx! i'll give it a try with vectors plus SRFI-43 then
*chrislck waits to hear of AOC D24 whereas 10 numbers get upgraded to 10,000 numbers...
<fnstudio>ROFL
<fnstudio>that's exactly my feeling when starting this kind of exercises... especially AOC where exercises always come in two parts... i always brace for the intractable part coming in the second half lol
<surpador>fnstudio: for what it's worth, I did that one with a circular list, and it worked really well
<surpador>Especially for the second part, you might need the linked list representation :)
<surpador>Also, any chance you have your solutions posted somewhere? I've been trying to find someone else who's doing them in Guile Scheme to conpare solutions with
<fnstudio>surpador: i'm very much a beginner but i'd be very glad to share them with you and exchange some feedback/ideas
<fnstudio>surpador: if you tend to hang out here pretty regularly i could send you a follow up / DM you once i've put them somewhere online
<surpador>fnstudio: that sounds great! Yep, I'm on here pretty regularly just lurking :)
<surpador>My code is up here if you want to compare for anything you've already done: https://github.com/jakeleporte/advent-of-code-2020/
<surpador>I'm just learning too so should be useful for both of us!
<fnstudio>surpador: excellent, thanks! i'll try and put things online asap
<fnstudio>i don't seem to be able to find min / max "built-in" procedures
<fnstudio>i suppose it's therefore a matter of sorting + car?
<fnstudio>am i missing something?
<RhodiumToad>(max ...) and (min ...) work at least for numbers, I think?
<fnstudio>ok, then i must have done something wrong... hm
<fnstudio>apply... i guess :)
<surpador>Yeah, should be like (apply max list) I think
<RhodiumToad>won't work for circular lists obviously.
<fnstudio>RhodiumToad: sure, thanks for mentioning that - luckily it was for another part of the exercise
<fnstudio>is there any substantial differnece between take (from SRFI-1) and list-head, or is it just the name?
<civodul>fnstudio: it's just the name, and also 'list-head' is implemented in C so it might be slightly slower
<fnstudio>civodul: fantastic, thanks!