ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Picolisp latest found at http://www.software-lab.de/down.html | check also http://www.picolisp.com for more information
f8l has quit [Quit: WeeChat 1.9.1]
f8l has joined #picolisp
miskatonic has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
f8l has quit [Quit: WeeChat 1.9.1]
orivej has quit [Ping timeout: 260 seconds]
f8l has joined #picolisp
karswell has quit [Remote host closed the connection]
karswell has joined #picolisp
f8l has quit [Ping timeout: 268 seconds]
f8l has joined #picolisp
pchrist has quit [Remote host closed the connection]
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
rob_w has joined #picolisp
_whitelogger_ has joined #picolisp
_whitelogger has quit [Ping timeout: 276 seconds]
<tankfeeder> morning
<tankfeeder> i have to store (London Dublin 464) and search combinations of roads London Dublin and Dublin London
<tankfeeder> how better organize store pairs of cities and km between em
<tankfeeder> ?
aw- has joined #picolisp
<beneroth> might be fitting for pilog
<beneroth> (not storing, but the solving)
<Regenaxer> Indeed
<Regenaxer> The pil release comes with even two versions
<Regenaxer> misc/trip.l and misc/travel.l
<Regenaxer> The latter one is Pilog
<tankfeeder> good.
<Regenaxer> In doc/travel there is even a diagram
<Regenaxer> wow! misc/travel.l is from 22oct03!
<Regenaxer> misc/trip.l is the same, but was changed to '++' in 2016
<Regenaxer> (pop 'L) to (++ L)
<tankfeeder> i will take pilog version
<Regenaxer> good
<Regenaxer> Interesting. misc/trip.l uses a genetic algorithm
<Regenaxer> didn't remember
<Regenaxer> The Pilog version simply does a brute force search
<beneroth> Regenaxer, oh nice
<beneroth> I think genetic algorithms are underused
orivej has joined #picolisp
<beneroth> but I like meta-programming generally (as long it isn't bloated/overdone)
<Regenaxer> yeah
<Regenaxer> genetic algorithms are easy to use. No need to understand the problem ;)
<beneroth> aye. but requires "code" is "data" to be easily implemented ;)
<Regenaxer> yes, makes it easier at least (but this is the case almost everywhere)
<beneroth> ahaha, T
<tankfeeder> i did it
<Regenaxer> cool
<Regenaxer> Did you count how many pil programs you created over the years? Seems a lot!
<tankfeeder> everything in repo
<tankfeeder> *all* of them.
<Regenaxer> :)
<m_mans> Hi all
<Regenaxer> Hi m_mans
<m_mans> I'd like to continue to explain a little about my question with (fork) and (loop)
<m_mans> need to find pastebin link first :)
<Regenaxer> ok
<m_mans> it seem that such subprocess doesn't stopped when I press Ctrl-C and Ctrl-D in debug mode
<m_mans> I miss something I suppose
<Regenaxer> ^C should stop here. Probably the signal goes to 'curl'
<Regenaxer> Several ^C don't help?
<Regenaxer> hmm, no, it waits in pil most of the time. I would expect it to stop
<m_mans> Main process stops, and after several second I see the error message (I suppose it's from that subprocess) - something related to "error writing to pipe"
<beneroth> probably the pil IPC ?
<beneroth> (parent and children are by default connected by pipes)
<Regenaxer> no ipc involved here, just 'call'
<m_mans> most time it should be in curl (because of long polling)
<beneroth> ah, I see.
<m_mans> in general it's in the IPC family as I understand
<beneroth> maybe add an additional wait to give you time to issue the Ctrl-c during debugging?
<Regenaxer> Yeah, so it is not clear here who gets the ^C
<beneroth> m_mans, maybe you want to put (abort) around the (call) ?
<Regenaxer> m_mans, 'call' does no I/O to pil
<beneroth> T
* beneroth would like to have a nice secure TLS connector without using curl...
* beneroth also uses curl right now to talk to a SOAP API
<Regenaxer> or print something before and after the call, so you can stop between that
<m_mans> what woud happen when they will stop in production mode?
<Regenaxer> Also, (in '(curl ...) or (pipe (exec 'curl might be more useful than just 'call'
<Regenaxer> I believe two ^C should always work
<Regenaxer> 'call' makes its own process group, while 'in' or 'pipe' don't (iirc)
<m_mans> oh, sorry. I use exactly (in '(curl) ..!
<m_mans> not just call
<Regenaxer> ah, ok
<m_mans> then it's more clear?
<Regenaxer> bash sends signals to all processes in the group I think
<Regenaxer> So 'call' is kind of detached
<m_mans> I should try and see when does curl stop
<Regenaxer> eg if you (call 'vi)
<Regenaxer> you want signals go to only vi
<Regenaxer> Do (in ..) or (pipe ..) not stop everything?
<Regenaxer> What happens if you first do "killall curl", then stop pil?
<m_mans> let me try
<beneroth> I would expect broken pipes when you use (in) or (out) and kill the called program
<Regenaxer> I think otherwise pil gets the kill, and curl continues running because of 'call'
<beneroth> Regenaxer, but its a sub-process, so also killed, no?
<Regenaxer> yes, broken pipes may occur, if the called program does not handle them
<m_mans> no, as I told, in fact no 'call there, just 'in
<Regenaxer> no, it is a separate process
<m_mans> T
<Regenaxer> bash sends ^C signals only to processes in the same process group
<Regenaxer> pgid
<beneroth> ah yeah, but I mean when I do "kill <pid>"
<beneroth> OK
<beneroth> bbl
<Regenaxer> yes, kill <pid> always works
<Regenaxer> unless it is not ignored by the process
<Regenaxer> Ah, it is not the process group
<Regenaxer> it is the terminal control probably
<Regenaxer> tcsetpgrp(0,pid);
<Regenaxer> done by 'call' only
<Regenaxer> It is all a mess :(
<Regenaxer> Perhaps whe strategy in in, out, pipe, call should be done differently?
<Regenaxer> I'm not sure if it is perfect now
<Regenaxer> Many years ago I tuned around it a lot until it seemed OK
<Regenaxer> but who knows?
<Regenaxer> I asked several Unix gurus, but nobody could tell me exactly how it should be
<m_mans> ok. I've tried a little.
<m_mans> 1) I did -main -go +
<m_mans> (no client here)
<m_mans> while curl is working, I pressed ^C once
<Regenaxer> Without curl it stops immediately, right?
<m_mans> when curl exits after a few seconds, I see this error "^C(23) Failed writing body" and then Picolisp stops
<m_mans> so ^C pressed once doesn't stops curl
<Regenaxer> This message must be from curl
<m_mans> but I suppose it stops pil subprocess
<Regenaxer> is curl called in a pipe?
<m_mans> or main process
<Regenaxer> 'in' or 'pipe' ?
<m_mans> 'in'
<Regenaxer> ok
<m_mans> I can add some message to *Bye, right?
<Regenaxer> you can strace all processes in separate terminals
<Regenaxer> yes, *Bye is also good
<m_mans> ah, T
<Regenaxer> strace is easier, no code modification
<m_mans> trying more :)
<Regenaxer> ok :)
<Regenaxer> bbl
<aw-> "American scientists are now working on a brand new rice cooker. They're writing it in Picolisp."
<beneroth> captain?
<beneroth> :D
<aw-> hi all
<aw-> hi beneroth
<beneroth> hi aw- :)
<aw-> has anyone here ever completed a MOOC ?
<beneroth> I completed the MOOCs AI (by Peter Norvig & Sebastian Thrun) and ML (by Andrew Ng) in 2011 (two of the 3 first ones by Stanford people)
<beneroth> was work. enjoyed it. the ML one was much more practical (programming exercises and exams), the AI was more a general introduction
<beneroth> haven't used that knowledge in practice yet, but the deeper general understanding I found pretty useful
<aw-> sweet
<aw-> beneroth: did you put it on your CV ?
<beneroth> yes, even put the pdf certificates I got for completing with high scores, but so far it didn't happen that I tried to sell myself to people who could actually understand this above the "oh he took a class which I don't understand what it even is about".. so the certificates I took out again
<aw-> i see
<beneroth> I usually get contracts from existing word of mouth reputation and my little network.
<aw-> haha yeah same here, much easier
<beneroth> good enough
<aw-> doesn't work for everyone though
<aw-> have you encountered companies/hiring managers who didn't recognize your MOOC certificates? i.e: who thought it was BS
<beneroth> maybe I could land better contracts with more reputation and visibility (I have like zero online presence), but I'm not sure if I really could within switzerland and/or with the amount of effort I would find acceptable to put into it
<beneroth> at the moment my main customer is very close to where I live, has enough issues to have reasons to contract me for quite a longer time, and rest of time I spend webhosting and working on my own products
<beneroth> other customers I found among my webhosting clients (I took over the webhosting business from another company, which had it as a side-business, not well maintained the last years)
<aw-> yeah that sounds nice, lots of ffreedom
<beneroth> right. good enough for now, but not the long-term career I would like to stay in (freelancing = fixing other peoples crap, usually without the freedom to fix it right)
<beneroth> so I hope that in the next few years I can change from contracting to a product business model
<beneroth> last and this year I actually did/do a lot of custom applications based on my database/webframework (based on pil)
<beneroth> need to polish and enhance my existing stuff before I can build serial products on top of it (or turn it itself into a product)
<beneroth> also so far I have only implemented a few pieces of my vision
<beneroth> everything takes more time than hoped.
<Regenaxer> ret - Cool, the picolisp rice cooker! Must have for my wife
<beneroth> but the tendency is good. so I continue :)
<beneroth> Regenaxer, :D
<beneroth> I still don't get it.
<aw-> beneroth: yes, productize your business, always good idea :)
<aw-> Regenaxer: haha i knew you would like that one
<Regenaxer> :)
<beneroth> are real "us scientists" behind this account? what is the context? why do rice cooker need software?
<aw-> beneroth: it's a bot account
<Regenaxer> High tech, today's cookers ;)
<beneroth> ok I see :)
<beneroth> Regenaxer, IoT! running apache and a directory listing vulnerability on it!
<aw-> there's often bots tweeting random things with the word picolisp
<beneroth> like in the dish washers: https://ics-cert.us-cert.gov/alerts/ICS-ALERT-17-089-01
<beneroth> aw-, haha, cool. good enough xD
<beneroth> who is training to do them? tankfeeder ? :P
<beneroth> s/them/this
<aw-> probably tankfeeder ;)
<Regenaxer> yeah, he crunched out the biggest amount of picolisp code so far
<aw-> yes, quite impressive
<beneroth> aye
<aw-> err
<aw-> biggest amount of *public* picolisp code
<Regenaxer> ok, probably
<beneroth> hm.. I think I was in Regenaxers basement. but yeah, there could be stuff hidden :P
<aw-> i've written quite a large amount of pil code, not public though :\
<beneroth> same. but its mostly not "public YET".
<aw-> like my password manager, not public yet or ever
<beneroth> not enough time/priority to polish the non-essential parts for publication. and the essential parts are changing all the time.
<beneroth> so so
<beneroth> well I'm very glad for the stuff you already published, aw- :)
<aw-> actually i can confirm there are quite a few fortune 500's running picolisp now
<beneroth> do they know? :P
<aw-> probably not
<aw-> ahhaha
<beneroth> I planted some pil too. it will probably die when they get rid of their solaris box :/
<aw-> planted.. doesn't sound safe
<beneroth> well they actually know and use it.
<aw-> solaris.. i was wondering who uses solaris here
* beneroth sees business as an gardening art
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
rob_w has quit [Quit: Leaving]
<aw-> ok i'm out for the night
<aw-> see you
<Regenaxer> have fun!
<aw-> out = going home to sleep
<aw-> haha
<Regenaxer> oh, not isakaya?
<aw-> no! I don't drink alcohol
<Regenaxer> ok :)
<aw-> :D
<Regenaxer> isakaya is also for eating
<aw-> and smoking
<Regenaxer> true, that's nasty
<aw-> yes, very
<Regenaxer> Here it is forbidden everywhere
<aw-> although some standing izakayas are kind of fun, drunk salarymen spewing corporate secrets haha
<Regenaxer> :)
<aw-> yes Japan needs to change this before the Olympics
<aw-> g'nite!
<Regenaxer> nite!
aw- has quit [Quit: Leaving.]
groovy2shoes has quit [Quit: moritura te saluto]
groovy2shoes has joined #picolisp
<tankfeeder> sum all numbers
<tankfeeder> hm
<Regenaxer> using 'read'?
<Regenaxer> in token mode
<Regenaxer> works
<Regenaxer> (sum num? (str "1.[1,2,3]{\"a\":2,\"b\":4} ...1}]" "_"))
<Regenaxer> -> 25
<tankfeeder> i will try
rob_w has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]
<Regenaxer> BTW, 25 is not correct. "-" is handled separately by this parser
<Regenaxer> So you must iterate the list, and watch out for "-" and numbers
<tankfeeder> yea.
<Regenaxer> I would 'map' the list, and do (set (cdr L) (- (cadr L))) for each "-"
<tankfeeder> and then sum again over list ?
<rick42> hi all!
<rick42> aw-, beneroth: what is MOOC?
<rick42> Hi, Regenaxer, tankfeeder!
<joebo> hi!
<joebo> how about this?
<joebo> : (sum prog (mapcar '((X) (format (pack X))) (split (chop Data) ~(diff (uniq (chop Data)) (chop "1234567890-")))))
<joebo> -> 18
<Regenaxer> Hi rick42, joebo!
<joebo> (setq Data "[1,2,3]{\"a\":2,\"b\":4}[[[3]]]{\"a\":{\"b\":4},\"c\":-1}{\"a\":[-1,1]}[-1,{\"a\":1}]")
<joebo> rick42: MOOC = online class "massively open online course"
<joebo> like coursera
<Regenaxer> The format and pack is not necessary with 'str' though
<Regenaxer> The diff is a good idea, but a read macro is not useful perhaps
<joebo> hmm - str doesn't seem to work
<joebo> because they are sublists
<joebo> ? (split (chop Data) ~(diff (uniq (chop Data)) (chop "1234567890-")))
<joebo> -> (NIL ("1") ("2") ("3") NIL NIL NIL NIL NIL ("2") NIL NIL NIL NIL ("4") NIL NIL NIL ("3") NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL ("4") NIL NIL NIL NIL NIL ("-" "1") NIL NIL NIL NIL NIL NIL ("-" "1") ("1") NIL NIL ("-" "1") NIL NIL NIL NIL NIL ("1") NIL NIL)
<joebo> I agree the read macro wasn't as useful... I couldn't figure out how to use 'apply or something like it
<Regenaxer> hmm, now I get 19 :)
<Regenaxer> (let Lst (str "1.[1,2,3]{\"a\":2,\"b\":4}[[[3]]]{\"a\":{\"b\":4},\"c\":-1}{\"a\":[-1,1]}[-1,{\"a\":1}]" "_")
<Regenaxer> (for (L Lst L)
<Regenaxer> (when (= "-" (++ L))
<Regenaxer> (set L (- (++ L))) ) )
<Regenaxer> (println (sum num? Lst)) )
<joebo> hehe, I added it manually twice and came up with 18
<joebo> am I crazy?
<Regenaxer> maybe I'm wrong
<Regenaxer> I'm not sure about the ++'s
orivej has joined #picolisp
<joebo> yes, I think it's 18
<Regenaxer> no, I get 19 again
<rick42> hi joebo!
<rick42> thanks (for def)
<joebo> Regenaxer: you have a 1. in front of it
<joebo> I don't see that in the paste
<joebo> ... "1.[1,2,3]{ ...
<Regenaxer> ah!
<Regenaxer> A copy/paste error. took the string from tankfeeder's original pastebin
<Regenaxer> Is the "1." not part of the data?
<Regenaxer> yes, 'raw' view doesn't have it
<Regenaxer> Usually I always click on raw immediately if I get a pastebin link
<Regenaxer> here I did not, it seems, as it was only a single line
<rick42> joebo: is MOOC a proper name or simply referring to a type of course? (please work with Regenaxer first. i can wait)
<Regenaxer> No worry
<Regenaxer> This "-" issue is ugly
<Regenaxer> There must be an easier way
<joebo> rick42: it's just a way of describing online classes I think
<rick42> thanks joebo
<joebo> my solution is frustrating too... can't seem to get rid of the read macro
<joebo> it's been too long since I've played with pil maybe!
<joebo> rusty
<joebo> I thought maybe I could build the code to run and then eval it
<joebo> : (cons 'split (list (chop Data) (diff (uniq (chop Data)) (chop "1234567890-"))))
<joebo> -> (split ("[" "1" "," "2" "," "3" "]" "{" "\"" "a" "\"" ":" "2" "," "\"" "b" "\"" ":" "4" "}" "[" "[" "[" "3" "]" "]" "]" "{" "\"" "a" "\"" ":" "{" "\"" "b" "\"" ":" "4" "}" "," "\"" "c" "\"" ":" "-" "1" "}" "{" "\"" "a" "\"" ":" "[" "-" "1" "," "1" "]" "}" "[" "-" "1" "," "{" "\"" "a" "\"" ":" "1" "}" "]") ("[" "," "]" "{" "\"" "a" ":" "b" "}" "c"))
<Regenaxer> Must be (split '("["
<Regenaxer> ie the quote
<Regenaxer> What do you want to do?
<joebo> well I want to get rid of the read macro in this
<joebo> (sum prog (mapcar '((X) (format (pack X))) (split (chop Data) ~(diff (uniq (chop Data)) (chop "1234567890-")))))
<Regenaxer> (format (pack X)) is not needed, just (format X)
<joebo> oh! that's what you meant
<joebo> cool :)
<Regenaxer> But how does "1234567890-" help in tankfeeder's example?
<Regenaxer> and the 'uniq'?
<joebo> well, I want to split on anything that's not numeric or the - sign
<Regenaxer> ah
<joebo> so that all the numbers are grouped together
<Regenaxer> understand
<Regenaxer> tricky idea :)
<joebo> :)
<Regenaxer> Should be possible without the read macro
<joebo> I think the problem is that split takes doesn't want a list
<joebo> : (split (chop "a1b2") '("a" "b"))
<joebo> -> (("a" "1" "b" "2"))
<joebo> fail
<joebo> vs
<joebo> : (split (chop "a1b2") "a" "b")
<joebo> -> (NIL ("1") ("2"))
<tankfeeder> i would do all manually and collect nums negatives and positives
<joebo> should be a common enough thing -- just can't figure it out :)
<Regenaxer> 'apply' is the key here
<Regenaxer> (let Lst (chop "[1,2,3]{\"a\":2,\"b\":4}[[[3]]]{\"a\":{\"b\":4},\"c\":-1}{\"a\":[-1,1]}[-1,{\"a\":1}]" "_")
<Regenaxer> (msg
<Regenaxer> (sum format
<Regenaxer> (apply split (diff Lst '`(chop "1234567890-")) Lst) ) ) )
<Regenaxer>
<Regenaxer> gives 18
<joebo> nice!
<Regenaxer> good idea joebo!
<Regenaxer> best solution so far
<joebo> thanks! I almost had the apply working
<joebo> I must have stumbled somewhere
<Regenaxer> :)
<joebo> it seems that '` is unnecessary?
<joebo> : (sum format (apply split (diff Lst (chop "1234567890-")) Lst))
<joebo> -> 18
<Regenaxer> right, just an optimization *if* in a function
<Regenaxer> to avoid 'chop' each time
<joebo> :) I'm interested... what's it do
<Regenaxer> '`(chop ..) expands to a constant list '("1" ...) at read time
<Regenaxer> so it does not make sense for single-shot code
<joebo> ahh yes :)
<joebo> very nice
<joebo> fun problem
<joebo> nice distraction :)
<joebo> now back to work I suppose
<tankfeeder> works
<tankfeeder> second part
<rick42> nice job everyone!
<joebo> tankfeeder: trickier :)
<joebo> I don't think I have an elegant way yet
<joebo> my first approach would be to build nested lists for each object "{" and then traverse and look for "red" as a property and then mark that list as being "dead" and then filter to remove all dead branches and then sum
<joebo> or maybe use aw's json parser
libertas has quit [Ping timeout: 255 seconds]
libertas has joined #picolisp
rob_w has quit [Read error: Connection reset by peer]