warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
megalography has quit [Quit: Leaving.]
megalography has joined #lisp
meepdeew has quit [Remote host closed the connection]
asarch has joined #lisp
dddddd has quit [Read error: Connection reset by peer]
Cymew has joined #lisp
Cymew has quit [Ping timeout: 246 seconds]
orivej has quit [Ping timeout: 245 seconds]
Cymew has joined #lisp
Cymew has quit [Ping timeout: 246 seconds]
Cymew has joined #lisp
nowhereman_ has quit [Ping timeout: 252 seconds]
Cymew has quit [Ping timeout: 268 seconds]
Cymew has joined #lisp
nowhereman_ has joined #lisp
Cymew has quit [Ping timeout: 252 seconds]
Cymew has joined #lisp
Cymew has quit [Ping timeout: 268 seconds]
Cymew has joined #lisp
Cymew has quit [Ping timeout: 252 seconds]
makomo has quit [Ping timeout: 252 seconds]
Cymew has joined #lisp
[X-Scale] has joined #lisp
X-Scale has quit [Ping timeout: 252 seconds]
[X-Scale] is now known as X-Scale
ryan_vw has joined #lisp
semz has quit [Ping timeout: 252 seconds]
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
Cymew has quit [Ping timeout: 252 seconds]
Cymew has joined #lisp
shifty has joined #lisp
Cymew has quit [Ping timeout: 246 seconds]
Cymew has joined #lisp
robotoad has quit [Quit: robotoad]
Cymew has quit [Ping timeout: 272 seconds]
Cymew has joined #lisp
Cymew has quit [Ping timeout: 245 seconds]
Cymew has joined #lisp
Cymew has quit [Ping timeout: 245 seconds]
marusich has quit [Ping timeout: 252 seconds]
Cymew has joined #lisp
SaganMan has joined #lisp
Cymew has quit [Ping timeout: 244 seconds]
Cymew has joined #lisp
shifty has quit [Ping timeout: 245 seconds]
Cymew has quit [Ping timeout: 245 seconds]
shifty has joined #lisp
Cymew has joined #lisp
quazimodo has quit [Ping timeout: 246 seconds]
quazimodo has joined #lisp
slightlycyborg has joined #lisp
robotoad has joined #lisp
Cymew has quit [Ping timeout: 252 seconds]
Cymew has joined #lisp
arescorpio has joined #lisp
Cymew has quit [Ping timeout: 272 seconds]
Cymew has joined #lisp
astronavt has quit [Ping timeout: 245 seconds]
Cymew has quit [Ping timeout: 268 seconds]
marusich has joined #lisp
moei has joined #lisp
Roy_Fokker has quit [Read error: Connection reset by peer]
_whitelogger has joined #lisp
Cymew has quit [Ping timeout: 244 seconds]
Cymew has joined #lisp
Cymew has quit [Ping timeout: 252 seconds]
Cymew has joined #lisp
Cymew has quit [Ping timeout: 250 seconds]
<beach>
Good morning everyone!
<no-defun-allowed>
o/
<slightlycyborg>
good morning beach
<slightlycyborg>
no-defun-allowed: nice name #defmacro
<no-defun-allowed>
thankyou!
<slightlycyborg>
I wrote a todo list in lisp. I orignally saved all my completed todos into an sql db...I recently added a twitter backend though, so now all that info gets livetweeted. Most pointless twitter account ever
<slightlycyborg>
My next pointless twitter account driven by lisp will be a live video stream of myself broken up into 140 second video segments.
arescorpio has quit [Remote host closed the connection]
<beach>
slightlycyborg: Would you like a code review. If so, post your code on some pastebin.
arescorpio has joined #lisp
wanz has quit [Remote host closed the connection]
rumbler31 has quit [Remote host closed the connection]
<beach>
If I were you, I would write an ASDF system definition so that you don't have to LOAD explicitly.
<no-defun-allowed>
yes, an asdf system would make it loadable via quicklisp and simplify dependencies considerably
<slightlycyborg>
Oh. I've never used ASDF explicitly before. OK. I will put some reading material on how to do that on my todo list
<no-defun-allowed>
it's not very hard honestly, i can show you an example
<beach>
Your indentation is off. It could be that you have TABs in your code so that the pastebin does not display it correctly. Or it could be that your indentation is off. :)
<beach>
slightlycyborg: You have some useless code in there, like (progn words nil)
<slightlycyborg>
which file? i can screenshot it
<slightlycyborg>
ya. (progn words nil) was me commenting out that function
<beach>
An IF with only a `then' branch is better expressed with a WHEN.
<slightlycyborg>
lol
<slightlycyborg>
I just learned about WHEN in paip. will change it
<beach>
Then you can eliminate the PROGN as well.
<beach>
For an IF, either put each of the three arguments on a separate line, or put everything on one line.
<beach>
Not the condition and the `then' branch on one line and the `else' branch on a separate line.
<beach>
For good indentation of LOOP clauses, I recommend you use the slime-indentation contribution.
<slightlycyborg>
you mean put the pred on a seperate line?
<slightlycyborg>
(if pred \n then \n else) right?
<slightlycyborg>
or (if \n pred \n then \n else) no?
<beach>
You either put everything on one line, or else you put the test on the same line as the IF, and you align the `then' and the `else' with the test.
<slightlycyborg>
ok
<beach>
The first.
<slightlycyborg>
I'm going through right now and changing my if then's to whens
<beach>
You have some code duplication in there. todo-select and todo-complete are almost identical.
<beach>
You could make a single function that takes an additional argument. Either 'complete or 'select.
<beach>
It is a bit strange to have (IF (NOT ...) rather than removing the NOT and reversing the arguments. Especially since INTEGERP seems to be the "special case", and you want to handle special cases first.
<slightlycyborg>
Ok on the single function
<beach>
That is also some duplication by the way: (if (not (integerp...)) (if (listp...)))
<beach>
(= 0 x) is better expressed as (zerop x).
<beach>
Top-level comments should have 3 (sometimes 4) semicolons.
<slightlycyborg>
Ok. Do you mean the file name for top level comments. I just put those in there for pastebin
<beach>
I also see ;; A way to integerate...
<beach>
(setf <stuff> (+ <stuff> time-diff)) is better expressed as (incf <stuff> time-diff)
<slightlycyborg>
I'm going to screencap all of this
<beach>
(IF (not (null...)) <only-a-then-branch>) is better expressed as (when (null...) <only-a-then-branch>)
<beach>
This should keep you busy for a while. I'll review your next version if you like. Now I am off for a break. Back in 30 minutes or so.
<myrmidon>
Hi! I'm trying to make a macro produce a backtick list with some ,@(when ...) forms in it, but all I can get is ,(when ...) forms: https://ptpb.pw/PVsQ/lisp -- any advice?
ryan_vw has quit [Ping timeout: 272 seconds]
<no-defun-allowed>
maybe you could try ,@,@ instead of ,,@?
<no-defun-allowed>
double backquotes aren't my strong point but i think you'd need to backquote-splice twice
<myrmidon>
Yes! Awesome thank you, I'd been fiddling with that for literally hours :)
zagura has joined #lisp
<jackdaniel>
,@,@ is undefined behavior in Common Lisp
<myrmidon>
oh
<no-defun-allowed>
):
<jackdaniel>
you may splice it shallow or deep and even CL implementations are not consistent here
<no-defun-allowed>
well i think we're trying to get the ,@ syntax into the macroexpansion
<ggole>
Hoist stuff out of the backquotes until you can understand what's going on
<no-defun-allowed>
we're not doing a double splice
<aeth>
At this point I'd just use helper functions or at least move most of it to a let at the top to try to make it a little readable
<no-defun-allowed>
it's the face you make when you see double backquotes
orivej has joined #lisp
<myrmidon>
Yeah I had a feeling I might not being doing it the best way :-/
<aeth>
When the macro gets complicated I tend to do (let ((some-piece `(foo ,(bar 42) baz)) (another-piece ...)) ...)
<aeth>
At the very least, even if it doesn't help too much with readability, you avoid most ,,s that way
<ggole>
Makes it *much* easier to see what the pieces are, too
<aeth>
Whether it makes more sense in a helper function or a let at the top (or both, where the let at the top is just calling a function) is hard to say, of course.
<aeth>
don't forget to use eval-when for helper functions if they're in the same file.
<myrmidon>
,@(append ,@(...)) is working but I think you're right it's a bit messy, i'll try to rework it
<myrmidon>
thanks for the advice :)
robotoad has quit [Quit: robotoad]
cage_ has joined #lisp
<makomo>
jackdaniel: i've read the thread you linked but i don't get how ``(,@,@foo) corresponds to the `,@foo case which is undefined
frodef has joined #lisp
smokeink has quit [Remote host closed the connection]
smokeink has joined #lisp
siraben has joined #lisp
<jackdaniel>
makomo: "< no-defun-allowed> maybe you could try ,@,@ instead of ,,@?"
robotoad has joined #lisp
<makomo>
jackdaniel: oh, i meant the "`,@foo" case which is said to be undefined by the spec
<makomo>
i presume that is the reason why ,@,@ is undefined
<jackdaniel>
",@,@" is not defined in the spec too
<jackdaniel>
,@foo is defined, if foo is a list
<makomo>
neither is ,, or anything else, at least not explicitly. it's defined recursively
<makomo>
jackdaniel: right, but that's kinda "handwavy", as it's not how it is formally defined, no?
<jackdaniel>
I don't have time to discuss it right now, sorry. I have said everything I had to say.
guicho has joined #lisp
<makomo>
jackdaniel: ah, ok. i'm just interested in interpreting the formal rules that the spec gives fpr backquote and figuring out exactly where it fails
<makomo>
jackdaniel: if you come up with an idea, let me know (and i'll do the same if i figure it out)
<jackdaniel>
I think that all there is about ,@,@ is covered in this thread, so I find hard to add anything to it
heisig has joined #lisp
<makomo>
jackdaniel: ahhh never mind, i see it now. you have to do the expansion by hand using the formal rules to see it
<makomo>
in one of the intermediate steps, `,@foo shows up, and that's undefined
knicklux has quit [Remote host closed the connection]
<makomo>
jackdaniel: hm, i said that too quickly, without actually doing it by hand but just thinking that it would surely show up
<makomo>
i'll try to think about it more
guicho has quit [Ping timeout: 276 seconds]
<makomo>
jackdaniel: however, regarding your ",@foo is defined, if foo is a list", take this example "(let ((var 10)) `(,@var))"
graphene has quit [Remote host closed the connection]
<makomo>
afaict, that is a valid backquote template according to the formal rules, because, even though the final forms are implementation-defined, the semantics still have to match with the forms that are used in the formal rules
graphene has joined #lisp
<makomo>
using the formal rules, the above expands into "(let ((var 10)) (append var))" which is valid, because APPEND takes any object as its last argument
<jackdaniel>
I concede, ",@" is defined not only for lists
<jackdaniel>
however I'm not sure where you did get that append from
<jackdaniel>
that said, I will be afk in 5 minutes
<makomo>
the bullet "* `(x1 x2 x3 ... xn . atom) may be interpreted to mean (append [ x1] [ x2] [ x3] ... [ xn] (quote atom)) (...)"
<_death>
and what about `#(a b ,@x)
<makomo>
the spec says "`#(x1 x2 x3 ... xn) may be interpreted to mean (apply #'vector `(x1 x2 x3 ... xn))"
<jackdaniel>
I don't see direct implication on `(,@var) -> (append var), in fact evaluating `(,@3) gives me three, not (append 3)
<makomo>
jackdaniel: evaluating, yes, but i was talking about the "expansion", i.e. what the backquote template is read in (using the forms given in the standard)
<makomo>
read in as*
<makomo>
_death: so it degenerates to the previous case
<jackdaniel>
OK, as I said I have no time to dive into spec. it is not that I disagree or anything, I've just pointed out that ,@,@ is undefined since I saw it
<_death>
makomo: then you applied vector to something that's not a proper list
<jackdaniel>
(I know that I'm not physically forced to discuss that, but all these highlights certainly make me feel so)
<makomo>
jackdaniel: sorry if i was being a bother, i won't ping you anymore :-). but yeah, if you get the time in the future, let me know
<jackdaniel>
I want to point out, that I'm not also especially interested in discussing such things unless it is a mean towards implementing something correctly
<jackdaniel>
I can spend such time on other thigns (also beneficial to CL community), like fixing bugs
<jackdaniel>
or finishing computation of a correct bounding rectangle for vertical fonts
<makomo>
jackdaniel: sure, i understand. s/if you get the time/if you feel like discussing it/ is what i meant :-)
<jackdaniel>
OK
<makomo>
_death: right, so that would be invalid in the end
<makomo>
but i still haven't figured out where exactly ,@,@ fails (using the formal rules!)
myrmidon has quit [Quit: myrmidon]
_whitelogger has joined #lisp
orivej has quit [Ping timeout: 272 seconds]
smokeink has quit [Remote host closed the connection]
gigetoo has joined #lisp
robotoad has quit [Quit: robotoad]
dddddd has joined #lisp
Cymew has joined #lisp
vlatkoB_ has joined #lisp
Cymew has quit [Ping timeout: 252 seconds]
vlatkoB has quit [Ping timeout: 252 seconds]
orivej has joined #lisp
<pjb>
makomo: on 2.4.6, 4th star (*), [,@form] is interpreted as form. `(foo `(x1 ,@,@form x3)) --> `(foo (x1 ,@form x3)) ; seems legit to me. (let ((form '((1) (2) (3)))) `(foo `(x1 ,@,@form x3))) #| --> (foo (list* 'x1 (append (1) (2) (3) '(x3)))) |#
<pjb>
But as you can see, you better have form return a list of lists…
<pjb>
,@ = I want a list. ,@,@ = I want a list of lists.
<makomo>
pjb: can you perform the expansion bit by bit and show the intermediate results? the thread that jackdaniel linked says that the behavior of ,@,@ is undefined
<makomo>
perform the expansion using the formal rules*
<pjb>
makomo: I don't think it's undefined. clhs 2.4.6 has a rule for it, which means that: `(foo `(x1 ,@,@form x3)) --> `(foo (x1 ,@form x3))
<makomo>
i do it in small steps, fully expanding all the inner ` before going onto the outer `
<makomo>
that's how the algorithm works anyway, except it does it recursively. because we're humans, i prefer to do it iteratively. the result is the same, as the innermost backquote is always fully expanded before the outermost one
<makomo>
since i haven't encountered any `,@foo, i don't see why this would be undefined
void_pointer has joined #lisp
nowhereman_ has quit [Ping timeout: 252 seconds]
<pjb>
makomo: indeed.
<pjb>
and it just works.
<makomo>
yup, so i would say that ECL and CCL are wrong here
<pjb>
Yes, because (append [ x1] [ x2] [ x3] ... [ xn] (quote atom)) means that xn is not the last argument to append. If you have a proper list, then atom is nil.
<pjb>
So (let ((there '((list :x 1) (list :y 2)))) ``(hello ,@,@there)) should be the same as (let ((there '((list :x 1) (list :y 2) nil))) ``(hello ,@,@there))
<makomo>
pjb: so then (let ((var 10)) `(,@var)) should really be an error, right?
kooga has joined #lisp
nanoz has quit [Ping timeout: 245 seconds]
<makomo>
pjb: ah nice, i was just about to ask whether you were going to open another issue for the `(,@var) thing
<makomo>
looking forward to the comments
<pjb>
I did it also on ccl, next bug report.
<makomo>
yeah, i just saw :-)
<pjb>
You may report it to the other implementations ;-)
<makomo>
if ccl goes with the changes then i might do it, because i'll have more evidence to point to
Bike has joined #lisp
<pjb>
I don't expect a patch soon. It's not the kind of prioritary bug…
<makomo>
i'm going to take a look at what fare-quasiquote does
<makomo>
"first it has all the bugs straightened out, including dark corner cases (some implementations still get the simple ``(foo ,@,@bar) wrong);"
<makomo>
well, well, well :-)
random-nickname is now known as random-nick
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 250 seconds]
Essadon has joined #lisp
<russellw>
I don't suppose there is anything like a way to tell loop to do one more iteration? Specifically, I'm trying to implement a read-line function as something along the lines of (loop until(eql(peek-char #\newline)) collect(read-char)) but then that doesn't collect the actual newline
<beach>
(loop for char = (read-char) collect char until (eql char #\newline))
<beach>
Something like that.
<beach>
But you might want to check for EOF as well.
<russellw>
ah, thanks!
<makomo>
pjb: fare-quasiquote talks about both ,@,@foo and `(,@foo)!
<makomo>
`(,@foo) is technically incorrect but fare-quasiquote accepts it by default in the name of interoperability and consensus. there's a feature you can use to make it signal an error
<makomo>
jackdaniel: just to let you know: we concluded that ,@,@var is well-defined defined but that `(,@var) is not (contrary to what i said the first time -- i forgot the ". nil")
Josh_2 has joined #lisp
nirved has quit [Quit: Leaving]
azrazalea has joined #lisp
varjag has joined #lisp
<Xach>
flip214: tusn tack
libre-man has quit [Ping timeout: 246 seconds]
frodef has quit [Ping timeout: 246 seconds]
zotan has joined #lisp
wanz has joined #lisp
heisig has quit [Quit: Leaving]
<jackdaniel>
append (if last argument is not a list) returns that argument
warweasle has joined #lisp
<jackdaniel>
and despite reading whole thread I didn't change my mind, but I'm not motivated enough to defend that claim
<jackdaniel>
if only argument is not a list*
<jackdaniel>
it is because a) it is the last argument, b) all preceding lists are null (and dragons and whatever), because it is an empty cave of knights ;-)
SenasOzys has quit [Ping timeout: 245 seconds]
SenasOzys has joined #lisp
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
lemoinem has quit [Ping timeout: 250 seconds]
Josh_2 has joined #lisp
<makomo>
jackdaniel: yeah, true, and that is why `(,@10) => 10 is incorrect. `(,@foo) actually reduces to `(,@foo . nil) which then expands into (append foo 'nil)
<makomo>
since foo is 10, that APPEND call should fail, but it seems like most implementations have broken backquote simplifiers
<makomo>
but regarding ,@,@ -- it is not undefined behavior
<beach>
Eclector reduces `(,@10) to (append 10 'nil)
<beach>
Actually, not quite true...
<beach>
The SICL implementation of the macro ECLECTOR.READER:QUASIQUOTE expands the form returned by Eclector to (APPEND 10 'NIL)
<jackdaniel>
"If a comma is immediately followed by an at-sign, then the form following the at-sign is evaluate" – that means that defined behavior applies only to at-signs followed by forms. and I'm not diving into that discussion any further, I kind of regret that I said anything about ,@,@ earlier. If I'm wrong - so be it.
<makomo>
jackdaniel: yes, right, but that applies to a single level of backquote. n nested backquotes require n evaluations to fully process. the spec is at all times talking about a single level of quotation, and the rest have to be handled recursively
<jackdaniel>
good for it
wanz has quit [Quit: wanz]
<makomo>
beach: glad to hear that
<jackdaniel>
does anyone know dejavu ttf fonts which have vmtx table defined? (for testing font renderer)
<beach>
makomo: We try hard. :)
<makomo>
beach: and what about (let ((there '((list :x 1) (list :y 2)))) ``(hello ,@,@there))?
<makomo>
woop,s you'll have to evaluate the result of that once again to get the final result
<beach>
It's interesting how I can evaluate SICL code even though SICL doesn't exist, isn't it? :)
wanz has joined #lisp
<makomo>
indeed :D
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
<makomo>
bootstrapping problems are the best
<beach>
Well, "best" is not quite the adjective I would have chosen, but hey. :)
<makomo>
:-)
igemnace has joined #lisp
<makomo>
beach: speaking of bootstrapping. CL has various functions which are primitives and cannot really be implemented by the user. stuff such as CAR, CDR, APPLY, +, -, etc. now, thinking about meta-circular interpreters, would it ever be possible to write an interpreter for a language L in L, but without relying on L's primitives?
<ggole>
Sure, you just use L functions instead of L primitives
<beach>
You are asking me this after I have worked 13 hours straight today?
Josh_2 has joined #lisp
<makomo>
beach: hah, feel free to answer whenever :D
<Bike>
you can implement lisp in lisp without using host lisp structures to represent client lisp structures.
<makomo>
ggole: hm, but let's say we take + for example. how would you avoid using + within the interpreter itself?
<russellw>
makomo, sure, you could reimplement numbers using church numerals or whatever. It's just that it would be very slow
<makomo>
Bike: that's precisely what i'm wondering
Josh_2 has quit [Client Quit]
<beach>
I think Bike is right.
<makomo>
russellw: aha, that's what came to my mind to, but wouldn't you still have to rely on "incrementing" somewhere?
<Bike>
church numerals have an increment operation.
<Bike>
it will not use machine/hostlisp arithmetic.
<Bike>
particularly, you would represent numbers as host functions.
<ggole>
The interpreter itself can use + internally, of course
<Bike>
the client would only be able to access them as client numbers, though. non porous abstraction
<makomo>
ggole: that's what i want to try and avoid for this thought experiment
<ggole>
And within the implementation of object-language primitives, you could use + (if the semantics were correct)
<Bike>
what's the point of avoiding internal use of +?
<makomo>
Bike: what do you mean by that last sentence?
<makomo>
Bike: well, it's a thought experiment isn't it :-D
Josh_2 has joined #lisp
<Bike>
surely you hvae a reason for your thought experiment
<beach>
makomo: You can't avoid using host functions for the interpreter itself. You have to have access to the computation machinery.
<Bike>
einstein thought about the dude with a flashlight because ehe was wondering about relativity
<makomo>
Bike: yeah, i'm trying to sort out the meaning of "meta-circular" from the various subtly conflicting definitions i've read
<ggole>
Programming without certain primitives is possible up to a point, but you need to encode your logic into something in the host language
<Bike>
usually it means something like using host structures as client structures
<makomo>
ggole: mhm, true, but i just want to avoid using the exact same primitive to implement the feature of the object language
<Bike>
that's different from using a function internally
<ggole>
Yeah
<makomo>
yeah, of course, i agree with what you said about encoding numerals as functions
<makomo>
Bike: i just didn't get your last sentence completely
<makomo>
the "non-porous abstraction" thing
<ggole>
You also have non-primitive issues like order of evaluation
<ggole>
There are various ways to work around that
<Bike>
i mean the client lisp will be unable to treat church numerals except as numbers. it won't be able to FUNCALL them or anything.
<makomo>
oh yeah, of course
<makomo>
Bike: and as another example, let's take closures. these would also be implementable without using host's closure, but using a separate "hand-written" data structure, right?
<Bike>
sure
<beach>
makomo: You would have a representation of a function as a structure containing "code" and "environment".
<ggole>
Host languages need not have closures at all, in general
shka_ has joined #lisp
<Bike>
well, it might use host closures internally, depending on how the implementation works, but it doesn't have to BE a host closure
<ggole>
As in machine code
<ggole>
Same with control flow features like exceptions
<Bike>
i've had client closures as a struct with a host closure and a closure vector before
warweasle is now known as warweasle_afk
<Bike>
no big
<makomo>
ggole: right, true. in this case i'm using L to implement L (L being Lisp in this example), but of course, you could implement Lisp in assembler and assembler obviously doesn't have closures
<ggole>
You can piggy-back on the implementation's, or roll your own
<ggole>
The object language should not be able to tell the difference (except in operational senses such as time taken)
<Bike>
well, that alone should answer your question, really.
<makomo>
Bike: yeah, pretty much
<Bike>
if you can implement lisp in assembler you're not using lisp functions, so there's no way it would be required to use lisp functions.
<makomo>
as soon as i thought of it (2 minutes ago), it was kinda clear what the answer was
<makomo>
but i was still wondering about +, etc.
<beach>
You wouldn't WANT to use Church numerals, of course, given their performance.
<makomo>
i mean, wouldn't using assembler's INC or ADD (assuming some common assembler) qualify as circular? i'm not sure
<makomo>
beach: yeah, true
razzy has quit [Ping timeout: 252 seconds]
<ggole>
You can do binary encodings with functions that aren't quite as awful
<Bike>
depends on what host structures you have available.
<Bike>
machine languages usually pretty much only have small positive integers.
<Bike>
nonnegative, whatever
<makomo>
we've talked about this before, what i really want to do is figure out why the name is "meta-circular" and not just "circular". i've come to the conclusion that (1) it's "meta" because it's L implementing L and (2) it's "circular" because you're reusing the host's primitives to implement the object's primitives
<makomo>
so there are really 2 things going on
<makomo>
i could throw away the circularity and just have an L implemented in L, a "metainterpreter" i guess
<Bike>
i hope you realize there's a decent chance it's "metacircular" because a mildly drunk programmer thought it sounded cooler.
lemoinem has joined #lisp
<makomo>
or i could implement L in some language A but still have it be circular
<beach>
Maybe you are putting too much interpretation into a name that might have been chosen quite arbitrarily.
<makomo>
yeah, maybe, i don't know
<beach>
... basically what Bike said.
<Bike>
"The term itself was coined by John C. Reynolds, and popularized through its use in the book [SICP]" so maybe there's an explanation, i don't remember.
<makomo>
Bike: sicp does mention it (of course), but it's like there's an implicit assumption that the implementation reuses host's primitives
FreeBirdLjj has quit [Remote host closed the connection]
<Bike>
that's just because it's what sicp is about. it should be obvious it's not required or programming would be impossible.
FreeBirdLjj has joined #lisp
<beach>
makomo: I don't think the term is sufficiently well defined to determine whether using host primitives is acceptable.
<Bike>
as far as i remember, as sicp goes on the host-client link gets more and more distant.
<makomo>
4.1 says "An evaluator that is written in the same language that it evaluates is said to be metacircular."
<makomo>
they just skip over the "reusing the host's primitives" thing in their definition
<makomo>
wikipedia further muddies the waters with "self-interpreters"
<ggole>
I think there's a bit in Queinnec's book about that as well
FreeBirdLjj has quit [Read error: Connection reset by peer]
ryan_vw has joined #lisp
<makomo>
beach: yeah, it is a bit fuzzy
FreeBirdLjj has joined #lisp
<makomo>
ggole: thanks for the pointer, that's on my reading list :-)
shifty has quit [Ping timeout: 268 seconds]
<makomo>
Bike: that paper explicitly mentions the circularity part, "We have coined the word “meta-circular” to indicate the basic character of this interpreter: It defines each feature of the defined language by using the corresponding feature of the defining language."
_whitelogger has joined #lisp
ringer1 has joined #lisp
frodef has joined #lisp
Cymew has quit [Ping timeout: 245 seconds]
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
Josh_2 has joined #lisp
SenasOzys has quit [Ping timeout: 252 seconds]
wanz has quit [Quit: wanz]
siraben has quit [Read error: Connection reset by peer]
siraben has joined #lisp
ryan_vw has quit [Ping timeout: 245 seconds]
ryan_vw has joined #lisp
makomo has quit [Ping timeout: 250 seconds]
graphene has quit [Remote host closed the connection]
quazimodo has quit [Ping timeout: 244 seconds]
graphene has joined #lisp
quazimodo has joined #lisp
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
steiner has joined #lisp
ryan_vw has quit [Ping timeout: 272 seconds]
wooden_ has quit [Ping timeout: 245 seconds]
makomo has joined #lisp
siraben has quit [Read error: Connection reset by peer]
siraben has joined #lisp
siraben has quit [Ping timeout: 246 seconds]
siraben has joined #lisp
nowhereman_ has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
DGASAU has joined #lisp
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
<flip214>
Xach: you're welcome
rumbler31 has joined #lisp
nowhereman_ has quit [Ping timeout: 244 seconds]
nowhere_man has joined #lisp
slac-in-the-box has joined #lisp
nowhere_man has quit [Remote host closed the connection]
nowhere_man has joined #lisp
montxero has quit [Quit: Lost terminal]
Orion3k has quit [Ping timeout: 268 seconds]
<jcowan>
can anyone talk about practical examples of degenerate arrays, either of rank 0 or of no elements?
ryan_vw has joined #lisp
<ggole>
When you want n things, and n happens to be 0?
<ggole>
Arrays of rank 0 are a bit less obvious, I guess
<jcowan>
I was actually thinking of multidimensional arrays rather than vectors of size 0; I see the application of the latter well enough, as they are a particular instance of empty indexable sequences
gector has quit [Read error: Connection reset by peer]
<ggole>
Once you allow empty arrays of rank 1, it would be inconsistent to disallow empty arrays of higher rank.
<ggole>
I'm not sure I could come up with a concrete use, though.
sjl has joined #lisp
<pjb>
jcowan: (aref #0A42) #| --> 42 |# can be used as a generalization of scalar in a context where you are processing arrays.
Roy_Fokker has joined #lisp
<jcowan>
or writing an APL implementation, I suppose, where scalars really are rank-0 arrays
<sjl>
does the standard permit (format nil "foo") to return that string literal?
<sjl>
For some reason I thought format returned a fresh string every time, but
<jcowan>
not persistent, but not just mutation-undefined either
<jcowan>
LdBeth: What is more efficient than a simple array?
roscoe_tw has quit [Remote host closed the connection]
<ggole>
In general you need updates to data structures, and copying the whole array is too slow
razzy has joined #lisp
<ggole>
For persistent arrays tou can do structure-sharing stuff with wide nodes to do better than that, but that's not 'immutable arrays' in the sense that you seem to mean
<jcowan>
You need it except when you don't.
<jcowan>
"Immutable vectors of non-characters can be extremely useful as lookup tables, which can be passed in toto without worrying about the callee side-effecting the table." --HB
<_death>
in Lisp we learn to trust the callee instead of worrying
<Bike>
people mess up constant data enough, catching that would be nice
<jcowan>
immutable objects are also good in distributed computing, which is one of HB's central concerns.
heisig has joined #lisp
pyx has joined #lisp
pyx has quit [Client Quit]
random-nick has quit [Read error: Connection reset by peer]
random-nick has joined #lisp
<jcowan>
I tried to remove mutable strings from Scheme, where strings are sui generis (not arrays), but failed to convince the committee to break the IEEE standard
<pjb>
Nothing prevents an implementation to provide them. The verbiage of the specifications clearly allows it.
<pjb>
I mean, to provide immutable objects. I would reject removing mutable objects too.
<void_pointer>
One of the hard things is that assuming one has managed to get all of one's data into a valid state in the first place, is keeping it from becoming invalid. I've had times where an array was the best structure for something but it was something that should not change at all after creation (it was intercoupled with some other things that shouldn't change).
<heisig>
Truly immutable data structures always sound nice on paper - until you have an application where performance and storage matter a lot.
<pjb>
I mean, I bought Knuth's books, so I cannot live without mutable arrays :-)
<pjb>
and it's an investment too.
<void_pointer>
It is a fairly common situation to have 2D or 3D arrays that should never change once initialized when doing various scientific and engineering simulations. Though to be fair, it isn't exactly common for the people doing such simulations to worry about this or many other problems, for better or worse.
<stylewarning>
Lambda: the ultimate immutable
<stylewarning>
(let ((a (make-array ...))) (lambda (x) (aref a x)))
robotoad has joined #lisp
<_death>
or (defmethod (setf gref) ((array immutable-array) &rest subscripts) (thats-a-no-no))
stereosphere has joined #lisp
magistr has joined #lisp
heisig has quit [Quit: Leaving]
<stylewarning>
(error 'rip-in-peace :who *you*)
magistr has left #lisp [#lisp]
<void_pointer>
Or if you can control where it gets stored in memory and have the right permissions, just put it in some pages of memory by itself and then set those pages to read-only so that a fault is raised any time there is a write to the pages assuming you have a processor that supports that.
<_death>
sure.. and how useful is this feature in practice? in Lisp, we usually document whether the function is destructive or not
<Bike>
yeah but that doesn't mean we get it right all the time.
<void_pointer>
It would depend on how mission critical whatever the code is doing is. I don't think common lisp is used for very many mission critical things where great lengths should be gone to to make sure that an invalid state cannot be entered and/or it at least fails gracefully.
<_death>
right.. so then will the default be mutable or immutable?
<Bike>
mutable, probably
<_death>
then by default, this feature will be unused :)
orivej has joined #lisp
<Bike>
that is what i just said, yep
<Bike>
though quoted data could be auto immutable
<void_pointer>
You know, an interesting question. Is anybody doing mission critical stuff with lisps these days? I sometimes wonder
<_death>
void_pointer: language features are often severely overrated when it comes to "mission critical" code.. in practice, it's process and the environment external to the system that matters there
<void_pointer>
_death: that makes sense. One tool in the toolchest among many. Insufficient by itself
FreeBirdLjj has joined #lisp
Oladon has quit [Quit: Leaving.]
<void_pointer>
I don't have much experience with such processes, sadly.
<_death>
a language isn't any good if the implementation's quality is unknown.. so code has to be written with full knowledge of the latter
FreeBirdLjj has quit [Ping timeout: 260 seconds]
<_death>
but the processes involve actual effort into testing, designing with redundancy and killswitches in mind
ykm has joined #lisp
<void_pointer>
Yes, and ideally plain old simple electronic and mechancial failsafes if applicable.
wiselord has joined #lisp
<_death>
but I guess such features help in "ordinary" code, which is lightly tested..
ykm has quit [Remote host closed the connection]
<wiselord>
hey! Please help me, i need an example for condition with auto-restart for the case: i run function (startn-fn () (ProcessingLoop () ... (getFromWeb ...) )), getFromWeb calls drakma:http-request, and if drakma:http-request (in fuction getFromWeb) return error (usocket:ns-try-again-condition) - i need atomatically restart (restartPL () ...). For manual restart i use code (start-fn () (restart-case
<wiselord>
(ProcessingLoop) (restartPL () ...))) but how can i automate the restart?
<shka_>
wiselord: you know PCL?
<wiselord>
yes, i read PCL... and CLtL2, but i did not understand how to apply for my task
<jcowan>
shka_: Lexical environments are only mutable if there is a lexically apparent setq that mutates them, that's my point. And the compiler knows that.
<shka_>
riiiiight
<francogrex>
however recently i decided to finally build the 64 bit CL implementation version and use it, however does any one know if there is a library to interact with COM?
<makomo>
shka_: hm, not a bad example :-D
orivej has quit [Ping timeout: 276 seconds]
<shka_>
makomo: but even then, it is unwieldy to write this way
<shka_>
i think that you may find something like this in LOL book
<makomo>
shka_: i've read LOL and don't remember seeing a triple backquote anywhere :^(
<shka_>
hmmm
<shka_>
well, then it is bad idea even by LOL standards :D
<makomo>
haha
Cymew has joined #lisp
rozenglass has quit [Read error: Connection reset by peer]
rozenglass has joined #lisp
Cymew has quit [Ping timeout: 268 seconds]
wiselord has quit [Ping timeout: 268 seconds]
ggole has quit [Quit: ggole]
angavrilov has quit [Remote host closed the connection]
<jcowan>
I've decided to switch from macros that expand to definitions to macros that expand to their bodies. More verbose but much clearer.
<pjb>
Just use functions to generate stuff and call them from macros.
francogrex has quit [Quit: ERC (IRC client for Emacs 25.3.1)]
Cymew has joined #lisp
Pixel_Outlaw has joined #lisp
Jesin has quit [Quit: Leaving]
Cymew has quit [Ping timeout: 246 seconds]
nowhere_man has joined #lisp
<jcowan>
That seems orthogonal to my point, which is not to hide definitions inside macro invocations.
graphene has quit [Remote host closed the connection]
slightlycyborg has joined #lisp
graphene has joined #lisp
anewuser has joined #lisp
shka_ has quit [Ping timeout: 252 seconds]
Jesin has joined #lisp
rumbler31 has quit [Remote host closed the connection]
lnostdal has quit [Ping timeout: 245 seconds]
<phoe>
jcowan: I only expand to DEF* and DEFINE-* macros inside macros that are defining macros themselves.
anamorphic has joined #lisp
<jcowan>
reasonable
<jcowan>
Here I am doing something like `(defun variant-function (foo bar) (variant-generator 'this 'that foo bar)`
<jcowan>
where variant-generator is a macro
<jcowan>
obviously it could generate the defun as well, but that makes the function definition un-apparent.
orivej has joined #lisp
<_death>
and what if you now need multiple functions to support the abstraction
<_death>
or some other bookkeeping
<phoe>
jcowan: hm
<phoe>
this is basically (curry #'variant-generator 'this 'that)
<phoe>
do you really need to define a toplevel function for each variant-function of yours?
<phoe>
because if this is your only use for this, then a macro looks like an overkill to me
cage_ has quit [Quit: Leaving]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<jcowan>
_death: I do, but the multiple (variant) functions are two-liners now instead of whatever the size of variant-generator is
<jcowan>
"generator" is a misleading term
<jcowan>
phoe: And yes, I do need a toplevel function for each variant, because I don't control the API
<jcowan>
that I am implementing.
Cymew has joined #lisp
zxcvz has quit [Quit: Leaving]
Oladon has joined #lisp
Balooga_ has joined #lisp
Cymew has quit [Ping timeout: 252 seconds]
graphene has quit [Remote host closed the connection]
Fare has joined #lisp
<Fare>
Upgraded my NixOS to 18.09, but my stumpwm config doesn't work anymore :-(
graphene has joined #lisp
<no-defun-allowed>
):
lnostdal has joined #lisp
anamorphic has quit [Ping timeout: 268 seconds]
warweasle has joined #lisp
random-nick has quit [Ping timeout: 250 seconds]
random-nick has joined #lisp
slightlycyborg has quit [Ping timeout: 252 seconds]
<phoe>
where MY-THING is the API function you export
<jcowan>
again, that's pretty opaque
random-nick has quit [Ping timeout: 260 seconds]
DGASAU has joined #lisp
zfree has quit [Ping timeout: 252 seconds]
<phoe>
jcowan: readable for me, as long as I have the definition for the base function
<phoe>
but I am not saying that this solution is the best one for your specific case
<phoe>
I'd need to take a longer look at it
DataLinkDroid has quit [Ping timeout: 256 seconds]
hhdave has joined #lisp
<jcowan>
I don't think, given the desire to find the definition of function foo in a large codebase, would go searching for "(setf (fdefinition 'foo".
<aeth>
No, but I don't assume that functions are defined by defun, I assume they're defined by defun or define-*
* jcowan
grumbles at the irregular definition of -, which means one thing for one argument and something totally different for 2+ arguments
<aeth>
Maybe I'm the only one who likes to write macros that write defuns rather than writing defuns directly for a lot of things (e.g. shaders)
<jcowan>
aeth: Fair enough
<aeth>
If you have a pattern that creates a function, it would be reasonable to turn it into a macro called define-*
<phoe>
jcowan: I wouldn't search the codebase, I'd do M-. in slime and let it find the source for me
<phoe>
but yes, I get your point
asymptotically has quit [Quit: Leaving]
* jcowan
wrote sentence no subject anyway
hhdave has quit [Ping timeout: 276 seconds]
<aeth>
If I see a define-* in CL I assume it ultimately creates at least one of (1) a function, (2) a macro, (3) a standard-object, (4) a structure-object, or (5) a type. Unless it does something fancier like sets a value in a global hash table or something... but that probably should be replaced with a function that returns one value IMO.
<aeth>
Oops, forgot to paste in (define-function-from-lambda 42+ (curry #'+ 42))
Selwyn has joined #lisp
<no-defun-allowed>
i have a similar define-codec in netfarm
<no-defun-allowed>
it takes a string (might make it a downcased symbol later) and two lambdas and sets it in a hash-table
hhdave has quit [Quit: hhdave]
rumbler31 has joined #lisp
<aeth>
What I do instead of relying on an implicit global hash table is that I have an explicit function that takes in a list of symbols and does something with that. So e.g. define-shader defines a function that returns a shader object and define-shader-data contains a lists all of the shader objects. So defining a shader is a pure function with no side effects, but you have to define which shader-returning functions to actually use
<aeth>
(in case that got cut off, "which shader-returning functions to actually use")
<no-defun-allowed>
they're only used internally and can only be named and found with #'find-codec so purity isn't a big problem for me
<no-defun-allowed>
so when my parser hits an atom `base64:AAAA` it funcalls (find-codec "base64" :decode) with "AAAA"
<aeth>
no-defun-allowed: You could probably replace that with a with-codec macro that binds the function to a variable so it's not looked up every time.
rumbler31 has quit [Ping timeout: 276 seconds]
<no-defun-allowed>
maybe but i can't predict what will be looked up
<oni-on-ion>
aeth: didnt cut off btw
makomo has quit [Ping timeout: 252 seconds]
<aeth>
oni-on-ion: I can't tell when the CCL log bot isn't here, I just know that it usually cuts off around that point
<aeth>
The most unpredictable part about IRC is where your message gets cut off.
<oni-on-ion>
ahh =) yeah. wasnt sure if your client may have truncated. this client here (weechat) automatically splits up a certain amount into seperate messages
<aeth>
yeah, but it just guesses afaik
<aeth>
It depends on the server and the size of the total IRC message (which includes some metadata like your nick) afaik. I get several more characters to work with than you.
<pjb>
:-)
<aeth>
pjb wins
<oni-on-ion>
^_^
varjag has quit [Ping timeout: 244 seconds]
slyrus1 has quit [Ping timeout: 250 seconds]
varjag has joined #lisp
tko has quit [Read error: No route to host]
pjb has quit [Ping timeout: 276 seconds]
ice1000 has joined #lisp
<ice1000>
LdBeth
lavaflow has quit [Read error: Connection reset by peer]
varjag has quit [Remote host closed the connection]
lavaflow has joined #lisp
Balooga_ has quit [Quit: Balooga_]
quazimodo has quit [Ping timeout: 268 seconds]
quazimodo has joined #lisp
nowhere_man has quit [Ping timeout: 276 seconds]
nowhere_man has joined #lisp
rumbler31 has joined #lisp
DGASAU has quit [Read error: Connection reset by peer]
DGASAU has joined #lisp
<LdBeth>
ice1000 (IRC): wtf
rumbler31 has quit [Ping timeout: 246 seconds]
graphene has quit [Remote host closed the connection]
graphene has joined #lisp
rumbler31 has joined #lisp
rozenglass has quit [Remote host closed the connection]
Kaisyu has joined #lisp
rumbler31 has quit [Remote host closed the connection]
aindilis has quit [Read error: Connection reset by peer]
robotoad has quit [Quit: robotoad]
Essadon has quit [Quit: Qutting]
Fare has quit [Ping timeout: 252 seconds]
frodef has quit [Ping timeout: 246 seconds]
energizer has quit [Quit: ZNC 1.7.0+deb0+xenial1 - https://znc.in]
graphene has quit [Remote host closed the connection]