waleee has quit [Ping timeout: 252 seconds]
njsg has left #commonlisp [#commonlisp]
<gendl> well maybe some young whippersnappers will start coming in here too (fingers crossed)
<gendl> oh I see whippersnapper has a kind of negative connotation... that's not what I meant
Bike has quit [Quit: leaving]
Lycurgus has joined #commonlisp
kjz has joined #commonlisp
Oladon has quit [Quit: Leaving.]
kjz has quit [Client Quit]
Lycurgus has quit [Quit: Exeunt]
random-nick has quit [Ping timeout: 248 seconds]
octothorpe has joined #commonlisp
etimmons has quit [Remote host closed the connection]
eric[m] has joined #commonlisp
eric[m] is now known as etimmons
jaykru has joined #commonlisp
<jaykru> is lparallel broken? a few weeks ago I had a pmap call that yielded a huge
<jaykru> lparallel kernel, I am only getting 100.4% CPU utilization, and a much slower computation.
<jaykru> performance improvement over sequential map. #'time reported several hundred percent CPU utilization. now on the same machine with the same
<jaykru> oops, sorry about the eye piercing formatting
<jaykru> potentially relevant info: number of workers is and has been 16.
<Nilby> I use lparallel all the time, but I just use the thread pool task stuff. The way I wanted to use pmap didn't work.
<Nilby> I usually make the workers be the processor count.
<Nilby> Oh actually it was defpfun that I had trouble with, not pmap.
<Nilby> Unfortunately there are some platforms where bt:*supports-threads-p* is NIL, but I'm assuming that's not your case.
octothorpe has left #commonlisp [WeeChat 3.1]
beans has joined #commonlisp
beans has left #commonlisp [WeeChat 3.0.1]
<jaykru> yeah i set the number of workers to cl-cpus:get-number-processors (or whatever the actually name is)
<jaykru> hm
<jaykru> maybe i'll try the thread pool task stuff then
<jaykru> worth a shot
<jaykru> i'm just pretty confused why it was working before and now suddenly not :/
<Nilby> jaykru: if you could make a short example that doesn't work maybe others could test it?
dieggsy has quit [Read error: Connection reset by peer]
dieggsy has joined #commonlisp
hexology has joined #commonlisp
hexology has quit [Changing host]
hexology has joined #commonlisp
<beach> Good morning everyone!
<hexology> good morning!
<Nilby> Good morning beach.
<beach> hexology: Are you new here? I don't recognize your nick.
<hexology> i was on freenode, although i mostly lurked there too
<beach> I see.
<hexology> does sbcl buffer stdin at all? if i'm writing an application that reads from stdin, should i implement my own block buffering? or should i assume that stdin is appropriately buffered already, and read from stdin however is most convenient?
silasfox has quit [Ping timeout: 264 seconds]
ircseeker has joined #commonlisp
bilegeek has quit [Quit: Leaving]
johan_ has quit [Ping timeout: 264 seconds]
<beach> hexology: Maybe the people in #sbcl know more.
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 264 seconds]
Lord_of_Life_ is now known as Lord_of_Life
<hexology> beach: ok, i'll ask there
ad-absurdum has joined #commonlisp
leeb has joined #commonlisp
srhm has quit [Quit: Konversation terminated!]
Nilby has quit [Ping timeout: 264 seconds]
leeb has quit [Client Quit]
leeb has joined #commonlisp
ircseeker has quit [Remote host closed the connection]
ad_absurdum has joined #commonlisp
ad-absurdum has quit [Ping timeout: 248 seconds]
<saturn2> i believe streams in SBCL are always buffered
Oladon has joined #commonlisp
leeb has quit [Quit: WeeChat 3.1]
leeb has joined #commonlisp
amk has quit [Read error: Connection reset by peer]
amk has joined #commonlisp
johan_ has joined #commonlisp
ad_absurdum has quit [Read error: Connection reset by peer]
ad-absurdum has joined #commonlisp
Oladon has quit [Quit: Leaving.]
pve has joined #commonlisp
ad_absurdum has joined #commonlisp
robin has quit [Quit: Leaving]
robin has joined #commonlisp
ad-absurdum has quit [Ping timeout: 264 seconds]
johan_ has quit [Ping timeout: 248 seconds]
leo_song has joined #commonlisp
dickbar__ has joined #commonlisp
fengshaun has joined #commonlisp
johan_ has joined #commonlisp
Lord_of_Life has quit [Quit: Laa shay'a waqi'un moutlaq bale kouloun moumkine]
Lord_of_Life has joined #commonlisp
rgherdt has joined #commonlisp
prite has joined #commonlisp
Lycurgus has joined #commonlisp
totoro has quit [Quit: WeeChat 2.8]
mindCrime has joined #commonlisp
Lycurgus has quit [Quit: Exeunt]
johan_ has quit [Ping timeout: 252 seconds]
cage has joined #commonlisp
johan_ has joined #commonlisp
TheLugal is now known as sndr
johan_ has quit [Ping timeout: 264 seconds]
srji has quit [Quit: leaving]
srji has joined #commonlisp
srji has quit [Quit: leaving]
srji has joined #commonlisp
hendursa1 has joined #commonlisp
hendursaga has quit [Ping timeout: 252 seconds]
selwyn has joined #commonlisp
selwyn has quit [Remote host closed the connection]
selwyn has joined #commonlisp
mindCrime has quit [Ping timeout: 264 seconds]
mindCrime has joined #commonlisp
ad-absurdum has joined #commonlisp
ad_absurdum has quit [Ping timeout: 248 seconds]
mindCrime has quit [Ping timeout: 265 seconds]
akanouras has quit [Quit: Konversation terminated!]
akanouras has joined #commonlisp
<srji> any pandas clone in clisp?
<tux0r> pandas?
<srji> sorry
<beach> srji: Why CLISP specifically? Most Common Lisp code works across implementations.
<srji> its a widely use dataframe clone in python
<srji> beach: i thought clisp stand for commonlisp?!
<beach> It does not.
<srji> oh ok
<beach> CLISP is one of many implementations of the Common Lisp language.
<srji> i see
<srji> ill take care of it in the future :)
<beach> If you don't want to type "Common Lisp", and you don't have your abbrev processor as I do, then use "CL" instead.
<srji> good to know :)
<srji> i want to replace python with lisp in my dialy work which involves data analysis and web scraping and currently im looking for similar libs in lisp
<srji> theres a good article related to web scraping in the CL cookbook
<srji> but what i miss is something similar to pandas https://pandas.pydata.org/docs/getting_started/index.html
<srji> it seems lisp-stat goes into this direction
amk has quit [Read error: Connection reset by peer]
amk has joined #commonlisp
nature has joined #commonlisp
<beach> nature: You have a lot of duplication because you are duplicating the functionality of existing functions.
<beach> nature: UPDATE-ENTRY is essentially REINITIALIZE-INSTANCE.
<beach> nature: Also, let me take this opportunity to point you to page 13 of the LUV slides by Norvig and Pitman. The expectations by the person reading your code is that WHEN takes a Boolean expression as a test, but your tests are variables that have non-Boolean values where NIL indicates a default.
Nilby has joined #commonlisp
<beach> nature: Furthermore, it is best to have a different name of a slot an of its accessor, because if they are the same, an exported symbol can be used in SLOT-VALUE, which should not be part of your protocol.
<beach> Slots are implementation details that should not be visible to client code.
<beach> nature: And there is no particular reason to have an initform for your slots if every time you create an instance, you supply the initargs.
<nature> Got it beach !
<nature> Thanks
<beach> Sure.
<nature> I ended up using defstruct (:type list) tho since it seems to fit my usecase in a simpler way, is there any reason I shouldn't?
<beach> Structs don't have the good semantic properties that instances of standard classes do. If you modify a standard class, then existing instances are updated to conform to the new version of the class. There is no such guarantee with structs.
<nature> And regarding WHEN it's the better to test with (null myvar) ?
<beach> That's what I do: (UNLESS (NULL MYVAR) ...)
<nature> makes sense
<beach> Semantically, they are the same. But the message you send to the person reading the code is different.
<beach> I have to stop and think whenever I see (WHEN EMAIL ...).
<nature> Interesting, I felt it read more "naturally" like english
<beach> "Hmm, let's see, if EMAIL is NIL then the body is not going to be evaluated. Oh, so it's really (UNLESS (NULL EMAIL)...)"
<beach> nature: Well, in your case, what you really mean is "If the EMAIL argument was supplied, then ...". And that is done differently. You have so-called SUPPLIED-P parameters for the keywords.
<nature> oooh I see, that's the subtelty
<beach> ::clhs 3.4.1
<beach> Because with your code, if you pass :EMAIL NIL, then presumably, the caller wanted to set the EMAIL slot to NIL.
<beach> Your code doesn't handle that situation, but with SUPPLIED-P parameters, it will.
<nature> May I share the updated version using structs?
<beach> I don't understand the question.
<beach> So your code would then look like (WHEN EMAIL-P (SETF (EMAIL OBJ) EMAIL)).
<beach> Oh, you want us to look at it?
<beach> I never use structs myself so I'll let others have a look.
<contrapunctus> srji: I have no experience with pandas, but I remember seeing this - https://github.com/40ants/teddy ; maybe there's something here, too? https://github.com/CodyReichert/awesome-cl#numerical-and-scientific As a last resort, there are a bunch of ways to use Python code in Lisp, which is obviously clunkier than using native Lisp libraries.
<nature> beach: I see yeah, the thing is that I changed it a bit since yesterday to use struct instead of objects and yeah I wanted to show the updated version to see if I understood things well
<nature> In case anybody has some time to critique this as well, I feel it's cleaner but feel free to let me know how this is not the right way: https://p.sonu.ch/d764.lisp
Wombatzus has quit [Ping timeout: 264 seconds]
<phoe> I sort of dislike the fact that there's an implicit WHEN NULL *DB* everywhere
<phoe> IMO loading the database should be an explicit action, rather than being triggered by any database operation
<phoe> also, if your database *is* null, then you're going to read an empty file on every get-db
<phoe> and also this snippet does not define *DB-PATH*
<phoe> also the multiple SETFs can be coalesced into one, but that's just style
<nature> Makes sense! It may make more sense to just load the *DB* at server start, and how ca you coalesce the multiple SETFs into one?
<phoe> (setf a b c d e f g h ...)
<phoe> SETF accepts pairs of arguments
<phoe> in the above example B gets set to A, D to C, F to E, H to G, ...
<nature> ok thanks for the contructive feedback
<nature> My experience with the code AND the people in common lisp has been a real enjoyement so far! :D
<phoe> <3
yitzi has quit [Quit: Leaving]
heisig has joined #commonlisp
winter has joined #commonlisp
dieggsy has quit [Read error: Connection reset by peer]
dieggsy has joined #commonlisp
winter has quit [Ping timeout: 272 seconds]
johan_ has joined #commonlisp
winter has joined #commonlisp
dieggsy has quit [Ping timeout: 265 seconds]
dieggsy has joined #commonlisp
winter has quit [Quit: WeeChat 3.1]
cirrus21 has joined #commonlisp
<cirrus21> hi
<beach> hello cirrus21.
<cirrus21> hhas anyone here ever use cl-irc?
<beach> Isn't that what beirc uses?
<cirrus21> who
<beach> The CLIM-based IRC client, not a person.
<cirrus21> ooh
<beach> Yes, I confirm.
leeb_ has joined #commonlisp
<_death> minion too, RIP
<beach> We need to teach Colleen some tricks, I guess.
<cirrus21> i aam at work, developer for python but i ffor a a year or so know ssome lisp
<cirrus21> and llike lisp
<cirrus21> but iits hard : )
<beach> cirrus21: Keyboard problem?
<cirrus21> nno im ok
<beach> cirrus21: Many letters are doubled.
<cirrus21> ooh
<cirrus21> yes
<cirrus21> i mmade a robot for that
leeb has quit [Ping timeout: 264 seconds]
<cirrus21> ddoes anyone here use stumpwm
<beach> Yes, some do.
<cirrus21> i uused to use stumpwm aall the time
<cirrus21> i mmade a command tthat turns current layout into fibonacci sspiral its nnice
<beach> cirrus21: Would it be possible to turn off those double letters?
<cirrus21> iid prefer not to..
<beach> It is very irritating.
<cirrus21> ssorry
johan_ has quit [Ping timeout: 252 seconds]
random-nick has joined #commonlisp
waleee has joined #commonlisp
<nature> xD
<Nilby> i LiKe tExt acCenTs. 𝔚𝔥𝔶 𝔫𝔬𝔱 𝔥𝔞𝔳𝔢 𝔣𝔲𝔫?
<nature> You should adapt your bot to add a hyphen between those double letters so it really looks like you're stuttering
<cirrus21> ooh
<_death> yuor irenentt rlaey chat cenlit can be pogmeramrd to sohw text the way you wnat
waleee has quit [Ping timeout: 264 seconds]
cage has quit [Remote host closed the connection]
cage has joined #commonlisp
<phoe> cirrus21: please don't
<beach> phoe: "don't" what? Turn them off?
<phoe> please don't write like that
<beach> Right, thanks.
<phoe> wasting other people's time on reading badly written messages is, as the first word in my sentence states, wasteful
<beach> Indeed. Some people either don't realize that, or they don't care.
<cirrus21> hhuh
<phoe> please
<cirrus21> ddont understand
cirrus21 was kicked from #commonlisp by phoe [please stop using doubled letters]
<hexology> ironically i just wrote a program in lisp last night to turn text into "mOCkINg Meme tEXt"
<tux0r> iRoNiCalLY i JUSt wROTe A prOgraM IN LiSP last niGhT to TUrn teXT INTo "mOCKINg mEmE Text"
<tux0r> :p
<phoe> oh gods no
<beach> It seems the message didn't get across.
<phoe> I truly hope that these last messages were irony and/or sarcasm
<dsk> (setf *print-case* :pokemon)
rgherdt has quit [Ping timeout: 272 seconds]
<hexology> phoe: this is great! now i have a "professional" version i can learn from
<hexology> this was mine https://bpa.st/BZYA (obviously the defmacro was unnecessary here but i was just trying to get reacquainted with the language)
<hexology> why is it "pokemon" case? i called it "sbob" after the spongebob image macro
<hexology> ah i see this is alternating, mine is random
<phoe> hexology: have you ever seen the pokemon logo? it's stylized like PoKeMoN
<phoe> oh yes, right
<hexology> phoe: huh.... it is. i never noticed that
<hexology> so you pre-allocate an array and fill it w/ the LOOP
<phoe> yes - my function accepts a string and returns a fresh string
<Nilby> Thankfully my identifier filters for converting from c++/java will handle PoKe/sbob too.
<phoe> I assume that this code of mine can be further improved, but I don't think it's really worth it
<hexology> yours looks more efficient than mine
<hexology> i didn't realize that (make-array n :element-type 'string) was literally identical to a string
<beach> If y'all are bored, I have a list of suggested programming projects: http://metamodular.com/Common-Lisp/suggested-projects.html
<beach> hexology: It isn't.
<hexology> hm. they print the same in the repl...
<hexology> i can explore futher
<beach> A string would have :element-type 'character
<phoe> beach: I assume what's what hexology meant
selwyn has quit [Read error: Connection reset by peer]
<phoe> but, yes, nowadays I would have written this as just (copy-seq string)
<beach> I see yes.
<Nilby> I should probably regret the the fit of maddness when I added a bunch of meme effects/de-effects to my input stuff. 𝓑𝓾𝓽, 𝕒𝕔𝕥𝕦𝕒𝕝𝕝𝕪 𝕴 ⒭⒠⒜⒧⒧⒴ ĐØ₦₮. 𝓘𝓽'𝓼 𝓪𝓵𝓼𝓸 ᗯᕮIᖇᗪ ᑕOᒪOᖇᔕ. Maybe I was envious of the ^F font stuff in old symbolics code.
selwyn has joined #commonlisp
<_death> you can have it fill the input, creating a 2D block of text.. then you can pick some distortion clusters where the effect is applied.. each effect could be parameterized by a strength, which may be at a maximum in the cluster's center
<_death> you could call it k-mons
jealousmonk has quit [Quit: Long live IRC!]
tzlm454 has joined #commonlisp
<Nilby> _death: That sounds above my meager meme abilities. I'm trying to resist the urge to investigate how irc colors work and convert from my effected string format.
jealousmonk has joined #commonlisp
micro has joined #commonlisp
leeb_ has quit [Quit: WeeChat 3.1]
leeb has joined #commonlisp
yitzi has joined #commonlisp
johan_ has joined #commonlisp
leeb has quit [Quit: WeeChat 3.1]
dieggsy has quit [Ping timeout: 264 seconds]
dieggsy has joined #commonlisp
<hexology> phoe beach that is indeed what i meant!
<hexology> for that matter, what exactly is a "character"? is it a unicode code point? a byte?
<hexology> ah wait, i found it in the hyperspec. http://www.lispworks.com/documentation/HyperSpec/Body/13_a.htm
<hexology> or not... how should "a unitary token" be interpreted?
<phoe> however you want
<phoe> a character in Common Lisp is an abstract entity
<phoe> you can turn it into a char-code and from a char-code, but generally characters are neither bytes or unicode code points
<phoe> s/or/nor/
<phoe> they're abstract entities with their own class
<hexology> apparently #\👋🏻 is not a valid character
<phoe> mostly because it is not a single character - it seems like an emoji with a modifier
rgherdt has joined #commonlisp
<hexology> 13.1.2.1 - "A script is one of possibly several sets that form an exhaustive partition of the type character. The number of such sets and boundaries between them is implementation-defined."
<phoe> (length "👋🏻") ;=> 2
<hexology> phoe: well that's the thing - a "unitary token" could be a grapheme cluster
<hexology> it appears to be a unicode code point in sbcl, which is what most languages do (e.g. python)
<phoe> there was that article somewhere where lots of languages interpret emoji with modifiers as not-single-characters
<phoe> and I think it's implemented as a UTF32 unicode code point under the hood
<phoe> at least in non-base-strings
<hexology> ah, so the hyperspec requires 96 specific characters http://www.lispworks.com/documentation/HyperSpec/Body/02_ac.htm
<hexology> all of which happen to be 1 unicode code point and 1 ascii byte, conveniently
<hexology> but beyond that it seems entirely implementation dependent
<hexology> what is a "non-base string"?
<phoe> a string that is not of type base-string
<phoe> and a base-string, according to the standard, can only contain standard characters
<phoe> so only those 96 chars that you mentioned
<beach> Is that right?
<beach> Sounds wrong to me.
<hexology> so it appears to be
<heisig> Yep "The selection of base characters that are not standard characters is implementation defined."
<hexology> "The type base-string is equivalent to (vector base-char)"
<Nilby> In practice a base-string is usually 8-bit chars.
<hexology> "abcd" so is this a base string, and an implementation can be smart and store it in 8 bit characters?
<hexology> then i can append "â" to it, and it will be no longer a base-string
<hexology> and maybe everything will be reallocated as utf-16 or utf-32
<Nilby> but you can only rely on it holding base-chars
<hexology> right
<Nilby> or actually standard-chars
<beach> But base-char is not restricted in any way.
<beach> phoe: So I object to the "only".
<phoe> beach: OK, understood
<beach> An implementation can decide that BASE-CHAR covers every Unicode code point if it so desires.
<beach> ... which is what SICL does.
<beach> hexology: So a string containing â can very well be a BASE-STRING.
<hexology> or, it could decide that base-char is the 96 standard characters and that the more-general character class should be used for everything else
<hexology> i see
<hexology> so what happens if an implementation decides they don't want to support all of unicode, maybe only supporting the 96 standard characters
<hexology> will it just crash or fail to compile if i write "âââ" in the code?
<beach> It is free to do so, but it would be a silly decision today.
<beach> I suppose.
<hexology> like how sbcl says "unrecognized character name:" for the waving hand with light skin tone
<hexology> very interesting... this is the kind of thing where i (mostly a lisp outsider) think it'd be nice to have an update to the spec that imposes some more "modern" requirements :P
<beach> UTF-16 would not be practical at all as a representation for strings in Common Lisp.
<hexology> i know "update the spec" is an over-discussed issue
<hexology> why not beach?
<hexology> as far as i know that's what a lot of other dynamic languages use for strings (which are typically strings-of-unicode-code-points)
<beach> Because it uses a variable length encoding.
<beach> Common Lisp strings are vectors of characters, and you need to be able to say (aref some-string i).
<beach> If the encoding is variable, you need to search from the beginning of the string .
<Nilby> It's a little confusing because even though base-string is equivalent (vector base-char) it says: "The base string representation is the most efficient string representation that can hold an arbitrary sequence of __standard characters__."
<hexology> ah, because they can be mutated in-place
<beach> hexology: Not related to mutation. You just don't know which one is the i:th character until you have scanned from the beginning.
<hexology> beach: nice. note that personally i dont think "updating the standard" is a good idea, although a "lisp 2" could be an interesting independent project, if only as a language design excercise
<beach> So you get an O(n) AREF which is very counter intuitive.
<hexology> well that's the same as in python, ruby, perl, etc. no?
<hexology> although i think it's just accepted to be O(n) in those language
<beach> I wouldn't know.
<beach> It would be very unacceptable in Common Lisp.
<beach> hexology: We are working (slowly) on WSCL: https://github.com/robert-strandh/Well-Specified-Common-Lisp
<Nilby> suporting unicode has been a big problems in python, ruby, perl, etc. and specificly caused people to want to stay on python2
<hexology> cool!
<hexology> Nilby: fwiw i think they are more concerned about porting legacy code than about the representation of text being different
<Nilby> i think except ruby actually which supported from the begining
<Nilby> Even caused problems in C with wchar_t etc
<Nilby> Lisp actually somehow anticipated unicode before it was invented.
<hexology> i just asked in #python, apparently in the standard python implementation ("cpython") strings are stored in a variable size internally, such that lookups are always O(1)
<hexology> funny, they didn't think that was an important property to preserve. interesting what different language communities prefer.
<beach> I don't see how variable encoding can give O(1). How is that implemented?
<Nilby> it's variable "length" not variable character size
<hexology> strings are immutable in python, so "abc" is utf-8/ascii internally, but if you append "â" to it, you get a new string that's ucs-2 or utf-16 internally.
<beach> Ah, OK.
<hexology> the entire thing is copied anyway
<beach> hexology: Copying a string is not O(1).
<Nilby> python actually converted from the old C way, to the Lisp way
<hexology> right, but _lookups_ are O(1)
<beach> hexology: I don't see how they can be.
<hexology> beach because the size is chosen such that they can be
<hexology> the size of each character*
<beach> So the encoding is fixed.
<beach> Each character has the same fixed-length code.
<hexology> yes, but the encodings of 2 different strings in memory might not be the same
<beach> Sure.
<beach> Just like in Common Lisp.
<hexology> right
<hexology> and it's specified in neither language, it's left to the implementation to decide
<hexology> this isnt meant to be a better-than comparison. i like knowing how things are done in different situations. interesting to look at the tradeoffs
<beach> Definitely interesting.
<Nilby> old CL even anticipated what I want to do, but nobody does, with extended-chars :)
<beach> Like I said, for SICL, I decided it wasn't worth saving memory by using a special encoding for some types of strings.
<hexology> makes sense
hendursa1 has quit [Quit: hendursa1]
<hexology> probably simplifies the code a lot
<beach> That's the point, yes.
<hexology> is there a lisp package to iterate over grapheme clusters in a string?
<Nilby> beach: I think that's the only sensible choice, which other languages have to come around to eventually.
<beach> Nilby: Good to know. It certainly felt "right".
<Nilby> sb-unicode:graphemes
hendursaga has joined #commonlisp
<hexology> thanks
<hexology> is there something platform independent? or is that a good one to throw on the project pile
<hexology> the algorithm i believe is published somewhere in the unicode spec
<Nilby> hexology: Sadly I don't know of one. I had to make my own bad version on non-sbcl.
<hexology> https://www.unicode.org/reports/tr29/#Default_Grapheme_Cluster_Table seems tractable, should be easy enough to write tests for
<Nilby> Like I said, I did it, but there are problmes, such as it has to be kept updated to the published tables, etc. A lot of things in unicode "Should be easy" but aren't as easy as they seem.
ad_absurdum has joined #commonlisp
ad-absurdum has quit [Ping timeout: 248 seconds]
luis0 has joined #commonlisp
ad-absurdum has joined #commonlisp
tzlm454 has quit [Remote host closed the connection]
tzlm454 has joined #commonlisp
luis has quit [Ping timeout: 244 seconds]
luis0 is now known as luis
<hexology> true
ad_absurdum has quit [Ping timeout: 264 seconds]
tzlm454 has left #commonlisp [#commonlisp]
dsk has quit [Ping timeout: 272 seconds]
ad_absurdum has joined #commonlisp
tzlm454 has joined #commonlisp
ad-absurdum has quit [Ping timeout: 264 seconds]
mindCrime has joined #commonlisp
tzlm454 has quit [Remote host closed the connection]
tzlm454 has joined #commonlisp
tzlm454 has quit [Remote host closed the connection]
tzlm454 has joined #commonlisp
tzlm454 has quit [Remote host closed the connection]
tzlm454 has joined #commonlisp
tzlm454 has left #commonlisp [#commonlisp]
dmc00 has joined #commonlisp
<drmeister> Hey folks - I'm thinking about implementing an 'mmap-stream' within clasp - it would mmap a file into memory and then stream reads/writes would avoid file locking/unlocking.
<drmeister> I've implemented a read-line-into-simple-base-string (a riff on Franz' read-into-string https://franz.com/support/documentation/current/doc/operators/excl/read-line-into.htm).
<drmeister> Profiling when reading 10M lines of text looks like this:
<drmeister> It's spending lots of time locking/unlocking the file.
<loke[m]> drmeister: Why are you locking?
<drmeister> My input-stream is using fread and that is locking.
<drmeister> I have another type of stream io-stream - that uses filedescriptors and 'read' - I'm trying to figure out how to create one of those from Lisp.
rgherdt has quit [*.net *.split]
dieggsy has quit [*.net *.split]
johan_ has quit [*.net *.split]
hexology has quit [*.net *.split]
OlCe has quit [*.net *.split]
kagevf has quit [*.net *.split]
thonkpod has quit [*.net *.split]
alanz has quit [*.net *.split]
jcowan has quit [*.net *.split]
gendl has quit [*.net *.split]
pok has quit [*.net *.split]
alanz has joined #commonlisp
didi has joined #commonlisp
<Nilby> Since you're not really using libc buffering, why lock? But why use any read? Isn't that the point of mmaping?
johan_ has joined #commonlisp
<didi> How do I change the size of a stream buffer?
hexology has joined #commonlisp
hexology has quit [*.net *.split]
dmc00 has quit [*.net *.split]
mindCrime has quit [*.net *.split]
katco has quit [*.net *.split]
notzmv has quit [*.net *.split]
scymtym has quit [*.net *.split]
sm2n has quit [*.net *.split]
rbtEngrDude has quit [*.net *.split]
sm2n has joined #commonlisp
mindCrime has joined #commonlisp
hexology has joined #commonlisp
rbtEngrDude has joined #commonlisp
Lycurgus has joined #commonlisp
mindCrime has quit [Ping timeout: 265 seconds]
<prite> drmeister: You could convert the `FILE *` into a file descriptor via fileno(3)
johan_ has quit [Ping timeout: 264 seconds]
selwyn has quit [Read error: Connection reset by peer]
<drmeister> prite: Thank you - I switched to a file descriptor based stream - then that gets slowed down by decoding and other code in the character reading code. Hmm.
<drmeister> It's always something.
waleee has joined #commonlisp
OlCe has joined #commonlisp
mindCrime has joined #commonlisp
johan_ has joined #commonlisp
selwyn has joined #commonlisp
Lycurgus has quit [Quit: Exeunt]
selwyn has quit [Read error: Connection reset by peer]
selwyn has joined #commonlisp
v88m has joined #commonlisp
<drmeister> I had to re-re-re-learn that calling 'read' one character at a time is slow.
<pjb> drmeister: note that if locking is needed to access a given file, then it's not because you're using mmap that it's not needed anymore.
<pjb> drmeister: the correction to bring here could be to have a :file-lock option to OPEN, and to enable or disable file locking for the FILE* stream.
<drmeister> pjb: That is a good suggestion - I'll take a look at implementing a :file-lock option.
<pjb> drmeister: that said, I misunderstood the meaning of flockfile. It's not a file system lock, but a mutex around the FILE structure, for multithread access.
<drmeister> Understood - I'm fine with taking off the safety here and disabling any kind of file locking.
<pjb> But the same reasonning applies: eg. ccl has a :share keyword to cl:open, to indicate whether the stream will be private to a thread, will or will be shared amongst several threads (and thus require mutex).
<drmeister> This is implementation specific code I'm writing here.
<pjb> eg. https://ccl.clozure.com/docs/ccl.html#streams :sharing :private|:loc|:external
<pjb> drmeister: cleary, I'm just indicating how other implementation avoided to hardwire a given behavior, but let the user decide providing this option.
<drmeister> Understood.
<pjb> drmeister: on zOS, there's a fread_unlocked()…
<drmeister> I just noticed that fopen has a "m" option since glibc2.3 that lets you tell it to access the file using mmap - that's kind of like what I'm looking for.
<pjb> I don't see a POSIX API to prevent flockfile in fread/fwrite…
<drmeister> I don't see one either.
<pjb> drmeister: but they will probably still lock.
<pjb> Oh, there's getc_unlocked(3), putc_unlocked(3)
<pjb> The getc_unlocked() and getchar_unlocked() functions conform to IEEE Std 1003.1-2001 (``POSIX.1'').
<pjb> drmeister: notably the question is whether even with mmaped FILE, it still uses some kind of buffering before writing or reading the mmaped memory?
<pjb> But even without buffering, you'd want to avoid multiple writers or reading another thread writes the same mmap range.
domovod has joined #commonlisp
kevingal has joined #commonlisp
domovod has quit [Quit: WeeChat 3.1]
domovod has joined #commonlisp
katco has joined #commonlisp
RedPhoton has joined #commonlisp
RedPhoton has quit [Quit: And then there was darkness!!]
v88m has quit [Read error: Connection reset by peer]
v88m has joined #commonlisp
sjl has quit [Quit: WeeChat 2.2-dev]
domovod has quit [Quit: WeeChat 3.1]
rbtEngrDude has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
johan_ has quit [Ping timeout: 245 seconds]
<mason> Hey all. Noob question. Let's say I'm inside a (let) and I have a list passed back from a function. Is there a standard way to assign a list to a set of variables tersely? In Perl, I can say ($year, $month, $day) = Add_Delta_Days($year, $month, $day, 7 * 8) but in CL I can't seem to find a way to say the same. (setq (year month day) (add-delta-days year month day 56)) is wrong but I'm hoping there's
<mason> something right that's about that simple.
<White_Flame> (destructuring-bind (y m d) (get-ymd-stuff ...) ....body in which y m d are bound)
<mason> Thank you. I'll read about destructuring-bind.
<White_Flame> clhs destructuring-bind
<White_Flame> !clhs destructuring-bind
<White_Flame> do we have a bot?
<mason> White_Flame: I was wondering about that. Is there a standard way to get doc strings or usage from a function if I'm sitting at a REPL?
<White_Flame> (describe 'destructuring-bind)
<Nilby> :clhs destructuring-bind
<mason> ah,
<Nilby> ::clhs destructuring-bind
<Nilby> there we go, different syntax
<White_Flame> I don't recall the emacs keystrokes for bringing up the CLHS, I tend to have it in my browser history and the address bar completes it for me pretty easily
<luis> C-d C-d h
<Nilby> Colleen: thanks
<Colleen> Unknown command. Possible matches: 8, grant, time, tell, set, say, mop, get, block, award,
<mason> White_Flame: Hrm, so, full context: https://bpa.st/DUOQ does the new destructuring-bind only set the values within its body? I'd want the loop to be able to see the new values.
<mason> I'm not sure I've got the loop syntax quite right. Never really learned much loop.
<White_Flame> right, it is a lexically scoped body, so you'd have to SETF into your loop vars in this case
<White_Flame> or use a recursive function, where you can recurse from within any scope
gosukiwi has joined #commonlisp
<mason> So, I'd have to save off the list and parse it bit by bit, setf foo cadr result, setf bar caddr result, etc?
<White_Flame> oh
<yitzi> Anybody able to get ironclad working with CMUCL? I am getting an error about the encrypt-function reader not being defined while loading the system.
<White_Flame> (loop while (destructuring-bind ... (when [test] (format t "Conflict")) ... (<= year 2050))
<mason> My hope, whether it exists or not, is something as semantically simple as the Perl ($year, $month, $day) = Add_Delta_Days()
<mason> hrm hrm
<White_Flame> so the destructuring-bind returns your loop boolean
<gosukiwi> Hi guys, anyone knows a good package/library to easily implement a TCP server? I don't need much, just handle 2 or 3 connections
Wombatzus has joined #commonlisp
<White_Flame> gosukiwi: usocket is one
<gosukiwi> Thanks :) I'll check that out
<White_Flame> it has the lower level API as well as a simple (socket-server ...) function that handles the infrastructure for you
<gosukiwi> `socket-server` seems to be what I'm looking for :D
<mason> White_Flame: What I'm not seeing from your example there is how to have initial values I'm setting before I start looping.
<pjb> mason: if you already have the variables in your LET form, then you want something like: (let (a b c) (multiple-value-setq (a b c) (values-list (list 1 2 3))) (list a b c)) #| --> (1 2 3) |#
<mason> multiple-values-setq is new to me
<mason> ::clhs multiple-values-setq
<Colleen> "multiple-values-setq" not found in CLHS.
srhm has joined #commonlisp
<Nilby> ::clhs multiple-value-setq
<pjb> mason: however, it may be cheaper to write this: (let (a b c) (let ((r (list 1 2 3))) (setf a (pop r) b (pop r) c (pop r))) (list a b c)) #| --> (1 2 3) |#
<mason> value/values, sorry
<pjb> mason: however, or this: (let (a b c) (destructuring-bind (aa bb cc) (list 1 2 3) (setf a aa b bb c cc)) (list a b c)) #| --> (1 2 3) |#
<White_Flame> right, you need to setf back into your accumulators, which outlive your destructuring-bind scope
<mason> Oh, I had no idea setf could do multiple assignments like that.
<mason> nifty
<White_Flame> it might be useful to have a single object for your y/m/d triple, to be able to overwrite in a single step
gosukiwi has quit [Quit: Connection closed]
<pjb> mason: there's even a parallel setf: (let ((a 1) (b 2) (c 3)) (psetf a b b (+ b a) c (+ a b c)) (list a b c)) #| --> (2 3 6) |#
<White_Flame> as well as passing it to comparison & addition functions
<mason> White_Flame: Likely, yeah. So far, I'm looking at a prepackaged date-calc from QL based on Perl's Date::Calc. I've also looked at Scheme's SRFI-19 but I'm struggling to get it into my Chicken Scheme.
<pjb> mason: for example (encode-universal-time 0 0 0 29 5 2021) #| --> 3831228000 |#
<Nilby> mason: There's also (setf (values x y) (truncate 7 4))
<pjb> mason: for example (let ((date (encode-universal-time 0 0 0 29 5 2021))) (multiple-value-bind (se mi ho da mo ye) (decode-universal-time date) (list da mo ye))) #| --> (29 5 2021) |#
<mason> ::clhs psetf
<White_Flame> Nilby: huh, I didn't know that one. That would probably fit this one the best
<pjb> mason: but note that encode-universal-time and decode-universal-time don't work in a time-machine going beyond 1900/01/01.
<mason> Nilby: That looks the closest to the Perl so far. Is it, or is it conceptually different?
<Nilby> I think it's pretty close.
<mason> I'm just going to save this hunk of IRC log and revisit it until I understand all of it. :P
<mason> Am I doing myself harm by using (setf (values ...) ...) because of its notional simplicity?
<White_Flame> nope
<White_Flame> it shortcuts away individual temporary vars that hold the intermediate individual values
<White_Flame> and since you're storing them immediately into longer-scoped variables, which are still visible
<White_Flame> there's no loss of access of anything
<mason> Hm, now if I manage to tweak my use of format I'll be there.
<mason> Last question for now, is there a better way to do this loop, or is this reasonable? https://bpa.st/H45Q
<moon-child> it would be nice if you could bind multiple values in a loop. (loop for (values year month day) = (add-delta-days...)
<White_Flame> right, but if it were in a datastructure (even just a list), then that syntax would be possible
<moon-child> yes
<White_Flame> (loop for date = '(2021 2 6) then (add-delta-days date 56) ...)
<moon-child> I mean, you could do (loop for (year month day) = '(2021 2 6) then (multiple-value-list (add-delta-days))
<White_Flame> mason: stylistically, since the year/month/day vars are only within the loop, you can do (loop with year = 2021 and month = 2 and day = 6 ...) instead of the LET
<White_Flame> it's functionally equivalent
<mason> hrm
<White_Flame> I think the LET is more concise, and generally "more lispy" in this case :)
didi has left #commonlisp [O bella ciao bella ciao bella ciao, ciao, ciao.]
<White_Flame> anything else would be changing the nature of the y/m/d structure, as moon-child & I fiddled with above
<moon-child> mason: you should probably use when rather than if there
<mason> Concise is a significant goal. I'd like to get to where I can do this stuff in Lisp as naturally as I can in Perl.
<White_Flame> perl is a syntax-heavy language oriented on making things small
<White_Flame> Lisp is very regular and light on syntax, oriented on abstraction
<moon-child> concision happens at large scales, not so much at small scales, in lisp
<White_Flame> there's many cases where individual expressions are always going to be larger in lisp
<mason> moon-child: Does the if have an implicit else it looks for, hence more code?
<White_Flame> foo[1] vs (aref foo 1) being a common example
<moon-child> mason: I don't know what you mean by 'more code'. I think using when is a clearer expression of intent
<White_Flame> mason: the 'else' is optional in IF, but WHEN will also indent better as well
<mason> White_Flame: Well. Size alone isn't all of it. There's not notion of not having to write new code to do things the Perl syntax is doing. The (values ...) here isn't quite as terse but it saves me having to do it myself, which is pleasant.
<White_Flame> right
<mason> s/not notion/the notion/
<White_Flame> once you get into code generation with macros, the regularity of common lisp is an absolute godsend
<White_Flame> and launches past the expressability of pretty much all other languages
<White_Flame> so sometimes it's hard to get the advantages when starting out, as all these greybeards are prognosticating on this other weird stuff ;)
<mason> Hrm, the descriptions of if and when at https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node84.html aren't making the choice between the two abundantly clear to me.
<White_Flame> btw, you should use CLHS, not CLtL. The latter was before the common lisp standard, and isn't exactly the same
<mason> Oh, I thought the newer version was post-ANSI.
<White_Flame> CLtL has a more readable, descriptive style though, while CLHS is a formal reference
<moon-child> mason: (if c t) and (when c t) are identical. However if implies to a human reader choice between two values and a result that will be used. Whereas when implies conditional execution of an effect, and an unused result
<moon-child> s/are identical/behave identically/
<White_Flame> heh, this CLtL section seems to go against the previous lisp style guide discussion in its recommendations
<mason> moon-child: Ah, I understand now. Thank you.
johan_ has joined #commonlisp
cage has quit [Remote host closed the connection]
akoana has joined #commonlisp
commandoline has joined #commonlisp
johan_ has quit [Ping timeout: 245 seconds]
yitzi has quit [Quit: Leaving]
tfb has joined #commonlisp
tfb has quit [Client Quit]
kayprish has joined #commonlisp
kayprish has quit [Remote host closed the connection]
kayprish has joined #commonlisp
VincentVega has joined #commonlisp
VincentVega has quit [Read error: Connection reset by peer]
ad-absurdum has joined #commonlisp
ad_absurdum has quit [Ping timeout: 264 seconds]
VincentVega has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
heisig has quit [Quit: Leaving]
kayyyypreeesh has joined #commonlisp
kayprish has quit [Read error: Connection reset by peer]
kayyyypreeesh has quit [Remote host closed the connection]
kayprish has joined #commonlisp
karlosz has quit [Quit: karlosz]
nature has quit [Quit: Lost terminal]
waleee has quit [Ping timeout: 244 seconds]
VincentVega has quit [Remote host closed the connection]
waleee has joined #commonlisp
pve has quit [Quit: leaving]
karlosz has joined #commonlisp
dsk has joined #commonlisp
prite has quit [Ping timeout: 272 seconds]
waleee has quit [Ping timeout: 268 seconds]
kayprish has quit [Quit: Leaving]
<jaykru> anybody here played with vintage macintosh common lisp? which version should I be looking at running on an SE/30?
<jaykru> i'm hoping to port a barnes-hut gravity simulation I wrote in SBCL + web to macintosh CL with some sort of native drawing
mindCrime has quit [Ping timeout: 264 seconds]
akanouras_ has joined #commonlisp
akanouras_ has quit [Client Quit]
tzlm454 has joined #commonlisp
casual_friday has joined #commonlisp
* moon-child idly wonders if maclisp will run on a mac
<pl> Only with a lot of emulation
akanouras has quit [Quit: node-irc says goodbye]
akanouras has joined #commonlisp
dsk has quit [Ping timeout: 245 seconds]
tzlm454 has quit [Remote host closed the connection]
tzlm454 has joined #commonlisp
kevingal has quit [Remote host closed the connection]