<nij->
That helped. Sorry, I was away for an emergency.
pillton has quit [Quit: ERC (IRC client for Emacs 27.2)]
lisp123 has joined #commonlisp
lisp123 has quit [Ping timeout: 252 seconds]
<dieggsy>
So i'm "compressing" a list of ordered numbers as in '(1 1 1 2 2) -> '((1 . 3) (2 . 2)) and i have this https://paste.dieggsy.com/2021-08-19T20:46:44 but i'm almost certain there's a more efficient way lol
<dieggsy>
i don't think i'm doing badly, i just think it's awkward code
<moon-child>
dieggsy: the condition (= last thing) is duplicated. I would have only one branch
<moon-child>
you can also declare 'last' and 'last-count' inside of the loop
<moon-child>
also, I don't think you correctly collect the final run of values
<dieggsy>
moon-child: i think you're right, i'm off by one
<dieggsy>
could you show me an example of what you mean by the first two suggestions though?
<moon-child>
second: (loop with last = (car list) with last-count = 0 for thing in list...)
<dieggsy>
ah, with. nice.
<dieggsy>
ooh, i think i'm off by one in that i'm missing one for each count but also the last element of the list lol
<dieggsy>
oof
<mfiano>
dieggsy: That is called RLE
<nij->
mfiano: Thanks a lot, really. I am determined to understand the read=>macro-exp=>compile procedure.
<moon-child>
(though I think I might actually prefer the recursive approach to the iterative, for this)
<nij->
For example, in the READ stage, reader macros kick in and expand things into s-expressions.
<nij->
What are s-exprs right here? Are they still texts? Or are some part internalized already?
Lycurgus has joined #commonlisp
<dieggsy>
moon-child: i prefer recursive everything since i'm coming from years of exclusively scheme lol, but i'm trying to wrap my head around loop better. thanks for your help
<mfiano>
nij-: They are lisp data, s-expressions.
<nij->
So interalized as lisp data already?
<mfiano>
After read, everything is lisp data, yes
<nij->
I.e. not just text?
<nij->
ok
<mfiano>
Right
<mfiano>
The hard part to realize is that even though there is READ -> MACRO-EXPAND -> COMPILE for each file...
<mfiano>
within each of those steps, you can invoke any other, recursively.
<mfiano>
But let's ignore that for now
<nij->
You said after READ it's lisp data, how about during READ?
<mfiano>
Important thing to realize though, is you can only access functions in the MACRO-EXPAND phase that have been previously compiled.
<mfiano>
Which means:
<mfiano>
if you try to use a unquote "," in a macro, and it's calling a function defined in that same file earlier, it will not be available without an (eval-when ...) around it. This is because we are still at the MACRO-EXPAND stage, and haven't reached COMPILE yet
<mfiano>
But if it was defined in a previous file, then COMPILE would have been reached for it already
<mfiano>
This isnt a problem if the macro generates (returns) a call to that function
<mfiano>
It's only the unquoted stuff that is evaluated at the middle stage of the pipeline
<mfiano>
that needs to be fully available at that stage
<mfiano>
so: (defmacro foo () (some-func ...)) is bad if there is a (defun some-func ...) before it in that file
<mfiano>
but: (defmacro foo () `(some-func ...) is fine.
<mfiano>
To fix the former, you'd do: (eval-when (:compile-toplevel :load-toplevel :execute) (defun some-func ...))
<mfiano>
But I prefer to just usually define it in a previous file
<nij->
read->macroexp->compile
<nij->
how about special forms?
<mfiano>
special forms are just compiled. they are already in lowest terms, since they are implementation code
<dieggsy>
moon-child: woah! funky use of :by
<dieggsy>
i've a lot to learn
<mfiano>
you can treat them as any other function, just with different evaluation rules
<dieggsy>
that's neat
<nij->
at which stage are they invoked?
<moon-child>
mfiano: 'lowest terms' depends quite a lot; you can define different special forms in terms of each other
<mfiano>
what do you mean by invoked?
<moon-child>
'treat them as any other function' No (funcall #'if t 5 7)
<moon-child>
(actually, you can do that in s7 scheme. But not in cl)
<mfiano>
moon-child: true, i'm using a pedagogical device here, as to not introduce too much at once.
<nij->
er
<nij->
How to genuinely understand the procedure?
<nij->
To read the source code of an impl, say sbcl?
<mfiano>
Can you rephrase?
<nij->
Rephrase for "invoke"? Sure. I mean, at which stage does an expression that starts from a special form gets invoked?
<mfiano>
You shouldn't really try to understand special forms without intimate knowledge of the inner workings of the particular implementation. Just read CLHS for the semantics of each one.
<mfiano>
They are just functions to you.
<nij->
So they take actions after "COMPILE"?
<dieggsy>
nij-: not sure i'd recommend reading the source code of an impl to start out with, that can be.... WILDLY hairy lol
<mfiano>
Yes
<nij->
I think so, dieggsy. How about going through MAL myself?
<mfiano>
Well, they take actions when they are called
<mfiano>
Compiling is different from calling.
<nij->
dieggsy:, that won't be CL though..
<nij->
mfiano: I feel like I have a general picture, but many corners are still pretty vague.
<dieggsy>
i mean, whatever works for you i suppose
<mfiano>
nij-: It will become clear if you read more books and write more code. It took me a couple years to fully grasp it, but I am slow, so YMMV
<moon-child>
an interpreter is different from a compiler. But both express a language's semantics in terms of something else; it won't tell you how anything 'actually' works
<moon-child>
if you can understand natively the semantics of a compiler's target language or an interpreter's implementation language, then you can understand natively the semantics of the source language itself
<hayley>
MAL doesn't have an awful lot of special forms, or really anything that is notably hard. And it is only a tree-walking interpreter, so the implementation would be different to that of a compiler.
<nij->
mfiano: Thanks for that :) Yes, I'm sure CL will accompany my life and give me a lot of fun.
<mfiano>
nij-: I highly recommend picking up one or both of the books I mentioned, but only if you've read PCL first.
<nij->
hayley: Oh, good to know that too.
<mfiano>
Even if you don't understand them yet, you will later.
<hayley>
Say, (IF p t e) could just be defined as (if (eval p environment) (eval t environment) (eval e environment)) and that would be...kind of boring
<nij->
I've read PCL as a tool book. For some of them, I skimmed through. For some other parts, I revisited many times.
<mfiano>
That's good.
<mfiano>
Keep at it and repeat until your brain is full of parentheses
<nij->
(eq () '<3) ;; => T
<mfiano>
But no book or no person can teach someone how to program or how a compiler works. That is all intuited from experience.
<mfiano>
You can read and get an idea, but until you write code or dig into compiler theory by writing your own compiler, you won't understand a lot
<nij->
I think the trickest part is that we all talk about "lisp data", but we cannot point to lisp data at all, we can only point to expressions that evaluate to them.
<nij->
But the importance lies in the difference of expression and data.. so i often find it confusing.
<moon-child>
nij-: why do you say that?
<mfiano>
nij-: Question for you
<nij->
moon-child: just some rant, i guess..
taiju has quit [Ping timeout: 240 seconds]
<mfiano>
nij-: Without cheating, what do you think this returns, and let me know your thought process: (length (quote '(1 2 3)))
<White_Flame>
lisp data is cons cells, numbers, symbols, etc. The same components that make up expressions.
<White_Flame>
(hashtables, structs, etc as well, which aren't generally part of form literals)
<White_Flame>
the entire point of "homoiconic" is that there is no difference between expressions & data
<White_Flame>
it is the evaluator (and sometimes the reader/printer) than interpret the meaning of it
<White_Flame>
*that
<nij->
Hmm.. that is just (length (quote (quote (1 2 3))), which is (length ___), where ___ evaluates to a list of two members. So the answer should be 2.
<nij->
___ is the list whose car is 'quote and whose second is '(1 2 3)
<White_Flame>
the CAR is the symbol QUOTE, and the second is the list (1 2 3)
<mfiano>
Good. The important thing is that reader macros are expanded first.
<nij->
White_Flame: Let me think about it. I think there's still some subtle difference.
<mfiano>
What about (length '#'foo)?
<moon-child>
nij-: there is none
<moon-child>
nij-: consider that EVAL is a regular function
<nij->
mfiano: I didn't know any reader macros working here. I just know that quote is a special form, and it stops the evaluation stack.
<White_Flame>
the quotes in IRC are intended to represent literals, but you should probably get used to not using those
taiju has joined #commonlisp
<nij->
mfiano: (length '#'foo) is just (length (quote (function foo))), so it is 2 as well.
<White_Flame>
what value is being evaluated as the parameter to LENGTH?
<nij->
moon-child: Now I'm pretty intrigued.. by "there is none". I should think deeper.
<White_Flame>
or otherwise, what if it was CAR instead of LENGTH?
<nij->
(car (quote (function foo))) should return the symbol FUNCTION
<White_Flame>
ok, right
<mfiano>
nij-: #\' is a reader macro character, and so is #\( if you want to be technical.
<nij->
Oh, I see. I admit I don't understand this part well yet.
<mfiano>
What does this return before the compiler sees it? (macrolet ((foo (x) `(call-me ',x))) (call-me foo))
<nij->
moon-child: By "there is none" do you mean that if we really want, we can print every lisp data READably, whose result is read back as the "same" (up to #'equalp') lisp data?
<moon-child>
no
<moon-child>
reading is largely a distraction
<nij->
mfiano: you mean macroexpand-1 that?
<nij->
lemme think..
<mfiano>
I mean work it out in words
<hayley>
Generally, any object can be shoved into a Lisp expression, as everything that is not a list or symbol is self evaluating.
<White_Flame>
hayley: as long as it doesn't try to get written into a .fasl
<hayley>
White_Flame: Right.
<hayley>
Try (eval `(list ,(make-instance 'standard-class :name 'blah))) for example. (the :name is just so that the printer probably won't signal an error while printing the class name.)
nij- has quit [Read error: Connection reset by peer]
nij- has joined #commonlisp
<mfiano>
hayley: except for keyword symbols.
<nij->
mfiano: sorry my computer locked myself and I needed to reboot
<mfiano>
np
<moon-child>
hayley: huh? I don't get an error printing that
<nij->
I am thinking about your macrolet problem.. ',foo seems to be turned into whatever foo evaluates too, and then get quoted.
<mfiano>
',x you mean
<hayley>
moon-child: Oh, okay. I swear it did once.
<White_Flame>
and of course, the (quote ,x) view of it makes it apparent
<White_Flame>
compared to (list 1 2 ,y) or something
<nij->
"hayley: Generally, any object can be shoved into a Lisp expression, as everything that is not a list or symbol is self evaluating." <== ??!?!
<nij->
mfiano: oh right
<mfiano>
nij-: remember macros return data. this is why you do not need to know what call-me does for the answer.
<hayley>
1 is self-evaluating. The result of evaluating (make-instance 'standard-class) is self-evaluating.
<moon-child>
nij-: for an easy example, try (eval 1)
<moon-child>
or (eval "hello")
<moon-child>
if that weren't the case, something like (+ 1 2) wouldn't work. You'd have to write (+ '1 '2)
<nij->
mfiano: .. hmm ok I don't know how that macrolet works.
<mfiano>
Also examples are not part of the standard, so don't take them too seriously
Lycurgus has quit [Ping timeout: 240 seconds]
<kakuhen>
yeah I know its not part of the standard
<kakuhen>
I just saw the example since it was something useful to me, and then I got curious if it was just ECL giving me problems or it's just a mistake in the CLHS example
<kakuhen>
thanks for the link btw -- i wish i could've found this earlier.
<minion>
kakuhen: WSCL: Well-Specified Common Lisp. Pronounce it as "whistle". A project to revise the Common Lisp standard in a non-controversial way. See https://github.com/s-expressionists/wscl
<hayley>
Neither CLtL book is considered representative of the language you use, but the HyperSpec is derived from the ANSI standard.
<Bike>
CLtL2 was written during the standardization process, so it's not totally up with the standard
<nij->
Oh.. I see.
<Bike>
but it is pretty close and sometimes easier to follow
<hayley>
The prose in CLtL is more interesting, e.g. "Lisp implementations since Lisp 1.5 have had what was originally called ``the program feature,'' as if it were impossible to write programs without it!"
<nij->
I find cltl easier indeed.. sometimes
<hayley>
"In certain implementations of Common Lisp they get away with it. Others abhor what they view as an abuse of unintended ambiguity in the language specification. For maximum portability, I advise users to steer clear of these issues."
<copec>
CLtL is a fascinating read for historical insight
<copec>
How CL formed
prxq_ has joined #commonlisp
prxq has quit [Ping timeout: 240 seconds]
Qwnavery has joined #commonlisp
Qwnavery has left #commonlisp [#commonlisp]
copec has quit [Quit: checkity check out.]
copec has joined #commonlisp
<jcowan>
Not only for that, but for explanations *why* features appear in the standard, something the dpANS and CLHS are sorely lacking
<nij->
Sounds like a good read.
<nij->
I cannot figure this out.. when I evaluate (asdf:defsystem..) I got the error pasted in the bottom. In the link you can also find the tree system too. https://bpa.st/AQYQ
<nij->
I've done several micro projects, copying and pasting the defsystem forms.. never had this problem before.
<lotuseater>
you don't have to set the pointed named systems set in double quotes
<lotuseater>
and try with ":serial t" maybe that works then
<nij->
Still doesn't work @_@
<beach>
Good morning everyone!
<lotuseater>
Hello beach :)
<nij->
Hello!
<lotuseater>
I must admit, very impressive how you manage staying up so early every day.
<nij->
You mean me or beach?
<nij->
(It's 10:11pm here, btw.)
<lotuseater>
I mean him.
<nij->
Oh ok.. iirc beach said that's a scripted good morning.
<beach>
lotuseater: It's a genetic defect in my family. We can't help it. My parents were so bored at 4am that they got second jobs distributing newspapers.
<nij->
I wouldn't call it a defect.
<nij->
I still have no idea why the tree structure of my repo doesn't work ... @_@
<nij->
lotuseater: fixed with your advice: https://bpa.st/ ... same error though
<lotuseater>
Oh I wasn't aware of such. But that way around one is more productive I think.
<nij->
beach: If they are too bored, drive them to learn some lisp.
<nij->
They will never be bored again.
<lotuseater>
nij-: Then genetic difference. That people can eat lactose products is also just possible by genetic mutations.
<lotuseater>
and in the :components you surely need the double quotes as this is looking how files are named
<dieggsy>
i think I asked this before, but does anyone know of a way of seeing uiop:run-program's :interactive output in the slime REPL buffer as opposed to the inferior lisp buffer ?
<Bike>
if that's actually the directory structure I don't understand how the error is happening. I mean, if i'm reading correctly that package.lisp is in the same directory as fusion-category.asd.
<nij->
dieggsy: I wonder that too.
<dieggsy>
basically it's kind of inconvenient to have to switch buffers or wait for :output t
<nij->
Iirc it's an unsolved issue.
<nij->
Bike: yes.
<nij->
\ @_@ /
<nij->
Oh interesting, I remove all the subdirectories (operator, ordered-set,..) and removed them from :depends-on accordingly, then it loads.
<nij->
god knows why it happens..
semz has quit [Ping timeout: 245 seconds]
<Bike>
huh. maybe the error is botched. like the actual error is that asdf can't find the subsystems, but it reports it wrong.
<nij->
Am I supposed to evaluate (asdf:defsystem..) manually in the repl?
taiju has quit [Ping timeout: 240 seconds]
<nij->
Ah, nvm. I end up using an simpler tree system. Thank you Bike and lotuseater :)
<Bike>
you're not supposed to evaluate defsystem forms, no.
<Bike>
you're supposed to tell asdf where asd files are and then let it handle them.
<lotuseater>
or link the file symbolically to quicklisp/local-projects
<nij->
I see.
semz has joined #commonlisp
<semz>
and my connection drops the moment I say that. clearly the admins disagree
<semz>
I don't know how easy it would be to redirect stdout to the slime buffer but that's the direction I'd go looking in
<nij->
It goes already into the inferior buffer, so it shouldn't be too hard..
taiju has joined #commonlisp
<nij->
dieggsy: In the first place, why are there any info that is sent to the inferior buffer but not the main slime buffer?
<nij->
Is there a filter that determines which should go into the main slime buffer? I guess there must be one in the source code.
<dieggsy>
nij-: er, because of the way that slime is set up as a server/client and the funky things that have to happen to handle output
<dieggsy>
it's not exactly deliberate AFAIK
<nij->
What is the inferior buffer doing there anyways?
<nij->
I mean, the hardest part seems to be catching what ever from the shell into emacs. Now they are in the inf buffer, meaning that this step is achieved already.
<dieggsy>
Again, details i'm not well acquainted with to do with SLIME's architecture. If it was built on e.g. run-lisp it could all be on a single buffer, but it's not and there's not an option for that AFAIK. Would be neat. Something something pull request, I know. Maybe one day when I have a lot of time lol
<dieggsy>
nij-: I think something about separating the actual running lisp from the client REPL is what splits the output in this fashion
Bike has quit [Quit: sleep]
<dieggsy>
makes you wonder if you couldn't just have some listener in emacs waiting around for inferior lisp to get output and just shoving it into the REPL buffer
<dieggsy>
I'm fairly certain I tried that. I come back to this a lot. Can't hurt to try again later i suppose
<lukego>
I wonder if that works better in Sly. I know they don't use the SLIME REPL code but I'm not sure if it's actually terminal I/O that you interact with there.
PinealGlandOptic has joined #commonlisp
<dieggsy>
lukego: sly is actually what i use. output technically works worse lol
<dieggsy>
slime has a stream flushing loop it uses for real time output that sly removed
<dieggsy>
neither of these affect uiop:run-program IIRC though
<lukego>
least messy solution that comes to my mind would be giving these subprocesses their own repl-like buffers where all their I/O happens in a raw form. pops up on output, type and press ENTER to send. I'm not sure how much of the necessary infra exists in SLIME/UIOP.
<dieggsy>
lukego: not sure i follow that or how it's better than switching to the inferior lisp buffer i guess
kulernil has quit [Remote host closed the connection]
lisp123 has quit [Ping timeout: 240 seconds]
Inline has quit [Quit: Leaving]
Nilby has joined #commonlisp
CrashTestDummy3 has joined #commonlisp
retropikzel has joined #commonlisp
CrashTestDummy2 has quit [Ping timeout: 268 seconds]
Alfr has joined #commonlisp
ahlk has quit [Remote host closed the connection]
kstuart has joined #commonlisp
selwyn has joined #commonlisp
Lycurgus has joined #commonlisp
Lycurgus has quit [Client Quit]
pve has joined #commonlisp
fengshaun has quit [Quit: bibi!]
fengshaun has joined #commonlisp
lisp123 has joined #commonlisp
Cymew has joined #commonlisp
doyougnu has quit [Ping timeout: 252 seconds]
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
scymtym has quit [Ping timeout: 245 seconds]
CrashTestDummy2 has joined #commonlisp
easye has joined #commonlisp
shka has joined #commonlisp
CrashTestDummy3 has quit [Ping timeout: 250 seconds]
amk has joined #commonlisp
kakuhen has quit [Remote host closed the connection]
kakuhen has joined #commonlisp
kakuhen_ has joined #commonlisp
kakuhen has quit [Ping timeout: 250 seconds]
rain3 has joined #commonlisp
kakuhen_ has quit [Ping timeout: 250 seconds]
kakuhen has joined #commonlisp
makomo has joined #commonlisp
retropikzel has quit [Quit: Leaving]
scymtym has joined #commonlisp
taiju has quit [Ping timeout: 240 seconds]
taiju has joined #commonlisp
Krystof has joined #commonlisp
gaqwas has joined #commonlisp
gxt_ has quit [Remote host closed the connection]
gxt_ has joined #commonlisp
Qwnavery has joined #commonlisp
rgherdt has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
cosimone has joined #commonlisp
CrashTestDummy3 has joined #commonlisp
cosimone` has joined #commonlisp
cosimone has quit [Ping timeout: 250 seconds]
CrashTestDummy2 has quit [Ping timeout: 250 seconds]
gaqwas has quit [Ping timeout: 248 seconds]
hendursa1 has joined #commonlisp
hendursaga has quit [Ping timeout: 244 seconds]
cage has joined #commonlisp
srji has quit [Quit: Lost terminal]
srji has joined #commonlisp
Jach has quit [Remote host closed the connection]
Jach has joined #commonlisp
CrashTestDummy2 has joined #commonlisp
selwyn has joined #commonlisp
selwyn has quit [Remote host closed the connection]
selwyn has joined #commonlisp
CrashTestDummy3 has quit [Ping timeout: 250 seconds]
Noisytoot has quit [Ping timeout: 268 seconds]
Noisytoot has joined #commonlisp
santiagopim has quit [Remote host closed the connection]
santiagopim has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
kstuart has quit [Ping timeout: 250 seconds]
lisp123 has joined #commonlisp
selwyn has joined #commonlisp
selwyn has quit [Remote host closed the connection]
selwyn has joined #commonlisp
cosimone` has quit [Remote host closed the connection]
lisp123 has quit [Ping timeout: 250 seconds]
cosimone has joined #commonlisp
cosimone has quit [Read error: Connection reset by peer]
selwyn has quit [Read error: Connection reset by peer]
cosimone has joined #commonlisp
kakuhen has quit [Quit: Leaving...]
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
Lycurgus has joined #commonlisp
random-nick has joined #commonlisp
tyson2 has joined #commonlisp
attila_lendvai has joined #commonlisp
<nij->
dieggsy: Here's where =sly= sends the finalized string to the socket: https://github.com/joaotavora/sly/blob/master/sly.el#L1618 . It uses the emacs built-in function #'process-send-string. An example usage of that is `(shell) (process-send-string (get-process "shell") "date\n")`. The first form calls shell and gives you a comint buffer, the second sends the process to shell. There's no other need to "listen", the result of `d
<nij->
up immediately in the comint buffer.
<nij->
This leads me believe that, at least in sly/slynk, how the message is received from the inferior process depends on comint.
<nij->
What #'sly-connection returns in my case now, is given by #'sly-net-connect.
dlowe has joined #commonlisp
dlowe has quit [Remote host closed the connection]
Lycurgus has quit [Quit: Exeunt]
lisp123 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
lisp123 has quit [Client Quit]
lisp123 has joined #commonlisp
Qwnavery has quit [Quit: WeeChat 3.2]
ln43 has joined #commonlisp
cosimone has quit [Ping timeout: 250 seconds]
nij- has quit [Remote host closed the connection]
amb007 has quit [Ping timeout: 240 seconds]
amb007 has joined #commonlisp
lotuseater has quit [Ping timeout: 258 seconds]
igemnace has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 258 seconds]
kevingal has joined #commonlisp
waleee has joined #commonlisp
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
lisp123_ has joined #commonlisp
lisp123 has quit [Ping timeout: 248 seconds]
Nilby has quit [Ping timeout: 240 seconds]
nij- has joined #commonlisp
ahlk has joined #commonlisp
<phoe>
I am still searching for use cases for UIOP:DEFINE-PACKAGE's :UNINTERN keyword
<phoe>
does anyone perhaps have any?
<beach>
Maybe the author? Fare, I presume?
dtman34 has quit [Ping timeout: 268 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
Bike has joined #commonlisp
cosimone has joined #commonlisp
notzmv has quit [Ping timeout: 240 seconds]
Inline has joined #commonlisp
attila_lendvai has quit [Ping timeout: 250 seconds]
cosimone has quit [Remote host closed the connection]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
cosimone has joined #commonlisp
pjb has quit [Ping timeout: 258 seconds]
ln43 has quit [Quit: Connection closed]
amb007 has quit [Ping timeout: 250 seconds]
amb007 has joined #commonlisp
rowanthorpe has joined #commonlisp
lisp123_ has quit [Remote host closed the connection]
tyson2 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
<jcowan>
The only thing I can think of is to make security-critical internal bindings unavailable even to ::.
<jcowan>
kind of an anti-export
<phoe>
that's a stretch
<phoe>
I mean, I can understand this
<phoe>
but still, this would belong to an UNINTERN call, rather than an UIOP:DEFINE-PACKAGE (re)definition
keutoi has joined #commonlisp
<jcowan>
The unintern call would have to appear at the end of the code itself, which kind of negates the idea that defsystem specifies the whole of a package's visibility.
<jcowan>
But I am shooting fish in the dark
<phoe>
yes, that is my main gripe with this idea
selwyn has quit [Read error: Connection reset by peer]
<jcowan>
These troubles are due to the very old decision that was is imported and exported are symbols, rather than the meaning(s) of symbols. Normally, when you import foo from package bar, you don't care about foo itself, what you want is the function or variable definition of it.
amb007 has quit [Read error: Connection reset by peer]
lisp123 has joined #commonlisp
<jcowan>
s/was is/what is
<phoe>
the issue is that "function or variable definition" are not first class concepts
PinealGlandOptic has quit [Quit: leaving]
<phoe>
same with class/type/whatever definition
amb007 has joined #commonlisp
<lisp123>
Does the hashing function used in CL for hash tables create unique hashes for each key hashed, or does it create non-unique hashes and then a secondary step is to take a list of elements on that hash to extract the right one?
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
<Bike>
i am not sure what "take a list of elements on that hash" means, but in general hashes can collide and the hash table implementation has to deal with collisions
<Bike>
two keys hashing to the same hash can still have different values in the same table
<lisp123>
Bike: Yes. In a book I am reading, if two keys hash to the same hash, the values are stored in something like an alist, so then one needs to extract the right element from that list
<Bike>
that is one way to do it, but there are other ways
<lisp123>
How frequent are collisions in the CL Hash Function?
<Bike>
the hash function is totally implementation dependent.
amb007 has quit [Ping timeout: 252 seconds]
<Bike>
of course hash tables are very useful and implementations generally try pretty hard to come up with hash functions with few collisions.
<lisp123>
I was wondering if there was a trade off between computing the hash vs. reducing the number of collisions
amb007 has joined #commonlisp
<Bike>
well, sure there is. You could use (constantly 0) as a hash function and it would be very quick to compute, but severely degrade the performance of the table
<lisp123>
Yes :)
<lisp123>
Thanks for the color, looks like in general most hash tables have very few collisions
<jcowan>
Per contra, there are ways to derive perfect hash functions if you know the set of keys in advance.
<Bike>
if your hash function gives you a 64-bit word, it can distinguish eighteen quintillion objects. of course a real hash function isn't evenly distributed over all possible objects, but it can be pretty suboptimal while still working fine for a table with less than say a trillion entries
<Bike>
a real hash function that isn't perfect
<lisp123>
jcowan: Thanks, thats useful to know
<lisp123>
Bike: Thanks, useful to know
<jcowan>
For example, in protocol interpretation you may know that some string has a hundred valid values and you want to map it to some internal representation. A perfect hash function is ideal for this.
<lisp123>
Why is that?
<lisp123>
Is it because you don't have to compute the hash?
<lisp123>
(actually ignore that0
<Bike>
the opposite. you don't have to do any comparisons.
<lisp123>
Oh yes, okay
lisp123_ has joined #commonlisp
Josh_2 has joined #commonlisp
kevingal has quit [Remote host closed the connection]
lotuseater has joined #commonlisp
lisp123__ has joined #commonlisp
lisp123 has quit [Ping timeout: 250 seconds]
pjb has joined #commonlisp
pranavats has left #commonlisp [Disconnected: Replaced by new connection]
pranavats has joined #commonlisp
lisp123_ has quit [Ping timeout: 248 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
tyson2 has joined #commonlisp
<utis>
a simple cat in cl with (loop (write-line) (read-line)) works differently from a corresponding while ((c = getchar()) != EOF) putchar(c); in c: if you type foo<ctl-d>, the c program will duplicate the line immediately, on the same line, but the cl program requires either RET or /two/ ctl-d. why is that?
<pjb>
utis: that's because read-line reads a line. Therefore it can ask the system to perform this line buffering, but using the line discipline on the input stream. C-d doesn't interrupt anything (contrarily to C-c); it just enqueues an end-of-file mark.
<pjb>
utis: note: using read-char will probably use the same line discipline, so it'll behave the same.
<utis>
pjb: sorry, i meant: read-char
<pjb>
utis: you'd have to use implementation specific API to use the character discipline (raw-mode), or use FFI to use the I/O primitives of the system, like C does it.
<utis>
so is there a way to get the behaviour of the c code?
<Xach>
utis: use read-char instead of read-line.
<pjb>
utis: you can get the behavior of the C code by doing exactly the same thing.
<utis>
Xach: yeah, sorry that was just a typo, i did use read-char
<utis>
pjb: ? if i did exactly the same thing i would be writing c and not cl
<pjb>
utis: which means, not using CL operators, but using FFI to use the C operators. You could call getchar from CL. But note that getchar comes from libc, uses FILE, and buffering, and if the C program doesn't remove the line buffering, it'll behave like the CL library functions. Probably cat changes the buffering calling setvbuf https://www.gnu.org/software/libc/manual/html_node/Controlling-Buffering.html
alanz has quit [Ping timeout: 256 seconds]
<pjb>
utis: but you can also call directly syscalls from Common Lisp, ie. call ioctl(2), read(2) and write(2), to set the line discipline, and read character by character.
<pjb>
utis: indeed.
<utis>
pjb: thanks!
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
<pjb>
utis: you may also find a "portability library" which gives you access to the C libraries, such as eg. cl-charms (or cl-curses) to use ncurses, etc.
amb007 has quit [Read error: Connection reset by peer]
<pjb>
utis: you could use stty(1) to set C-d to signal an interrupt, and install a signal handler (but again, posix signal handlers are not defined by the CL standard, you'll have to use extensions or the FFI to do that).
<pjb>
then you could use read-line or read-char, and get a lisp condition signaled when the posix signal is received. (it may be difficult to program correctly, given the restrictions on what you can do in signal handlers).
alanz has joined #commonlisp
<pjb>
utis: perhaps more reasonable, would be to patch the CL implementations to provide the wanted feature, as an extension to the CL language (which is allowed by the CL standard). Since you could implement this extension in several (free-software) CL implementations, you'd have a strong proposition force there.
amb007 has joined #commonlisp
lisp123__ has quit [Ping timeout: 268 seconds]
doyougnu has joined #commonlisp
notzmv has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
selwyn has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
notzmv has quit [Ping timeout: 250 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
ryanbw has quit [Quit: I'll be back.]
notzmv has joined #commonlisp
amb007 has quit [Ping timeout: 252 seconds]
lisp123 has joined #commonlisp
amb007 has joined #commonlisp
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #commonlisp
rowanthorpe has quit [Ping timeout: 248 seconds]
wheelsucker has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
derelict has quit [Quit: WeeChat 3.2]
lotuseater has quit [Remote host closed the connection]
lotuseater has joined #commonlisp
pjb has quit [Quit: need to reboot to install of a new version of a macOS kernel module.]
azimut has quit [Remote host closed the connection]
azimut has joined #commonlisp
derelict has joined #commonlisp
MetaYan has quit [Ping timeout: 240 seconds]
MetaYan has joined #commonlisp
notzmv has quit [Ping timeout: 248 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Ping timeout: 250 seconds]
amb007 has joined #commonlisp
tyson2 has joined #commonlisp
gaqwas has joined #commonlisp
pjb has joined #commonlisp
lisp123_ has joined #commonlisp
amb007 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
lisp123 has quit [Ping timeout: 252 seconds]
amb007 has joined #commonlisp
keutoi has quit [Ping timeout: 252 seconds]
notzmv has joined #commonlisp
keutoi has joined #commonlisp
copec_ has joined #commonlisp
copec_ has quit [Client Quit]
notzmv has quit [Ping timeout: 252 seconds]
keutoi has quit [Quit: leaving]
selwyn has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
tyson2 has quit [Quit: ERC (IRC client for Emacs 27.2)]
amb007 has joined #commonlisp
cosimone has quit [Ping timeout: 252 seconds]
<Josh_2>
Now I'm in the correct room...
<Josh_2>
With local-time is there a way to get the :min keyword to local-time:encode-timestamp to always return two digits?
<Josh_2>
right now if the time is say 12 the string ends up as 12:0 which isn't right imo
<mfiano>
or maybe you don't. depends if you are trying to align text or not. I haven't played with local-time in a long time but maybe there's a way to change the zero pad character
<Josh_2>
I am not trying to align text
<Josh_2>
going for most aesthetic
<pjb>
(local-time:format-timestring *standard-output* (local-time:universal-to-timestamp (get-universal-time)) '(:ordinal-day " of " :long-month " " :year " at " :hour12 ":" :min :ampm)) --> > Debug: Incorrect keyword arguments in ((:ordinal-day " of " :long-month " " :year " at " :hour12 ":" :min :ampm)) .
<pjb>
Sorry, :format got dumped in the process.
<pjb>
(local-time:format-timestring *standard-output* (local-time:universal-to-timestamp (get-universal-time)) :format '(:ordinal-day " of " :long-month " " :year " at " (:hour12 2) ":" (:min 2) :ampm)) #| 20th of August 2021 at 09:17pm --> "20th of August 2021 at 09:17pm" |#
<pjb>
In any case, you don't want to use hour12, always use hour24!
<Josh_2>
idk why I would want to watch tintin anyway
<Josh_2>
also why wouldn't I want to use 12h? Looks nice
<lotuseater>
wtf blocked
cage has quit [Quit: rcirc on GNU Emacs 27.1]
<lotuseater>
cause it's a bit inconsistens and you would have to shoulder a 'AM/PM
azimut_ has joined #commonlisp
<lotuseater>
pjb: France gave us cool things like this :) or pink panther
<Josh_2>
But I want am/pm
nij- has joined #commonlisp
<lotuseater>
then provide a simple convertion method
<nij->
I can load maxima into a lisp repl, but it opens a maxima repl inside it :( Does anyone know how to interact with the maxima object it returns in the lisp repl?
<lotuseater>
so the critical point in my opinion is this 12am/pm thing. or 0am/pm?
<lotuseater>
nij-: you repeat yourself
azimut has quit [Ping timeout: 244 seconds]
<nij->
lotuseater? You mean I've asked this before?
<lotuseater>
yes in exact the same way 2 or 3 days ago
<nij->
I rephrased, and was seeking some more luck this time. Is repeating question not welcome here?
<lotuseater>
I didn't say that.
<pjb>
Josh_2: when I read TinTin destination Moon when I was a child I learned that using 12-hours could lead to catastrophic errors. I don't want to be as idiotic as the Dupont-Dupond (Thomson-Thompson). So ever since, I use 24 hours.
<nij->
Ok.. just let me know if it's not ok. I'm sure some of my behavior are frown upon by someone. I'm willing to coordinate :)
<pjb>
nij-: maxima repl has a command to go back to a lisp repl.
<lotuseater>
same questions from (different) users happen all the time
<pjb>
nij-: and you have a way to call maxima functions from lisp (and lisp from maxima).
<pjb>
nij-: just check the doc; I've not used maxima for too long, I don't remember how.
<lotuseater>
oh nice, i thought in saying providing another main loop could be helpful
<lotuseater>
pjb: he wants to work on the objects maxima produces
<nij->
pjb:No actually, it goes back to a lisp repl yes, but not my main lisp repl.
Lord_of_Life_ has joined #commonlisp
<nij->
So in my workflow, I call sly/slynk, load in maxima, and open a maxima REPL in my lisp sly repl.
<nij->
And from there, I can open yet another lisp repl (the 3rd repl so far).
<nij->
But that's by no means my sly repl. The amount you can interact with it isn't as great as in SLY.
<Bike>
a while back there was a maxima fork to make it more embeddable rather than more of a standalone application. i don't know how well it worked out though. https://github.com/bld/embeddable-maxima
Lord_of_Life has quit [Ping timeout: 258 seconds]
Lord_of_Life_ is now known as Lord_of_Life
<Bike>
the original forker seems to have deleted their repo for some reason...
<_death>
gn
<nij->
Oh! Tried that several days but didn't work.. hmmmmm but I forgot why. I can do that again.
<lotuseater>
or maybe having run maxima the way as slynk, sending messages to it for evaluation
<pjb>
nij-: then perhaps you'll need to check the code for maxima, and see if there's a way to initialize it without entering its repl.
<pjb>
nij-: it may be documented, but if not, use the source, Luke!
* nij-
ducks. Ok, I will try the source!
<pjb>
nij-: if you launch a swank server before launching maxima, it doesn't matter if it has its one repl, with swank you can create new repls, or evaluate expressions in threads.
<pjb>
s/its one/its own/
<nij->
I don't see a way to use a swank server to talk to maxima either.. :(
<nij->
By default, the maxima ("to_lisp") lisp repl does not have asdf either. Any idea how I load asdf in maxima's lisp repl?
<nij->
Bike: thanks :) emb-maxima fails to load here and generate the error https://bpa.st/A6YQ (in case you're interested.. )
<Bike>
i have no idea what that means, sorry. i just remember hearing about embeddable maxima.
<nij->
Bike: sure, still a lot of thanks too :)
<nij->
By the way, for who is reading this log in the future, there's another reason why I think embeddable-maxima doesn't provide what I have above. It's a shallow reason though..:
<nij->
In its official page, there's a "USAGE" procedure: (ql:quickload :embeddable-maxima) (cl-user::run) run_testsuite(); quit();.. you can see that after #'run, it starts to use maxima's syntax. I think that means #'run is bringing me into a maxima repl as well.
<Bike>
i would imagine so, yeah. i would hope that there are other ways to use it than calling (run). that's what i'd expect from being embeddable i guess
<nij->
No worries. I think my last resort is indeed the source, as pjb suggested.
scymtym has quit [Ping timeout: 250 seconds]
nij- has quit [Quit: Using Circe, the loveliest of all IRC clients]
scymtym has joined #commonlisp
Cymew has quit [Ping timeout: 252 seconds]
dtman34 has joined #commonlisp
cosimone has joined #commonlisp
tyson2 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
pve has quit [Quit: leaving]
amb007 has joined #commonlisp
<lisp123_>
Anybody here an expert / semi-expert / interested party in pathfinding algorithms?
<lisp123_>
I have written something (a draft) that seems useful to me (in Common Lisp), but want to share for thoughts & to see if its different to a uniform cost search or any other established method - bit hard for me to follow
lisp123_ has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
lisp123 has quit [Remote host closed the connection]
lisp123 has joined #commonlisp
<jasom>
pjb: some of us need to support users as idiotic as Dupont-Dupond
lisp123 has quit [Ping timeout: 252 seconds]
shka has quit [Ping timeout: 250 seconds]
lisp123 has joined #commonlisp
kakuhen has joined #commonlisp
<anddam>
semi-ot, can someone help me with Sly package not being able to connect to Slynk? https://termbin.com/wxp9
akoana has joined #commonlisp
<Josh_2>
Why are you using clisp?
<Josh_2>
Might be worth just trying SBCL/CCL
doyougnu has quit [Remote host closed the connection]
selwyn has quit [Read error: Connection reset by peer]
<kakuhen>
im more interested in why clisp is in /bin o.O
<kakuhen>
sly works on my end with clisp, so I'm not sure what's going wrong with their setup
<kakuhen>
anddam: I'm assuming you're invoking M-x sly and choosing the binary?
<anddam>
kakuhen: /bin is likely due to Void's packaging choice
<anddam>
kakuhen: I am opening a file in lisp-mode and then calling sly
<anddam>
kakuhen: I have set the inferior lisp program to /bin/clisp
<kakuhen>
btw it may be better to move this discussion to #emacs
<anddam>
ok, I tried a couple times last few days
selwyn has joined #commonlisp
frgo has quit [Remote host closed the connection]
frgo has joined #commonlisp
<Josh_2>
Can I make macros compile at runtime?
<Bike>
could you elaborate on what exactly you want?
<Josh_2>
I'm confused xD
<Josh_2>
Okay, so I have a top level macro for writing web pages, however each of those macros will rely on information that doesn't exist until the system starts and is running
<Bike>
You mean, how they expand depends on this information?
<moon-child>
what sort of informatiaon?
<moon-child>
they need this at expansion time?
<Josh_2>
Runtime information
<Josh_2>
well
<Josh_2>
uh
gaqwas has quit [Ping timeout: 268 seconds]
dnaeon has joined #commonlisp
<Josh_2>
I have my entry function that starts up hunchentoot and also sets the value of my variable *server* to a custom acceptor, my macros for writing webpages relies on *server* being that instance of my custom acceptor
<moon-child>
why does the macro need that? That seems like something that could be dealt with by the generated code
<Josh_2>
Because objects are put within that variable
<Josh_2>
https://github.com/K1D77A/cl-bloggy/blob/master/src/test-server.lisp you can see what is almost happening here, the difference between that and what I'm doing is that I have (new-..) and (add-image ..) along with (make-instance 'bloggy-acceptor ) all inside the function that is executed when the program is started after a save-lisp-and-die
cosimone has quit [Ping timeout: 250 seconds]
<Josh_2>
Well I can always put them into a directory near where it is built and then run load
random-nick has quit [Ping timeout: 250 seconds]
<Josh_2>
:angry:
<Josh_2>
Okay I figured it out :joy:
<pjb>
jasom: oh, if it's a customer's required, then no problem, whatever they ask. They're paying they'll be paying to repair their catastrophes ;-)
<Josh_2>
can I share information between compile time and run time? For example if I wanted to store a list of function names programmatically so that I could call them all at run time without having to manually write them down can I do that?
Krystof has quit [Ping timeout: 250 seconds]
<Josh_2>
so I would compile, save-lisp-and-die, I'd have a macro that at compile time wrote a variety of function names into some variable, and then at runtime I can execute a function which would lookup all of the functions in that variable and execute them
waleee has quit [Ping timeout: 240 seconds]
Lycurgus has joined #commonlisp
selwyn has quit [Read error: Connection reset by peer]