paraparity has quit [Remote host closed the connection]
anamorphic has quit [Ping timeout: 258 seconds]
wavemode has joined #lisp
v88m has joined #lisp
flazh has quit [Ping timeout: 272 seconds]
rumbler31 has joined #lisp
eabarbosa has quit [Remote host closed the connection]
rumbler31 has quit [Ping timeout: 244 seconds]
gxt has joined #lisp
Kundry_Wag has joined #lisp
clintm has joined #lisp
_leb has joined #lisp
Kundry_Wag has quit [Ping timeout: 258 seconds]
flazh has joined #lisp
Kundry_Wag has joined #lisp
randyjohnson86 has joined #lisp
<randyjohnson86>
perhaps a controversial question, but how long would one normally say to become familiar with the general lisp syntax?
t58 has quit [Quit: Night]
<no-defun-allowed>
not very long?
<Bike>
few days? hours?
<wavemode>
once you start using it to make small projects you will pick it up like any other language's syntax
<no-defun-allowed>
90% is just lists, the rest is #', quasiquote and literal arrays
<randyjohnson86>
yes, I'm slowly working my way through 'a gentle introduction to symbolic computation' by touretzky
<randyjohnson86>
it's rather quite fascinating, but I still find myself making little things in python rather than practicing my lispcraft
<Xach>
I use lisp for small things because of the nicer support for interactive ongoing development and debugging.
libertyprime has joined #lisp
<LdBeth>
I'm writing ALGOL68 right now
<LdBeth>
It seems CL doesn't have computed goto
<no-defun-allowed>
you can use lisp on the boat, on the house, on the pets, in the kitchen, there's nothing you can't do with lisp
<LdBeth>
Also that software I'm trying to reimplement uses pointer arithmetic a lot
<wavemode>
embedded?
<LdBeth>
That software was intended to be "compiled" with a dedicated macro assembler
<randyjohnson86>
I think it will take some more time to get into the rhythm of it, it's a lot to undertake in a few settings
zotan has quit [Ping timeout: 244 seconds]
zotan has joined #lisp
zotan has quit [Ping timeout: 268 seconds]
zotan has joined #lisp
dddddd has quit [Remote host closed the connection]
zotan has quit [Ping timeout: 259 seconds]
zotan has joined #lisp
randyjohnson86 has quit [Quit: Leaving]
refpga has quit [Ping timeout: 258 seconds]
<oni-on-ion>
no-defun-allowed, =)
aindilis has joined #lisp
keep_learning_M has joined #lisp
keep_learning_M has quit [Client Quit]
<drmeister>
Howdy lispers - where do you put declares in LOOP?
<drmeister>
(loop for x below 1000000000) How do I say x is a fixnum?
<Bike>
for x fixnum below
<Bike>
i think
<drmeister>
Oh - neat
<drmeister>
Wanna look at the llvm stuff tomorrow for debug source info for inlines?
<aeth>
Bike: no
<aeth>
Bike: it's of-type fixnum
<aeth>
I think fixnum might be one of the few where of-type is optional, but it's better just to be uniform and always have of-type there imo
<Bike>
just x fixnum works4me.
<mfiano>
aeth: No. That's the complex type spec
<aeth>
mfiano: okay
<mfiano>
For simple types, omitting it is valid
<aeth>
You have to be careful for testing it because SBCL and CCL will accept more than the spec, e.g. single-float and double-float, which will fail under CLISP
rumbler31 has joined #lisp
<aeth>
interestingly, I just tested that in CLISP and I only get a warning, so I guess it only fails sometimes (since it's not like CLISP has gotten a new version recently)
<mfiano>
Kind of like (declare (type fixnum ...)) vs (declare (fixnum ...)) for simple/complex forms.
<drmeister>
In my heart I'm always screaming that LOOP isn't lispy.
<aeth>
It's just a bit more Lispier if you always have of-type, though
<aeth>
Then it looks almost like a plist
<White_Flame>
if LOOP demanded keywords for its ... keywords, then it would look like actual lambda args
<White_Flame>
and still be "lispy"
<aeth>
I always use keywords for LOOP keywords because then they're syntax highlighted like keywords and stand out
<White_Flame>
although the ordering demands between the key/value pairs still extends what lambda args support
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
rumbler31 has quit [Ping timeout: 258 seconds]
<aeth>
With very minimal changes (mostly just adding some extra parens) you could have basically LOOP, but with plists. e.g. (loop :for x :of-type fixnum :below 1000000000) vs. (do-loop (:for x :of-type fixnum :below 1000000000))
<aeth>
It'd probably be hard to implement, but easier than LOOP, since you could just do destructuring-bind with &key
<mfiano>
Probably also worth mentioning you can destructure types when using loop variable destructuring.
keep_learning_M has joined #lisp
Kundry_Wag has quit [Ping timeout: 258 seconds]
wavemode has quit [Ping timeout: 256 seconds]
caltelt_ has joined #lisp
Oladon has joined #lisp
caltelt has quit [Ping timeout: 258 seconds]
linack has joined #lisp
shangul has quit [Remote host closed the connection]
<beach>
Good morning everyone!
q9929t has joined #lisp
q9929t has quit [Ping timeout: 248 seconds]
Kundry_Wag has joined #lisp
Oladon has quit [Ping timeout: 248 seconds]
Kundry_Wag has quit [Ping timeout: 246 seconds]
kajo has quit [Ping timeout: 252 seconds]
libertyprime has quit [Read error: Connection reset by peer]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 248 seconds]
caltelt_ has quit [Ping timeout: 272 seconds]
libertyprime has joined #lisp
torbo has quit [Remote host closed the connection]
Bike has quit [Quit: Lost terminal]
pillton has joined #lisp
linli has joined #lisp
Kundry_Wag has joined #lisp
dale has quit [Quit: dale]
Kundry_Wag has quit [Ping timeout: 272 seconds]
linli has quit [Remote host closed the connection]
linli has joined #lisp
dale has joined #lisp
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 268 seconds]
_leb has quit []
libertyprime has quit [Quit: leaving]
linli has quit [Remote host closed the connection]
kipkap has joined #lisp
kipkap has quit [Quit: Leaving]
sauvin has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 257 seconds]
keep_learning_M has quit [Quit: This computer has gone to sleep]
eabarbosa has joined #lisp
vlatkoB has joined #lisp
eabarbosa has quit [Remote host closed the connection]
linack has quit [Quit: Leaving]
lavaflow has quit [Ping timeout: 258 seconds]
JohnMS_WORK has joined #lisp
<phoe>
Hey beach
donotturnoff has joined #lisp
Kundry_Wag has joined #lisp
rumbler31 has joined #lisp
Kundry_Wag has quit [Ping timeout: 272 seconds]
makomo has joined #lisp
rumbler31 has quit [Ping timeout: 244 seconds]
oni-on-ion has quit [Ping timeout: 248 seconds]
manualcrank has quit [Quit: WeeChat 1.9.1]
ggole has joined #lisp
oni-on-ion has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 248 seconds]
crystalball has joined #lisp
nowhere_man has quit [Ping timeout: 248 seconds]
grewal_ has quit [Ping timeout: 248 seconds]
grewal has joined #lisp
anewuser has quit [Quit: anewuser]
crystalball has quit []
scymtym has joined #lisp
<flip214>
drmeister: how do you feel about ITERATE?
shangul has joined #lisp
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Ping timeout: 272 seconds]
varjag has joined #lisp
dddddd has joined #lisp
pent has quit [Ping timeout: 252 seconds]
tehidiot has quit [Ping timeout: 276 seconds]
chewbranca has quit [Ping timeout: 276 seconds]
billstclair has quit [Read error: Connection reset by peer]
jhei has quit [Ping timeout: 252 seconds]
XachX has quit [Ping timeout: 252 seconds]
rvirding has quit [Ping timeout: 252 seconds]
crystalball has joined #lisp
adulteratedjedi has quit [Ping timeout: 276 seconds]
tazjin has quit [Ping timeout: 252 seconds]
tazjin has joined #lisp
jhei has joined #lisp
rvirding has joined #lisp
XachX has joined #lisp
tehidiot has joined #lisp
billstclair has joined #lisp
chewbranca has joined #lisp
adulteratedjedi has joined #lisp
pent has joined #lisp
Kundry_Wag has joined #lisp
schweers has joined #lisp
Kundry_Wag has quit [Ping timeout: 258 seconds]
hhdave_ has joined #lisp
mingus has quit [Remote host closed the connection]
mingus has joined #lisp
mathrick has quit [Ping timeout: 252 seconds]
mgsk has quit [Ping timeout: 252 seconds]
mathrick has joined #lisp
billstclair has quit [Ping timeout: 250 seconds]
wilfredh has quit [Ping timeout: 250 seconds]
p_l has quit [Ping timeout: 248 seconds]
mgsk has joined #lisp
keep_learning_M has joined #lisp
wilfredh has joined #lisp
billstclair has joined #lisp
p_l has joined #lisp
adulteratedjedi has quit [Ping timeout: 250 seconds]
jhei has quit [Ping timeout: 252 seconds]
rme has quit [Ping timeout: 252 seconds]
rme has joined #lisp
ggole has quit [Remote host closed the connection]
ggole has joined #lisp
jhei has joined #lisp
adulteratedjedi has joined #lisp
bytesighs has joined #lisp
XachX has quit [Ping timeout: 252 seconds]
derrida has quit [Ping timeout: 252 seconds]
derrida has joined #lisp
XachX has joined #lisp
voidlily has quit [Ping timeout: 248 seconds]
voidlily has joined #lisp
heisig has joined #lisp
orivej has quit [Ping timeout: 244 seconds]
keep_learning_M has quit [Quit: This computer has gone to sleep]
Kundry_Wag has joined #lisp
dmiles has quit []
Kundry_Wag has quit [Ping timeout: 252 seconds]
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 248 seconds]
maxxcan has joined #lisp
Lycurgus has joined #lisp
pankajgodbole has joined #lisp
froggey has quit [Ping timeout: 245 seconds]
crystalball has quit []
froggey has joined #lisp
wmfree has joined #lisp
wmfree has left #lisp ["ERC (IRC client for Emacs 26.2)"]
<schweers>
pjb: I know how they work. I still find it awkward to set them up.
<phoe>
that is what I use and I enjoy it
<pjb>
For example, on macOS, applications are not forked from a shell, even if you launch them from the Terminal (with open), but by a launcher process.
<schweers>
pjb: what if one launches a long lived command line tool? For instance calling rsync on a large dataset and/or a slow connection?
<schweers>
<pjb>
This launcher process used to read a file ~/Library/LaunchAgents/enrivonment.plist
<pjb>
(which is a xml file).
<pjb>
So you can see that you can, even on a "unix" system, configure environment variables WITHOUT having to use an old shell.
<pjb>
I'm not sure it's a progress. But at least, there's a GUI plist file editor…
<pjb>
schweers: again, it's irrelevant what you launch or how you launch it. What matter, is WHO launches it, because it's the parent process that transmits the environment variables IT has set, to its children.
<schweers>
Ah, so there is an extra process in between, which sets all the environment variables for the child process?
<pjb>
And whether the child dies in childhood or of long age doesn't matter at all.
<pjb>
In the case of Applications, the open command sends a message to the launcher.
<pjb>
But you can also fork the application executable directly from a shell just like any unix program.
<pjb>
Which can be confusing, since the environment will obviously be different.
<pjb>
(but then, the application doesn't have to use the environment variables either).
<pjb>
Now, yes, kind of special variables for processes. Also, usually programs don't clear out the environment. At most, they may add or change a couple of variables. So grand-children will get the environment as set by their grand-parent. Which can be useful.
<pjb>
On the other hand, this may also be a security concern. Hence the env -i command, and programs cleaning their environment upon entry. It may be harder to use those programs…
<pjb>
Notably, there are (or were) some nice bugs in bash regarding the handling of some environment variable.
JohnMS has joined #lisp
<schweers>
Maybe a more standard way of setting initial variables would be sufficient to address my complaints.
<schweers>
And setting them for already existing processes. If I decide I want to change a variable, already existing processes won’t be affected by this change.
<schweers>
On the other hand, this can also be a good thing.
<pjb>
env is quite standard. It's a IEEE Std 1003.1-2017 standard.
<schweers>
Maybe my real problem is with this whole zoo of files which get processes by various shells in various circumstances. Which may or may not set environment variables. I think my complaint was poorly thought out and I hereby retract it until I have thought about it some more.
kushal has quit [Ping timeout: 256 seconds]
kdas_ is now known as kushal
<pjb>
schweers: usual shell let you specific an environment file. So you would do BASHENV=$HOME/yourenv.sh in .bashrc for example, and something equivalent in the rc of the other shells, using the same $HOME/yourenv.sh so you can edit a single file.
<schweers>
shka__: no, but the result is still that we have multiple languages claiming to be a lisp.
<no-defun-allowed>
schweers: don't you know clojure is the modern incarnation of lisp and the only one will scale to potatoes, (jvm-running) quantum computers, space probes, CAD software, etc, etc
<schweers>
I know that clojure is a modern incarnation of ... something lisp like? I think it has some nice ideas which are unrelated to lisp itself. I’m not sure I’d want to use it for real work though.
<pjb>
s/clojure/927/
<schweers>
And yes, I know you were joking
<no-defun-allowed>
a lot of the clojure "magic" sounds only that useful for embarrasingly parallel stuff, in which case you can just lparallel:pmapcar and get better speed
<shka__>
i like clojure though
<schweers>
I’m not sure you’d get better speed with pmapcar.
<no-defun-allowed>
and also it smells like java too much
<schweers>
I guess abcl also smell of java.
<schweers>
It mostly smells of jvm, but I guess you can never truly hide the abomination that java the “language” is.
<no-defun-allowed>
does + overflow when given two ints in abcl?
<schweers>
Now, enough bashing of lesser languages.
<schweers>
Ah, that’s what you mean. Does it in clojure?
<no-defun-allowed>
also do some braindead ABCL users write in camelCaes?
<shka__>
so much hatred ;]
<no-defun-allowed>
yes, you need +' to do "slow" (read: actually working) addition
<schweers>
Wow.
<no-defun-allowed>
maybe the less braindead but still awkward ABCL users write in camelCase even
<schweers>
abcl does seem to be a nice tool if one has to interact with a jvm for some reason.
<no-defun-allowed>
and (cons 1 2) also doesn't work but anyways, discussing actual lisps on #lisp hurts my head less
elderK has quit [Quit: Connection closed for inactivity]
<no-defun-allowed>
i thought the moral of "CONS Considered Slightly Harmful" was to make binary trees of some form for efficient parallel processing, not pretend you have conses which actually aren't conses but i don't have any work experience like rich hickney and i've been spoonfed useless propaganda by BDFL-less programming language theory researchers
<phoe>
wait a second
<phoe>
#'+ may never overflow
<phoe>
otherwise it doesn't conform to the standard
<phoe>
adding two fixnums must result in a bignum
<schweers>
phoe: we were talking about clojure
<phoe>
ooh - carry on then
Xizor has quit [Ping timeout: 245 seconds]
<no-defun-allowed>
basically this image sums up my feelings towards clojure and i shall speak no more of it tonight: https://i.redd.it/ffne9jvbeer21.jpg
<phoe>
this is already #lispcafe material
<no-defun-allowed>
(psst, phoe: in Clojure family languages arithmetic is basically allowed to do whatever the host platform finds least annoying, like having everything as floats in ClojureScript)
<jackdaniel>
point being made CL is not a silver bullet which "just works"
<grewal>
phoe: An implementation can do some weird stuff and still be conformant
<jackdaniel>
i.e on machines we have today it is impossible to represent arbitrary numbers (be it floats or bignums), so it is a platform limitation
<jackdaniel>
so we do whatever the host platform finds "least annoying" ;-)
<grewal>
Build an ai that requests or builds more hardware when it's about to overflow
<xristos>
jackdaniel: CL not forcing me to expend mental energy to worry about how to handle integer promotion/overflow is pretty close to a silver bullet
<xristos>
i find the different operators in clojure disgusting to say the least
<jackdaniel>
grewal: hah, and integrate it with the compiler! :-)
<no-defun-allowed>
The universe and our computing time are both finite, but bignums (and ratios) are less annoyingly finite.
<jackdaniel>
instead of debating how pitiful are clojure programmers we should catch up to them in at least a few fields we lack (as CL community and ecosystem) -- it is really a difference between reassuring yourself you are the best and trying to improve yourself
<phoe>
^
* jackdaniel
drops the terminal to avoid the flame, will read logs later ,-)
ym555 has joined #lisp
<dmiles>
CDR7 (format "~0,f" 1.0001) is supposed to be (floanum-to-string 1.0001 NIL 1 NIL) ?
<dmiles>
to jackdaniel :)
<dmiles>
oops
<dmiles>
(floanum-to-string 1.0001 NIL 0 NIL)
<jackdaniel>
"~0,f" is not a valid stream ,)
<dmiles>
:P
<dmiles>
(floanum-to-string T 1.0001 0 NIL ) ?
<jackdaniel>
I don't know what floanum-to-string is, your format should print 1.0 though
<dmiles>
sorry i didnt have the code in front of me
<dmiles>
"~0,f" i thought might mean NIL as to the precision
heisig has quit [Quit: Leaving]
<dmiles>
so in the case of 1.0001 it would be 4
<jackdaniel>
afair if float doesn't fit in width, then you need to use *minimal* number of characters
<jackdaniel>
1. doesn't cut it, because it is an integer
<jackdaniel>
otoh "~0,0f" is an explicit ask to cut *all* numbers after .
<jackdaniel>
so it would be 1., but if you had 0.001, you'd have a result .0 (which is a correct float)
<jackdaniel>
fun stuff, I remember pulling out my hair reading through the spec to get it right ;)
<dmiles>
glad you are here.. i am startign ti implement
<jackdaniel>
you'd have 0., .0 would be if you had "~0,f"
<jackdaniel>
as you can see, I don't remember it by heart, so I'd refer to the spec for details
<dmiles>
.. i am using ECL as the way to learn the spec
<dmiles>
but now i am wondering how you can say "use whatever precision but let me contorl the left side"
<jackdaniel>
I don't understand
<dmiles>
like ... (format nil "~10,0f" 1234.056) => " 1234." (format t "~1,1f" 1234.056) => " 1234.1" .. next come "control"
<dmiles>
(format t "~1,f" 1234.056) = " 1234.056"
<dmiles>
menaing no number there meaning "i dont care .. let the number control it"
<jackdaniel>
you want to cut integers at the beginning? that would be incorrect result, not a lost precision
<dmiles>
these are floats not int
<jackdaniel>
s/integers/digits/
<dmiles>
ah.. righ
<White_Flame>
(no, left ;) )
<dmiles>
well what i'll like to do is only pad the left but not lose persision
Kundry_Wag has joined #lisp
rogersm has quit [Quit: rogersm]
<dmiles>
i was incorectly reading the spec thinking that was what (format t "~10,f" 1234.056) did
<White_Flame>
what do you mean by padding the left?
<White_Flame>
I think you mean print so that the decimal point always lines up, no matter how many fractional digits there are printed
<White_Flame>
?
<dmiles>
> (format nil "~1,1f" 1234.056)
<dmiles>
> (format nil "~10,1f" 1234.056)
<dmiles>
"1234.1"
<dmiles>
" 1234.1"
<White_Flame>
it's the ",1" that makes you lose the fractional precision, not the 10
<dmiles>
> (format nil "~1,4f" 1234.056)
<dmiles>
> (format nil "~10,4f" 1234.056)
<dmiles>
"1234.0560"
<dmiles>
" 1234.0560"
<White_Flame>
what do you desire to happen?
<dmiles>
i want to get " 1234.056"
<dmiles>
without guessing the number should bee 3
shangul has quit [Remote host closed the connection]
<jackdaniel>
you want have all separators lined up vertically, do I understand correctly?
<dmiles>
a assume (format nil "~10,f" 1234.056) means "guess for me"
<White_Flame>
(format nil "~10f" 1234.056)
Kundry_Wag has quit [Ping timeout: 258 seconds]
<White_Flame>
but still, "I want to get this string" doesn't fully describe what features of that string make it the correct represtation for you
<White_Flame>
*representation
<dmiles>
ok good the "~10f" covers that !
<dmiles>
so what does this mean? (format nil "~10,f" 1234.056)
<White_Flame>
it makes the number 10 characters long
<White_Flame>
I don't think the comma changes anything, since no parameter is given for its slot
<White_Flame>
but I could be wrong
<dmiles>
(format nil "~10,1f" 1234.056) <- this means make it 10 lone but only 1 presision
<White_Flame>
the number after the 1st comma tells it how many fractional digits to print
<dmiles>
ok so it really is: "~10,0f" == "~10,f
<dmiles>
ok so it really is: "~10,0f" == "~10,f"
<jackdaniel>
what White_Flame says. first number says how many characters (if doesn't fit, implementation must use minimum number of characters)
<jackdaniel>
and the second number is for number of digits after "."
<jackdaniel>
and no, ~10,0f is not the same as ~10,f
<jackdaniel>
the latter is the same as ~10f
<dmiles>
ECL doesnt treat "~10,f" as "~10f" but i expected it to
<dmiles>
which was why i was confused
<jackdaniel>
what ECL version do you have?
<White_Flame>
"~<totalchars>,<fracdigits>f" If either are not specified, then it simply prints however many characters are appropriate
shangul has joined #lisp
<dmiles>
ECL 16.1.2
<jackdaniel>
the most recent release is 16.1.3, maybe try that (I don't remember when I was working on format float exactly)
<dmiles>
ok.. good.. btw .. now everything makes sense.. I did understand the doc .. i just might have an outdated ECL
<dmiles>
oops i checked now i realize ECL is doing what i hoped
<White_Flame>
pebkac
<dmiles>
how i was making the mistake is wasnt really taking in acount for <totalchars> correctly
<White_Flame>
gotta check for those :)
<dmiles>
:)
<jackdaniel>
so there is no suspicion I've lied - my terminal was down all this time ,-)
<jasom>
another-user: you have no termination condition
<jasom>
another-user: (read-line stream nil) will return "nil" each time once you hit EOF
<jasom>
another-user: after the "for line =..." line put a "while line"
<beach>
until (null line) is better yet.
<another-user>
ahh, thank you!
<another-user>
beach: why is it better?
<phoe>
another-user: more explicit
<jasom>
another-user: it's a style thing. (null foo) implies that it's checking for nil being a null value rather than a true/false value
<another-user>
got it
<jasom>
the actual behavior is identical
<jasom>
nil/T vs nil/<some useful data>
<phoe>
"while line is non-NIL" and "until line is NIL" are equivalent functionally, but there's a detail regarding NIL-checking functions in Lisp
<beach>
another-user: Because while line violates the expectations that WHILE should be followed by a Boolean, wheras LINE is not a Boolean, it's line or NIL which means a default value, and not a Boolean.
<beach>
another-user: See page 13 of the LUV slides by Pitman and Norvig.
<phoe>
(not line) and (null line) are the same functionally, since NOT and NULL do literally the same thing
<phoe>
but presence of one and not the other conveys a meaning to the programmer - are you expecting a boolean, or are you expecting any Lisp datum
<beach>
phoe: But NOT also expects a Boolean, so that's again a violation of expectations.
keep_learning_M has joined #lisp
<phoe>
beach: yes
<jasom>
so clearly we should use (not (null line)) :P
<jasom>
so clearly we should use "while (not (null line))" :P
<phoe>
while (not (null line)) makes sense, too
<phoe>
I mean, it's literally how I'd read that in English
<phoe>
while the line is not null
<phoe>
do this and that to it
cosimone has quit [Ping timeout: 272 seconds]
<another-user>
beach: thank you for pointing at great material!
<phoe>
another-user: LUV slides are pretty good
<pjb>
I beg to differ about not and null. The problem is that the language is specified in such a way that you have to understand what while line means.
<phoe>
so is the Google style guide, it's worth to read it
<pjb>
So there's no gain in using until (null line) or while (not (null line))
<pjb>
So little gain, that most compiler don't even bother to optize them out!
cosimone has joined #lisp
<pjb>
So you'll get code that is slower, for no more clarity in the source code, and maintainer left to wonder why there's some negative logic or useless calls, when while line was perfectly clear and defined in the first place.
<pjb>
On the other hand, I would perfectly understand that you defined a language where while <boolean> would exclude while <line> with <line> being of type (or null string) (which is not boolean (member nil t).
<pjb>
But notice also that CL specifies predicates to reutrn generalized boolean, so you would have to change this specification or use while (not (not (= x 420))) etc…
random-nickname has joined #lisp
<pjb>
It's just that it's not the case of lisp.
<jasom>
pjb: "generalized boolean" is meaningless to a machine, since all values are generalized booleans. It's meaningful to a programmer though in that "the only useful information here is (eq X nil)"
<pjb>
jasom: it is not meaningless. It means that operator taking generalized boolean must already check specifically for NIL. (presumaly using null).
<pjb>
It's silly to write (not (null (not (null x)))) so don't write (not (null x)) when the operator already has to use (not (null .)) around your value, by specification.
random-nick has quit [Ping timeout: 258 seconds]
<jasom>
pjb: If you follow the style suggested in LUV then "while X" implies that the only interesting thing about X is whether it is nil or not. but "until (null x)" implies that there are other interesting things about X.
<jasom>
It's about communicating extra information to the reader by convention, not about anything else; similar to (but less universal than) earmuffs.
t58 has joined #lisp
<phoe>
pjb: the machine doesn't care, the programmer might though.
notzmv has quit [Ping timeout: 268 seconds]
notzmv has joined #lisp
Jesin has quit [Quit: Leaving]
hhdave_ has quit [Ping timeout: 248 seconds]
cosimone has quit [Quit: WeeChat 2.3]
notzmv has quit [Ping timeout: 246 seconds]
keep_learning_M has quit [Quit: This computer has gone to sleep]
Jesin has joined #lisp
cosimone has joined #lisp
<beach>
another-user: Glad you like it.
aindilis has quit [Ping timeout: 244 seconds]
Kundry_Wag has quit [Remote host closed the connection]
_leb has joined #lisp
dkmueller has joined #lisp
aindilis has joined #lisp
<_death>
jasom: to me that would be more about while/until than about X.. personally I use "while line" because that's the normal case.. I would use until when some work must be done until some condition is satisfied, and that it's satisfied is what should be emphasized
nowhere_man has joined #lisp
drewc has quit [Read error: Connection reset by peer]
oni-on-ion has joined #lisp
random-nickname is now known as random-nick
fivo has quit [Quit: WeeChat 1.9.1]
dkmueller has quit [Quit: WeeChat 1.6]
Necktwi has quit [Ping timeout: 246 seconds]
Necktwi has joined #lisp
linli has quit [Remote host closed the connection]
MichaelRaskin has joined #lisp
another-user has quit [Quit: WeeChat 2.4]
FreeBirdLjj has quit [Remote host closed the connection]
scymtym has quit [Ping timeout: 248 seconds]
random-nick has quit [Read error: Connection reset by peer]
igemnace has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
random-nick has joined #lisp
sauvin has quit [Read error: Connection reset by peer]
CrazyEddy has quit [Ping timeout: 246 seconds]
<jasom>
_death: that's a style difference, I almost always use whichever allows me to eliminate a negation, but I see the advantages of your way as well.
cosimone has quit [Quit: WeeChat 2.3]
CrazyEddy has joined #lisp
khisanth_ has quit [Ping timeout: 244 seconds]
kajo3 has joined #lisp
kajo has quit [Ping timeout: 248 seconds]
maxxcan has joined #lisp
cyberoctopi has joined #lisp
khisanth_ has joined #lisp
Bike has quit []
donotturnoff has quit [Remote host closed the connection]
donotturnoff has joined #lisp
v88m has joined #lisp
maxxcan has quit [Quit: maxxcan]
donotturnoff has quit [Remote host closed the connection]
pankajgodbole has quit [Ping timeout: 248 seconds]
cosimone has joined #lisp
cyberoctopi has quit [Remote host closed the connection]
igemnace has quit [Ping timeout: 248 seconds]
Kundry_Wag has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
dkmueller has joined #lisp
Kundry_Wag has quit [Read error: Connection reset by peer]
Bike has joined #lisp
zigpaw has quit [Remote host closed the connection]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
_leb has quit []
Jesin has quit [Quit: Leaving]
Jesin has joined #lisp
<pfdietz_>
I use (not (not x)) to normalize "true" values to T. It's used all over the place in ansi-tests.
moei has joined #lisp
vlatkoB has quit [Remote host closed the connection]
shka_ has quit [Ping timeout: 258 seconds]
kajo3 has quit [Ping timeout: 244 seconds]
<sjl_>
(if x t nil) is one fewer character :)
LiamH has quit [Quit: Leaving.]
<sjl_>
can save 4 more if you use a 1-armed if like an uncultured swine
<sjl_>
(if x t)
vaporatorius has joined #lisp
kajo3 has joined #lisp
<aeth>
that's evil
ted_wroclaw_ has joined #lisp
<aeth>
I tend to go with a one-line (if x t nil)
<aeth>
The correct solution, though, is always the one that's done through the type system. (handler-case (progn (check-type x null) x) (type-error () t))
ted_wroclaw has joined #lisp
ted_wroclaw_ has quit [Client Quit]
<edgar-rft>
even more obsure but often seen in old code is (and x t)
<grewal>
Apparently you can't coerce to boolean
<edgar-rft>
grewal: you don't need to because everything that's not NIL is true
<grewal>
I was trying to find a sillier way than aeth's example to get normalized truth values
lumm has quit [Quit: lumm]
ggole has quit [Quit: Leaving]
Bike has quit [Quit: Lost terminal]
scymtym has joined #lisp
ebrasca has quit [Remote host closed the connection]
<aeth>
Well you can have fun with heavyweight libraries to do a simple task, e.g. using specialization-store to type-dispatch: (defstore coerce-to-boolean (object)) (defspecialization coerce-to-boolean ((object (not null))) boolean (declare (ignore object)) t) (defspecialization coerce-to-boolean ((object null)) boolean object)
<aeth>
If you want to do something using just built-ins, I think this similar approach works: (defgeneric coerce-to-boolean (object)) (defmethod coerce-to-boolean ((object null)) object) (defmethod coerce-to-boolean ((object t)) (declare (ignore object)) t)
wilfredh has quit [Quit: Connection closed for inactivity]
<grewal>
(unless x (not x))
<grewal>
Yeah, I guess medium length joke things aren't as funny. It needs to be short or completely over the top
<Inline>
lisps way of saying "truth be told....."
<Inline>
lol
<pjb>
(not x) is one function call and one if. (not (not x)) is 2 function calls and two IFs. (if x t nil) is just one IF.
<pjb>
(not x) may be understood by random people, but they'll have a hard time, if they don't know lisp to infer that it'll return either the symbol T or the symbol NIL. (if x T NIL) on the other hand should be obvious to everybody, even most non-programmers.
<pjb>
(mapcar (lambda (x) (unless x (not x))) '(nil t 42)) #| --> (t nil nil) |#
<aeth>
hmm... with optima it looks like it's just (optima:match x ((not nil) t))
<Inline>
when not x not x
<Inline>
nothing about x
<aeth>
pjb: trying to microoptimize this doesn't make sense because even the simplest optimizing compilers will probably optimize this away. e.g. I think SBCL has all of the simple examples as equivalent
<Inline>
so if x is true, don't touch it
<Inline>
but if it's false invert it, giving true as a result
<pjb>
aeth: I'm not optimizing the compiler, or compiled code, but the understanding by human readers.