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
orivej has quit [Ping timeout: 240 seconds]
aw- has joined #picolisp
aw- has quit [Client Quit]
tankf33der has joined #picolisp
<cess11_> Good morning.
<Regenaxer> Hi cess11_!
<beneroth> Good morning cess11_, Regenaxer
<Regenaxer> Hi beneroth!
<cess11_> Did a little exercise in PHP7 yesterday, so now I'm trying to figure out which is more performant of a if-if-if-construct one with their map.
<cess11_> *or one with
<cess11_> The if-if-if seems slightly faster in a crude Unix 'time' measurement in the terminal but not much so.
<cess11_> Perhaps I should just have some coffee and read the news instead.
Regenaxer has left #picolisp [#picolisp]
Regenaxer has joined #picolisp
Regenaxer has quit [Remote host closed the connection]
Regenaxer has joined #picolisp
<beneroth> why do you bother with PHP, cess11_ ? other reasons than availability of hosting?
<cess11_> It is quite sellable.
<Regenaxer>
<beneroth> hm. granted.
<beneroth> though it's more about selling code then, than about selling software (or a solution/optimizing for a problem).
<beneroth> when selling software / a solution for a need then the technology should not matter (much), I think.
<beneroth> well often (<> "should" "does actually")
<beneroth> Regenaxer, I see no text in your last message
<cess11_> In this particular case it's about doing some work on legacy code if I get hired.
<Regenaxer> beneroth: Which message?
<beneroth> 09:15
<beneroth> cess11_, legacy code in PHP7? or they hire you to upgrade to PHP7 ?
<Regenaxer> No idea. Did I type space-return?
<Regenaxer> I'm experimenting with .tmux.conf
<beneroth> probably. no idea. only wanted to ask, in case it should display something ;)
<Regenaxer> Good, thanks
<beneroth> cess11_, I'm just surprised that PHP7 has already legacy code around, new as it is?
<cess11_> Updating is probably a better fit than rewriting it in another language.
<Regenaxer> What kind of if-if-if?
<cess11_> And if I can write a few pages of OK PHP7 I can probably get hired elsewhere too.
<cess11_> Variable lookup, it checks a value and if it fits runs a line, otherwise does the next check.
<Regenaxer> Like 'case' and/or 'cond'?
<Regenaxer> or 'if2'?
<cess11_> More like https://pastebin.com/1ezCpPJN .
<Regenaxer> yes, 'case' in pil
<Regenaxer> though "else if" would be better than multiple ifs
<Regenaxer> (avoid furter checks, in any lang)
<cess11_> Since it is very short I'm unsure how switch-case with break or making it implicit with elseif would compare. if:s tend to have quite tight and efficient byte- or machine code output.
<cess11_> If it was longer I'm sure breaking out of testing earlier and also order of tests is important for optimisation.
<Regenaxer> Such short tests are not meaningful probably
<Regenaxer> you test other things than the 'if' itself
<Regenaxer> Take 1000 'if's to see the effect
<Regenaxer> in a row, not in a loop, otherwise you test more the loop
<cess11_> The testing I was doing compared scripts and ran those fragments many millions of times to make differences more visible.
<Regenaxer> yes, that's what I mean
<cess11_> elseif seems a little faster for when the first case is true but it is much slower when it is one of the inner ones that gets repeated.
<cess11_> In the vicinity of five times slower.
<Regenaxer> That's strange
<cess11_> And yes, for isolated profiling it would be better to write a test harness in pil or some other scripting language and output files for the PHP interpreter that repeats rather than loops.
<beneroth> <cess11_> Updating is probably a better fit than rewriting it in another language
<beneroth> T
<cess11_> I think it is because two if:s are leaner and occupies less memory and takes fewer cycles than an if-elseif, but I'm unsure.
<Regenaxer> yes, probably a caching issue
tankf33der has quit [Quit: Connection closed for inactivity]
<Nistur> I haven't touched PHP for... oof.... 14 years I think. I didn't like it then, and I try my best to not have to do it now :P
<cess11_> Today it's somewhat like a clunky Java or a C++ where the templating system is rotten.
<Nistur> I'll stick to C++ over PHP :P
<cess11_> So not so bad as rumour has it but not convenient.
<Nistur> Oh yeah, I had a call this morning from the CEO/founder of a company sounding very keen in me applying for a job for them... it is almost my dream job... but it's in London :(
orivej has joined #picolisp
<Regenaxer> Nistur, you live *near* London?
<Nistur> about 2h drive to get into London
<Nistur> too far to commute :P
<Regenaxer> true
<Regenaxer> Try to convince them of home office
<Regenaxer> and to use pil of course ;)
<Regenaxer> You can't go by train?
<Nistur> stupidly expensive
<Nistur> he did mention something about working remotely short term, but he wants senior people in the London office while they bring this side of the business up to speed, it's not a startup, but they're going onto the next phase of their growth plan
dtornabene has joined #picolisp
<cess11_> If you are young and don't have kids 2h is OK.
<Nistur> I am 30, not sure if that counts as young or not any more :P And no kids... but I have a wife, who I'm sure would complain if I had to commute 2h :P
<cess11_> Sort of the same as me, then. I'm 33, wife, no kids. Commuted 2.5h+ at least once a week last year, to Stockholm.
<Nistur> Hmmm, I am clearly missing something, I have (de process_image (path) ((quote (image) (im:read_image X image) (im:resize_image 106 80 image) image) (im:new_wand))
<Nistur> should that not return the image/wand?
<Nistur> Sweden is nice, not been to Stockholm, but I have visited other bits of Sweden, my dad has a house in Varmland
<cess11_> So I'd say either your wife or the cash ought to decide. Unless they do really secure stuff some remote work should be fine.
<cess11_> Yeah, nice nature and most people are low-key.
<cess11_> Lately government and politics has gone a bit haywire though so I'm open to relocate these days.
<Nistur> its VR games and applications... the only issue is gamedev specifically likes developers to be in the office
<cess11_> Right, really secure stuff, or that.
<Nistur> I don't mind the occasional long commute. I'm currently working in a satellite office, and on Wednesday I have to drive up to the main office...
<Nistur> with no traffic it'd take me about an hour, but that means it'll probably be at least 2
<cess11_> If I can I take a train or bicycle, either I can do some reading or programming or I can listen to a book and indulge the scenery.
<cess11_> Takes an hour for me to clean out the workday so it is usually time well spent if I have to sit and wait for an hour or two between work and home.
<cess11_> I might however end up with actually doing my own software shop before summer, so we'll see whether I'll be hacking out pil apps or something else at that time. It is highly unlikely I will stay in socially visible positions after this years elections.
<cess11_> *year's
<Nistur> When I did live in London, I commuted by tube for 1-1.5h each way
<Nistur> and I mostly spent the time codin
<Regenaxer> Nistur, the above 'process_image' looks correct on first sight. Except possible conflicts of the variables (naming conventions)
<Nistur> I wrote silly little things, my first tube project was a 'tiny little maths machine', a C++/C library which took mathematical equations, compiled them into RPN byte code, and could evaluate it in ns time https://github.com/nistur/tlmm but then I also added my 8 bit CPU emulator to it https://github.com/nistur/tlvm
<Nistur> Regenaxer: what conflicts?
<Regenaxer> path -> Path
<Nistur> and image is a valid value within the quote, but if I do (println (process_image "test.png")) I get NIL
<Nistur> oh, that was because I typed it out by hand into here
<Regenaxer> 'path' overshadows that function for example
<Regenaxer> ah, ok
<Regenaxer> ((quote (image) (im:read_image X image) ... is ok
<Regenaxer> but (let Image (...) (im:read_image is more readable
<Regenaxer> and a lot faster, because less function call overhead
<Nistur> ahh ok
<Regenaxer> Something is wrong with the parens?
<Regenaxer> (de process_image (path)
<Regenaxer> ((quote (image)
<Regenaxer> (im:read_image X image)
<Regenaxer> (im:resize_image 106 80 image)
<Regenaxer> image )
<Regenaxer> (im:new_wand) )
<Nistur> I shall rewrite it with let and maybe it'll become clearer
<Regenaxer> Indented with vip
<Regenaxer> yes, a paren seems missing afte image )
* Nistur facepalms
<Regenaxer> You see such mismatches if you pass it through @bin/pilIndent
<Regenaxer> I have it in vim
<Regenaxer> and vip does it internally
<Nistur> ok
<Regenaxer> I have in my .viprc 'map , !}pilIndent<CR>'
<Regenaxer> (from before I switched to vip)
<Nistur> I am sure emacs has something for lisp checking, let me see :P
<Regenaxer> "Lisp" is not picolisp in this regaad
<Regenaxer> regard
<Regenaxer> only plain parens are the same though
<Regenaxer> but indentation conventions are totally different
<Regenaxer> and comments, superparens
<Nistur> I've seen some .el in the picolisp package, I assume this is a major mode for picolisp?
<Regenaxer> Probably, I have not really investigated it
<Nistur> yup, seems to be
<Nistur> huh. It seems to have frozen emacs though. Interesting
<Nistur> works again now
<beneroth> Nistur, emacs with paredit is nice
<beneroth> yeah there is a picolisp-mode
<beneroth> cess11_, what's the prognosis for elections in Sweden?
<cess11_> Scheiss, basically.
<Nistur> pffft, ok, so that's donw, and now I have some more fun, one function, it's saying one of the parameters is undefined, despite it being printed out in the line before
<cess11_> We have proportional mandates so we get minority and coalition governments which means it is easy for fascist movements to gain traction once the elites get even slightly corrupt and sluggish.
<cess11_> And these days our corruption levels are quite high for us, and about a handful of serious neofascist movements are running for parliament this time, where one already has representation there.
<beneroth> Nistur, maybe you need to quote it?
<cess11_> Our state is already heavily bureaucratic and somewhat totalitarian so it will be a bumpy ride ahead when these things fight it out.
<beneroth> parameter get automatically evaluated before being passed to the function, unless the function is a FEXPR
<Nistur> beneroth: maybe... but the value is a C ptr (I assume it's just treated like a number) and it works without being quoted in every other location
<beneroth> number works without quotation as they evaluate always to themselves
<Nistur> aha, I think I know what I did
<Nistur> yup
<Nistur> works now
<Nistur> another facepalm moment :)
<beneroth> cess11_, so how/why was this not improved? or did the "good" guys actually install laws which can be used quite otherwise? this seems often to be the case.
<beneroth> Nistur, you're progressing very fast.
<beneroth> getting into pil requires some self-facepalming, so usually the learning process takes a while. I hope your face doesn't hurt too much :D
alexshendi has joined #picolisp
<Nistur> well, I now have all my images loading into a single ImageMagick 'wand'
<Nistur> They're not loading in order, so I guess I need to sort the output of dir
<Nistur> but I guess the next step for me is to figure out how imagemagick creates PDFs
<Nistur> let's see what happens if I just call "MagickWriteImages" with a filename ending in .pdf
<beneroth> figure it out on cli first. I did pdfs with imagemagick on cli in the past, its pretty easy if I remember correctly
<Nistur> yeah
<beneroth> yeah I think you only have to specify the output type somehow
<Nistur> it's just convert *.png output.pdf
<beneroth> dunno, its some years ago
<beneroth> yeah!
<beneroth> :)
<Nistur> the lib doesn't match the cli 1:1
<beneroth> so you want to do this with lib, and free the image memory :)
<beneroth> btw you could also use cli and a tempfs. but I guess that would not be very portable for your plans
<Nistur> yeah, I want this working on Windows :P
<Nistur> that was the starting thing, I have the thing working in Bash scripts on macOS and probably Linux too
<beneroth> clacke[m], you're into GNU Guix?
<Nistur> Regenaxer: ok, I have an interesting conundrum... not sure if it's easily solvable or not... I cannot output a pdf yet, but it won't tell me why... so I thought I'd finally get around to hooking up error checking and reporting... which is fine, the functions all return 0 on failure and 1 on success... buuuuuuut when you call MagickGetException, it returns a char*, which you're supposed to pass to
<Nistur> MagickRelinquishMemory to clean up afterwards...
<Nistur> I assume the native type I would get back from GetException, I cannot both print out a human readable string, and maintain the ptr to pass back to C?
<Regenaxer> Why not?
<Nistur> I assumed it translated it into some internal type
<Regenaxer> returns a char*
<Regenaxer> mkStr() ?
<Nistur> (native libname "MagickGetException" 'N wand X)
<Nistur> the 'N is a char*
<Nistur> the X is meant to be ExceptionType&
<Nistur> I _assume_ that it's just an enum, but how to pass that through I also have no idea
<Regenaxer> You could pass 'S instead of 'N
<Regenaxer> then 'native' builds a transient symbol
<Nistur> but then I could not call (native libname "MagickRelinquishMemory" NIL description)
<Regenaxer> Sorry, have a meeting at 14:00, must hurry
<Nistur> it's ok
<Regenaxer> :)
<Nistur> have fun
<Regenaxer> Sure you find out! :)
<Regenaxer> Thanks!
<cess11_> beneroth:
<cess11_> beneroth: The solution is to organise more people and have the public keep checks and balances on power.
<cess11_> Our elites have however become quite comfy since the fall of the wall.
<cess11_> As in most of the Occident.
<cess11_> So while most of our population have nice salaries and don't care much for politics and our elites have insanely high incomes and use political parties as platforms for careers the perifery has become irritated and illoyal while the male urban lower middle class has become mostly neofascist and begun attacking minorities and socially discriminated groups.
<cess11_> Over the last three decades corrupt and corporativist people have privatised billions and billions almost without resistance. It will easily take at least half a century just to clean out the worst parts, things like publicly traded school kids and collapsing infrastructure.
<cess11_> Our roads are as shitty as the roads in northeast Bulgaria, the poorest part of the EU.
<cess11_> For the most part. It's so bad the government agency overlooking the maintenance of them wants to privatise tens of thousands of kilometers basically overnight.
<cess11_> If one would do a systematic scan of our publicly owned and governmental IT-infrastructure one would it is like the best of hard cheeses, full of holes.
<cess11_> Sometimes I poke around a little and every time I find a place where one would fall through if one wanted to.
<cess11_> So, it is a good idea to not live here if one is either a minority, democratically inclined or have a history of antifascist activities.
<cess11_> The other day our government burned down a sami hut instead of dismantling it nicely. A few weeks ago it was reported that the police chief in part of northern Sweden is a racist fanatic that spews hate in his free time and still got promoted to this position. Another police has made a huge following by coming out as a neofascist and spreading propaganda about minorities and refugees.
<beneroth> I don't think this is a good solution. public outcry is kinda the last method before violence.
<cess11_> Neonazis are in county assemblies, aiming for parliament this election and this time it is likely they will earn mandates of their own in local assemblies due to having registered as a party and not just relying on the Sweden Democrats leaving their lists 'open' so they can be used to elect anyone that could possibly have such a position.
<beneroth> and see what happened with the Occupy Movements - they were easily crushed everywhere
<cess11_> The public is silent these days. This is why violence will follow from minorities and other such groups once repression is intense enough. Bad for business, bad for everything.
<beneroth> T
<cess11_> The neonazis are already utilising bombs and arson, so the molotov has been thrown, so to say.
<cess11_> The state isn't protecting the weak so they will turn to self organising. Pretty obvious how it will play out if left unchecked.
<cess11_> Also, we've recently seen how secret police is lenient and amateurish in relation to these neonazi groups, among them one that has been in Russia for paramilitary training and inspiration before blowing things up here. So it is fairly obvious they want to keep them as informants rather than locked up, sacrificing those that get killed or mutilated.
<cess11_> Anyhow, I'm really glad I stumbled over the Factor language. It is really nice compared to politics.
<cess11_> Not as good as pil but it is quite convenient.
<alexshendi> cess11_: I bet *any* programming language is nice compared to current politics ...
<cess11_> alexshendi: Yeah, when you put it that way...
dtornabene has quit [Quit: Leaving]
<Nistur> Random tangentially related question. Is there a place to buy an official picolisp tshirt?
<cess11_> Not yet.
<cess11_> What would you like to have on it?
<Nistur> my wife's been getting at me to throw out some of my tshirts, I wear them long after she thinks they should be got rid of
<Nistur> so I will need to stock up again when she decides to force the matter
<Nistur> dunno
<Nistur> maybe picolisp logo
<Nistur> not sure if it would be worth having any more than that
karswell_ has quit [Read error: No route to host]
grp has joined #picolisp
<beneroth> Nistur, btw have you found http://picolisp.com/tractatus/ ?
<cess11_> That one is quite nice.
<cess11_> I could see myself in a 'T shirt.
grp has quit [Ping timeout: 240 seconds]
grp has joined #picolisp
grp has quit [Changing host]
grp has joined #picolisp
<Nistur> um
<Nistur> that wasn't meant to get posted here
<Nistur> oops :P
<Nistur> beneroth: I had not seen it yet.
<Nistur> But it looks interesting, thanks
<Nistur> cess11_: are you pondering what I'm pondering?
grp has quit [Quit: box shutting down...]
<cess11_> Dunno.
<Nistur> cess11_: not a Pinky and Brain fan?
dtornabene has joined #picolisp