IRC channel logs

2018-01-01.log

back to list of logs

<amz3>happy new year from utc+2
***b4285 is now known as b4283
<sLN696>13,04▄10,09▄05,13▄08,09▄13,12▄07,11▄08,02▄02,13▄13,03▄12,11▄11,02▄04,08▄08,09▄08 A DISCUSSION IS GOING ON ABOUT TO TO RE-ENSLAVE NIGGERS IN #/JOIN IF THIS GETS YOUR DICK HARD JOIN IN (MESSAGE VAP0R FOR HELP) qgdtemk: thomassgn jpf SHODAN 08,13▄08,05▄06,09▄04,13▄06,03▄07,09▄11,02▄09,02▄11,12▄03,10▄03,06▄06,06▄
<ijp>new year, same old shit :/
<Gattix_120>09,05▄05,04▄04,03▄12,13▄04,03▄08,10▄09,05▄04,06▄13,02▄02,13▄10,09▄13,04▄08,10▄03,06▄11,07▄10,08▄04,03▄10,03▄04,11▄10 we have got more than 200% of the monthly donations today, thank you all so much!(weechat devs)mtcaspch: reepca babyflakes ragge_ 04,07▄08,11▄12,09▄08,03▄02,07▄05,08▄09,09▄12,08▄10,11▄11,04▄07,04▄03,13▄
<manumanumanu>Mornign
<YottaByte>hi all, I heard about some guile javascript backend? anyone know about this? you write guile and it outputs js? like clojurescript or something?
<mwette>YottaByte: I think this is it: https://gitlab.com/ijp/guile
<YottaByte>hmm
<mwette>look at the compile-to-js-2017 branch, in module/language/js-il
<mistnim>how do I run a system command so that later I am able to kill it gently?
<rlb>mistnim: depends - if you ran it via open-pipe or similar, close-pipe may do it if the process responds to the close as you'd like. Otherwise, you can always do a primitive-fork, etc., but that requires notably more care.
<mistnim>rlb: I tried with an input pipe, but close-pipe just hangs
<rlb>Is the subprocess reading, writing, or neither?
<mistnim>rlb: it doesn't write anything, it can optionally read from stdin but I don't use it that way
<mistnim>maybe I can run the command in a thread and then use cancel-thread?
<rlb>OK, well if closing its stdin doesn't cause it to quit, and if there's not some other function/lib/srfi available (haven't been watching scheme closely for a while), then you could try to use primitive-fork: https://www.gnu.org/software/guile/manual/html_node/Processes.html
<rlb>To do what you want (assuming I understand), you need the subprocess pid so you can kill it.
<rlb>i.e. sigint or similar (assuming that's "gentle" enough).
<mistnim>rlb: so I would use primite-fork to get the pid? Isn't there another way?
<rlb>Hmm -- guess you could also use a hack, i.e. write a helper script that launches the subprocess and kills everything when stdin closes. Then run that via open-input-pipe...
<mistnim>rlb: I see
<rlb>Seems like guile (and/or the srfis) should add something "better"...
<rlb>Did you say you were using open-input-port, or open-output-port? May not matter if the program just ignores stdin the way you're invoking it. In any case, given that both already involve the shell, you might not need a helper, i.e. something like (open-output-pipe "cat | your-command") or whatever.
<rlb>Or whatever -- something that'll cause the pipeline to die when stdin closes.
<mistnim>rlb, I tried both now, it hangs in both cases
<mistnim>even with open-output-pipe "cat | my-command"
<rlb>how about something like this (untested -- you may need to adjust it to do what I meant):
<rlb> "my-command & pid=$!; trap \\"kill $pid\\" EXIT; cat"
<rlb>ACTION thinks there's almost certainly a more succinct way to do that...
<rlb>And if it does appear to work, I'd double check via ps aux or similar that it really did kill your process.
<mistnim>rlb: that worked! :D
<rlb>great
<joshuaBPMan>hello guilers, is anyone here a functional programmer?
<joshuaBPMan>or like the idea behind functional programming?
<mwette>joshuaBPMan: yes, but I'm not very hard core
<amz3>joshuaBPMan: sort of
<joshuaBPMan>mwette: recursion is super tough. hahah. I'm trying to solve dailyprogrammer #341
<ijp>it's weird at first, but it quickly becomes natural
<ijp>it doesn't help that all the examples of recursion people see are terrible (factorial & fib)
<ijp>first examples*
<joshuaBPMan>ijp: My problem right now, is I'm trying to recursively build a list...
<joshuaBPMan>but sometimes each call of the function doesn't give a useful value...
<joshuaBPMan>ie: recursing 1-100 is pretty easy.
<joshuaBPMan>each time you call the function you producet a new value.
<joshuaBPMan>produce*
<ijp>I have no idea what you are trying to do
<joshuaBPMan>ijp: I'm trying to solve #341 in dailyprogrammer on reddit.
<joshuaBPMan>I'm so used to doing things using loops, but I guess functional programs don't do that.
<ijp>which one, I'm seeing gradations
<joshuaBPMan> https://www.reddit.com/r/dailyprogrammer/comments/7eh6k8/20171121_challenge_341_easy_repeating_numbers/
<ijp>but you can always write a loop as a recursion (and vice versa)
<ijp>the latter is probably less widely recognised for some reason
<joshuaBPMan>ijp: yeah. It's just I'm used to programming via loops. I just need to wrap my head around it.
<joshuaBPMan>I'm under the impression that recursion is usually the better way to program.
<joshuaBPMan>it makes for short code...usually.
<ijp>it depends
<joshuaBPMan>Fun fact of the day, there are actually some types of number sequences that can only be defined recursively.
<ijp>for lists, it sort of depends on the direction you are accumulating
<joshuaBPMan>hmmm
<ijp>left to right = iteration, right to left = recursion (very roughly)
<joshuaBPMan>(let ((x (+ 1 2))) x)
<joshuaBPMan>(let ((x (+ 1 2))) (display x) (display "\\n"))
<joshuaBPMan>(+ 1 2)
<joshuaBPMan>sorry I thought I was in the guile repl.... my bad
<ijp>there are really two problems in this challenge. 1. split the input up into all contiguous segments and 2. check for duplicates
<ijp>well, more accurately for 2. grouping the equal segments together