abarbosa has quit [Remote host closed the connection]
Kaisyu7 has quit [Quit: ERC (IRC client for Emacs 26.2)]
Achylles has quit [Ping timeout: 258 seconds]
quazimodo has joined #lisp
Kaisyu7 has joined #lisp
beach has quit [Ping timeout: 252 seconds]
rdh has quit [Quit: Leaving]
rozenglass has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
bexx has quit [Ping timeout: 272 seconds]
oni-on-ion has joined #lisp
torbo has joined #lisp
akoana has left #lisp ["Leaving"]
equwal has joined #lisp
equwal has left #lisp ["ERC (IRC client for Emacs 27.0.50)"]
equwal has joined #lisp
<equwal>
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
Lord_of_Life has quit [Ping timeout: 248 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
Lord_of_Life has joined #lisp
rvirding has quit [Ping timeout: 252 seconds]
dale_ has joined #lisp
dale has quit [Disconnected by services]
dale_ is now known as dale
rvirding has joined #lisp
voidlily has quit [Ping timeout: 248 seconds]
v0|d has quit [Ping timeout: 252 seconds]
voidlily has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
<LdBeth>
Hello
<edgar-rft>
world!
<LdBeth>
GG
<LdBeth>
U missed a comma
karlosz has joined #lisp
Oladon has joined #lisp
zotan has quit [Ping timeout: 245 seconds]
FreeBirdLjj has joined #lisp
abarbosa has joined #lisp
<aeth>
Missing commas are pretty annoying. You wind up trying to access a variable that doesn't exist because the macro author only tested the macro with outer variables having the same name as the macro variable.
zotan has joined #lisp
<aeth>
Then you use foobar instead of foo and see the issue right away.
v0|d has joined #lisp
zotan has quit [Ping timeout: 248 seconds]
<LdBeth>
Can someone explain what's "safe call" in CLHS
<beach>
asarch: You rarely need to use RETURN-FROM. The usual way is what Xach told you.
<beach>
asarch: If you find yourself using RETURN-FROM a lot, it might be that your programming style is not that great.
<aeth>
I'm not sure if I've ever used return-from. Maybe once. It's very rare.
<no-defun-allowed>
Works if you're doing something like a tree-traversing EVERY.
<beach>
Occasionally, in a loop, when the final value becomes known, it can be a good solution.
<asarch>
Well, that's for a GTK+ call back to do OpenGL rendering operations
<asarch>
If a function need something like (foo ... (lambda (x y) ...)), how could I put (lambda ...) in a function and the pass that function to (foo ...)?
schweers has quit [Remote host closed the connection]
schweers has joined #lisp
schweers has quit [Remote host closed the connection]
schweers has joined #lisp
oni-on-ion has quit [Ping timeout: 245 seconds]
python476 has quit [Remote host closed the connection]
elinow has quit [Ping timeout: 245 seconds]
heisig has joined #lisp
manualcrank has quit [Quit: WeeChat 1.9.1]
oni-on-ion has joined #lisp
manualcrank has joined #lisp
pankajgodbole has quit [Ping timeout: 272 seconds]
manualcrank has quit [Client Quit]
manualcrank has joined #lisp
Achylles has joined #lisp
jmercouris has joined #lisp
<jmercouris>
is there a type of AND macro or form that instead of returning the result of evaluating the last form returns t or nil?
<jmercouris>
you could of course wrap the AND in a WHEN and have t as the body of WHEN, but that seems a bit clunky
<jdz>
jmercouris: Just add T at the end.
<jmercouris>
ah, yes
<jmercouris>
jdz: thank you
<jdz>
I'm glad the proposed solution works for you.
<jackdaniel>
(not (not (last-form))) is another way to normalize the value
<jackdaniel>
admittedly longer
<jmercouris>
I do feel like this would be a good candidate for a macro though
<jmercouris>
it could be called like AND-P or something
<jmercouris>
or wait ANDP
<jmercouris>
the dash is only if there are other dashes
<shka_>
i don't think this is a good idea
<jmercouris>
why not?
<shka_>
you are better off with function like not-null
<shka_>
or as-boolean
rotty1 has quit [Ping timeout: 264 seconds]
<jackdaniel>
question: how often do you need AND to return either NIL or T?
<shka_>
and why not OR
<jdz>
And using (if (and ...) t nil) might communicate your intent even better.
<shka_>
i advice against the above
<shka_>
anyway, i would simply add function converting to boolean and be done with it
<aeth>
jackdaniel: when storing something
<jackdaniel>
"you" is implicitly pointing at jmercouris as the person to whom I address the question
<jmercouris>
jackhill: not very often
<jmercouris>
sorry, wrong username
<jmercouris>
jackdaniel: not very often
<jmercouris>
I would say about 1/25th of all times I write conditionals do I want it to be explicit that it is a bool
<jackdaniel>
then is it worth to extend a vocabulary with this particular verb?
<jmercouris>
perhaps not, I do like the (if (and ...) t nil) suggested above, it is clear
<shka_>
aeth: thing is that storing is orthogonal to logical operators. You will need to do the same with a lot of functions in multiple places, creating custom versions of each of those is pointless
<beach>
jmercouris: Most of the time, the arguments to AND should be Boolean values anyway.
<beach>
The only exception I can see would be when some standard Common Lisp function returns a generalized Boolean, such as DIGIT-CHAR-P.
<jmercouris>
beach: well, in this case I was using a find-if basically to check if some element exists in the list, and it was returning that element instead of a Boolean
<beach>
Yes, I see.
<jmercouris>
this is all stemming from that email a few months ago about Booleans
<jmercouris>
I have been thinking about it, and while it is more verbose instead of just leaving it as a find-if, it more clearly conveys intent
<beach>
On the other hand, you should almost never see the value of the AND form.
<jmercouris>
why is that? I have it as part of a predicate function
<beach>
It should typically only appear in a context of a conditional.
<_death>
maybe you want SOME
elinow has joined #lisp
<jmercouris>
I think that would be a bit strange like (defun my-predicate-p (when (and ...)))
<beach>
jmercouris: If the AND form is in an IF, COND, WHEN, UNLESS or something like that, you will never see the value.
<beach>
Right, but then my-predicate should only appear in such a position, so again, you won't see it.
<jmercouris>
_death: SOME and NOTANY are things I have not encountered, and do seem more clear than FIND-IF which is meant to operate on the element if it is found
<jmercouris>
at least the name makes me feel like it is intended to operate on the element
<jackdaniel>
code like: (let ((foo (and xyz abc (qux xyz abc))) …); is not uncommon
<jmercouris>
lots to think about here...
<beach>
jackdaniel: Yes, but then I expect FOO to be used in a conditional.
<jmercouris>
that's the thing with software engineering and languages, it is so philosophical :D
<jackdaniel>
jmercouris: difference between and /and/ every is that the latter evaluates all its arguments because it is a function
<_death>
FIND-IF also won't do if the particular element is NIL
<beach>
jmercouris: What I am trying to say is that the return value of AND should only ever end up in a conditional, so then the exact nature of the true value is unimportant.
<jackdaniel>
in case of and arguments are evaluated until you find NIL
<jackdaniel>
this is important distinction if the arguments are forms which have side-effects (or take long to process)
<jmercouris>
beach: yes, I see what you are saying
<jmercouris>
it does make sense, I will try writing code with that in mind for some time
<jackdaniel>
(same applies to OR vs SOME)
<_death>
jackdaniel: you're right but note that EVERY will also stop checking if the predicate returns false.. the difference is that AND is connective and EVERY is a (Common Lisp) predicate
<jmercouris>
jackdaniel: I'm having trouble understanding what you are saying, are you talking about short circuiting?
<jackdaniel>
_death: I'm talking about argument evaluation, not about predicate evaluation
<_death>
jackdaniel: sure, that's why I said you're right :)
<no-defun-allowed>
sounds like something Interlisp's CLISP would do though, it let you put meaningless words like `(if (foo-p thing) then ... else ...)` in places to make it more readable
<no-defun-allowed>
PG does not like anything remotely deep
kajo has quit [Quit: From my rotting body, flowers shall grow and I am in them and that is eternity. -- E. M.]
<no-defun-allowed>
pretty sure him and ESR have some weird anti-CLOS thing too
JohnMS has quit [Ping timeout: 248 seconds]
<jackdaniel>
I'm referring to what Dan Weinreb said
<jackdaniel>
(so I recommend skipping tl;dr attitude and see what is said by one of the construct authors)
<no-defun-allowed>
i did read it, must have missed the obvious introduction that pointed out that PG didn't write that
<_death>
no-defun-allowed: well, I sympathise with both camps :).. I think it's good to be skeptical of both loop/antiloop and clos/anticlos :)
<no-defun-allowed>
(though "I consider Loop one of the worst flaws in CL, and an example to be borne in mind by both macro writers and language designers." in the parens suggests i'm not wrong, just completely off the point)
<_death>
or should I say clos/clostrophobia
<no-defun-allowed>
amazing
crystalball has joined #lisp
crystalball has quit [Client Quit]
<jmercouris>
I can understand antiloop, I can't sympathize with anticlos
<_death>
consider the premise that object-oriented style is just one possible paradigm out of many
scymtym has quit [Ping timeout: 248 seconds]
<_death>
jumping straight to clos, or delving deep into the mop to make it suitable to your problem may not be the most efficient or clear approach to get at what you actually want
<_death>
of course, sometimes what you actually want brings you to clos/mop, and that's great
* didi
has "The art of the metaobject protocol" queued to be read
<jmercouris>
that's the thing though, should we remove procedural style from Lisp?
terpri has quit [Ping timeout: 246 seconds]
<jmercouris>
it is also one of many paradigms
<jmercouris>
granted, you cannot make the argument that it required any changes to Lisp to implement
<jmercouris>
I'm not sure where I'm going with this, but I cannot imagine Lisp without introspection and CLOS
<jackdaniel>
anti-clos as in: "do not use clos", not "remove clos from the language"
<jmercouris>
what do they suggest instead? structs and functions only?
<jmercouris>
how do they group data more complex than what a list of lists can handle?
<jmercouris>
and who is "they" anyway? are there any anti-clos arguments I can read?
<_death>
CL itself due to its history has CLOS almost as an addon.. so it's easy to imagine CL-sans-CLOS
<jmercouris>
I'm using the expression in the sense of, "it would be very unfortunate", not that I cannot imagine it literally
<jackdaniel>
it is not said that if there were no "clos" CL wouldn't incorporate other kind of OOP
<jmercouris>
of course when I was learning Lisp (still learning of course), I did not yet know CLOS and was working without it
<jackdaniel>
also object orientation and encapsulation are orthogonal concepts, you may write protocol for accessing complex data which has underlying structure in form of a vector whatsoever
<jmercouris>
I know the other OO systems though, and I don't like them nearly as much, I can't think of an argument for them anymore
<jackdaniel>
you just define functions to set and access data
<_death>
DEFSTRUCT existed prior to CLOS, I believe
<jmercouris>
sure you can, just how you could drop down into assembler, but abstractions that objects provide make it far easier to persist/access data
<jmercouris>
and I will disagree with you object orientation and encapsulation are *NOT* orthogonal concepts
<jackdaniel>
also using clos daily encourages sloppy code where there are dangling methods (and it is hard to follow how the program behaves)
<jmercouris>
that is one of the big reasons behind Java's different type of class members, they are closely tied
<jmercouris>
I will not say that one necessitates they other, but I will not say they are orthogonal
oni-on-ion has quit [Remote host closed the connection]
JohnMS has joined #lisp
JohnMS has quit [Client Quit]
JohnMS_WORK has quit [Ping timeout: 248 seconds]
ricekrispie has joined #lisp
svillemot has quit [Ping timeout: 257 seconds]
svillemot has joined #lisp
jmercouris has quit [Ping timeout: 246 seconds]
kdas_ has joined #lisp
kushal has quit [Remote host closed the connection]
kdas_ is now known as kushal
pankajgodbole has joined #lisp
dale_ has joined #lisp
dale_ is now known as dale
LiamH has joined #lisp
warweasle has joined #lisp
kushal has quit [Remote host closed the connection]
kushal has joined #lisp
beach has quit [Ping timeout: 252 seconds]
milanj has joined #lisp
beach has joined #lisp
zooey has quit [Remote host closed the connection]
zooey has joined #lisp
Lord_of_Life has quit [Ping timeout: 244 seconds]
Lord_of_Life has joined #lisp
jmercouris has joined #lisp
bobby has quit [Ping timeout: 245 seconds]
lnostdal has quit [Ping timeout: 272 seconds]
Achylles has quit [Ping timeout: 252 seconds]
Lycurgus has joined #lisp
schjetne has quit [Ping timeout: 258 seconds]
hjudt has joined #lisp
jprajzne has quit [Quit: Leaving.]
lnostdal has joined #lisp
Achylles has joined #lisp
sjl_ has joined #lisp
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
Inline has joined #lisp
jmercouris has quit [Ping timeout: 245 seconds]
lnostdal has quit [Read error: Connection reset by peer]
lnostdal has joined #lisp
lnostdal has quit [Read error: Connection reset by peer]
anewuser has quit [Ping timeout: 248 seconds]
jmercouris has joined #lisp
lnostdal has joined #lisp
jkordani has quit [Ping timeout: 246 seconds]
pankajgodbole has quit [Ping timeout: 248 seconds]
v88m has quit [Read error: Connection reset by peer]
v88m has joined #lisp
heisig has quit [Quit: Leaving]
zhlyg has joined #lisp
Lycurgus has quit [Quit: Exeunt]
shifty has quit [Ping timeout: 248 seconds]
<markasoftware>
i want to make a macro `with-modulo`. In its body, all basic arithmetic operations should have their results modulo'd. So, (with-modulo 5 (+ 4 2)) would be 1
<markasoftware>
I'm unsure how I should properly override the + functions here
<beach>
markasoftware: You can't override the version in the CL package.
<markasoftware>
there's no way to lexically or dynamically bind an override?
<White_Flame>
you could fiddle with the current package such that + reads as MY-PACKAGE:+ instead of CL:+
<White_Flame>
you'd have to transform that back to CL:+ outside your with-modulo scope
jmercouris has quit [Ping timeout: 268 seconds]
<markasoftware>
huh, i guess I'll just make +m, -m, *m, etc
<White_Flame>
in SBCL you can unlock the CL package and fiddle with things like that even if you're not supposed to
<beach>
It is fine to shadow + in your own package.
jmercouris has joined #lisp
<White_Flame>
other implementations probably have the same
<Xach>
In this case I think it would be appropriate to use a code walker but I do not know how easy or difficult that would be.
<_death>
markasoftware: suppose you move (+ 4 2) to some function and call it in WITH-MODULO.. should it return the same result?
<markasoftware>
i was planning for it to be lexical, so no
<markasoftware>
i didn't think function binding was so different from value
<White_Flame>
it's not that different; the difference is that the CL package is effectively locked
<_death>
markasoftware: then as Xach said, one way is to use a walker.. if you like to live dangerously you can SUBLIS :)
<markasoftware>
so, a walker would look through the forms in &body for any + to replace them?
<White_Flame>
yes, the naive approach is to just walk the source as a list
<White_Flame>
but you might miss things in backquotes and other reader macro stuff
<White_Flame>
fare-quasiquote can normalize the backquote handling to sexprs
<White_Flame>
plus, distinguishing between vars, function calls, etc in all the lisp-2 scopes is more difficult in a manual code walk
<White_Flame>
but for the base case, simply searching the nested lists of &body source works
<markasoftware>
i think i'll just take the easy route and use different functions for modulo arithmetic and normal arithmetic. Thanks for the insight!
<White_Flame>
yep. It is often a pain point that the standard functions are not extensible or generic functions
<aeth>
And the standard functions that are generic are a special kind of generic, not generic functions
gravicappa has joined #lisp
<lavaflow_>
hey dumb question, but which software license is generally prefered by the lisp community?
<aeth>
MIT seems to be the most common these days.
<lavaflow_>
I was thinking, the most popular editor seems to be emacs, so maybe the lisp community likes the GPL too?
<lavaflow_>
okay yeah that makes sense
<aeth>
Licenses seem to match the general trend in licenses.
<lavaflow_>
yeah, MIT seems pretty popular these days
zhlyg has quit [Remote host closed the connection]
<Xach>
the most popular chainsaw is husqvarna but I do not speak swedish
<ckonstanski>
Yesterday I asked about getting a lisp process to run in docker. Turns out the problem is not with lisp but rather with docker, and the solution also lies within docker. Add -t to the docker run command line to get a pseudo-TTY.
schweers has quit [Ping timeout: 248 seconds]
<aeth>
Xach is probably the only one who could quantiatively tell you (1) how many projects are under a certain license and (2) if that trend has changed over time based on first commit in the repository.
<ckonstanski>
The REPL cannot exist without a TTY, and therefore the lisp image dies as soon as it wants to land at the REPL.
<_death>
could be there are a massive number of proprietary projects that you never heard of :)
<Bike>
your lisp probably has an optiona to run something else instead of the repl, if that's the kind of thing you want to do
<aeth>
ckonstanski: in SBCL it is sbcl --non-interactive --load path/to/your/file.lisp
<aeth>
Other implementations probably have similar flags.
<aeth>
You probably need to create a file to be run specifically for this purpose since it will call your main or whatever, which you wouldn't normally do automatically from the REPL.
<Xach>
_death: that is one reason why i don't like an attitude like "I will break my interface and send patches to all projects that break" - how can you know what breaks below the surface?
<ckonstanski>
--non-interactive makes the problem worse. Lisp exits as soon as it finishes loading and running whatever is in thte --load (or --userinit or whatever) parameter.
<White_Flame>
is this supposed to be a server?
<ckonstanski>
If you're trying to run a hunchentoot web server (for instance) that listens in the background, you have to keep the image alive after it'S done loading.
<aeth>
ckonstanski: you probably want a loop to keep it alive, with a way to quit it, and a way to access it via swank, using an ssh-tunneled SLIME
<White_Flame>
yes, the main thread should block until shutdown is requested
<Xach>
_death: I don't mind a justified breaking of interfaces, but I find the idea that it is mitigated substantially somehow by sending patches around not great.
<aeth>
Xach: not just proprietary projects, also e.g. Debian
<aeth>
Sure, Debian will eventually get the upstream, years later.
<_death>
Xach: definitely.. that is a very important pro for CL, that it's stable.. although when what you say happens I'm sometimes ambivalent because I believe the ecosystem is still small enough for it to make sense if the interface is very broken
<_death>
bitrot doesn't just happen.. it is caused, sometimes manufactured :/
<Xach>
I remember one message from the "big 5" standardization list: "I'd rather piss off a thousand RMSs than one MCC", which is not exactly my sentiment, but it is slightly related.
<Xach>
Hmm, I guess it was in the k-machine stuff.
<pjb>
ckonstanski: this is false. You can have a REPL without a TTY. For example, slime.
<pjb>
ckonstanski: also, you don't need a REPL to run a lisp program in the background.
<ckonstanski>
For purposes of docker though. Context matters.
<pjb>
background as in, in a docker.
<White_Flame>
ckonstanski: this is no different than a server in any other language. There's a "main thread is finished" behavior or equivalent that exits the program, that you need to block on
schjetne has joined #lisp
<White_Flame>
and yes, the only REPL you should have on a server is a SLIME-served REPL
<White_Flame>
(technically SWANK-served, but whatever)
<aeth>
ckonstanski: You can do something like this: (defun main () (loop :until (zerop (random 10)) :do (sleep 1/10))) (main)
<aeth>
Except instead of (random 10) it's a quit signal
<_death>
Xach: hah.. don't release internal code so that customers won't use internal interfaces... :)
<White_Flame>
aeth: or :use bordeaux-threads and do it properly :-P
<aeth>
nah
<_death>
Xach: I think I have some projects that I don't put up for that reason, amongst others ;)
igemnace has joined #lisp
hhdave has quit [Quit: hhdave]
elinow has quit [Quit: Leaving]
themsay has quit [Ping timeout: 268 seconds]
jxy has quit [Quit: leaving]
jxy has joined #lisp
jmercouris has quit [Ping timeout: 244 seconds]
ggole has quit [Quit: Leaving]
<Xach>
/win 3
<markasoftware>
How can I access a macro argument as a string?
<Xach>
markasoftware: (princ-to-string argument)
<Xach>
markasoftware: that is a little tongue in cheek. what prompts the question?
<markasoftware>
i want to generate functions which are named +m, -m, *m, and /m, slightly modified versions of all the built-in arithmetic
<markasoftware>
i want to make a macro (make-my-thing +) (make-my-thing /) etc
<markasoftware>
i need to append the m
<markasoftware>
but need to call the original arithmetic function inside the definition
<Bike>
what does make-my-thing do?
<Xach>
markasoftware: ok. you can get the name of a symbol as a string with (symbol-name symbol)
<markasoftware>
Bike: it defines, say, +m as (mod (+ a b) *modulus*)
<markasoftware>
i want these functions to all modulo their results by a global variable
<Bike>
ah.
<_death>
(make-my-thing +m +) is also an option
<Xach>
symbol names that appear in sources as lowercase are by default read into lisp as uppercase, so if you make a symbol with a name of "m+" it will print funny, but it won't if you use "M+".
<markasoftware>
and how do i go backwards, to convert a string to a symbol?
<White_Flame>
neither of these will perform the read-case transformation, though. read-from-string can convert a string to a symbol, with the case transformation, *IF* it reads as a string
<White_Flame>
although intern + string-upcase can be compatible enough
<White_Flame>
oh, the alexandria library also has SYMBOLICATE, which is handy for building up symbols from parts
<White_Flame>
although it doesn't seem to perform read-case conversion for you either
<markasoftware>
so, (defun (intern whatever) body) ?
oni-on-ion has joined #lisp
voodooanon has joined #lisp
<Bike>
you can just try intern and symbol-name and stuff in the repl to get a feel of how they work
<Xach>
markasoftware: likely something more like `(defun ,function-name ,lambda-list ,@body)
voodooanon has left #lisp [#lisp]
nowhereman has joined #lisp
<_death>
imagine if DEFINE-MODIFY-MACRO appended an F :)
<pjb>
markasoftware: if it's whatever, why do you care giving it a name? Just (lambda ,lambda-list ,@body).
d_run has joined #lisp
<pjb>
(intern "name with smaller case, and other <strange> \"characters\" and stuff.") #| --> |name with smaller case, and other <strange> "characters" and stuff.| ; nil |# works too ;-)
<pjb>
(|and also| (|make my thing| +) /)
Oladon has quit [Ping timeout: 258 seconds]
<oni-on-ion>
hmm " and | need to be different? ie. why wouldnt symbols and strings have more 'equality'?
moei has joined #lisp
<pjb>
oni-on-ion: it's possible. The first LISP used commas to separate tokens. (foo |bar baz| quux) was written (FOO,BAR BAZ,QUUX)
<pjb>
ie. spaces were significant!
<oni-on-ion>
ohhh thats quite interesting =)
terpri has joined #lisp
<_death>
it also didn't have strings
<pjb>
(PRINT,HELLO WORLD)
<oni-on-ion>
i notice that hemlock (and clim listener?) use space for completion. (also it uses Real Word Command rather than real-word-command)
<pjb>
but you couldn't print a comma :-)
<oni-on-ion>
heh those things
<oni-on-ion>
in a way looking back, it could make sense as we-use-hyphens-for-spaces-instead nowadays
<_death>
I'm reminded of those javascript testing frameworks with it("should not break too hard", function() { ... })
pierpal has quit [Ping timeout: 248 seconds]
specbot has quit [Remote host closed the connection]
minion has quit [Remote host closed the connection]
minion has joined #lisp
specbot has joined #lisp
<Xach>
o for a macro
Jesin has quit [Quit: Leaving]
nowhere_man has joined #lisp
nowhereman has quit [Ping timeout: 258 seconds]
ckonstanski has quit [Read error: Connection reset by peer]
ckonstanski has joined #lisp
pierpal has joined #lisp
<_death>
(defmacr 'defmacr)
Jesin has joined #lisp
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
dpl has joined #lisp
mulk has quit [Ping timeout: 244 seconds]
ckonstanski has left #lisp ["ERC (IRC client for Emacs 26.2)"]