<p0a>
I wasn't able to find this info on teh website. I hjad to use google
<p0a>
the sbcl website
<p0a>
I should probably use the sbcl implementaion right? seems the safest bet
t58 has quit [Quit: Night All]
<p0a>
Bike: sorry for being a total newbie, but following the instructions on SB-GMP doesn't give me a ersult, https://github.com/sfrank/sb-gmp
<p0a>
They say to run (sb-gmp:install-gmp-funs) but sbcl complains sb-gmp is not there
<p0a>
says stable version is included in SBCL in that readme? idk
orivej has quit [Ping timeout: 246 seconds]
<Bike>
(require :sb-gmp) probably
<p0a>
thank you
smasta has joined #lisp
<Bike>
out of curiosity, what do you want bigfloats for
<p0a>
I am computing something. I want to distinguish preise solutions from nonprecise ones
<p0a>
for my purposes e-15 may be imprecise. I want to see e-50
smasta has quit [Ping timeout: 246 seconds]
<p0a>
I Get errors with (require :sb-gmp) and (require :sb-mpfr) when I use the example; for example (sb-mpfr:set-precision 400) errors on SB-GMP::WORD not defined
<p0a>
actually, "Unknown type specifier: SB-GMP::WORD"
<Bike>
how recent is your sbcl?
<p0a>
1.5.1
<Bike>
i ask because there's a "Fix sb-gmp" commit here dating to 19 days ago
<p0a>
oh LOL
Kundry_Wag has joined #lisp
<p0a>
always got to run into those things :)
<Bike>
aaaand the fix commit just makes sure word is defined
<p0a>
lol
<p0a>
okay thanks Bike, any advice on how to use the commit? I am a bit of a noob
<p0a>
I don't even know where to look fkor it
<Bike>
how did you get sbcl?
<p0a>
Binary from sbcl .org
<p0a>
I opted for the noobest of options som days ago
<Bike>
check the "Getting Started" page on the site for instructions on building sbcl from source
<p0a>
will this give me the latest fixed version?
<Bike>
it will get you the latest commit
<Bike>
which might be broken for other reasons, but it'll probably be fine
<p0a>
yeah. alright :D
<p0a>
I tjhink I should exit emacs
<p0a>
to have it run faster
ismay has quit [Ping timeout: 252 seconds]
<p0a>
sorry but the compilation who knows... it'll take some time.
<p0a>
thank sfor hte help
p0a has quit [Quit: bye]
<Bike>
it's like, ten minutes but okay
dddddd has quit [Remote host closed the connection]
bexx has quit [Remote host closed the connection]
catchme has quit [Quit: Connection closed for inactivity]
abhixec has quit [Quit: leaving]
jeosol has quit [Ping timeout: 256 seconds]
stacksmith has joined #lisp
stacksmith has quit [Ping timeout: 268 seconds]
Aruseus has quit [Remote host closed the connection]
p0a has joined #lisp
<p0a>
Hello
<p0a>
is defun a progn by default?
CuriousCain has quit [Quit: WeeChat 2.2]
<p0a>
Also, wow: sbcl compiled really fast
karlosz has joined #lisp
<Bike>
the forms in a defun body ar ein an implicit progn, if that's what you mean
<p0a>
Okay, thank you
<p0a>
Also, does #:foo mean the package in question?
<p0a>
BEcause in the sb-mpfr page it says #:div #:exp #:mpfr-float etc
<Bike>
it means a symbol with no package
<Bike>
those are used as string designators in the defpackage form
<p0a>
I think I should learn some stuff for packages at some point soon :P
<Bike>
perhaps
<Bike>
you've seen the books right
<p0a>
they're big
<Bike>
so is the language
<p0a>
yea I like the gigamonkeys book
<p0a>
I've visitted the LOOP chapter a lot :P
jgodbou_ has joined #lisp
<p0a>
hm, I've seem to encountered a small hindrance
<p0a>
so far I've been using #c to record points in the plane but now I realize that sb-mpfr doesn't "support" complex numbers
<p0a>
so I really need to move to a CONS or a vector
libertyprime has joined #lisp
<p0a>
this also forces me to drop the declares
<p0a>
is there a way to choose between two versions of a function? or something like that? with_mpfr and without ?
<Bike>
basically, if sb-mpfr is not oaded, code marked with #+sb-mpfr will not exist
nullniverse has joined #lisp
<p0a>
but that only allows to 'add' code
<p0a>
not to have 2 versions
bexx has joined #lisp
<p0a>
it's not an IF ELSE, just IF, right?
<Bike>
if sb-mpfr is loaded, code marked with #-sb-mpfr will not exist
<p0a>
oh great, thank you. I wasn't sure if #-sb-mpfr is just marking the end of #+sb-mpfr or has the opposite functionality
cyberoctopi has quit [Ping timeout: 246 seconds]
<p0a>
awesome!
cyberoctopi has joined #lisp
<p0a>
well it looks like to save space I need to move these internals in a defclass
<p0a>
so that the defmethods are not affected
<p0a>
Bike: I've written this program in Haskell, then in C++ and finally in Common Lisp
<p0a>
Bike: now, I'm writing it again, in Common Lisp. lol
<p0a>
anyhow, thank you for all the help. Appreciated
<Bike>
no problemo
p0a has quit [Quit: bye]
Bike has quit [Quit: Lost terminal]
anewuser has joined #lisp
oni-on-ion has quit [Quit: Leaving]
abhixec has joined #lisp
deng_cn has joined #lisp
zotan has quit [Ping timeout: 250 seconds]
ltriant has joined #lisp
jgodbou_ has quit [Ping timeout: 256 seconds]
bexx has quit [Remote host closed the connection]
Kundry_Wag has quit [Remote host closed the connection]
Arcaelyx has quit [Read error: Connection reset by peer]
ltriant has quit [Ping timeout: 246 seconds]
Kundry_Wag has joined #lisp
Arcaelyx has joined #lisp
libertyprime has quit [Ping timeout: 246 seconds]
libertyprime has joined #lisp
libertyprime has quit [Read error: Connection reset by peer]
cyberoctopi has quit [Ping timeout: 246 seconds]
libertyprime has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
oni-on-ion has joined #lisp
cyberoctopi has joined #lisp
_whitelogger has joined #lisp
<beach>
Good morning everyone!
gravicappa has joined #lisp
<clintm>
Good morning, beach.
cyberoctopi has quit [Ping timeout: 246 seconds]
cyberoctopi has joined #lisp
rwlisp has quit [Quit: rwlisp]
<LdBeth>
Morning
libertyprime has quit [Ping timeout: 255 seconds]
libertyprime has joined #lisp
cyberoctopi has quit [Ping timeout: 246 seconds]
nullniverse has quit [Ping timeout: 257 seconds]
cyberoctopi has joined #lisp
rippa has joined #lisp
rumbler31 has quit [Ping timeout: 268 seconds]
vlatkoB has joined #lisp
rumbler31 has joined #lisp
ggole has joined #lisp
igemnace has joined #lisp
ltriant has joined #lisp
ltriant has quit [Ping timeout: 268 seconds]
meepdeew has joined #lisp
smasta has joined #lisp
smasta has quit [Ping timeout: 244 seconds]
smasta has joined #lisp
meepdeew has quit [Ping timeout: 255 seconds]
akoana has left #lisp ["Leaving"]
smasta has quit [Ping timeout: 250 seconds]
smasta has joined #lisp
asarch has quit [Quit: Leaving]
smasta has quit [Ping timeout: 268 seconds]
oni-on-ion has quit [Quit: Leaving]
nirved__ has joined #lisp
nirved_ has quit [Ping timeout: 258 seconds]
SaganMan has joined #lisp
dale has quit [Quit: dale]
altgray has joined #lisp
anewuser has quit [Quit: anewuser]
smasta has joined #lisp
meepdeew has joined #lisp
smasta has quit [Ping timeout: 268 seconds]
meepdeew has quit [Ping timeout: 246 seconds]
abhixec has quit [Quit: leaving]
rippa has quit [Ping timeout: 244 seconds]
schjetne has quit [Ping timeout: 244 seconds]
orivej has joined #lisp
robwgla has joined #lisp
igemnace has quit [Quit: WeeChat 2.4]
robwgla has quit [Quit: robwgla]
ltriant has joined #lisp
ltriant has quit [Ping timeout: 246 seconds]
marusich has joined #lisp
defaultxr has quit [Ping timeout: 255 seconds]
random-nick has joined #lisp
karlosz has quit [Quit: karlosz]
karlosz has joined #lisp
mindthelion has quit [Ping timeout: 244 seconds]
techquila has joined #lisp
orivej has quit [Ping timeout: 246 seconds]
lumm has joined #lisp
lumm_ has joined #lisp
Arcaelyx has quit [Ping timeout: 264 seconds]
lumm has quit [Ping timeout: 258 seconds]
lumm_ is now known as lumm
<moldybits>
i want to define a local data structure for only one function. a defstruct would leak through ...
marusich has quit [Remote host closed the connection]
<beach>
"leak through"?
lumm has quit [Quit: lumm]
lumm has joined #lisp
smasta has joined #lisp
igemnace has joined #lisp
smasta has quit [Ping timeout: 268 seconds]
<cl-arthur>
Make a with-local-structure that cleans up by 'undefining' the data structure?
orivej has joined #lisp
refpga has joined #lisp
<moldybits>
(let (list-of-blah) (defstruct blah ...) (defun do-blah-stuff () ...)) i don't want blah to be visible outside of this let form. but it'll stay alive through the run of the program.
<moldybits>
it's just a record and i considered aliasing first, second, and third, maybe. not sure how one does that, either.
<moldybits>
specifically, i'm keeping track of 3 variables associated with a game object. it's some stuff i don't want to store inside the game objects themselves, because it only pertains to this one thing.
troydm has quit [Ping timeout: 250 seconds]
troydm has joined #lisp
<cl-arthur>
you can locally alias first, second and third by using either flet or macrolet. (let (list-of-blah) (defun do-blah-stuff () (flet ((aliased-first (x) (first x)) ... ) ...)) ?
<moldybits>
ah, flet ...
<moldybits>
ah, the problem with that is that then setf won't work out of the box :)
<moldybits>
oh, i can setf the symbol-function. i tried setf'ing the #' but that "didn't work"
<cl-arthur>
You can flet local setf functions too, it seems.
<no-defun-allowed>
no, you can't use #' syntax as a setf place, #' is function, not symbol-function
beach has quit [Disconnected by services]
beach has joined #lisp
<moldybits>
i'll just use a plist ...
fivo has joined #lisp
orivej has quit [Ping timeout: 246 seconds]
lumm has quit [Quit: lumm]
ltriant has joined #lisp
orivej has joined #lisp
shka_ has joined #lisp
ltriant has quit [Ping timeout: 244 seconds]
logicmoo is now known as dmiles
cl-arthur has quit [Remote host closed the connection]
Lord_of_Life has quit [Ping timeout: 246 seconds]
Lord_of_Life has joined #lisp
dddddd has joined #lisp
Inline has quit [Quit: Leaving]
cyberoctopi has quit [Ping timeout: 268 seconds]
orivej has quit [Ping timeout: 246 seconds]
meepdeew has joined #lisp
meepdeew has quit [Ping timeout: 246 seconds]
nowhere_man has joined #lisp
orivej has joined #lisp
Inline has joined #lisp
makomo has joined #lisp
jeosol has joined #lisp
nanoz has joined #lisp
lumm has joined #lisp
igemnace has quit [Quit: WeeChat 2.4]
nowhere_man has quit [Ping timeout: 258 seconds]
lumm has quit [Quit: lumm]
wxie has joined #lisp
lumm has joined #lisp
Nilby has joined #lisp
Inline has quit [Ping timeout: 264 seconds]
cosimone has joined #lisp
Inline has joined #lisp
lumm has quit [Remote host closed the connection]
nowhere_man has joined #lisp
lumm has joined #lisp
lumm has quit [Remote host closed the connection]
ebrasca has joined #lisp
lumm has joined #lisp
nowhere_man has quit [Ping timeout: 258 seconds]
lumm has quit [Remote host closed the connection]
nowhere_man has joined #lisp
miatomi has quit [Ping timeout: 250 seconds]
Inline has quit [Ping timeout: 264 seconds]
nirved_ has joined #lisp
nirved__ has quit [Ping timeout: 258 seconds]
\u is now known as meowray
Bike has joined #lisp
meepdeew has joined #lisp
lumm has joined #lisp
lumm has quit [Remote host closed the connection]
paul0 has quit [Read error: Connection reset by peer]
meepdeew has quit [Ping timeout: 246 seconds]
z3t0 has joined #lisp
nowhere_man has quit [Ping timeout: 258 seconds]
lumm has joined #lisp
t58 has joined #lisp
cosimone has quit [Quit: WeeChat 2.3]
altgray has quit [Quit: leaving]
Inline has joined #lisp
ltriant has joined #lisp
lumm has quit [Ping timeout: 268 seconds]
easye has joined #lisp
TheWild has joined #lisp
<TheWild>
hello
ltriant has quit [Ping timeout: 268 seconds]
<TheWild>
newbie to Lisp. But let's talk not about any specific dialect of Lisp, just the syntax of Lisp in general. Do you have all-in-one reference of all the tokens/characters (not the function names) used in Lisp?
Inline is now known as oleo
vaporatorius has joined #lisp
<TheWild>
because all I got so far is: (evaluate this), '(do not evaluate this) and "string literals"
oleo is now known as Inline
<Bike>
syntax in fact varies between languages.
<Bike>
common lisp, which this channel is about, has more complex syntax than scheme.
<Bike>
you could additionally have numbers, booleans, characters, or vectors. common lisp has all of these but not booleans, because in lisp that's not a separate representation. scheme does have ltieral booleans because they are differently represented.
<Bike>
oh, and comments.
<TheWild>
do all the dialects have greatest common divisor?
<Bike>
Do English and German have a greatest common divisor?
<TheWild>
ummm... okay
<Bike>
what i mean is: No.
<Bike>
oh yeah, and there's also backquote syntax.
Inline is now known as temporal_0
<MichaelRaskin>
Then there are reader conditional and read-eval
nowhere_man has joined #lisp
temporal_0 has quit [Quit: Leaving]
<Bike>
lisp syntax is explained in chapter two of the CLHS. R6RS has a layout of that scheme's syntax in chapter four, including a BNF kind of grammar.
orivej has quit [Ping timeout: 246 seconds]
<TheWild>
thank you for the references
<TheWild>
I choose Lisp because it seems to be the most easily parseable higher-than-assembly programming language if one had to write parser entirely from scratch, but seems that I will likely end up with my own dialect. (ah, there was even revelant xkcd for that: https://xkcd.com/927/)
<MichaelRaskin>
There are simpler dialects already, though
orivej has joined #lisp
Lycurgus has joined #lisp
defaultxr has joined #lisp
_whitelogger has joined #lisp
nowhere_man has quit [Ping timeout: 258 seconds]
cosimone has joined #lisp
Ukari has quit [Remote host closed the connection]
<Nilby>
Sorry, just kidding around. I'm just always saying ":type boolean"
<pjb>
moldybits: don't bother with private stuff. If you want to define a structure that is used only by one function there's no problem in using a global defstruct. At most, you could prefix a % to the name of the structure, to show that it's an internal structure that must not be used without consideration.
<Nilby>
I know (symbolp t) => T
<moldybits>
(type-of 'nil) => NULL ; this surprised me!
<pjb>
moldybits: NULL is a subtype of BOOLEAN which is a subtype of SYMBOL.
<moldybits>
i see ...
<beach>
TheWild: You can't really write a parser for Common Lisp without having a Common Lisp system.
<pjb>
moldybits: there's an infinite number of possible types. They form a latice.
<beach>
TheWild: The parser for Common Lisp is READ and it can be modified in interesting ways. In other words, Common Lisp does not have a fixed syntax.
<moldybits>
pjb: i did end up making it a class so that i could use with-accessors. i mostly just wanted to be clear it's specific to one function, for readability.
<pjb>
moldybits: with-accessors can be used with structures to. with-slots is reserved to clos objects.
<TheWild>
darn, it really reminds me of chicken and egg problem
<Nilby>
#f in scheme does feel much more serious than nil
<pjb>
Nilby: #f is partial. In scheme, you need #f, () and nil (sometimes, nil is just the symbol nil).
<moldybits>
oh, with-slots ... maybe i'll use that instead if it lets me avoid defining accessors ...
<beach>
TheWild: Yes, it is difficult to write a Common Lisp system for that reason. There are ways around it of course.
<beach>
TheWild: What is the purpose of the parser you plan to write?
<moldybits>
TheWild: what's the use-case, anyways?
<TheWild>
but there must be some fundamentals... you're not gonna tell me it builds on top of lambda calculus, right?
<beach>
TheWild: No. In fact the best way to write a Common Lisp system is to write it in Common Lisp and to use an existing Common Lisp to bootstrap the new one.
<Nilby>
pjb: indeed, except when it's tripping me up in CASE
<pjb>
moldybits: otherwise, you can define a macro (with-local-structure (name fields…) …) that would expand into a bunch of functions and accessors in a flet, to implement a local structure (not using defstruct).
<shka_>
beach: that's true for a lot of systems, not just common lisp :P
<beach>
shka_: Most other languages have a fixed syntax, though.
<beach>
TheWild: People who write Common Lisp systems in other languages have all kinds of problems with getting the full language up and running.
<TheWild>
my purpose is to have a scripting language that can be easily parsed, which can be later easily interpreted and compiled, and fully sandboxed, and something that doesn't rely on availability of features from a languages builtin library the parser is being written in.
Inline has joined #lisp
<TheWild>
Lua for example doesn't support JSON out of the box
<shka_>
TheWild: you want to embed your language in other program, like video game?
<beach>
TheWild: I strongly recommend writing the entire system in Common Lisp, rather than mixing some static language and some scripting language.
<TheWild>
yup, that would be one purpose among others
<beach>
TheWild: The combination if difficult to debug, and also frequently slow.
<shka_>
TheWild: there is ECL already
<shka_>
you can stick this into C/C++ project and it generally just works
<shka_>
ideally it is better to write everything in lisp as beach said, but this may be not practical
SaganMan has quit [Quit: WeeChat 1.6]
<shka_>
for instance you would have to write order of magnitude more code for rendering, physics, animation and other game engine stuff
libertyprime has quit [Ping timeout: 246 seconds]
orivej has joined #lisp
<TheWild>
Although I didn't come here to reimplement Common Lisp, the sentence "it is difficult to write a Common Lisp system" really bug me. What are the most basic atoms of Common Lisp? Not the core library, just what's built in to the language at the very beginning?
Bike has quit [Quit: Lost terminal]
<pjb>
TheWild: that's the CL package. 768 symbols.
<beach>
TheWild: There is no unique answer to that question.
<TheWild>
(let x (* 5 10)) - the 'let' seems to be the one of most basic, but could it be a macro?
orivej has quit [Ping timeout: 246 seconds]
<beach>
TheWild: LET is defined to be a special operator.
<beach>
But implementations are allowed to make it a macro.
<beach>
TheWild: And your LET syntax is wrong according to Common Lisp system.
<beach>
TheWild: Different sets of core features are possible. But like I said, the language is very intertwined. Core features sometimes use what would typically be in a library.
<pjb>
TheWild: for example, (let ((x 1) (y 2)) (+ x y)) is equivalent to ((lambda (x y) (+ x y)) 1 2)
<pjb>
TheWild: (well, there's a small case where they would differ strictly speaking, but in general that's the case).
<TheWild>
ah, I'm fighting clisp interpreter right now and forgot first that 'let' accepts a list of variable-value pairs and second that the scope of variables is limited to the list they have been defined in.
Nilby has quit [Remote host closed the connection]
<beach>
TheWild: As shka_ said, if you want to use Common Lisp as a scripting language, probably ECL is a better choice.
Nilby has joined #lisp
<TheWild>
thanks pjb. Things got interesting. Maybe Common Lisp will be as awesome as lambda calculus when I got into it.
<TheWild>
and thank you too, beach
<beach>
Anytime.
<TheWild>
now I became curious if a single operator can be defined such that it can emulate any other operator
<beach>
Sure, but it would be a horribly complex one, so not worth it.
<Nilby>
You can just write everything with only parentheses.
<pjb>
TheWild: turing completeness is achieved by a single instruction in a von neuman architecture: CMOVE.
nanoz has quit [Read error: Connection reset by peer]
meepdeew has joined #lisp
<beach>
TheWild: In case you intend to learn Common Lisp, for beginners, there is the channel #clschool.
<pjb>
And if you want to use ecl in one of your C/C++ applications, there's #ecl
lumm has joined #lisp
<TheWild>
I was recently playing with lambda calculus, SK combinator calculus and finally iota language and... yeah, Turing completness has been achieved, but the Church numerals are not so fun and any simple operation build entirely out of SK (or worse, iota) gets ridiculously long!
meepdeew has quit [Ping timeout: 255 seconds]
<pjb>
TheWild: you can implements integers modulo 2^p easily in lambda calculus too.
<TheWild>
yup, one single full-adder can do
orivej has joined #lisp
<Nilby>
The nice thing about the base lambda calculi is that they preserve locality and mutability, unlike von neuman which pretends you can push things around with no cost.
<TheWild>
you meant immutability
<Nilby>
perhaps, but imutability/mutability is less meaningful in a universe created out of only recursive subdivision
lumm_ has joined #lisp
lumm has quit [Ping timeout: 268 seconds]
lumm__ has joined #lisp
lumm__ is now known as lumm
lumm_ has quit [Ping timeout: 246 seconds]
orivej has quit [Ping timeout: 246 seconds]
ltriant has joined #lisp
ltriant has quit [Ping timeout: 246 seconds]
cosimone has quit [Ping timeout: 258 seconds]
cosimone has joined #lisp
cosimone has quit [Client Quit]
TheWild has quit [Ping timeout: 245 seconds]
Nilby has quit [Remote host closed the connection]
refpga has quit [Remote host closed the connection]
cosimone has joined #lisp
Nilby has joined #lisp
X-Scale` has joined #lisp
X-Scale has quit [Ping timeout: 245 seconds]
X-Scale` is now known as X-Scale
lumm has quit [Ping timeout: 255 seconds]
anewuser has joined #lisp
makomo has quit [Quit: WeeChat 2.2]
q3d has joined #lisp
lumm has joined #lisp
jeosol has quit [Ping timeout: 256 seconds]
lumm has quit [Ping timeout: 246 seconds]
Arcaelyx has joined #lisp
TheWild has joined #lisp
wxie has quit [Ping timeout: 250 seconds]
Aruseus has joined #lisp
shifty has quit [Ping timeout: 250 seconds]
lumm has joined #lisp
lucasb has joined #lisp
random-nick has quit [Ping timeout: 244 seconds]
longshi has joined #lisp
lumm has quit [Quit: lumm]
lumm has joined #lisp
orivej has joined #lisp
abhixec has joined #lisp
Kundry_Wag has joined #lisp
p0a has joined #lisp
<p0a>
Hello
<p0a>
I am looking to make a version of my code that uses SB-MPFR (big float sbcl extension) instead of (complex double-float).
<p0a>
But I'd like to keep the old version too, because it's slightly faster. Ideally there should be an on/off switch. How should I do this?
<p0a>
for example I wrote a class `point', because so far I was using #c() for points. Then I was going to write a macro? or function? to `make-point' with #+sb-mpfr and #-sb-mpfr in it. Is that a good idea?
refpga has joined #lisp
<mfiano>
Hello all. Does anyone know of a library that figures out the type of file format a particular file is, by reading the magic number etc? Sort of like the file(1) utility. I'm currently using trivial-mimes, but that is only concerned with the file extension, so gets things wrong in the case of container formats, etc.
Lycurgus has quit [Quit: Exeunt]
<p0a>
I thought file uses a C library
<p0a>
libmagic
<mfiano>
It does. That doesn't mean it can't be written for CL
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
ltriant has joined #lisp
orivej has quit [Ping timeout: 244 seconds]
Kundry_Wag has quit [Ping timeout: 246 seconds]
ltriant has quit [Ping timeout: 268 seconds]
<beach>
p0a: CFFI wont work with CLOSOS, so I applaud the desire to have a pure Common Lisp library.
lumm has quit [Quit: lumm]
<MichaelRaskin>
Well, it is highly likely that keeping up with TLS will force CLOSOS to have POSIX C FFI (isolated, I guess) support
<p0a>
beach: sure, that's what it sounded to me like
<p0a>
the annoying thing wiht replacing #c() with a point class is that now I need to rewrite all the methods for +, - etc :P
<p0a>
wait, even more annoying: the *coordinate* methods also need to be wrapped around #+sb-mpfr and #-sb-mpfr
<p0a>
because adding two first coordinates of two points p,q is different if they're simple-float or mpfr-float
<p0a>
:/
<pjb>
MichaelRaskin: or just implement it in CL. We already have ironclad.
varjag has joined #lisp
<_death>
we also have cl-tls
<p0a>
If I write a macro, does it "run" before #+ and #- checks?
<pjb>
nope.
<pjb>
reader macros are expanded at read-time, before macros.
<pjb>
Macros are expanded at macro-expansion time, which occurs either at compilation-time, or at run-time (when interpreted).
<p0a>
too bad
nirved has joined #lisp
<beach>
p0a: Precede the macro call with #.
<p0a>
I realized I can have an flet that has the #+ and #- to `name' my add/sub/mul/div operations
<p0a>
to be correspondingly mpfr-add for mpfr-float or just + if I'm working with simple-float
<pjb>
Yes, you can always embed a compilation-time or a run-time into read-time (and vice versa, you canuse read-from-string or read at run-time or at compilation or macroexpansion time).
<p0a>
but this flet will have to be repeated in many defun
<MichaelRaskin>
pjb: ironclad doesn't even claim constant-time operation support
<p0a>
beach: oh, nice!
<pjb>
MichaelRaskin: who cares? when you run on intel processors…
<_death>
MichaelRaskin: you can consider everything work in progress.. but then openssl et al. are also in that state
nirved_ has quit [Ping timeout: 258 seconds]
<MichaelRaskin>
Non-constant-time is network-exploitable
<pjb>
You can add a process: (loop (sleep 0.001) (send-packet (get-next-packet-from-queue))).
<MichaelRaskin>
_death: the problem is that OpenSSL can basically dictate what supporting TLS _means_
<pjb>
There are RFCs…
<_death>
MichaelRaskin: I don't think that's true.. there are many TLS implementations.. mozilla has some, google has some, bsd has some, etc.. I think the RFCs + practical knowledge is needed
<MichaelRaskin>
Implementing enough wrappers to run a sandboxed OpenSSL (maybe auto-translated in the process) sounds more feasible than keeping up with all the updates to all the RFCs.
<_death>
then you have to keep up with OpenSSL
<MichaelRaskin>
Well, basically, if OpenSSL hasn't finished support, nobody will use the feature. For Mozilla and Google the same goes. BSDs? OpenBSD runs OpenSSL…
aeth has quit [Ping timeout: 246 seconds]
<_death>
MichaelRaskin: libressl.. diverged from openssl
<MichaelRaskin>
Not really, they are quite portable, the OS API requirements are changing decimal orders of magnitude slower than TLS versions
<_death>
there's also polarssl, bearssl, etc.
<p0a>
is there a `flag' argument?
<p0a>
I.e. (f :flag) tells f that flag is on
<p0a>
working with two versions becomes really hard
<p0a>
for example, I had initially decided to have (make-point 1.0d0 1.2d0) on the user-side and hide the internals
<p0a>
but in adding the points, I need to make a new point; there's no interface to pass mpfr-floats from the above though
Kundry_Wag has joined #lisp
<p0a>
so I either need to have make-point also accept mpfr-floats ?
<p0a>
k I know. if #+sb-mpfr is defined, then make-point has to be passed mpfr-floats. The coercion is left to the user. :D
<p0a>
sorry I'm just thinking out loudly
Kundry_Wag has quit [Ping timeout: 268 seconds]
<p0a>
beach: do I predate the macro when I call it or when I define it?
<pjb>
You can have several constructors.
<pjb>
And several representations.
aazsdk has joined #lisp
<pjb>
p0a: what do you mean? <p0a> beach: do I predate the macro when I call it or when I define it?
<p0a>
I have this macro here which I intent to use like: "(with-coordinate-funs (add (x P) (x Q)))"
<p0a>
What it does is it adds the x-coordinate of P and the x-coordinate of Q.
<pjb>
Yes.
<p0a>
But since P and Q may have single-float coordinates or mpfr-float coordinates, I want to have `add' be whatever is appropriate based on whether #+SB-MPFR or not
<p0a>
is the above correct?
<p0a>
the pastebin code
<pjb>
No, since you are using readtime #+ P and Q can only be #+sb-mpfr mpfr-float #-sb-mpfr single-float; It cannot be mpfr-float or single-float.
<pjb>
ie. you have to decide at read time what P and Q will be.
<p0a>
ok so you're saying that this doesn't provide two features to the user
<p0a>
unless the user is able to make decisions on read time
<pjb>
(typep p (quote #+sb-mpfr mpfr-float #-sb-mpfr single-float)) not (typep p (or mpfr-float single-float)) (even if technically the former implies the later).
meepdeew has joined #lisp
<p0a>
which is essentially recompiling the library every time, right?
<pjb>
p0a: well, we would have to define different roles depending on the times.
<p0a>
Maybe i should just rewrite my whole code to use SB-MPFR and be done with it
<p0a>
yeah but i suppose I'm all of the above three
<pjb>
So the user cannot make the decision at read-time, because he's too late. Only the compiler can decide what will be read and compiled, by setting the *features*.
<p0a>
right
<p0a>
I see
<pjb>
p0a: that's the problem, the developer often is both, and confuses them. You need to consider the 3 roles and times.
rozenglass has joined #lisp
<p0a>
sure. I see now however that that is ok
<pjb>
p0a: if it was essential to your program, you could also call compile-file and load at run-time, confusing things for the user too!
<p0a>
bootstraps :D
<p0a>
noone is safe from confusion
<pjb>
For example, the user could have a mpfr-float data set, and a single-float data set. So depending on the data set to be processed, you could recompile the sources of the program at run-time.
<pjb>
Some kind of late-optimization phase.
<p0a>
I still don't understand why my macro is wrong though
<pjb>
But you would have to assert whether the compilation time is amortized by the processing time.
<pjb>
It's not wrong.
<p0a>
yeah it's a late-optimization phase thing like you said. That's exactly what I am trying to do
<p0a>
as for your comment: yeah it is I'd say
<pjb>
My point would be that it would be easier for everybody to write generic code.
meepdeew has quit [Ping timeout: 245 seconds]
<p0a>
Well I have code that takes a long time to process
<p0a>
and reports back results; it's all in double-float
<p0a>
now once every blue moon it reports /interesting/ results; then I have to double-check in big-float...
<p0a>
but I'm only double-checking the specific run, not the millions before it
<p0a>
ah, great, thank you
<pjb>
You can even provide #+sb-mpfr (defmethod add ((a mpfr-float) (b real)) (add a (convert-single-float-to-mpfr (float b 0.0f0)))) #+sb-mpfr (defmethod add ((b real) (a mpfr-float)) (add a b))
<pjb>
So the user can add reals to mpfr-floats.
<p0a>
ah nice
aazsdk has quit [Ping timeout: 246 seconds]
<p0a>
well I expect the user to know what is going on if they're using mpfr-float
<p0a>
anyway I don't think anyone other than me will be using this
anamorphic has joined #lisp
<p0a>
btw, I wrote my number guesser program D:
<p0a>
Do you want to see it?
<pjb>
there's also the possibility to compile the different versions early and to package them in the same program, so you can still select one or the other depending on the data provided by the user.
<p0a>
Good point
<p0a>
the tradeoff is space but that's ok
<pjb>
For example, you can do: (defpackage #+sb-mpfr "MPFR-MATHS" #-sb-mpfr "SFLOAT-MATHS" …) and compile the same file twice, once with #+sb-mpfr and once without, then load both fasl and use both packages.
<pjb>
You will have to rename-file one fasl…
<p0a>
that's nice
<p0a>
so I can do mpfr-maths:foo and sfloat-maths:foo
<anamorphic>
err what's my best bet for using a c++ library via ffi? Is it hopeless apart from somehow CLASP?
<pjb>
anamorphic: write a C wrapper.
<pjb>
anamorphic: actually, it depends on whether you use templates (and the preprocessor) or not.
<pjb>
you could write C++ code that's easy to inferface in a FFI. Then you only to wrap the API in extern "C" to avoid name mangling it.
jtecca has joined #lisp
<pjb>
But if you use templates, you need to instanciate them, and for that, you need a C++ compiler. Hence the C wrapper (compiled with a C++ compiler).
<pjb>
Otherwise, you will have to use CLASP (but AFAIK, clasp still needs template-free C++ binaries).
<pjb>
anamorphic: there's also the possibility of using ecl, compiled with a C++ compiler, and using C-LINE to embed C++ sources in lisp functions.
<anamorphic>
Hmm I might be in luck then since there's no templates that I can see so far
<p0a>
C++ code without templates? must've been written by sensible people
<p0a>
:P
<pjb>
:-)
<shka_>
writing C wrapper can be perhaps done with generator
<shka_>
like SWIG
jtecca has quit [Remote host closed the connection]
<TMA>
shka_: SWIG can, but the quality of the binding is sometimes unusable
<TMA>
they lack a maintainer for the CFFI part
<shka_>
hm, this can be addressed
<shka_>
and CFFI is pretty stabl e
<TMA>
unlike C++
<shka_>
well, C++ is stable
dale has joined #lisp
<shka_>
but it grows
pankajgodbole has quit [Ping timeout: 246 seconds]
hiroaki has quit [Ping timeout: 255 seconds]
Kundry_Wag has joined #lisp
<pjb>
The C++ style doesn't look stable.
lavaflow has quit [Ping timeout: 245 seconds]
<pjb>
And they're still full of it, with their "smart" pointers…
wigust has joined #lisp
Kundry_Wag has quit [Ping timeout: 250 seconds]
wigust- has quit [Ping timeout: 245 seconds]
meepdeew has joined #lisp
<p0a>
why do I get this error
<p0a>
there is no class named COMMON-LISP-USER::MPFR-FLOAT
klltkr has joined #lisp
<p0a>
I wrote all my code with #+sb-mpfr and defgenerics but only the #-sb-mpfr version works, teh other one gives me the error above
<p0a>
pjb: are you sure (:method ((x mpfr-float)) x) works?
<p0a>
oooh nevermind
<p0a>
I need sb-mpfr:mpfr-float
meepdeew has quit [Ping timeout: 246 seconds]
anamorphic has quit [Ping timeout: 245 seconds]
<pjb>
well assuming it's a class.
<pjb>
It may not work indeed.
<p0a>
Actually sb-mpfr:mpfr-float worked just fine
<p0a>
It's ok I'm not set on the perfect solution
<p0a>
ah the illusive LOOP bug: `summing' no longer works if I have a custom `add'
<p0a>
I need to do it myself :P
jtecca has quit [Remote host closed the connection]
<p0a>
yay! did it!
nanoz has joined #lisp
Kundry_Wag has joined #lisp
<p0a>
how do I unrequire a package?
<p0a>
I have (require 'sb-mpfr) that loads it but I want to remove it to run my compilations again
<White_Flame>
often the easiest way to clean things out is to restart the lisp
<White_Flame>
M-x slime-restart-inferior-lisp
<White_Flame>
when you REQUIRE something, it can load in many packages. Technically you could go through and DELETE-PACKAGE them all, but they also might have also committed side effects elsewhere
<p0a>
got it, thankyou
<White_Flame>
it's always good to be able to build from scratch, preferrably just via ql or a single loader function. restarting lisp tests that
<p0a>
thanks WF
Kundry_Wag has quit [Remote host closed the connection]
Kundry_Wag has joined #lisp
<White_Flame>
you can end up with things like bad dependency ordering between your files if you just accrete your .lisp files while running in the same image
<White_Flame>
without restarting
FreeBirdLjj has joined #lisp
Kundry_Wag has quit [Remote host closed the connection]
<p0a>
interestingly I end up with 0.9999999999's. I was hoping sb-mpfr would fix that
<p0a>
anyway I guess I have to throw an *epsilon* parameter in the mix
<p0a>
that's kind of weird because sb-mpfr says it's going to be correct up to the next-to-last digit
<p0a>
also remove-duplicates doens't work with sb-mpfr
<p0a>
oh of course, it's comparing the object, not the value
ltriant has joined #lisp
random-nick has joined #lisp
ltriant has quit [Ping timeout: 245 seconds]
<p0a>
oh! it _does_ fix it but only if I set precision higher
<p0a>
I have no idea why
<p0a>
here's a crazy bug I have no idea how to explain:
<p0a>
Running my function with normal precision gives a number like 2. Running it with precision set to 60 digits gives the number 34694469519536141888 and running it with precision 400 gives the number 0
<p0a>
the right answer is 0
<p0a>
increasing precision to 4000 again give the wrong answer 2, this time...
<p0a>
I'll figure it out, there must be some weird bug
SenasOzys has joined #lisp
<White_Flame>
Can you use ratios instead of floating point for your particular problem?
<White_Flame>
you could convert input floats to ratios without losing precision
TheWild has quit [Ping timeout: 246 seconds]
meepdeew has joined #lisp
cyberoctopi has joined #lisp
<p0a>
well I of course introduced logic bugs to my previous functions by converting them to mpfr :P
<p0a>
Also sb-mpfr has a weird way of being printed. For example, 4.440892098500626d-16 gets printed as 44408920985006262 ?
<pjb>
I don't get it either: (sb-mpfr:coerce 4.440892098500626d-16 'sb-mpfr:mpfr-float) ==> 44408920985006262 (class-of 44408920985006262) #| --> #<built-in-class fixnum> |#
<pjb>
Try: (class-of 44408920985006262) in your implementation.
<p0a>
built it fixnum
nirved has quit [Ping timeout: 252 seconds]
<pjb>
So you can it be #<STRUCTURE-CLASS SB-MPFR:MPFR-FLOAT>?
<p0a>
Look, what I meant to say is this:
<pjb>
apparently SB-MPFR:MPFR-FLOAT objects print as fixnums! It's crazy.
<p0a>
ok right
<pjb>
I would stay far away from SB-MPFR
<p0a>
you see the crazyness.
<p0a>
It's not just what it prints
<p0a>
it's literally what it does.
<pjb>
It cannot be.
<pjb>
You said (not (eq (class-of (sb-mpfr:coerce 4.440892098500626d-16 'sb-mpfr:mpfr-float)) (class-of 44408920985006262))).
<p0a>
okay you're right
<pjb>
The only way this could be true, would means that I would stay very very far away from sbcl. If that was the case, I'd prefer sbcl to be in a different galaxy at least than me.
wooden__ has quit [Ping timeout: 246 seconds]
<p0a>
lol
<p0a>
let me get to the bottom of exactly what I think is going on before I give up
nanoz has quit [Ping timeout: 245 seconds]
<p0a>
yeah you're right
nanoz has joined #lisp
<p0a>
I was confused but it's just the printing that's wrong
mathrick has quit [Ping timeout: 240 seconds]
<pjb>
Then define or redefine a print-object method on mpfr-float…
nirved has joined #lisp
hiroaki has joined #lisp
<p0a>
pjb: I compiled SBCL from source
<p0a>
pjb: is it possible to just fix mpfr-float print?
<pjb>
yes, check the print-object method for it.
<pjb>
But better ask in #sbcl.
khisanth_ has quit [Ping timeout: 246 seconds]
<p0a>
alright thank you
wooden__ has joined #lisp
meepdeew has quit [Remote host closed the connection]
khisanth_ has joined #lisp
CuriousCain has joined #lisp
<p0a>
yeah #sbcl is a bit weird
<p0a>
but they acknowledged it's a bug. DO you or anyone know if reporting bugs in sbcl requires an ubuntu account or can I just use the mailing-list?
<p0a>
nevermind, it's on sbcl.org. I saw it. they have an e-mail
<flip214>
"they" might be weird, but also quick to anger and to fix bugs ;)
<White_Flame>
[11:59:43] <-- p0a (~user@unaffiliated/p0a) has left #sbcl ("bye")
<White_Flame>
[12:01:37] <stassats> i already have it fixed
<flip214>
strange $TZ, but yeah, that's what I was trying to get across
<flip214>
oh, west coast.
<p0a>
White_Flame: oh shit
<p0a>
I thought they were ignoring me
<flip214>
p0a: no. just busy fixing things.
<flip214>
typing in IRC takes up valuable time...
<p0a>
oh well how am I supposed to know I'm talking to a superhuman on #sbcl
<flip214>
"a" superhuman? apart from a few innocent bystanders they're ALL superhumans over there...
SenasOzys has quit [Ping timeout: 268 seconds]
<p0a>
well I'm the noobest
<flip214>
p0a: git head has the fix.
vlatkoB has quit [Remote host closed the connection]