jackdaniel changed the topic of #commonlisp to: Common Lisp, the #1=(programmable . #1#) programming language | Wiki: <https://www.cliki.net> | IRC Logs: <https://irclog.tymoon.eu/libera/%23commonlisp> | Cookbook: <https://lispcookbook.github.io/cl-cookbook> | Pastebin: <https://plaster.tymoon.eu/>
dra has quit [Ping timeout: 240 seconds]
varjag has quit [Ping timeout: 246 seconds]
tyson2 has joined #commonlisp
flip214_ has joined #commonlisp
flip214 has quit [Read error: Connection reset by peer]
rgherdt has quit [Quit: Leaving]
Lycurgus has quit [Quit: leaving]
pfdietz has joined #commonlisp
decweb has quit [Remote host closed the connection]
decweb has joined #commonlisp
<cdegroot> It's a great book about weird macros, though :)
Guest52 has quit [Quit: Ping timeout (120 seconds)]
mm007emko has quit [Remote host closed the connection]
mm007emko has joined #commonlisp
bjorkintosh has joined #commonlisp
bjorkintosh has joined #commonlisp
waleee has quit [Ping timeout: 264 seconds]
emilknievel has joined #commonlisp
Guest52 has joined #commonlisp
chsasank0 has joined #commonlisp
chsasank has quit [Ping timeout: 245 seconds]
chsasank0 is now known as chsasank
ronald_ has joined #commonlisp
ronald has quit [Read error: Connection reset by peer]
b00p has joined #commonlisp
chsasank1 has joined #commonlisp
chsasank has quit [Ping timeout: 264 seconds]
chsasank1 is now known as chsasank
<pfdietz> Macros that write macros.
tyson2 has quit [Remote host closed the connection]
occ has joined #commonlisp
random-nick has quit [Ping timeout: 268 seconds]
bilegeek has quit [Quit: Leaving]
emilknievel has quit [Ping timeout: 245 seconds]
emilknievel has joined #commonlisp
kevingal has quit [Ping timeout: 264 seconds]
akoana has quit [Quit: leaving]
mulk has quit [Ping timeout: 256 seconds]
chsasank4 has joined #commonlisp
mulk has joined #commonlisp
chsasank has quit [Ping timeout: 252 seconds]
chsasank4 is now known as chsasank
vyrsh has joined #commonlisp
<cdegroot> does it have anaphoric macros writing anaphoric macros? Don't remember.
ec has quit [Ping timeout: 260 seconds]
ec has joined #commonlisp
decweb has quit [Ping timeout: 255 seconds]
b00p has quit [Quit: b00p]
b00p has joined #commonlisp
skeemer has quit [Ping timeout: 256 seconds]
josrr has quit [Remote host closed the connection]
b00p has quit [Client Quit]
b00p has joined #commonlisp
piglet has joined #commonlisp
vyrsh has quit [Ping timeout: 255 seconds]
b00p has quit [Client Quit]
piglet has quit [Quit: Konversation terminated!]
igemnace has joined #commonlisp
hineios23 has joined #commonlisp
hineios2 has quit [Ping timeout: 268 seconds]
hineios23 is now known as hineios2
piglet has joined #commonlisp
<synchromesh> If "On Lisp" doesn't then "Let Over Lambda" probably does... :)
mason has joined #commonlisp
<beach> Anaphoric macros encourage the programmer to violate the rules stated on page 13 of the LUV slides by Norvig and Pitman.
Pixel_Outlaw has joined #commonlisp
igemnace has quit [Quit: WeeChat 4.2.1]
decweb has joined #commonlisp
Pixel_Outlaw has quit [Remote host closed the connection]
ronald_ has quit [Ping timeout: 264 seconds]
ronald has joined #commonlisp
holycow has quit [Quit: Lost terminal]
decweb has quit [Ping timeout: 260 seconds]
ronald_ has joined #commonlisp
ronald has quit [Read error: Connection reset by peer]
piglet has quit [Ping timeout: 268 seconds]
rtypo has quit [Ping timeout: 255 seconds]
igemnace has joined #commonlisp
istewart has quit [Quit: Konversation terminated!]
piglet has joined #commonlisp
danza has joined #commonlisp
shka has joined #commonlisp
Guest52 has quit [Ping timeout: 250 seconds]
Guest52 has joined #commonlisp
pve has joined #commonlisp
mm007emko has quit [Ping timeout: 264 seconds]
mm007emko has joined #commonlisp
wacki has joined #commonlisp
awlygj has joined #commonlisp
ronald has joined #commonlisp
ronald_ has quit [Ping timeout: 255 seconds]
vitez has quit [Remote host closed the connection]
<splittist> monkeyd108: PAIP teaches Common Lisp in the context of (classic) AI approaches. It doesn't assume you know it.
piglet has quit [Ping timeout: 268 seconds]
ronald_ has joined #commonlisp
ronald has quit [Read error: Connection reset by peer]
varjag has joined #commonlisp
King_julian has joined #commonlisp
nij- has joined #commonlisp
vitez has joined #commonlisp
rgherdt has joined #commonlisp
occ has quit [Ping timeout: 245 seconds]
danza has quit [Ping timeout: 255 seconds]
prxq has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
nij- has quit [Ping timeout: 246 seconds]
occ has joined #commonlisp
piglet has joined #commonlisp
vitez has quit [Quit: Leaving]
vitez has joined #commonlisp
vitez has quit [Changing host]
vitez has joined #commonlisp
vitez has quit [Quit: Leaving]
vitez has joined #commonlisp
mm007emko has quit [Read error: Connection reset by peer]
mm007emko has joined #commonlisp
danse-nr3 has joined #commonlisp
Lycurgus has joined #commonlisp
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
tibfulv has quit [Read error: Connection reset by peer]
samebchase has quit [Quit: Ping timeout (120 seconds)]
samebchase has joined #commonlisp
tibfulv has joined #commonlisp
pillton has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.2)]
mesaoptimizer has quit [Quit: nyaa~]
Cymew has joined #commonlisp
alcor has joined #commonlisp
lagash has quit [Ping timeout: 260 seconds]
mesaoptimizer has joined #commonlisp
dino_tutter has joined #commonlisp
rendar has joined #commonlisp
piglet has quit [Quit: Konversation terminated!]
markb1 has quit [Ping timeout: 260 seconds]
mgl has joined #commonlisp
markb1 has joined #commonlisp
markb1 has quit [Max SendQ exceeded]
igemnace has quit [Read error: Connection reset by peer]
donleo has joined #commonlisp
alcor has quit [Quit: upgrading erc]
alcor has joined #commonlisp
mesaoptimizer is now known as mesaoptimizer2
markb1 has joined #commonlisp
piglet has joined #commonlisp
igemnace has joined #commonlisp
Guest52 has quit [Ping timeout: 250 seconds]
Guest52 has joined #commonlisp
danse-nr3 has quit [Ping timeout: 264 seconds]
<younder> Hygenic macros can be viewed as a weakness rather than a strength. Both On Lisp and Let over Lambda shows how violation of these rules leads to a stronger abstraction system. But it is very demanding on it's implememntors. Most people would get it wrong. Thus it is probaly a bad pracice to encurage.
danse-nr3 has joined #commonlisp
<younder> Just my two bits.
zetef has joined #commonlisp
<younder> If we were all as smart as Graham, say, maybe it would be a good idea. But if we are not it can read to crappy code with unpredictable behavior.
pfdietz has quit [Quit: Client closed]
<younder> We have, what, 6000 libraries..
zetef has quit [Remote host closed the connection]
mesaoptimizer has joined #commonlisp
<younder> Personally I am more of Steel than a Moon. Argument for it, don't throw a book at it. ;)
mesaoptimizer has quit [Quit: Using Circe, the loveliest of all IRC clients]
piglet has quit [Quit: Konversation terminated!]
danse-nr3 has quit [Read error: Connection reset by peer]
danse-nr3 has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 255 seconds]
Lord_of_Life_ is now known as Lord_of_Life
King_julian has quit [Ping timeout: 252 seconds]
random-nick has joined #commonlisp
lagash has joined #commonlisp
zetef has joined #commonlisp
skeemer has joined #commonlisp
zetef has quit [Remote host closed the connection]
pfdietz has joined #commonlisp
yitzi has joined #commonlisp
piglet has joined #commonlisp
attila_lendvai has joined #commonlisp
a51 has quit [Quit: WeeChat 4.2.1]
tyson2 has joined #commonlisp
decweb has joined #commonlisp
King_julian has joined #commonlisp
ebrasca has joined #commonlisp
dra has joined #commonlisp
vyrsh has joined #commonlisp
reb` has quit [Ping timeout: 252 seconds]
piglet has quit [Ping timeout: 255 seconds]
wacki has quit [Ping timeout: 260 seconds]
Guest52 has quit [Ping timeout: 250 seconds]
wacki has joined #commonlisp
xantoz has joined #commonlisp
kevingal has joined #commonlisp
nij- has joined #commonlisp
fitzsim has quit [Ping timeout: 264 seconds]
fitzsim has joined #commonlisp
danse-nr3 has quit [Ping timeout: 264 seconds]
nij- has quit [Ping timeout: 246 seconds]
nij- has joined #commonlisp
josrr has joined #commonlisp
nij- has quit [Ping timeout: 272 seconds]
ebrasca has quit [Remote host closed the connection]
reb has joined #commonlisp
gko` has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
ronald_ has quit [Ping timeout: 260 seconds]
ronald has joined #commonlisp
giro has quit [Quit: irc]
attila_lendvai has quit [Ping timeout: 255 seconds]
dra has quit [Ping timeout: 264 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
yitzi has quit [Remote host closed the connection]
gko has joined #commonlisp
King_julian has quit [Ping timeout: 260 seconds]
<awlygj> How to reference a place. For example: http://paste.debian.net/1311953
<ixelp> debian Pastezone
gko has quit [Remote host closed the connection]
vyrsh has quit [Quit: Konversation terminated!]
gko has joined #commonlisp
<beach> awlygj: Places are not first-class objects in Common Lisp.
<beach> awlygj: So you can't pass them as arguments to functions, return them from functions, not assign them as values to variables.
<beach> awlygj: You also need to format your code to correspond to conventions.
<beach> awlygj: A closing parenthesis is never preceded by whitespace, including newline.
<beach> awlygj: Top-level comments have three semicolons. Non-top-level comments that are by themselves on a line have two semicolons.
<beach> awlygj: And the bodies of your DEFUN forms have too much indentation.
<beach> awlygj: May I recommend you join #clschool. That channel is dedicated to simple questions like this. This channel is not really meant for simple questions like that, though they are tolerated, especially if it is otherwise quiet.
istewart has joined #commonlisp
rtypo has joined #commonlisp
<awlygj> beach: ok. I joined #clschool. new format paste.debian.net/1311955 :)
X-Scale has quit [Ping timeout: 250 seconds]
dra has joined #commonlisp
vyrsh has joined #commonlisp
puchacz has joined #commonlisp
X-Scale has joined #commonlisp
Lycurgus has quit [Quit: leaving]
X-Scale has quit [Ping timeout: 250 seconds]
gorignak has joined #commonlisp
dra has quit [Ping timeout: 256 seconds]
istewart has quit [Quit: Konversation terminated!]
nerap has joined #commonlisp
Pixel_Outlaw has joined #commonlisp
tyson2 has quit [Read error: Connection reset by peer]
a51 has joined #commonlisp
Cymew has quit [Ping timeout: 260 seconds]
danse-nr3 has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
waleee has joined #commonlisp
flip214_ has quit [Quit: leaving]
yitzi has joined #commonlisp
josrr has quit [Remote host closed the connection]
<nerap> Hi, does someone of you know how to use https with ningle?
ec has quit [Remote host closed the connection]
ec has joined #commonlisp
vyrsh has quit [Ping timeout: 264 seconds]
alcor has quit [Quit: rebooting]
<reb> I've never used ningle so I don't know offhand. To answer this question I would track down the project's ASDF dependencies to see if there's any evidence of https support code, things like encryption libraries, etc.
tyson2 has joined #commonlisp
zetef has joined #commonlisp
vyrsh has joined #commonlisp
occ has quit [Ping timeout: 272 seconds]
danse-nr3 has quit [Read error: Connection reset by peer]
mgl has quit [Ping timeout: 268 seconds]
jon_atack has quit [Ping timeout: 264 seconds]
vyrsh has quit [Ping timeout: 272 seconds]
<nerap> It seems like I need to look inside of Lack.
occ has joined #commonlisp
mgl has joined #commonlisp
X-Scale has joined #commonlisp
waleee has quit [Ping timeout: 268 seconds]
zetef has quit [Remote host closed the connection]
mivanchev has joined #commonlisp
<mivanchev> hey, i've just released my very own first CL lib https://github.com/MIvanchev/cl-pacmd-parser
<ixelp> GitHub - MIvanchev/cl-pacmd-parser: Common Lisp parser for pacmd's various listings
<mivanchev> it's a good first attempt but far from optimal but thanks everyone for the guidance!
vyrsh has joined #commonlisp
<beach> mivanchev: You can use EQL to compare characters. No need to use EQUAL.
<beach> And if both are characters, you can use CHAR/=.
<mivanchev> beach, I think i'll use char= even
<beach> Even better with CHAR/=. Then you don't need the negation.
<beach> It looks like you are using MAPCAR without any list arguments.
<mivanchev> ports is a list
<mivanchev> but i need to rewrite that part
<beach> And that might be because PORTS is not vertically aligned with (LAMBDA ...)
<mivanchev> I am bothered by all the declare ignores
<beach> You need to align the arguments to MAPCAR vertically.
<beach> Otherwise, it is impossible to find the second argument without counting parentheses.
<mivanchev> done, thanks beach!
<beach> Sure.
<mivanchev> too many ignores there but oh well, if it works it works
<ixelp> ELS 2024, Vienna - European Lisp Symposium
tibfulv_ has joined #commonlisp
inline__ has joined #commonlisp
Inline has quit [Killed (lithium.libera.chat (Nickname regained by services))]
inline__ is now known as Inline
arpunk_ has joined #commonlisp
paulapatience_ has joined #commonlisp
morganw_ has joined #commonlisp
brettgilio_ has joined #commonlisp
alethkit_ has joined #commonlisp
jladd- has joined #commonlisp
svm has joined #commonlisp
Schnouki_ has joined #commonlisp
srhm_ has joined #commonlisp
jmbr_ has joined #commonlisp
okflo_ has joined #commonlisp
bheesham_ has joined #commonlisp
mgl has quit [Ping timeout: 255 seconds]
phadthai_ has joined #commonlisp
aeth_ has joined #commonlisp
flip214 has joined #commonlisp
icebarf_ has joined #commonlisp
mmk2410_ has joined #commonlisp
tibfulv has quit [*.net *.split]
jladd has quit [*.net *.split]
icebarf has quit [*.net *.split]
phadthai has quit [*.net *.split]
msv has quit [*.net *.split]
mmk2410 has quit [*.net *.split]
alethkit has quit [*.net *.split]
bheesham has quit [*.net *.split]
srhm has quit [*.net *.split]
jmbr has quit [*.net *.split]
brettgilio has quit [*.net *.split]
paulapatience has quit [*.net *.split]
Schnouki has quit [*.net *.split]
morganw has quit [*.net *.split]
arpunk has quit [*.net *.split]
okflo has quit [*.net *.split]
aeth has quit [*.net *.split]
Schnouki_ is now known as Schnouki
okflo_ is now known as okflo
jmbr_ is now known as jmbr
srhm_ is now known as srhm
bheesham_ is now known as bheesham
morganw_ is now known as morganw
paulapatience_ is now known as paulapatience
alethkit_ is now known as alethkit
brettgilio_ is now known as brettgilio
icebarf_ is now known as icebarf
gorignak has quit [Quit: quit]
mgl has joined #commonlisp
dwhelan1890 has joined #commonlisp
awlygj has quit [Quit: leaving]
dwhelan1890 has quit [Remote host closed the connection]
mm007emko has quit [Ping timeout: 240 seconds]
mm007emko has joined #commonlisp
josrr has joined #commonlisp
dwhelan1890 has joined #commonlisp
dwhelan1890 has quit [Remote host closed the connection]
dwhelan1890 has joined #commonlisp
dwhelan1890 has quit [Client Quit]
dwhelan1890 has joined #commonlisp
dwhelan1890 has quit [Remote host closed the connection]
amb007 has quit [Ping timeout: 272 seconds]
amb007 has joined #commonlisp
mivanchev has quit [Remote host closed the connection]
waleee has joined #commonlisp
mm007emko has quit [Read error: Connection reset by peer]
mm007emko has joined #commonlisp
yitzi has quit [Ping timeout: 256 seconds]
yitzi has joined #commonlisp
kevingal has quit [Ping timeout: 252 seconds]
Inline has quit [Ping timeout: 256 seconds]
mgl has quit [Ping timeout: 252 seconds]
vyrsh has quit [Quit: Konversation terminated!]
igemnace has quit [Quit: WeeChat 4.2.1]
<paulapatience> Nothing wrong with the ignores
ronald has quit [Ping timeout: 264 seconds]
ronald has joined #commonlisp
notzmv has quit [Ping timeout: 255 seconds]
simendsjo has joined #commonlisp
<simendsjo> I'm testing try-finally in parenscript, but the example just renders as a regular function call, and not the try/catch/finally as in the documentation: https://parenscript.common-lisp.dev/reference.html#try. Any idea what's going on?
<ixelp> Parenscript Reference Manual
dra has joined #commonlisp
<josrr> simendsjo: I don't see any problem (parenscript:ps (ps:try t (:catch (err) err) (:finally t)))
cage has joined #commonlisp
<simendsjo> Oh, I used `try` and not `ps:try` :/ Thanks!
nerap has quit [Ping timeout: 246 seconds]
younder has quit [Ping timeout: 260 seconds]
<josrr> It seems the Parenscript documentation assumes your package is using the PARENSCRIPT package.
shangul has quit [Changing host]
shangul has joined #commonlisp
shangul is now known as Farooq
davep has joined #commonlisp
kevingal has joined #commonlisp
mgl has joined #commonlisp
eddof13 has joined #commonlisp
eddof13 has quit [Client Quit]
zxcvz has joined #commonlisp
zxcvz has quit [Client Quit]
mgl has quit [Ping timeout: 255 seconds]
<Kingsy> is it possible to have (round 1 2) output a double? looks like it throwing out an int
eddof13 has joined #commonlisp
<paulapatience> Kingsy: fround
<Kingsy> ah I was just using coerce and just casting to 'double-float
<Kingsy> yeah thts much nicer. thanks
<Kingsy> paulapatience: hmm is it possible to round to x decimal places with fround?
<Kingsy> everything is coming out as a whole number but a double
<paulapatience> Not without multiplying and dividing appropriately
<Kingsy> sorr what do you mean? how would I round 2.225 to 2.23 in common lisp?
<Kingsy> kinda just some basic maths
eddof13 has quit [Quit: eddof13]
eddof13 has joined #commonlisp
<paulapatience> Round 100*2.225 to nearest decimal, then divide by 100
<Kingsy> :o seriously?
<Kingsy> honestly thats a bit mental.. :D never seen a language that doesnt have some functions to help with basic rounding
puchacz has quit [Quit: Client closed]
<paulapatience> ANSI CL will be missing many functions you are used to and have many functions you are not
<Kingsy> https://www.cliki.net/decimals <- looks good
<ixelp> CLiki: Decimals
<paulapatience> I don't see that it provides the function you're looking for
<paulapatience> Unless what you intended was displaying a floating point number
<paulapatience> In which case you can use ~,2F
<paulapatience> In a format string
<reb> ,(/ (fround 2.225 1/100) 100)
<ixelp> => 2.22
simendsjo has quit [Ping timeout: 272 seconds]
<reb> The floating point representation of 2.225 is slightly less than the real number 2.225, so fround rounds the value down.
<paulapatience> Oh, cool
<sjl> It rounds 2.225 down because CL uses banker's rounding.
<ixelp> CLHS: Function FLOOR, FFLOOR, CEILING, FCEILING...
<reb> It may not be quite what Kingsy wants, since fround rounds to even.
<sjl> > if the mathematical quotient is exactly halfway between two integers, (that is, it has the form integer+1/2), then the quotient has been rounded to the even (divisible by two) integer
<reb> Yes, but 2.225 is not halfway between 2.22 and 2.23 ... it's slightly lower.
<Kingsy> I don't really understand what the 1/100 and 100 are doing here.. hahah terrible maths.
<Kingsy> what is 1/100 ??! a fraction orsomething?
<reb> Yes, Common Lisp has a rational number data type.
<paulapatience> It's the same thing I did, but turning the multiplication into a division of the divisor
<Kingsy> yeah I don't understand that maths. :D :D
<paulapatience> 100*2.225 -> 222.5; round 222.5 -> 222; 222/100 -> 2.22
<paulapatience> But again, if your intention is just printing the value appropriately rounded, use format with ~F
<reb> ,(* 100 2.225)
<ixelp> (* 100 2.225) => 222.49998
Inline has joined #commonlisp
<reb> 2.225 does not have an exact representation
mesaoptimizer2 is now known as mesaoptimizer
<Kingsy> no I know. but lets say I didnt know the value. it could be 2.25687, then you cant do this right? because you'll always be left over with more decimals. you'll still need to round it off which will go up or down because of fround
<Kingsy> I don't see how * 100 or / 100 is doing anything helpful
cage has quit [Quit: rcirc on GNU Emacs 29.2]
<reb> Kingsy: I think you need to explain *exactly* what you want. Are your values money?
<Kingsy> reb: no they are temperatures.
<reb> ... and what's the purpose of rounding them?
<Kingsy> so they don't need to be EXACT. but I wanted to kep them accurate to 2 decimal places after computing their average using a mean
<reb> Why not just keep all the digits? Are you displaying a result for a human to read?
<Kingsy> I am feeding them into a graphing lib down the line which seems to be fast with less points. also yes, nicer for a human to read.
<Kingsy> but I suppose its turned into more of a general question as to how to round properly
<Kingsy> format will likely be absolutely fine in my case.
keinbock has joined #commonlisp
<paulapatience> It will work even if there are a million digits after the decimal point.
<paulapatience> Try it out
<Kingsy> ohhh beause of the round after the muliple.
<Kingsy> anway I'll use format.
pve has quit [Quit: leaving]
<Kingsy> oh I cant. the struct I have expects a double.
<sjl> Huh, TIL format's ~F doesn't have to use banker's rounding, it's implementation specific
<sjl> ,(format nil "~,2F" 2.225r0)
<ixelp> ERROR: Unbound variable: 2.225R0
<sjl> Huh, guess the bot doesn't use (recentish) SBCL?
<sjl> ,(format nil "~,2F" 2225/1000)
<ixelp> => "2.22"
<sjl> could legally produce 2.22 or 2.23
<sjl> good to know
Guest52 has joined #commonlisp
eddof13 has quit [Quit: eddof13]
palter has joined #commonlisp
eddof13 has joined #commonlisp
<Mondenkind> i wanna mandated correct rounding and ieee-754 for all float ops
<Kingsy> how in the world isnt there just a set of macros in CL that just does a expt 10 by what you pass in then divide it by 100? usage (dec-round number 2) ?
fitzsim has quit [Read error: Connection reset by peer]
mariari has quit [Ping timeout: 268 seconds]
X-Scale has quit [Quit: Client closed]
<Kingsy> can anyone think of a reason to not do that?!
fitzsim has joined #commonlisp
eddof13 has quit [Quit: eddof13]
Inline has quit [Ping timeout: 246 seconds]
Inline has joined #commonlisp
mariari has joined #commonlisp
tyson2 has quit [Read error: Connection reset by peer]
<Kingsy> yeah that works nicely. still surprised I had to do that. some info one why this macro doesnt lready exist would be cool. seems like a no brainer
b00p has joined #commonlisp
<bjorkintosh> Kingsy, they can't do everything for you, that's why the great language was created in the first place!
shka has quit [Ping timeout: 264 seconds]
thuna` has joined #commonlisp
phadthai_ is now known as phadthai
iNomad has quit [Quit: leaving]
kevingal has quit [Ping timeout: 268 seconds]
kevingal_ has joined #commonlisp
<Kingsy> does anyone know of a json encoding library that allows passing in custom structs? seems that "jonathan" doesnt like it.
<paulapatience> Kingsy: shasht, maybe jzon
wacki has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
kevingal_ has quit [Ping timeout: 264 seconds]
kevingal has joined #commonlisp
<Kingsy> thanks
b00p has quit [Quit: b00p]
<Kingsy> woah. paulapatience more rounding issues, so I have 1.44d0 shasht is printing it as -> 1.4399999999999996 <- what in the world....
aeth_ is now known as aeth
yitzi has quit [Remote host closed the connection]
<paulapatience> 1.44d0 cannot be represented exactly as a float
<gilberth> Yes, but (/= 1.4399999999999996d0 1.44d0)
<gilberth> ,(/= 1.4399999999999996d0 1.44d0)
<ixelp> => T
<gilberth> Not the same, so information is lost.
<gilberth> However, ,(= 1.4399999999999996 1.44)
<ixelp> (= 1.4399999999999996 1.44) => T
<ixelp> The Floating-Point Guide - What Every Programmer Should Know About Floating-Point Arithmetic
<gilberth> But 1.4399999999999996 as a single float would as well print as ,(progn 1.4399999999999996)
<ixelp> (progn 1.4399999999999996) => 1.44
<Kingsy> hm so are all my problems here because I am using doubles instead of floats?
<gilberth> Common Lisp has gotten that one right. So what is this library doing? Intentionally printing floating pointers incorrectly? For speed?
<gilberth> This is JSON, isn't it?
<ixelp> GitHub - yitzchak/shasht: Common Lisp JSON reading and writing for the Kzinti.
<Kingsy> you can reproduce with (shasht:write-json '(1 2.12d0 3))
<gilberth> Usually double precision floating point numbers are assumed with JSON, so I would expect that when you ask for 1.44d0 to be printed you get that printed and not some other number.
<gilberth> This is the culprit: (format nil "~,,,,,,'eE" value)
<Mondenkind> gilberth: sbcl floating point reading is broken
<Mondenkind> i never bothered to track it down. but it doesn't always round properly
<gilberth> Mondenkind: Here that JSON writer is broken.
<gilberth> 1.4399999999999996 when read as double float is not the same bitpattern as 1.44d0
<Mondenkind> just saying to be generally untrusting of the results you see
<gilberth> We talk about the printer. They all use the same don't they? Besides I found no CL that has a working ~E.
<aeth> wow, that's a new one for "there are so many JSON libraries and every JSON library gets something wrong"
rgherdt_ has joined #commonlisp
<aeth> time to cons it to the list, I guess
<gilberth> So I'd suggest something (with-standard-io-syntax (let ((*read-default-float-format* (type-of x))) (prin1 x stream)) Perhaps wrappend in (let ((x (if (floatp x) x (coerce x 'double-float))) ...)
<Kingsy> woah this is kinda over my head :D not being doign common lisp long
<gilberth> That would print your floats just fine. Using E as the exponent marker.
<Kingsy> yeah I don't understand. maybe I just try some other libraries or something
rgherdt has quit [Ping timeout: 268 seconds]
<gilberth> Heh. <https://termbin.com/qiht>
<bike> ouch.
<gilberth> So maybe that JSON writer is correct, but your Lisp is broken. Anyhow, 1.44d0 using the Lisp printer with SBCL prints as 1.44d0 just fine.
<bike> 1.44 in clasp, so now i'm wondering why it's different from ecl. maybe yitzi fixed it
<Kingsy> sorry I am lost. doesnt that example show that SBCL is broken?
<Mondenkind> gilberth: like i said
<Mondenkind> :p
<gilberth> I don't remember the details of ~E though. I would suggest to use that PRIN1 approach of mine. Probably faster, I guess.
<gilberth> Mondenkind: I already mentioned that I found no CL that implements ~E correctly. I however never got around to submit my patch that I have.
<Kingsy> gilberth: sorry, I have no idea, can you show me an example including your fix? I am a bit los here.
<gilberth> Kingsy: Give me a second.
<Kingsy> of course no worries
amb007 has quit [Ping timeout: 272 seconds]
<gilberth> Kingsy: This should do: <https://termbin.com/01ra>
thuna` has quit [Ping timeout: 252 seconds]
<Kingsy> gilberth: um am I supposed to be overrding some function? render-float never gets called by write-json?
<gilberth> Use that is the implementation for that print-json-value method at https://github.com/yitzchak/shasht/blob/master/src/write.lisp#L125
<ixelp> shasht/src/write.lisp at master · yitzchak/shasht · GitHub
<gilberth> Or better yet. alwyas coerce to double. Will be safer even, when we assume that JSON uses double floats.
<Kingsy> gilberth: well, I cant override it, I get -> https://bpa.st/TOLA <- I removed the value because its a huge object.
<ixelp> View paste TOLA
<gilberth> Like (defun render-float (value output-stream) (with-standard-io-syntax (let ((*read-default-float-format* 'double-float)) prin1 (coerce value 'double-float) output-stream)))) ;can't get simpler.
<Kingsy> ok this is way way over my head. I am obviously using this in the wrong place. I'll just use something else. I am otally lost.
<gilberth> Kingy: Is .. really that value, that indeed is no real. Where does this happen and why?
<Kingsy> gilberth: no I just removed it because it was a huge object over hundreds of lines. its actually a struct
donleo has quit [Ping timeout: 255 seconds]
<gilberth> Yes, and why was that passed to something wanting a REAL? You should look at where that happens. I bet it's completely unrelated.
<Kingsy> I likely overrided the wrong function because I don't understand.
<Kingsy> but yep ok
tyson2 has joined #commonlisp
dino_tutter has quit [Ping timeout: 255 seconds]
<Kingsy> LOL. jonathan doesnt work either. different issue -> https://bpa.st/LWKA <- got to say this is frustrating
<ixelp> View paste LWKA
rgherdt_ has quit [Quit: Leaving]
<gilberth> Kingsy: Wrong package? And are you even supposed to have a new method for %TO-JSON? Is that symbol exported? Meant to be messed with? Are you holding it correctly?
<Kingsy> gilberth: I ditched shasht and tried jonathan instead
<Kingsy> gilberth: the code is literally copied and pasted from the documentation -> https://github.com/rudolph-miller/jonathan
<ixelp> GitHub - rudolph-miller/jonathan: JSON encoder and decoder.
<Kingsy> gilberth: ok so back to shasht it is then.. :D in your example. what calls that function? https://termbin.com/01ra <- this one
<Kingsy> if I declare than and run shasht:write-json the issue is the same. so its never called.
<gilberth> You trashed shasht because of a bug with SBCL? Oh, you're back.
<Kingsy> yeah back now. just wanted to try jonathan as I have used that before.
<gilberth> Kingsy: Put it as an implementation fo that method here: <https://github.com/yitzchak/shasht/blob/master/src/write.lisp#L125>
<ixelp> shasht/src/write.lisp at master · yitzchak/shasht · GitHub
<gilberth> For that print-json-value method that you see there.
<Kingsy> gilberth: you mean rather than it beign delcared as (defun render-float (value output-stream) <- it should be (defmethod print-json-value ((value number) output-stream) <- containing the body in your pastebin? nothing else is needed?!
<gilberth> Just take the body of my function and make that the body of that method above. If this continues, I suggest we leave for #clschool Your troubles are of more basic struggle with CL.
<gilberth> Yes.
<gilberth> Or file a bug report with SBCL ;-)
<Kingsy> alright. let me have a go
<Kingsy> gilberth: we can go to clschool, but I am fairly sure I am doing what you are asking -> https://bpa.st/HMFQ
<ixelp> View paste HMFQ
<gilberth> Join me at #clschool this is getting off-topic.
<Kingsy> thankyou. will do