ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: | Check also for more information
ubLIX has quit [Quit: ubLIX]
<aw-> freeemint: git push; git pull
<aw-> i use git exclusively for that; git checkout; then it updates automatically, sometimes need to reload pil app,, no big deal
<aw-> freeemint: i git+ssh push to a central server, and then on my web servers I run git pull.. i don't push directly to the web servers because that doesn't scale well
orivej has quit [Ping timeout: 268 seconds]
rob_w has joined #picolisp
pierpal has joined #picolisp
pierpal has quit [Client Quit]
freemint has joined #picolisp
<freemint> aw- how do you deal with temporary files? Make clean style or .gitignore
<freemint> do you git pull manually or every 5 minutes?
freeemint has quit [Ping timeout: 268 seconds]
xkapastel has quit [Quit: Connection closed for inactivity]
orivej has joined #picolisp
<aw-> temporary files?
<aw-> the web server directory is read-only, there's no temporary files except maybe in /tmp/ or $HOME/.pil/tmp/
<aw-> i only git pull manually, when i'm ready to switch the prod version
orivej has quit [Ping timeout: 245 seconds]
<freemint> ok ... the database where do you store that?
<aw-> i imagine if you had 100 servers and deployed 20 times a day then you can automate the git pull, maybe roll it out to 1/3 of your cluster, if it's good then do the same for the others
<aw-> database stored on disk
<aw-> what's with these questions?
<aw-> they're so vague and generic
<aw-> please be more specific and tell me what you want
<freemint> if the Webserver directory is read only where is the DB stored then
<freemint> outside the read-only dir obviously...
<beneroth> what are you theorizing about? there is no single general right strategy, it depends a lot. For just a few webhosts, a manual deployment is easily better than setting up a complex deployment system with overhead, additional failure modes and additional setup costs.
<beneroth> btw hi freemint :)
<beneroth> hi aw-
<freemint> i am trying to sample the space of solutions so i can see what would work for me
<beneroth> there are always trade offs, don't let someone tell you something else.
<freemint> i am aware of that
<aw-> DB should never be stored in the web server dir anyways
<aw-> so by making it read-only then you remove that possible fail
<aw-> stored the DB anywhere you want, preferably fixed disk so it persists after reboot ;)
<beneroth> available-by-default (blacklisting instead of whitelisting) in webservers is a horrible blunder, I find...
<beneroth> fund thing is when editors make automatic backup copies of a edited file (most editors do)... if this is a web-app config it then becomes downloadable :)
<aw-> yeah if you're storing temp files in the git dir / web app dir, then you risk having issues when you try to "git checkout" a different version
<beneroth> T
<aw-> also you risk having those files accidentally served by the app
<aw-> beneroth: haha yeah i've seen that error with editors as well
<aw-> the file i was editing was had mode 0600, but the backup was 644 (facepalm)
<freemint> all these little pit falls
<aw-> oh that's 'nano' which does that btw
<aw-> gotta run, bbl
<beneroth> almost all editors do it.
<beneroth> better use vip? :D
<Regenaxer> Vip makes no temp files
<Regenaxer> yep
<Regenaxer> all in heap only, as a list of lists of chars ;)
<freemint> mhh thanks for those insights. what other ways are there to version your server code and so on?
<freemint> so on = make it run on the server "deployment"
<freemint> or are you all using git?
ubLIX has joined #picolisp
<aw-> freemint: i was using SVN for that, before switching to git maybe in ~2008
<aw-> and before that I was using CVS
<aw-> pretty much using the exact same method for code deployments for the last 20 years
<aw-> tools vary, but the idea is the same
<aw-> oh i think i've used rsync to sync web app files between multiple servers... that was a mess
<beneroth> I'm using git, but don't deploy with git. using scp. good enough for what I need to do.
<beneroth> I did deployment with git before, but somehow stopped it. I guess mainly because that why I don't need to keep all installation-specific tweaks within git repo - but having those in git repo is also a great backup
<beneroth> aw-, do you work with git submodules?
<aw-> right
<aw-> beneroth: no, not anymore
<aw-> git submodules don't scale beyond 1 human, once you add more people to work on a repo with submodules, it breaks often and easily
<beneroth> why did you stop? I'm still on the "module system/package manager" thingy, but for now limited to my actual use case, the goal of a "universal package manager" I postpone for now.
<aw-> it's a pain
<beneroth> I see
<aw-> every dev needs to become a "submodule manager" and be careful how they code/update stuff
<beneroth> T
<aw-> and the things to keep at the front of your mind multiple exponentially as you add more modules
<aw-> more submodules*
<beneroth> so far I have the code shared in multiple installations/projects in subdmodules, but I feel submodules are not powerful/application-specific enough for my next needs, therefore module/package manager
<beneroth> T. I only have 2 submodules.
<aw-> submodules are extremely powerful i think
<aw-> but they are a pain to MANAGE
<aw-> the keyword is _manage_, it's too much effort
<aw-> which leads to mistakes
<beneroth> you didn't think about automate/script it away for your needs? or you saw it as not effective?
<beneroth> T
<aw-> the problem is the submodules tightly couple two independent git repos with their own codebase etc, that's never good
<aw-> no you can't automate with submodules
<beneroth> I try to reduce the potential mistakes I can make
<beneroth> agreed, thanks for your thoughts :)
<aw-> because 1) you don't always WANT to update the submodules, 2) if they update, you need to specify to which version/commit/tag, 3) if it's automated then how do you specify all of that?
<aw-> and all of that goes to hell as soon as a 2nd person starts working on the project
<beneroth> T
<aw-> they forget to update the commit ref, or they push stuff and overwrite your submodule commit data, or whatever
<beneroth> aye
<aw-> it's better to just dump all the code into the same repo
<beneroth> well might be solvable by restricting branch access rights. but thats annoying too.
<aw-> and use directories to separate stuff
<beneroth> T
<aw-> branch access rights?
<aw-> i've never heard of that
<aw-> that's not a git feature
<beneroth> no, it is not. gitlab et al implement such things, and you can also cheaply achieve it with unix access rights on the server repos
<aw-> ok so if you don't use gitlab then you can't use that feature?
<aw-> sounds stupid
<aw-> why tightly couple your work to a third party?
<beneroth> e.g. only one guy is allowed to write to master branch, oder people have to push to feature branch and request the master-guy to pull it into master
<beneroth> you can self-host gitlab server software.
<aw-> pft
<aw-> gitlab is shit
<aw-> again, why tightly couple your work to a third party?
<beneroth> I haven't used it enough to tell. only noticed their epic backup failure on their hosted services.
<aw-> if git works perfectly without gitlab, why install gitlab just to use a useless feature?
<beneroth> I fully agree with you, just wanted to mention other possible ways of working :)
<aw-> i think a lot of these code hosting companies are making the mistake of trying to lock-in their user's workflow to their platform. Even though I use github, if they close my account i can still do 100% of my work without them. If i use that gitlab feature and they close my account or my "self-hosted" install fails, then i'm screwed
<beneroth> I agree, lock-in into their users workflow and communication is the whole strategy of this kind of IT companies. WhatsApp, facebook, github FOSS communities, its all about having the company as a middle-man with a monopoly on the connection/communication between people. this way this companies can gain the insane "disruptive" scaling-factors - they don't do much of the work, just collect some overhead when others scale up.
<aw-> if you want to manage modules and stuff, you can have them all in separate code repositories, but **do not** use git submodules to link them together. That will be more of a mess than just having separate repos independent from each other, and a quick pil script to bring them together however you want
<beneroth> But I still find its meaningful to difference between a service you can only get as a SaaS, where all of RMS SaaSS-critic applies, and one where you legally and technically can self-host and self-control it.
<aw-> dunno.. if i give you a shipping container filled with car parts and tell you: "here's a free car, build it yourself and don't ask me for help", do you still think it's good?
<beneroth> of course, if this control is merely theoretical in practice depends a lot of your resources/effort/skill/whatnot. but that's also true for the alternatives.
<beneroth> I tend to say its better then using a always-remote-tracked and remote-controllable smart car, yes.
<beneroth> and beats the "build your car yourself and also get/create all the required parts yourself" for most people (maybe not picolispers, granted :))
<aw-> the control aspect doesn't worry me so much as the complexity of it all. Adding Slack to a team increases communication complexity by 10x and makes it more difficult to communicate on things that actually matter. The real issue isn't of Slack reading the company's messages, but rather the company not reading the messages which need to be read
<beneroth> agreed, great argument
<beneroth> I just wonder how businesses even want to adopt something named slack xD
<aw-> i'm happy these companies exist as long as I can choose how much independence I can have from them
<razzy> :]
<beneroth> I'm radicalising more and more, meaning I want to become more independent and the wish becomes stronger over time.
<aw-> like GitHub, if you're only using it for repo and wiki hosting, it's an absolutely fantastic service
<razzy> me too :]
<aw-> but as soon as you get into tying your entire workflow in there, triggering all sorts of things through their "simple" UI etc, then you're locked-in
<aw-> beneroth: good
<beneroth> aw-, T, but then git init --bare and a simple pil app with a list of texts and a textarea form to submit/edit those textes is pretty easy :)
<beneroth> the real value of github is the FOSS community thingy. basically programmer social media. with all the bad centralised company monopolizes access aspect.
<beneroth> I'm not active in such communities, so I don't care, but I see the positive value and the enormous dependency.
<aw-> i don't see a dependency, anyone can easily move from GitHub to another platform
<aw-> and git has all the internal features you let you work offline or on a LAN with your co-workers
<beneroth> how to migrate issue history, stars on projects/people, such things? there is no export for them afaik.
<beneroth> T, git is an excellent work.
<aw-> yes all issues are available via API, same for stars/followers/forks/etc
<aw-> but that stuff is all secondary
<aw-> the important stuff is the code
<beneroth> for you. for me anyway.
<beneroth> In some way you are absolutely right, in another I think you greatly underestimate the socialising function of github.
<aw-> i don't?
<aw-> i realize the importance of issues
<aw-> but it's not the most important thing, far from it.
<aw-> you know how many repos have THOUSANDS of open issues?
<razzy> code can be moved away easily, people not so much
<aw-> do you think they really care that much about those issues?
<aw-> if yes, they would all be closed, not open
<beneroth> what about the people using github as a recruiting platform, if they move their profiles somewhere else the function of being visible to employees also vanishes.
<aw-> so, if one of those repos happens to lose all those issues, who cares? it's not like they planned to close them anyways hahaha
<aw-> they stay open eternally
<aw-> the important issues will resurface, customers will email, call, tweet ... to get it resolved
<beneroth> what about all the build scripts failing because they always assume github to be their source? haha
<beneroth> we agree that would be a good thing. but still, there is value for some people in that :)
<freemint> elegant way to check if a matrix (list of lists) contained just 0's?
<aw-> i'm not saying there is no value
<aw-> that's not what i wrote
<aw-> i said it is secondary to the code
<freemint> ignore that
<aw-> the code is the most important
<beneroth> freemint, maybe (full (fully ...)) ? else check tankf33der repo
<aw-> not the build, not the issues, not the profile or stars. It's the code.
<aw-> but if the build is that important then i wouldn't throw it on a third party service
<beneroth> aw-, that is your and also mine opinion, but I believe many people would disagree with that view
<aw-> unless i can move that build locally
<aw-> that's what i said before, i'm fine with 3rd party services for things which I can easily become independent from them
<beneroth> aye, we agree
<beneroth> I just think why should I even use the 3rd party then?
<aw-> beneroth: for the social benefit ;)
<freemint> i said ignore that ...
<freemint> but thanks anyway
<beneroth> oh okay, sorry I overlooked
<aw-> beneroth: you agree the social benefit is useful, but not critical to your business operations?
<beneroth> as I radicalise on my views of software purity and independence, I become caring even less about the social benefit
<beneroth> hm
<beneroth> good question
<aw-> of course for recruiters that is critical to their business.. but i don't think github was initially build for recruiters
<beneroth> currently I have zero social/business benefit from being on github, i'm pretty sure
<aw-> ok
<aw-> that's fine
<beneroth> but you're right, that might change when I try to build an FOSS community
<beneroth> good food for thought
<aw-> it's the same as #picolisp
<aw-> if #picolisp didn't exist, would you code in something different?
<aw-> i'm referring to #picolisp chat channel
<beneroth> I probably wouldn't. on the other hand, here Regenaxer convinced me to continue with picolisp when I was afraid I would manage to build something I cannot maintain
<beneroth> but we spoke also over the phone a lot in my early days :)
freeemint has joined #picolisp
freemint has quit [Ping timeout: 252 seconds]
<beneroth> I don't fully accept yet that changing from github to something else would be as easy and quick as changing IRC channels (would still take a mail on the ML, minimum)
<razzy> irc have great benefits to me.
<beneroth> it reminds me of the promise of being able to switch between different database systems by using an ORM and limiting yourself to use the minimal features supported by all sibling database systems.
<beneroth> thanks tankf33der ! ha, nested fully, nice :)
<beneroth> freeemint, check the link!
orivej has joined #picolisp
<beneroth> razzy, well the ongoing fashion to centralise internet services on the web (HTTP for everything) is horrible.
<beneroth> I hope DNS will survive the current attack.
<razzy> it is horrible :]
freemint has joined #picolisp
freeemint has quit [Ping timeout: 252 seconds]
ubLIX has quit [Quit: ubLIX]
<razzy> time to make lisp OS comunity :]
<razzy> with shared resources :]
<beneroth> aye, when I'm finished with insourcing webserver, database and browser I will need my own OS and then my own hardware :(
<razzy> or watch world crumble :]
freemint has quit [Ping timeout: 240 seconds]
<beneroth> oh watching world crumble we can do at the same time. if we lucky the world crumbling goes not so bad that it stops our projects ;-)
<razzy> :D
<razzy> i meant distributed OS with shared resources between members
<razzy> i can do with commercial instruction sets ;]
freemint has joined #picolisp
<beneroth> well you never know if the hardware is really hardware or running another linux pretending to be hardware ;)
<razzy> true, but you can abuse your hardware to the point that it reveal what it is or die
<beneroth> T, but that assumes there will be still hardware vendors without sick stuff in it.
freemint has quit [Ping timeout: 240 seconds]
<razzy> beneroth: there is way around, and if they make powerfull cheap HW, joke is on them
<beneroth> okay :3
<aw-> beneroth: we think alike
<beneroth> T. but that's something I notice with a lot of people in this little community here. Which I find pretty fascinating, given that in all other things people here seem to be very diverse and distributed I think.
freemint has joined #picolisp
<beneroth> somehow picolisp is a great filter to make a certain type of people self-selected out/into this community.
<aw-> haha perhaps
<razzy> mostly because Regenaxer weird syntaxe :]
<Regenaxer> Only simple-minded people ☺
<beneroth> :D
<beneroth> nice pun :)
<razzy> T
<beneroth> software ascetics ?
<beneroth> Thou shall not bloat. Thou shall weight every dependency to its practical long-term value. Thou shall not even think about premature optimization. Thou shall do you work pragmatically and practically-oriented
<Regenaxer> :)
<razzy> CoC
<Regenaxer> :(
<beneroth> Thou shall prefer koans above dogma (well that is stolen from discordians)
<razzy> picolisp has its own religious CoC :] muhehe :]
<Regenaxer> yes, kind of
<beneroth> that's the thing about true gurus - they're not self-appointed, and people flock to them :P
<beneroth> reminder: of course we don't like personality cult.
<razzy> :D
<razzy> afk
razzy has left #picolisp ["ERC (IRC client for Emacs 26.1)"]
freemint has quit [Ping timeout: 244 seconds]
orivej has quit [Ping timeout: 252 seconds]
freemint has joined #picolisp
orivej has joined #picolisp
razzy has joined #picolisp
ubLIX has joined #picolisp
<razzy> software asketism should be major religion :]
razzy has quit [Read error: Connection reset by peer]
razzy has joined #picolisp
<ubLIX> readline, readline, my cycles for a readline!
<razzy> :D
razzy has quit [Ping timeout: 252 seconds]
<freemint> Regenaxer (by bla uniq ListofList) does not work as expected any ideas what to replace it with
<beneroth> (uniq (by bla sort ListofLists)) ? :P
<freemint> oh let me try that
<freemint> does not work
<beneroth> (by bla sort) is comparable to (mapcar cadr (sort (mapcar '((Element) (cons (bla Element) Element)) ListOfLists))
<beneroth> what do you want to achieve?
<beneroth> uniq by element or uniq value returned from bla function ?
<freemint> uniq by value of bla function
<beneroth> you were doing uniq by element. I'm sure that works.
<beneroth> see (group) then
<freemint> (doc 'group) or (doc 'uniq) group example
<beneroth> doc group
<beneroth> -> (("x" "x" "x") ("y") ("z" "z"))
<beneroth> : (by name group '("x" "x" "y" "z" "x" "z"))
<freemint> ah and then take the first element out of each group?
<beneroth> well thats up to your task, I don't know.. what do you want with all the additional results ?
<beneroth> are the same? or do they just return the same value with (bla) but are different things?
<beneroth> you didn't tell enough about your use case to judge that from here
<freemint> I never thought i would write '(mapcar 'car X) but here i did
<beneroth> and btw. maybe improve your communication by not stating "pil func does not work as expected" when your expectation is probably wrong. the general expectation about a function would be about what is described in the doc. if you state "pil func x does not behave as expected" you are claiming a bug in picolisp - this can happen, but then better have an convincing finished example ready proving your point.
<freemint> ... better phrasing...
<freemint> ?
<beneroth> (mapcar car X) is enough, no need to quote 'car here, as it is built-in. but you could do it for good habits (always quoting then you don't have to remember what is built-in and what isn't - but then you waste one cell memory)
<freemint> I got a bug in my understanding
<beneroth> T
<beneroth> I want to achieve XY. I thought the way would be (...)). where am I wrong?
<beneroth> that would be much less confrontational :)
<beneroth> agreed=
<beneroth> ?
<freemint> (Rege Told me that about (mapcar 'stuff) a few times the additional quote is a habit that dies badly
<freemint> yeah less confrontational
<beneroth> yeah, it is okay, no worries. better one quote too much than one too less in this context.
<beneroth> could you solve your problem now?
<freemint> For now .. yes
<beneroth> great :)
<freemint> I tried to generate all upper diagonal matrizes which would result in a unique Jordan block configuration
<freemint> (assuming one Eigenvalue for complete matrix)
<beneroth> btw the quote thing is really an instance of "save a single cell" radicalism. not an important point in itself. but I would argue that training myself proper habits is good in principle, because then I'm more likely to do the right thing when it matters out of habit.
<beneroth> nice. I have no knowledge about such things :/ sounds cool :)
xkapastel has joined #picolisp
<freemint> beneroth i am trying to do some stupid math homework by bruteforce. luckily the mapping PicoLisp to math is not all that complicated
<beneroth> nice
<freemint> the problem is i come to the opposite result the question suggests.
orivej has quit [Quit: No Ping reply in 180 seconds.]
ubLIX has quit [Quit: ubLIX]
orivej has joined #picolisp
<Regenaxer> Sorry, was away
<Regenaxer> So far 'by' works only with 'sort' or 'group'. I did not find any other use case yet
<Regenaxer> BTW, (mapcar foo Lst) works also if 'foo' is not a builtin
<Regenaxer> 'mapcar' needs a function, so either a number (= builtin) or a list (= Lisp level)
<Regenaxer> In (mapcar foo Lst) the args are evaluated, so mapcar sees the value which is what it needs (hopefully)
<beneroth> well (by 'foo 'bar Lst) would also work, as long as bar can handle the list of cons, no ?
<Regenaxer> yes, but it must do something based on the CARs
<beneroth> naturally
<beneroth> as documented in ref :)
<Regenaxer> For 'foo' I see only sort or group I mean
<Regenaxer> yes
<Regenaxer> My answer "but it must do something based on the CARs" was not to the point
<Regenaxer> in fact 'bar' can be anything
<beneroth> T
<Regenaxer> oops
<Regenaxer> no :)
<Regenaxer> foo can be anything and bar is sort or group so far
<beneroth> (by 'bla 'uniq List) cannot work in principle, because it reduces the decorated list
<Regenaxer> yes, uniq does not make sense here
<beneroth> but (by 'foo 'bar Lst) would make sense if 'bar is a custom (sort)-like function
<beneroth> and would work then.
<beneroth> (should work, in principle. I did not test)
<beneroth> correct?
<Regenaxer> In principle 'bar' can be any function, yes
<Regenaxer> But I never found another use-case so far
<beneroth> yeah, same. because if it is a custom sort function, you can just put that custom functionality into the 'foo function (the decoration) and it works :)
<Regenaxer> yes, 'by' is not needed then
<beneroth> probably more efficient using the in-built sort instead of doing a custom sort... and when a custom sort is better, then by is not needed, aye
<beneroth> haha
<beneroth> yeah your right, it really only makes sense for group and sort xD
<Regenaxer> I think other cases can be conceived, but they are far more complicated than the direct way
<beneroth> T.
<beneroth> I strongly suspect such other very-specific cases are then simpler implemented by not using (by)
<beneroth> but yeah, there might be some cases.
<Regenaxer> I try to force one :)
<Regenaxer> hmm, examples get complicated quickly ;)
<Regenaxer> : (by '((L) (sum prog L)) '((Lst) (filter '((L) (=0 (car L))) Lst)) '((1 -1) (1 2 3)))
<Regenaxer> -> ((1 -1))
<Regenaxer> Pretty meaningless in praxis
<Regenaxer> It is useful if 'bar' operates on the CARs
<beneroth> xD
rob_w has quit [Remote host closed the connection]
<freemint> You never stop learning
<Regenaxer> Good so
<freemint> i thought of a more usefull case for uniq in that situation
<Regenaxer> 'uniq' is too simple in concept
<freemint> If you want uniq a list, but with the twist that each element is allowed to stay up to N times.
<Regenaxer> N times = not uniq ?
<Regenaxer> So 'filter' ?
<freemint> (by '((X) (% (how-often-have-you-seen X) 3) uniq List)
<Regenaxer> nada
<freemint> ok tell me he where i go wrong.
<freemint> we pass it (1 1 1 1)
<freemint> it gets decorated to ((1.1) (1,2) (1.3) (1.1))
<freemint> uniq makes it ((1.1) (1.2) (1.3))
<freemint> and we get (1 1 1) after dedecoraction
<freemint> Regenaxer where does that go wrong?
<Regenaxer> Who decorates (1 1 1 1) to that?
<Regenaxer> % ?
<freemint> by?
<Regenaxer> Moment, busy, bbl
<beneroth> freemint, (uniq) compares the cons pairs, not just the first element
<beneroth> so uniq compares (1 . 1) to (1 . 2) and decides those element are different
<freemint> yes
<beneroth> : (by car 'uniq '((1 . 1) (1 . 2) (1 . 3) (1 . 1)))
<beneroth> -> ((1 . 1) (1 . 2) (1 . 3))
<beneroth> works
<beneroth> not
<beneroth> :D
<freemint> as a proof of concept (by '(() (rand 1 3)) uniq (fish 'atom (list (1) (need 5 5) (need 25 25 ]
<beneroth> because the car results in '((1 1 . 1) (1 1 . 2) (1 1 . 3) (1 1 . 1)) -> again, elements are uniq when compared
<freemint> each item ends up in the list up-to 3 times (used random number since a symbol dependent counter would be to verbose in the is case
<beneroth> uniq compares elements. the decorated elements within (by) still contain the original elements consed to it, so they always look uniq
<freemint> (by '(() (rand 1 3)) uniq (fish 'atom (list (1) (need 5 5) (need 25 25 ]
<freemint> -> (1 5 5 5 25 25 25)
<freemint> (sometimes (1 5 5 25 25 25) but that's bad luck
<beneroth> this results in (mapcar '((E ) (cons E(rand 1 3))) (fish 'atom (list (1) (need 5 5) (need 25 25 ] during the (by)
<freemint> beneroth i tried to limit the occurrence of each element in the (1 5 5 5 5 5 25 ..25 ) to 3
<beneroth> in picolisp, when comparing two lists (or cons pairs), they're fully compared
<freemint> exactly that happend
<freemint> It works! I've seen it with my own two eyes
<beneroth> mistake, I meant (mapcar '((E ) (cons (rand 1 3) E)) (fish 'atom (list (1) (need 5 5) (need 25 25 ]
<beneroth> yes, do you understand why it works?
<beneroth> because there are multiple elements in the decorated list being the same, e.g. multiple times (1 . 25) which then get sorted out by uniq
<freemint> is my 5 line explanation up there right?
<beneroth> as far as I can see, yes it is. but its a pretty specialised case. you can't use this approach for arbitrary values for 'bla in (by 'bla uniq List)
alexshendi has joined #picolisp
<beneroth> so you do (mapcar cdr (uniq (mapcar '((E) (cons (rand 1 3) E)) (list 1 ~(need 5 5) ~(need 25 25)))) ?
<freemint> That seems right
<Regenaxer> Sorry, still busy, but I would do:
<Regenaxer> (let A NIL (filter '((N) (>= 3 (fin (accu 'A N 1)))) (1 5 5 5 5 5 7 7 7 7 9]
<Regenaxer> -> (1 5 5 5 7 7 7 9)
<beneroth> aye, (accu) :)
<Regenaxer> bbl
<freemint> yeah accu instead of rand
<freemint> Regenaxer your solution is 33% faster for very long lists (when both use accu) and there is a good deal of multiplicity
<Regenaxer> Another way than 'accu' is 'group' plus 'head'
<Regenaxer> (mapcan '((L) (head 3 L)) (group (mapcar cons Lst Lst)))
<Regenaxer> (let Lst (1 5 5 5 5 5 7 7 7 7 9) (mapcan '((L) (head 3 L)) (group (mapcar cons Lst Lst))))
<Regenaxer> -> (1 1 5 5 5 7 7 7 9 9)
<Regenaxer> OK, good
<Regenaxer> Perhaps this one is faster?
<freemint> let's wait 40 seconds and see
<Regenaxer> :)
<Regenaxer> 'accu' looks more expensive
<Regenaxer> on the other hand less mapping
<freemint> filter 41 seconds, group 50 seconds, by 66 seconds on my device
<Regenaxer> ok
<Regenaxer> group is wrong
<Regenaxer> Needs one more 'cdr'
<Regenaxer> (let Lst (1 5 5 5 5 5 7 7 7 7 9) (mapcan '((L) (head 3 (cdr L))) (group (mapcar cons Lst Lst))))
<Regenaxer> In my feeling 'filter' is the most natural approach
<freemint> yeah
<freemint> well we could decide with size
<Regenaxer> The correlation of size and speed in pil?
<Regenaxer> cell count
<freemint> filter is smaller so it is the more goofy solution ;)
<Regenaxer> yes
<beneroth> also its named "filter", so its more obvious that it does.. well filtering :)
<Regenaxer> and surprisingly often the smaller one is faster in pil
orivej has quit [Ping timeout: 240 seconds]
<freemint> is anybody in the mood for an algorithmic problem?
<freemint> problem turned out boring ...
<tankf33der> freemint: what task?
<freemint> I give the complex one ok? (which turned out not to be my problem)
<tankf33der> ha
<tankf33der> lets see
<freemint> imagine you got N meter of free space and you want to find all combinations of x meter sized cars you could park on that.
<freemint> Here are the rules. Between each car has to be atleast a meter (but it could be more) of space. There is no need to have safe space at the end or beginnt of you parking lot.
<freemint> Give a list of a unique combinations (2 3meter and 1 2meter) counts as the same as (1 2 Meter and 2 3 Meter)
<freemint> It is not that easy to get all the edgecases right.
<tankf33der> insane
<freemint> free space is not listed in the final result
<freemint> what is insane?
<freemint> tankf33der what is insane?
<tankf33der> hard level
<tankf33der> and i dont know how to solve it
<freemint> ok i will show you my solution later ...
<freemint> there is a trick i used to make the problem easier
orivej has joined #picolisp
alexshendi has quit [Remote host closed the connection]
<freemint> How can i get the property list of a symbol i forgot
<Regenaxer> 'getl'
<Regenaxer> Or iterate with 'maps'
<freemint> and how do 'off all properties?
<Regenaxer> 'putl' with NIL
<Regenaxer> (putl Sym NIL)
<freemint> tankf33der still working on it?
<tankf33der> freemint: no, i dont know how to do it
<freemint> i did it directly first and it was not so beautiful... recursion and fiddling until all cases work
<freemint> The easy way out it is:
alexshendi has joined #picolisp
<freemint> Generate all allocations things atleast 1 long
<freemint> (remove the duplicates by (uniq (mapcar 'sort
<freemint> So we got all unique allocations right now.
<freemint> If an allocation is larger than 2 we put a car in there, of the size one meter smaller so there is a meter space to the neighbor down the line. If it just a 1 we just leave an additional meter of space.
<freemint> At the end we allocated 1 meter more then we have but that is buffer from the last car, so we can ignore that and are done.
<freemint> Basically generate all allocations of space , decrease all by 1 and filter out the 0's
<freemint> tankf33der is that clear?
<tankf33der> yeap
<freemint> Beautiful?
<freemint> (setq Alloc (allows Totalspace))
<freemint> damn
<freemint> well you get the idea
<freemint> the results of this are used in 14 line nested for - for - until & (map - for - mapcar) loop i am trying to debug that one
<freemint> now
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 268 seconds]
ubLIX has joined #picolisp
grp has joined #picolisp
<freemint> 3+1/2 hours for 40 lines of code? is that bad?
<freemint> and i spend all day on the prototype which was completely missguided
<Regenaxer> A good programmer writes about 15 lines per day in a long-term large project (I read that some years ago, and I found it is right)
<freemint> comments appreciated
<freemint> the task was to find all (complex) Jordan matrizes which have the same number of Jordan blocks and behave the same under expontentiation
* freemint hints that he really needs some appreciation
<freemint> also the code depends on the puzzle tankf33der did not find the time to solve
<tankf33der> freemint: you are
<tankf33der> good
<tankf33der> keep coding.
<freemint> tankf33der you mean like today? or in general
<tankf33der> in general
<tankf33der> afk
<freemint> thank good
<tankf33der> sleep
<freemint> i need to a write up on that but the i will
<Regenaxer> freemint, looks good on a first glance. Some minor details
<freemint> as always
<Regenaxer> For an error 'quit' is better than a 'throw' without 'catch'
<Regenaxer> (= 1 -> (=1
<Regenaxer> and (< N 1) better (le0 N) ?
<freemint> yeah i tried to keep the code readable to somebody who is not that familiar with lisp
<Regenaxer> ok, good
<freemint> that explains the inefficient comparisons
<Regenaxer> which ones are inefficient?
<Regenaxer> length?
<Regenaxer> Is the 'copy' needed in (link (copy L)) ?
<freemint> maybe i sort those later ... but i think bot
<Regenaxer> (mapcar 'sort -> (mapcar sort
<freemint> some habits never die ;)
<Regenaxer> (- Option 1) -> (dec Option)
<Regenaxer> really pedantic ;)
<freemint> to keep it easier to read i tried to do none of the numeric shorthands
<Regenaxer> ok
<Regenaxer> I'm also too tired now to dig into it deeper ;)
<freemint> The code runs
<Regenaxer> perfect!
<freemint> There is one thing that could be improved but it is needed for solving the problem. I got everything prepared so i can generalize for nxn vs 7x7 but that feature was not needed
<freemint> it could be done in half an hour i think
<Regenaxer> cool!
<freemint> yeah i did cut losses there.
<Regenaxer> (when (> (length (car X)) 1) is a typical case
<Regenaxer> Better (when (cdar X)
<Regenaxer> length is expensive
<freemint> i would not have thought of that
<freemint> but i will keep out since it hinders readability
<Regenaxer> yeah, I see that often
<Regenaxer> if (car X) is not long no problem
<freemint> i am aware.
<Regenaxer> T
<Regenaxer> 'length' is seldom needed, so I'm alerted quickly
<freemint> I got a few situations where i walk a list one more often than i would have to but... not doing so would require counting up all the time
<freemint> i traded of for simplicity
<freemint> If there would be a "in the final iteration of (for X LIST" i could have prevented that
<freemint> I know that such a thing exists in common Lisp
<Regenaxer> You can 'map' and look at CDR
<Regenaxer> or 'for' on the list
<Regenaxer> (for (L Lst L (cdr L)) (if (cdr L) (notLast
<freemint> i see but i find that 3. Form of for still voddo
<freemint> thanks for the commen
<freemint> ts
<freemint> i feel it was worth it
<beneroth> yeah the higher forms of (for) are a hard spell to cast, I also have to look it up, also because I need it so rarely
<beneroth> good job freemint
<freemint> thanks ...
<beneroth> keep at it, you are a good programmer, you will become great
<freemint> oh that means so much to me.
<Regenaxer> I second that
<beneroth> first step is to develop a good taste, only then you can judge work (your own and others) and then continue to become much better. you absolutely have the right taste, else you would not be here and not have sticked.
<beneroth> (if I may claiming so arrogantly for picolisper to have good taste)
<freemint> i just wanted to hint at that
<freemint> any ideas how to print out code?
<beneroth> the problem is, often people stop once they developed a good taste
<beneroth> hmm. fixed-size font, 80 chars (or more, if readability allows) per line, syntax coloring if possible.
<freemint> i am talking about PicoLisp code ...
<beneroth> I would add some more linebreaks, especially with the comments (your comments are great)
<beneroth> else.. no idea haha, sorry :)
<beneroth> print to pdf from text editor of your choice?
<freemint> did you know that libreoffice can find and replace also with text attributes like bold?
<beneroth> no
<beneroth> nice one
grp has quit [Quit: box shutting down...]
orivej_ has quit [Ping timeout: 264 seconds]
orivej has joined #picolisp
CORDIC has joined #picolisp
DKordic has quit [Ping timeout: 240 seconds]
CORDIC has quit [Ping timeout: 240 seconds]
freemint has quit [Ping timeout: 264 seconds]
freemint has joined #picolisp