phoe changed the topic of #lisp to: Common Lisp, the #1=(programmable . #1#) programming language | <http://cliki.net/> <https://irclog.tymoon.eu/freenode/%23lisp> <https://irclog.whitequark.org/lisp> <http://ccl.clozure.com/irc-logs/lisp/> | SBCL 1.4.16, CMUCL 21b, ECL 16.1.3, CCL 1.11.5, ABCL 1.5.0
t58 has quit [Quit: Leaving]
lumm has quit [Remote host closed the connection]
lumm has joined #lisp
lumm has quit [Client Quit]
amerlyq has joined #lisp
rumbler31 has joined #lisp
moldybits has quit [Quit: WeeChat 2.4]
amerlyq has quit [Quit: amerlyq]
vms14 has quit [Quit: WeeChat 2.3]
rumbler31 has quit [Remote host closed the connection]
shifty has joined #lisp
kenu has quit [Quit: Leaving]
Oladon has joined #lisp
Lord_of_Life_ has joined #lisp
mhd2018 has joined #lisp
Lord_of_Life has quit [Ping timeout: 250 seconds]
Lord_of_Life_ is now known as Lord_of_Life
mhd2018 has quit [Quit: Textual IRC Client: www.textualapp.com]
ebrasca has joined #lisp
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
keep_learning_M has quit [Quit: This computer has gone to sleep]
keep_learning_M has joined #lisp
khisanth_ has quit [Ping timeout: 250 seconds]
Ukari has quit [Ping timeout: 245 seconds]
_whitelogger has joined #lisp
khisanth_ has joined #lisp
rumbler31 has joined #lisp
__jrjsmrtn__ has quit [Ping timeout: 264 seconds]
catchme has quit [Quit: Connection closed for inactivity]
rumbler31 has quit [Ping timeout: 268 seconds]
bugrum has joined #lisp
notzmv has quit [Read error: Connection reset by peer]
torbo has joined #lisp
mejja has joined #lisp
svillemot has quit [Quit: ZNC 1.6.5+deb1+deb9u1 - http://znc.in]
svillemot has joined #lisp
zigpaw has quit [Remote host closed the connection]
cantstanya has quit [Remote host closed the connection]
mejja has quit [Quit: mejja]
Essadon has quit [Quit: Qutting]
cantstanya has joined #lisp
rumbler31 has joined #lisp
smokeink has joined #lisp
margaritamike has left #lisp [#lisp]
Josh_2 has joined #lisp
orivej has joined #lisp
<beach> Good morning everyone!
_whitelogger has joined #lisp
pierpal has joined #lisp
<ebrasca> beach: Good morning!
paul0 has joined #lisp
_whitelogger has joined #lisp
adlai has quit [Ping timeout: 246 seconds]
orivej has quit [Ping timeout: 240 seconds]
Oladon has quit [Quit: Leaving.]
adlai has joined #lisp
jason_m has quit [Remote host closed the connection]
Arcaelyx has quit [Quit: Textual IRC Client: www.textualapp.com]
moldybits has joined #lisp
Bike has quit [Quit: Lost terminal]
_whitelogger has joined #lisp
dddddd has quit [Remote host closed the connection]
rumbler31 has quit [Remote host closed the connection]
montezad has quit [Quit: montezad]
_whitelogger has joined #lisp
_whitelogger has joined #lisp
bugrum has quit [Remote host closed the connection]
keep_learning_M has quit [Quit: This computer has gone to sleep]
techquila has quit [Ping timeout: 268 seconds]
techquila has joined #lisp
Harag1 has joined #lisp
<Harag1> morning, quick question on how to structure project for quicklisp.... I have a project that has some base functionality, but then there are "extentions" that I currently load with different .asd file in the same project. Is this accepted practice or would I need to split the extensions into it own project?
<beach> You can include them all. I do that regularly.
<Harag1> so multiple/optional .asd's in a single project is acceptable practice....thank you beach
<beach> Yes.
<beach> Anytime.
froggey has quit [Ping timeout: 245 seconds]
froggey has joined #lisp
<Harag1> i exclusively use sbcl on linux, but now i need to make sure that the project works with at least one other other lisp implementation, any suggestions... I was thinking ccl
rippa has joined #lisp
<jgkamat> does anyone know how to create js objects from a list? 'create' in parenscript seems to only take an arglist, and I can't seem to use cl 'apply' in parenscript
catalinbostan has joined #lisp
<jgkamat> er, js objects from a list in parenscript
catalinbostan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mathrick has quit [Ping timeout: 240 seconds]
catalinbostan has joined #lisp
catalinbostan has quit [Client Quit]
catalinbostan has joined #lisp
catalinbostan has quit [Client Quit]
mathrick has joined #lisp
moldybits` has joined #lisp
moldybits has quit [Ping timeout: 245 seconds]
<pjb> Harag1: yes, make your code conforming!
<pjb> Harag1: when it's not possible, modularize it so that the non-conforming parts are in separate, well delimited modules.
<pjb> Harag1: then use portability libraries to implement those non-conforming modules.
<Harag1> pjb: what do you mean by conforming?
<pjb> Harag1: basically, following the specification.
<Harag1> which specification?
<pjb> conformance, conforming code, conforming implementation, conforming processor, conforming program.
<pjb> This is the most important property of a CL program.
<pjb> Harag1: A conforming program will run the same way on all conforming implementations, producing the same results. If your program depends on implementation specific behavior, or implementation specific features, it won't be conforming.
vlatkoB has joined #lisp
<pjb> Harag1: if you use threads, sockets, file systems (physical pathnames), etc, your program cannot be confoming. So you have to separate modules that are confomring, and non-conforming modules using portability libraries such as bordeaux-threads, usockets, osicat, cl-paths etc.
<Harag1> pjb: http://www.lispworks.com/documentation/lw51/CLHS/Body/01_eb.htm ..... #1 applies 2-5 does not apply
<pjb> Harag1: and of course, conforming code cannot depend on things such as (eq 1 1) (this may be true or NIL depending on the application).
<pjb> everything applies, of course!
<Harag1> pjb: ok paths might be an issue....
<pjb> Code conforming with the requirements of this standard shall adhere to the following:
<pjb> point 2 is for example (lisp-implementation-type) #| --> "Clozure Common Lisp" |#
<pjb> You can use the result to display it, but you cannot use it to influence the processing.
<pjb> (eq 1 1) is also an example of point 2.
<Harag1> pjb: I use equalp mostly and only eq when checking if to references are the same...
<pjb> For example, with some implementations, you don't need to flush the buffers to see the output, but with others you need. The fact is that the conforming code will call finish-output, when you want to see the output.
<Harag1> so there I should be ok
<pjb> Harag1: you could forget EQ and use EQL instead.
<Harag1> ok
<pjb> The only place where EQ is used behind your back is in plists, which means that you cannot use characters or numbers as plist keys.
<pjb> Everywhere else, EQL is used as default test.
<Harag1> pjb: does defclass,defgeneric,defmethod need any special treatement I dont use any advanced mop features
ggole has joined #lisp
<pjb> Not particularly. But you have to be careful that implementations may insert standard-object anywhere in the class precedence lists of most system classes, so eg. fixnum could be a standard-object on which you can dispatch methods, but depending on that is non-conforming, since fixnum is specified as a system class.
<pjb> In any case, when you will try to compile and run you program in a few implementations, you will soon see the conformance problems.
<pjb> You may install and try to run on: sbcl ccl clisp abcl ecl
<aeth> pjb: (eq 1 1) is almost certainly T, what you can't depend on is (eq 32768 32768) ; wow the smallest possible bignum is pretty tiny!
<pjb> If you can run on 3 or more of them, you should be rather conforming.
<pjb> aeth: depends on the implementation.
<aeth> s/smallest possible/smallest possible positive/
<pjb> Harag1: ah, yes, there's also the problem of likmits.
<pjb> Harag1: for example, array-total-size can be 1024. Then you need to program your own big-array data structure if you want to write a conforming program with more than 1024 elements in a array (string, vector, etc).
<pjb> Harag1: of course, #+ccl array-total-size-limit #| --> 72057594037927936 |# so it won't be often needed, but in clisp 32-bit, it's 16M, which is rather low.
<aeth> pjb: right, a *docstring* longer than 1024 is nonconforming
<aeth> I have a few of those
<pjb> :-)
<aeth> I really think CL should have minimums for 32-bit (e.g. 24-bit) and 64-bit (e.g. 58-bit) implementations so you can make assumptions with just one query (which bit size the implementation is)
<Harag1> pjb: so this would be a problem (defmethod persist ((list list) ....
<aeth> Of course, CL is more hardware independent than that so you'd say "at least 32-bit" etc
<pjb> Harag1: yes, but you can make a method on NULL and on CONS.
<aeth> jackdaniel: You're the most approachable implementor
<aeth> jackdaniel: what do you think about having some de facto standard for minimum sizes above the tiny sizes the standard provides?
<beach> pjb: What? LIST is a system class.
<pjb> Yes, I'm wrong.
<pjb> FIXNUM is specified as a type, not a class, so we cannot dispatch on it. Some implementations have a fixnum class.
<pjb> The difference is between types and classes (system classes, builtin classes, standard classes).
<pjb> I was confused
karlosz has joined #lisp
<aeth> pjb: type dispatch libraries exist... too bad they're not integrated into the language.
<Harag1> pjb: I dont use arrays, I use lists, the speed difference on 10 million items (beyond that my project is not the right solution) was minimal
<Harag1> pjb: so (defmethod persist ((object number) is a problem then
FreeBirdLjj has joined #lisp
<pjb> No. Number is a system class so we can dispatch on it.
<aeth> Harag1: arrays of what?
<pjb> (the fact that it may be a standard-class too is actually irrelevant to defmethod dispatching; it has other consequences).
<Harag1> aeth: plists or structs... but it does not really matter you can override the methods that use lists to use arrays if you want to
<aeth> pjb, Harag1: If you must dispatch on type you can use a library like specialization-store... it will probably be even slower than defmethod unless it's inlinable, though
<Harag1> aeth: that is the only reason i use any methods ... to give the chance to tweak/customize
<Harag1> aeth: I dont need to dispatch on type for this project, was just curious for another project... but that is a long way from ready for quicklisp.... if ever
<aeth> Harag1: AoS ("arrays of structs") pattern isn't particularly efficient in CL, SoA ('structs of arrays") pattern can be very efficient, if you can use :element-type (mostly numeric/character types). Obviously, a C programmer named those patterns
<aeth> So it doesn't surprise me arrays weren't that much faster
<ggole> Which is more efficient depends on what you are doing, though
<ggole> AoS gives you all the elements of the struct close together in memory, which is great if you are going to be touching all/most of them
<aeth> ggole: CL doesn't have AoS, though, because it would be semantically difficult to have :element-type on an instance of a standard- or structure-class
<aeth> It's possible that implementations could implement it as a separate data structure, though
<Grue`> don't worry about portability, just wait until someone sets up a SBCL-only quicklisp, that's what I do
<ggole> Mmm. It would be nice to be able to have a 'struct' as an array element type
<ggole> They couldn't really be CL structs because of the semantic difficulties.
<aeth> ggole: they could, as long as the array itself was immutable (not necessarily the structs contained within
<aeth> of course, to usefully work with them, you'd need some sort of scheme to handle that sort of thing... You'd probably want to preallocate it to a fixed size, but make it adjustable, and to delete from the middle, the simplest solution is to copy the last element into the element you're removing
<aeth> the problem with that is that there's no copy-into constructor generated by structures, only copy
<ggole> That would still be a problem, since initialising the array with preexisting structs couldn't copy them into place without losing identity
<ggole> (Identity meaning the behaviour of eq and mutations to the struct.)
<ggole> So the choice array element type would not be transparent.
<ggole> Note that the existing choices of array element types avoid those problems by a combination of immutability of elements and explicit license in the standard about the behaviour of eq on those types.
igemnace has quit [Quit: WeeChat 2.4]
<aeth> ggole: you'd need GC support for it... because you'd want to create the struct with the array, but you'd also want to be able to reference it, and GC it if no reference exists to it directly, or to the array indirectly
<ggole> Yeah. That can be done, but you need the runtime design to support it.
angavrilov has joined #lisp
<Harag1> beach: so when you have multiple .asd files do you put them in the projects main directory or with the module/extension code in their own directories?
<aeth> ggole: The thing that makes it complicated is that (struct-aref foo 42) wouldn't always refer to the same thing if you wanted it to be a useful array concept. It could be invalid, it could be the same thing, or it could be a new thing. and (struct-aref foo 42) is probably isn't too far from 42*sizeof(your_foo_struct) in memory... so you'd need to be aware that the pointer could move all of the time
<beach> Harag1: I put them in separate directories.
<jackdaniel> aeth: I don't think there would be much utility in such agreement. most implementations already have reasonable limits above dictated by a standard, so we could put artificial flag: this is the minimum on the lowest one
<jackdaniel> but nothing guarantees that Newly Implemented Lisp (NIL) doesn't have lower limits
<jackdaniel> and it will be still a conforming common lisp implementation
<jackdaniel> so from practical standpoint you already have such guarantees, from theoretical enforcement of it wouldn't be "de facto" standard but would rather require making a new standard
<jackdaniel> but I take it as a compliment about approachability, thanks ;) that said there are other implementers here who do not shy away from being approached
<jackdaniel> it could be that I'm the most chatty over IRC (as in - small talk)
<pjb> aeth: struct or arrays implies copying the structures into the arrays. Therefore if you want to put the same structure in two places in the arrays, you end with 2 copies. You could use an array of indices into the arrays of the structure of arrays to place the same structure index at two or more places in the array of indices.
<pjb> But clearly, this is a specialized data structure.
kajo has quit [Ping timeout: 264 seconds]
ggole- has joined #lisp
ggole has quit [Ping timeout: 240 seconds]
ggole_ has joined #lisp
<aeth> pjb: this is essentially overriding the GC so it's very specialized, yes
ggole- has quit [Ping timeout: 240 seconds]
ricekrispie has joined #lisp
ricekrispie2 has quit [Ping timeout: 250 seconds]
<aeth> jackdaniel: well, yes, but it would be conforming in the same sense that an implementation without bordeaux-threads or
<aeth> cffi
<MichaelRaskin> I think CFFI uses #+implementation-name, which means that a really fresh implementation won't have CFFI
<MichaelRaskin> (until a PR gets merged)
random-nick has joined #lisp
<jackdaniel> aeth: as I said, from factual point of view all implementations have reasonable defaults, so they are indeed conforming to this imaginary requirement
<jackdaniel> I don't know what more can be done with this regard?
<jackdaniel> as MichaelRaskin said libraries are a different story, they are portability layers
<jackdaniel> s/defaults/limits/
<jackdaniel> I think ABCL settles at a minimum wrt array dimensions, but I don't remember that well enough to be sure
_whitelogger has joined #lisp
torbo has quit [Remote host closed the connection]
<jackdaniel> de facto standard is something like pln extension (in constrast to portability layer)
dddddd has joined #lisp
beach has quit [Ping timeout: 252 seconds]
beach has joined #lisp
Patzy has joined #lisp
mulk has quit [Quit: ZNC - http://znc.in]
mulk has joined #lisp
Zaab1t has joined #lisp
refpga has joined #lisp
hiroaki has quit [Ping timeout: 246 seconds]
<refpga> Hi, do labels allow me to use local variables defined (outside but) within the same (parent) function?
<refpga> so if I use labels to define functions within a let body, can I use the variables I defined using let, inside the labels functions?
<refpga> (Without passing them as arguments)
<pjb> refpga: yes. Both labels and flet are based on CL:FUNCTION, which creates closures.
<refpga> Thanks
hiroaki has joined #lisp
atgreen has quit [Remote host closed the connection]
atgreen has joined #lisp
wigust- has joined #lisp
wigust has quit [Ping timeout: 246 seconds]
orivej has joined #lisp
trocado has joined #lisp
atgreen has quit [Remote host closed the connection]
vms14 has joined #lisp
atgreen has joined #lisp
Ukari has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
FreeBirdLjj has quit [Ping timeout: 268 seconds]
varjag has joined #lisp
refpga has quit [Read error: Connection reset by peer]
lnostdal has quit [Remote host closed the connection]
lumm has joined #lisp
zigpaw has joined #lisp
beaky has quit [Read error: Connection reset by peer]
beaky_ has joined #lisp
beaky_ is now known as beaky
Josh_2 has quit [Read error: Connection reset by peer]
lumm has quit [Quit: lumm]
lumm has joined #lisp
varjag has quit [Ping timeout: 240 seconds]
karlosz has quit [Quit: karlosz]
lumm has quit [Remote host closed the connection]
Bike has joined #lisp
akater has quit [Quit: WeeChat 2.3]
vms14 has quit [Quit: WeeChat 2.3]
smokeink has quit [Remote host closed the connection]
varjag has joined #lisp
_whitelogger has joined #lisp
libertyprime has joined #lisp
nanoz has joined #lisp
igemnace has joined #lisp
atgreen has quit [Ping timeout: 250 seconds]
Essadon has joined #lisp
Essadon has quit [Max SendQ exceeded]
Essadon has joined #lisp
wxie has joined #lisp
trocado has quit [Ping timeout: 245 seconds]
lumm has joined #lisp
ebrasca has quit [Remote host closed the connection]
Zaab1t has quit [Ping timeout: 245 seconds]
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
nanoz has quit [Ping timeout: 252 seconds]
igemnace has quit [Ping timeout: 240 seconds]
Ukari has quit [Remote host closed the connection]
gareppa has joined #lisp
Ukari has joined #lisp
Lord_of_Life_ has joined #lisp
gareppa has quit [Remote host closed the connection]
Lord_of_Life has quit [Ping timeout: 245 seconds]
Lord_of_Life_ is now known as Lord_of_Life
Harag1 has quit [Ping timeout: 264 seconds]
wxie has quit [Ping timeout: 264 seconds]
pierpal has quit [Remote host closed the connection]
lumm has quit [Quit: lumm]
lumm has joined #lisp
pierpal has joined #lisp
lumm has quit [Client Quit]
Zaab1t has joined #lisp
lumm has joined #lisp
pierpal has quit [Remote host closed the connection]
pierpal has joined #lisp
nanoz has joined #lisp
_whitelogger has joined #lisp
Kevslinger has joined #lisp
lumm has quit [Quit: lumm]
t58 has joined #lisp
Volt_ has joined #lisp
rumbler31 has joined #lisp
fedreg_ has joined #lisp
fedreg_ has quit [Remote host closed the connection]
atgreen has joined #lisp
gjvc has joined #lisp
<gjvc> could someone point me at an example for reading very simple (not deeply nested) xml from a stream (file on disk) and dumping the resulting lisp form (total beginner here)
trocado has joined #lisp
<beach> gjvc: I would imagine the technique would be recursive descent, and similar to the code in a different language.
<beach> ... and the nesting depth would not matter.
<beach> gjvc: Or are you a total beginner with programming in any language?
<moldybits`> there are (plenty of) libraries for parsing xml
<p_l> gjvc: I'd recommend using cxml, and maybe for actually doing something with the data, cxml-stp as it gives a nice recursive interface
<p_l> S-expressions aren't, however, 1:1 to XML
<p_l> except maybe with CL's extended reader, using structure literals?
<moldybits`> why cxml, btw? it's easy to find a list of xml libraries, but it's hard to tell them apart.
<p_l> moldybits`: it had pretty complete XML support, and it has cxml-stp as well as other (dom, etc) interfaces, plus a bunch of other code (I think xuriella xpath library works with it)
<p_l> I'm aware of newer libraries, but for me cxml is kinda "tried and trusted" solution I take first when it comes to xml
<moldybits`> i couldn't figure out how to specify the path to the dtd in cxml, so i ended up using plump which supposedly is more "lenient". (note: i'm a complete newbie wrt to xml)
fedreg has joined #lisp
<p_l> hmm, I didn't have to specify dtd with cxml in the past
<p_l> mind you, dtd is incomprehensible to XML parser itself
<moldybits`> it's a private (system?) one, so it didn't know where to find it.
<p_l> (XML Schema isn't, and I find it superior in its limitations on what could be done with schema)
<p_l> moldybits`: unless you specify :validate t it should not complain about dtd
* beach suspects the answers were not to gjvc's satisfaction.
<p_l> ^^;
<p_l> I might actually write an example like the one in original question
<p_l> gjvc: still with us?
fedreg has quit [Quit: Mutter: www.mutterirc.com]
mathlover2 has joined #lisp
akoana has left #lisp [#lisp]
xkapastel has joined #lisp
rumbler31 has quit [Remote host closed the connection]
<p_l> aaand I kinda stumbled on the same issue as moldybits`
<p_l> either I parsed XML differently in the past (lost source :( ) or I forgot how I specified dtd
<p_l> had to download the dtd to home directory, but got this to pretty much output me a serialized form in S-expressions:
rumbler31 has joined #lisp
lnostdal has joined #lisp
Ukari has quit [Ping timeout: 264 seconds]
montezad has joined #lisp
mathlover2 has quit [Quit: Leaving]
fedreg_ has joined #lisp
klltkr has quit [Remote host closed the connection]
fedreg_ has quit [Ping timeout: 250 seconds]
Ukari has joined #lisp
pierpal has quit [Quit: Poof]
pierpal has joined #lisp
fedreg_ has joined #lisp
fedreg_ has quit [Ping timeout: 240 seconds]
pierpal has quit [Ping timeout: 264 seconds]
kajo has joined #lisp
<jgkamat> In case anyone was curious to my question yesterday, you need to have ps:lisp return a valid ps string, so (ps:lisp (push 'list my-list)) works for lists
Gnuxie[m] has joined #lisp
paul0 has quit [Read error: Connection reset by peer]
Oladon has joined #lisp
ym555 has joined #lisp
random-nick has quit [Read error: Connection reset by peer]
izh_ has joined #lisp
ym555 has quit [Ping timeout: 245 seconds]
random-nick has joined #lisp
ym555 has joined #lisp
random-nick has quit [Ping timeout: 250 seconds]
<gjvc> p_l: back (was out walking in the sun :-)
<gjvc> beach: p_l thank you for your responses - reading now
<p_l> my example included loading the DTD for apparently CXML didn't deal well with HTTP URIs in DTD specs
<gjvc> let me get CXML installed.
<gjvc> (i'm using sbcl)
shifty has quit [Ping timeout: 268 seconds]
<p_l> gjvc: if you don't have quicklisp installed, I recommend you get it first :)
<gjvc> yep got that and all working instaling into a project-local .quicklisp/ directory -- it's very neat
<gjvc> i also have sbcl running via a bash wrapper to read the project-local sbcl initialisation file to make it take note of said project-local .quicklisp/ directory
<gjvc> (ql:quickload "cxml" :silent t)
<gjvc> whee!
random-nick has joined #lisp
<gjvc> * ( cxml:parse-file "dat/spec/foo.xml" (cxml-dom:make-dom-builder))
<gjvc> #<RUNE-DOM::DOCUMENT {100422B1F3}>
<p_l> try cxml-stp :)
<gjvc> BTW, this is a one-time operation to transform these XML files into LISP forms
<gjvc> I have no interest in bootstrapping from them every run, given that the data is so simple
<gjvc> but this is a more educational approach that just doing a big search and replace. (although i could write something in python to read the xml and emit lisp hmmm ...:-))
<p_l> gjvc: then I think STP might offer a simple interface to rewrite them into whatever you want (it provides something akin to recursive descent where you plug your functions using STP methods to do things)
<gjvc> do you know of ElementTree in Python ?
<gjvc> it allows one to parse via (simple) x-path expressions
<p_l> STP is a bit similar, but I haven't touched it in a long time
<gjvc> ok
<gjvc> ok, grat
<gjvc> great
<gjvc> * (cxml:parse #p"dat/spec/foo.xml" (stp:make-builder))
<gjvc> this seems to be a good start -- thank you!
<p_l> stp then has functions for you like map-children, do-children, do-recursively et al
jason_m has joined #lisp
<rumbler31> ok, I'm too dumb for this apparently. I want to generate and write a very long string to a file, constructed letter by letter. (dotimes (i large) (write #\E)) writes #\E, I am looking for the character itself to be read without the #\. Various attempts have failed. I suppose I could just use (format... but I'd like to learn what is going on here
klltkr has joined #lisp
<rumbler31> assumption that was false is that I need to print pretty. that doesn't change the output unless I invoked it wrong
<ggole_> write writes readable representations of objects to stdout
<ggole_> eg, if you (write "foo"), you get the "s
<ggole_> So it's simply the wrong function.
<rumbler31> I assume that #\ is necessary for the reader to treat the form as a character and not a sybmol
<rumbler31> I see
<ggole_> You can think of it as printing what you would type in to construct such a value.
<ggole_> (With some exceptions that we can ignore here.)
<rumbler31> I seee
<rumbler31> so format is the correct answer for this then
<ggole_> You might try write-char
Oladon has quit [Quit: Leaving.]
<pmai> FWIW write is very flexible, you can specify what you want using the keyword args or through the normal printer variables
<rumbler31> duh omggggggggg I'm an idiot
<ggole_> Yeah, I should have specified "by default"
<rumbler31> write-char... of course. Also fwiw I was having a hard time understanding how the various flags to write relate to make thi shappen
<pmai> That said, write-char is likely more efficient for what you are after
<p_l> wouldn't write-sequence also be of interest in some cases?
<pmai> look at *print-escape* and the :escape arg
montezad has quit [Ping timeout: 250 seconds]
<pmai> You'll also want *print-readably*/:readably to be nil.
<pmai> :pretty / the pretty-printer are orthogonal to all of this
Aruseus has joined #lisp
nowhereman has quit [Ping timeout: 258 seconds]
hiroaki has quit [Ping timeout: 240 seconds]
zooey has quit [Ping timeout: 256 seconds]
zooey has joined #lisp
knicklux has joined #lisp
ebrasca has joined #lisp
hiroaki has joined #lisp
torbo has joined #lisp
vms14 has joined #lisp
<vms14> it is wrong to use setq if the variable does not exist yet?
<p_l> I'd say avoid setq in general?
<vms14> why p_l ?
<vms14> you mean use let instead?
<vms14> how I make multiple declarations in lisp?
<vms14> global ones
<p_l> Generally, for top-level variables: defvar, defparameter (the latter will always overwrite current value when evaluated), for constants use defconstant
<p_l> mind you, defvar and defparameter will create dynamic variables, not lexical, but lexical top-level is a bit iffy
<vms14> I've tried defparameter with multiple variables
<p_l> it won't create multiple variables in one go
<p_l> but then, the question is what you are actually trying to achieve?
<vms14> (defparameter dis (open-display "") screen (car (display-roots dis)))
<LdBeth> That just won’t work
<vms14> just make multiple global variable declarations
<p_l> just use multiple forms
<vms14> yeah it does not work
<vms14> but setq does
<TMA> if you need to use one form, wrap them in a progn
<p_l> (defparameter name initial-value documentation)
<p_l> vms14: why do you need them in one form? It doesn't change things in the end, except for unexpected breakage from SETQ use
<vms14> so if I add a string will work?
<p_l> no
<p_l> DEFVAR/DEFPARAMETER/DEFCONSTANT explicitly don't do multiple assignment
<vms14> because I wanted to initialize some variables
<LdBeth> If you are tired then use editor’s snippet utility to auto insert them
<p_l> vms14: still, why not use multiple forms?
<vms14> and thought lisp will give me a option to do that in one time
<LdBeth> ie. emacs’ yasnippet
<vms14> p_l I'll do it
<vms14> but, why setq is bad?
<p_l> vms14: it's pretty much a leftover from old code
<pjb> ggole_: (write #\x :escape nil) #| x --> #\x |#
<p_l> vms14: I think even code that predates lexical scoping
catalinbostan has joined #lisp
<vms14> and why the warning in sbcl while using setq to create new variables?
montezad has joined #lisp
<pjb> ggole_: (write foo :array t :base 10 :case :upcase :circle nil :escape nil :gensym t :length nil :level nil :lines nil :miser-width nil :pretty nil :radix nil :readably nil)
<vms14> It works, but gives a warning
<p_l> vms14: because people might have not expected that behaviour
<vms14> so what's wrong
asarch has joined #lisp
<p_l> vms14: it's part of the "hairy behaviour" of SETQ
<pjb> ggole_: of course, you can use ~A or ~S or princ or prin1 which pass the right key arguments to write.
<vms14> it's not a standard feature you mean?
<p_l> vms14: it's a *deprecated* feature, more like it
<p_l> the whole setq and set are
<p_l> or more like, community deprecated
<vms14> but there is no assignment version to do what I can do with setq
<p_l> vms14: because the general consensus was that assignment should not create new variables where there none
<vms14> hmm
<LdBeth> Use snippet
<vms14> tnx p_l
<p_l> vms14: it's a leftover, from my understanding, of introduction of lexical scoping
<pjb> vms14: you can just use let, even in the REPL.
<pjb> vms14: notably when you have a repl that let you edit back, such as slime or rlwrap.
<vms14> yeah, and I should use mostly let
<p_l> pjb: it won't create top-level bindings though
<p_l> vms14: but inside functions et al LET is definitely the answer
<vms14> but for tests I like to have global variables so I can use them
<LdBeth> Using proper test suits
<p_l> vms14: I tend to use DEFPARAMETER for things that I pre-set to some value, and include documentation on them (which it allows) which makes it simpler to understand the code the next day
<vms14> I need o wrap m mind with functional programming and learn lisp yet
<p_l> i.e. it's much easier (IMO) to reason about a bunch of DEFVAR/DEFPARAMETER/DEFCONSTANT, especially when they include documentation, than any single SETQ anywhere in code
<vms14> I'm just learning basic stuff and started loving the format function
<p_l> just remember, common lisp doesn't force you into functional programming :)
<vms14> p_l: I'll try to get used to write docstrings whenever posible
<vms14> I need to learn about programming design and code quality too
<vms14> my code usually sucks
<vms14> p_l: yeah, I like the freedom
<vms14> this is why I like C, but I'm liking Lisp more than any language
<p_l> C is too hairy for me these days :<
<vms14> Is really funny do stuff with lisp
<p_l> I find it at times easier to reason on assembler than C :(
<vms14> I have not much experience with C btw
<vms14> just played around with C sockets, did a shit server and client programs
<p_l> I'm not a C guru, which is I guess why I find it increasingly harder to use :)
<vms14> and xlib <3
<vms14> but that's all
ym555 has quit [Ping timeout: 250 seconds]
<vms14> played a bit with fork and execve, and stuff alike, but meh
<pjb> p_l: C is easy to use: you just re-implement a mini lisp in it and there you go!
<p_l> pjb: if I had to use it, then well, yeah ;P
<p_l> but I think for most cases ECL will cover that
<vms14> C for cffi in lisp is interesting
<pjb> typedef struct object T; T make_string(char* ...); int length(T obj); …
Ukari has quit [Remote host closed the connection]
<vms14> if you understand cffi you have no limit as long you have a C implementation/library
<pjb> p_l: sometimes you cannot include libecl in the project.
<vms14> well idk if you have limits xD
<vms14> but I'd like to understand cffi
<pjb> Perhaps lisp500.c?
selwyn has joined #lisp
<p_l> pjb: well, sometimes situations are bad
<p_l> pjb: but the projects that insist on C either insist on it for the rare good reason (work on kernel code base in C) or can be safely ignored
<vms14> I guess lisp is the language I was looking for
<LdBeth> CFFI does basically what a system ld does.
<p_l> projects that insist on language in my experience mostly involved corporate wanting java or similar :/
catalinbostan has quit [Quit: Textual IRC Client: www.textualapp.com]
<vms14> LdBeth: but as long as you have a object file, you can use this stuff in lisp, not?
<p_l> if you are the side signing the contract for the application, though, you can usually get any language going
<p_l> vms14: as long as you have a shared library that can be linked to, yes
ym555 has joined #lisp
asarch has quit [Quit: Leaving]
<p_l> vms14: because ultimately CFFI uses implementation's FFI interface
<p_l> vms14: and for good reasons implementations don't implement their own random object file linkers :)
<p_l> (nothing stops you from doing one, though you would probably have to use less nice sides of FFI)
<vms14> nah I just want to at least try it some day and understand it
<vms14> but atm what I aim to do with lisp is a transpiler to C for a toy language
<vms14> or just an interpreter
<vms14> I guess lisp is very good at this kind of job
<vms14> and I think that better your parser is, better your language can be
<vms14> So if lisp is your parser, your language can be nice
<vms14> I'll try starting with html generators
<vms14> xD
<LdBeth> Actually the best parser is prolog
<gjvc> how do i open a file (as a stream?) for input into cxml:parse ?
<gjvc> (defparameter document (cxml:parse (with-open-file (pathname filename))))
<pjb> (with-open-file (stream pathname) (cxml:parse stream))
<LdBeth> GG
<pjb> clhs with-open-file
<gjvc> all, thank you pjb
<vms14> LdBeth: why prolog?
<LdBeth> gjvc: just set (open FILE) to a variable and remember to close it later
<pjb> yeah, but no. You almost never use bare open.
<pjb> Who want to remember things like closing files?
<LdBeth> In case one insists assign it to a variable :D
<vms14> maybe you want to add stuff to that file in several parts of your program
<pjb> with-open-file assigns it to the variable. Like let.
<vms14> then would be better just use open
<gjvc> pjb, is this valid? not sure about the second "stream"
<gjvc> ?
<gjvc> (with-open-file (stream (pathname filename)) (cxml:parse stream))
<LdBeth> vms14: because in prolog u just have to write BNF
<pjb> filename is already a pathname designator, you you don't need to call pathname on it, open will do it.
<vms14> gjvc it will work until it's inside w/open-file body
<gjvc> thank you vms14 -- reading
<pjb> gjvc: well, cxml:parse wants a binary stream. So:
<pjb> (with-open-file (stream filename :element-type '(unsigned-byte 8)) (cxml:parse stream handler))
<gjvc> ok, looks good -- how should i define handler? (defun handler () ) ?
dale has quit [Ping timeout: 250 seconds]
<pjb> gjvc: by reading th cxml documentation and by programming.
<pjb> At least, this is what I would do.
<gjvc> ok :)
<Grue`> gjvc: handler is something like (cxml-dom:make-dom-builder)
random-nick has quit [Ping timeout: 250 seconds]
<_death> if filename is a string, then you likely want to use uiop:parse-native-namestring because otherwise each lisp implementation defines its own namestring format...
<minion> _death, memo from flip214: I've got a couple of (old!) patches up at github.com/phmarek/dbus.git ... Would you please take a
<minion> _death, memo from flip214: look? Thanks!
<vms14> and in terms of efficiency which assignment would be faster?
<pjb> vms14: the one you don't evaluate.
<vms14> for example if it's a copy ?
<pjb> vms14: the example 2 is wrong.
<pjb> you should use unwind-protect.
<vms14> I don't understand you, but nevermind
<vms14> it won't be a bottleneck
<vms14> and if it's a bottleneck it's due to bad code design
Josh_2 has joined #lisp
<pjb> vms14: (macroexpand-1 '(with-open-file (stream filename :element-type '(unsigned-byte 8)) (cxml:parse stream handler))) #| --> (let (#1=#:g37601 #2=#:g37602) (unwind-protect (multiple-value-prog1 (let ((stream (setq #1# (open filename :element-type '(unsigned-byte 8))))) (cxml:parse stream handler)) (setq #2# t)) (when #1# (close #1# :abort (null #2#))))) ; t |#
<pjb> vms14: at home, try: (pprint (macroexpand-1 '(with-open-file (stream filename :element-type '(unsigned-byte 8)) (cxml:parse stream handler))))
<vms14> pjb: I guess you're referring to gjvc
Zaab1t has quit [Quit: bye bye friends]
<vms14> is lisp seen in graphical applications?
<vms14> I like xlib, so I'll play around with clx
<vms14> but it seems not much programs are written in lisp and have a gui
ricekrispie2 has joined #lisp
<vms14> I just see stumpwm
<Josh_2> vms14: there is mclim
<vms14> Josh_2: library/framework?
<Josh_2> Which lets you make guis
<vms14> I remember that name
<LdBeth> AutoCAD
<vms14> it's cross-platform and easy to use
<vms14> if it's what I think
<vms14> xD
<vms14> LdBeth: right, I suppose it's just the fact that lisp is not much popular in general
ricekrispie has quit [Ping timeout: 250 seconds]
<vms14> I guess people usually don't mind in have features like what lisp offer and they look for something more mainstream
<vms14> but when they have like 10 years of programming experience they'll be making complex systems
<vms14> and lisp would be a nice language to have while building complex systems
nanoz has quit [Ping timeout: 246 seconds]
<vms14> the problem is the programmer usually won't likely switch to lisp when he has 10+ years coding in somelanguage
<vms14> how to raise the popularity of lisp?
<_death> write programs
<LdBeth> ^ totally agree
<LdBeth> Write awesome programs
<vms14> this is what I was going to say, programs that shine
<vms14> btw grammarly uses common lisp
<vms14> and sbcl I guess
<LdBeth> Both SBCL and CCL
<vms14> they discovered a bug in sbcl
<LdBeth> It’s funny cause no other language use different implementations for development and deployment
<vms14> (The bug was reported to SBCL maintainers, and there was a fix there as well, but we are still running with this hack, just to be sure :)
<vms14> I think also we should make more documentation and maybe focus on noob friendly users
<pjb> vms14: there's no way to have the features of lisp without having lisp.
<pjb> vms14: the essence of lisp is that you don't have a code syntax. The S-exp are defined to describe data.
<vms14> for example the fact that python is one of the most recommended languages for a newcomer makes grow a lot its number of users
<pjb> vms14: it's like if you wrote C programs using only {"hello",{1,2,3},"foo","bar"}
<pjb> vms14: already, notice that there's no symbol data type in C to represent identifiers in data!
<pjb> vms14: anyways, all the rest of lisp comes from that.
<pjb> xml has a better chance become lisp than C, there…
<vms14> json maybe
<vms14> since it can nest objects and arrays
q3d has joined #lisp
dale has joined #lisp
<pjb> vms14: you still need symbols. Only Ruby has them, but with the awkward syntax of prefixing them with a colon.
<pjb> [:def,:f,[:a],[:if,[:=,1,:a],1,[:*,:a,[:f,[:-,:a,1]]]]]
<vms14> so symbols + lists and you have a lisp?
<LdBeth> Why not :)
<vms14> and `data ,code
<vms14> homoiconity
<vms14> lisp is homo
<vms14> XD
<aeth> vms14: Games probably have a better chance at being graphical applications using Lisp than traditional graphics applications because games don't have the expectation of native look and feel.
<vms14> aeth: what about using lisp for writing games?
<vms14> I came to programming just because I wanted to make a game
<vms14> but ended doing nothing and still being a noob programmer xD
<Josh_2> cl veery good 4 games
<_death> pjb: shouldn't that be [:def, [:f, [[:a, nil], ...]]] ;)
<aeth> #lispgames is pretty active, and you have e.g. https://www.youtube.com/playlist?list=PL2VAYZE_4wRITJBv6saaKouj4sWSG1FcS
<pjb> homoiconity is only a consequence of using the data syntax to represent code.
<pjb> The essential feature is not homoiconity, it's to use the data syntax to represent code.
<vms14> tnx aeth for the link and channel <3
<vms14> pjb: but this is in fact homoiconity, not?
<pjb> vms14: http://cliki.net/IRC cf. #lispgames
<pjb> vms14: yes.
<pjb> vms14: start with simple games.
<vms14> I wanted to do stuff with clx, but cried because there is no xpm
<vms14> and xpm is what I used for xlib in C
<vms14> but I can do stuff with squares
<vms14> or use image libraries
<vms14> xD
<vms14> new-clx has xpm but it's only for clisp?
<vms14> yeah, since I'm a noob I should start with text games
<pjb> vms14: new-clx yes, but clx is portable.
<vms14> and the land of lisp book has some text games to do while learning lisp
<vms14> but draw points is even more funny than draw text
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<pjb> vms14: have a look at: https://cliki.net/Graphics%20library https://cliki.net/GUI I would advise https://cliki.net/pgl to write simple graphical games easily.
<Josh_2> suggesting ur own libraries *hmmm* xD
<vms14> yeah, I had a look on what graphics libraries has cl, but ignored them because I know a bit of xlib, so I'd like to go for clx
<vms14> anyway atm since I'm a noob I should only be drawing squares or points
dale has quit [Quit: dale]
<vms14> the condition system of cl seems very interesting
dale has joined #lisp
<vms14> I want to take a look at it, but I need to do basic stuff first
<vms14> and I see the format function is a very big function
<vms14> it has a lot of things
<vms14> features*
<Josh_2> A big complain of X is its such a PITA to work with
<pjb> Josh_2: if I don't do it, who will?
<Josh_2> xD
<vms14> yeah, because you need to understand how X works
<vms14> and all their terminology
<vms14> what a gc is, what diference between display and screen, how events are, etc
<vms14> but is nice to see this stuff, or at least to know that X was intended to be used mostly remotely
themsay has joined #lisp
<pjb> vms14: you don't need to know all of the condition system to use conditions. (handler-case (foo (error "an error occured")) (error (err) (print err))) is the basics of conditions.
<Josh_2> yeh its all very annoying when you can just make a game using opengl where there are more tutorials than there are opengl programmers
<vms14> this is why it works with sockets and has a server/client design
<vms14> opengl is not easy
<_death> if you want to write xlib code, instead of writing a game you can have lisp play a game.. http://vito.sdf.org/dino.html
<pjb> vms14: you don't need to know all of the format function to use format. (format stream "foo ~A bar ~S baz~%" a b) is the basics of format.
knicklux has quit [Read error: Connection reset by peer]
<vms14> pjb: yeah I know, but it has a very nice things it makes you happy to know
<Josh_2> pjb: thats basically my entire programming experience xD
<Josh_2> not understanding but things work somehow oof
<vms14> like appending to fill pointers, or iterating throught format arguments with things like ~:*
<pjb> Of course, don't stay at the basics, iterate and learn more depths.
<Josh_2> I use ~A~% that's about the extend of my format usage
<Josh_2> Not a fan of format magic cos its harder for people to read I suppose
<vms14> yeah I was working on a program using almost entirely format
<Josh_2> yeh saw that
<vms14> and it made me appreciate format
<vms14> but i'm stuck with the json function xD
<vms14> I don't know how to implement things yet, not meaning lisp, for programming in general
<makomo> _death: that's pretty cool!
<Josh_2> vms14: you just gotta find something you enjoy and just make stuff around that topic which I assume you are already doing
random-nick has joined #lisp
<vms14> if I start with clx I will
<vms14> btw I have a bit of fear about lisp speed
<Josh_2> vms14: can you figure out how to send a button press event for me while you are at it xD
<vms14> I've read that it's easy for a noob make lisp programs that are slow
<Josh_2> vms14: SBCL is very fast if you make declarations and use good datastructures etc, but clx is a cffi library basically so types are already known
<_death> makomo: yep :)
<vms14> Josh_2: clx is not cffi
<Josh_2> Isn't it?
<vms14> new-clx is cffi
<Josh_2> o
<Josh_2> ffi* then :P
<Josh_2> What does it use?
<vms14> but as X is a server and uses sockets the creators of clx chose make it purely in cl
<vms14> using sockets
<Josh_2> or maybe I'm talking out my ass
<Josh_2> I'd go with that
<Josh_2> vms14: it has type declarations in it so its gonna be pretty fast anyways xD
<vms14> think the xorg server it's just a server that listens to a port
<vms14> and every program is a client that makes request to a x port
<vms14> so does not matter the language as long you fully understand the X server protocol
<vms14> which is almost impossible for a human
<Josh_2> xD
<vms14> so clx creators are not simple humans
<vms14> this is why I guess it's a master piece
ggole_ has quit [Quit: Leaving]
karlosz has joined #lisp
vlatkoB has quit [Remote host closed the connection]
sjl has joined #lisp
<jackdaniel> is there any rule in the standard how ratio should be converted to float wrt rounding? i.e is rounding to 0 correct?
<jackdaniel> s/converted/coerced/
random-nick has quit [Ping timeout: 246 seconds]
montezad has quit [Quit: montezad]
libertyprime has joined #lisp
momozor has joined #lisp
<momozor> *cough*
<momozor> hi
Arcaelyx has joined #lisp
<aeth> momozor: hi
rumbler31 has quit [Remote host closed the connection]
jeosol has quit [Ping timeout: 256 seconds]
ricekrispie has joined #lisp
xkapastel has quit [Quit: Connection closed for inactivity]
ricekrispie2 has quit [Ping timeout: 245 seconds]
salamad has joined #lisp
<momozor> what do you guys think of this CLOS usage? https://pastebin.com/LUwGk8fL
salamad has quit []
<pjb> momozor: your modelization is wrong.
nai has joined #lisp
<pjb> in this instance calculator is meaningless.
<pjb> Rename it compound-shape
<pjb> so you don't need total-area, just an area specialized on compound-shape.
<nai> hi, why does (cdr ''nil) evaluate to (NIL) ? i'm not getting the logic
<pjb> You might want to compute the intersection of the shapes to remove it from the total area.
<pjb> nai: try: (cdr (read)) and type 'nil
salamad has joined #lisp
<pjb> nai: quote prevents the evaluation only when evaluation is performed.
<sjl> nai: ''nil reads as (quote (quote nil)), which evaluates to the list (quote nil). The cdr of that list is (nil).
<nai> sjl: oh right, thanks
<momozor> pjb: thx
<nai> what kind of black magic is #1=(programmable . #1#) ?
<nai> i'm guessing it repeats "programmable" infinitely or something
<sjl> It reads as a cons where the first element is the symbol programming and the second element is the cons itself, yeah
<sjl> s/first element/car/ s/second element/cdr/
<nai> thanks sjl
<pjb> nai: it's the #= and ## dispatching reader macros.
<nai> thanks :)
<pjb> nai: it allows to create data structure where a substructure is referenced twice or more.
<nai> i see that
<nai> basically a linked list that points to itself
<pjb> nai: in this case, we have #1# in the last cdr position, so it loops back to the first element, thus making a circular list.
aindilis has quit [Remote host closed the connection]
<_death> nai: https://gist.github.com/death/8c17afbba1eb10872e3c7f6f0bb7ba0a though it contains a bit of.. profanity..
<sjl> not necessarily a list, e.g. #1=#(#1#)
<sjl> is an array of one element (itself)
<pjb> So when printing, you get an infinite list of programmable programmable programmable … programmable programming language.
<LdBeth> Interestingly, dispatch macro accepts a numeric arg but only a few utilizations of it
<pjb> sjl: nope.
<pjb> sjl: you can also have arrays of 0 elements.
<nai> _death: ahah thanks. so much to read
<pjb> sjl: OOPS, sorry, I misread what you wrote.
<sjl> pjb: Sure. #1=#(#1#) is not one of them though.
<pjb> Yes.
<nai> i started trying to read LoL yesterday but then i realised my knowledge of lisp was wayyy insufficient. so here i am learning basic lisp
<sjl> nai: LoL meaning Let Over Lambda, or Land of Lisp?
<pjb> ## and #= can be used to all kinds of data structure, as long as they have a readable syntax.
<nai> let over lambda
<sjl> annoying conflict of abbreviation there
aindilis has joined #lisp
<LdBeth> Lêt over Lamdba
<nai> god, who named a book about lisp "LoL"
<nai> two years after let over lambda was out
<sjl> Ah yeah, that book requires you to be pretty comfortable with the basics first.
<nai> who names*
<pjb> millenials?
<sjl> I do like the name Land of Lisp, but the abbreviation collision is unfortunate.
<sjl> I don't think Barski is a millenial.
<no-defun-allowed> the easy LoL and the hard LoL
<no-defun-allowed> problem solved
<nai> i just typed #1=#(#1#) in my sbcl... :')
<nai> i see you were not lying
<pjb> Try again after: (setf *print-circle* t)
<pjb> and you may want to quote it: '#1=#(#1#)
<nai> nice
Josh_2 has quit [Quit: ERC (IRC client for Emacs 26.1)]
<nai> hm, why would i quote it?
<LdBeth> Well, you didn’t have to in CL
<sjl> See also: *print-level*
<sjl> I have *print-level* and *print-length* set to big-but-finite values in my init files to prevent accidents
<nai> i was looking at "big-but-finite" for a second like it was a lisp special value or something
<sjl> hah
<sjl> (defconstant big-but-finite most-positive-fixnum)
<pjb> (maplist (lambda (x) (cons x (car x))) '(a b c d e f)) #| --> (((a . #1=(b . #2=(c . #3=(d . #4=(e . #5=(f)))))) . a) (#1# . b) (#2# . c) (#3# . d) (#4# . e) (#5# . f)) |#
<nai> you never know!
<nai> pjb: i... was not ready for this
<pjb> nai: because code must not contain circularity (and even shared structures). Only data (including literal data, as quoted) can have them.
<nai> oh ok
<pjb> The behavior of #1=#(#1#) may be surprising: the implementation could choose to send a missile in the general direction of your house.
<_death> pjb: why must code not contain shared structure?
<nai> i see
<pjb> Or invoke nasal daemon flying out of your nose, at it's choice.
<_death> (do ((line #1=(read-line ...) #1#)) ...) is an idiom, used by some
<pjb> _death: because CL compilers may be not prepared to deal with it.
<pjb> _death: it's not conforming.
<sjl> Is that specifically prohibited by the standard somewhere?
<pjb> Yes, somewhere.
izh_ has left #lisp [#lisp]
moei has quit [Read error: Connection reset by peer]
ym555 has quit [Ping timeout: 264 seconds]
moei has joined #lisp
salamad has quit [Quit: Mutter: www.mutterirc.com]
vaporatorius has joined #lisp
<sjl> clhs load-time-value
<sjl> > [special case about load-time-value described] This can happen both when an expression being evaluated or compiled shares substructure,
vaporatorius has quit [Client Quit]
<sjl> Seems to point at sharing substructure being okay. Can you be more specific about where the standard prohibits it?
<_death> (defmacro twice (form) `(progn ,form ,form))
salamad has joined #lisp
nowhereman has joined #lisp
<pjb> There may be other problems, such as if the implementation provides source location, associating it with the lisp object. If it's shared, it can look as if the same lisp object has several source locations, but the implementation may be not prepared to deal with that case.
<pjb> And of course, circularity in code will involve infinite recursion during compilation…
<nai> sbcl does weird things with + - * /
<nai> where is that documented?
<sjl> what are "weird things"?
<pjb> #sbcl may know.
<nai> + seems to be the last thing i typed, * the last result i got, / the last result wrapped in ()
<nai> ok
<pjb> This is not sbcl, this is standard REPL.
<pjb> clhs +
<sjl> Oh, no, those are standard.
<nai> ah
<nai> thanks
karlosz has quit [Quit: karlosz]
vms14 has quit [Quit: WeeChat 2.3]
q3d has quit [Ping timeout: 256 seconds]
makomo has quit [Ping timeout: 246 seconds]
<aeth> _death: At that point, just use LOOP or write your own macro on top of DO (I've done both) to avoid the repetition of the read
techquila has quit [Ping timeout: 264 seconds]
rumbler31 has joined #lisp
Josh_2 has joined #lisp
<_death> aeth: the point is to show that shared structure is prevalent in lisp code
Essadon has quit [Quit: Qutting]
rumbler31 has quit [Ping timeout: 246 seconds]
Jesin has quit [Quit: Leaving]
ltriant has joined #lisp
MichaelRaskin has quit [Quit: MichaelRaskin]
momozor has quit [Quit: Leaving]
xkapastel has joined #lisp
Oladon has joined #lisp
karlosz has joined #lisp
loli has joined #lisp
<loli> It has been fun hacking package(module) functors into CL, the package system isn't the greatest so it has been a pain to do, but you can get some decent results
moei has quit [Quit: Leaving...]
<aeth> _death: imo it's a flaw in the code to use reader features when a defmacro can work instead
<gjvc> is the Common Lisp HyperSpec available as a downloadable zip ?
<aeth> yes
<aeth> On the site itself, I think
<gjvc> hmm can't see one
<_death> aeth: the expansion of TWICE with a cons form also demonstrates structure sharing in code.. if you mean to discuss the style aspect of the DO idiom, I would tend to agree
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
<_death> in your .emacs you can then have something like (setq common-lisp-hyperspec-root "file:///home/death/dev/HyperSpec/")
<gjvc> oh great thank you
<aeth> _death: I have only ever seen #1# etc. actually used in things when *print-circle* was T
<Bike> that... doesn't use #1#?
<aeth> Bike: in the print
<_death> that prints #1# etc. to show the shared structure
<Bike> what does that have to do with writing it in code
<_death> aeth: you should read more code then ;)
<aeth> Bike: that's the point, it shouldn't be written, only printed imo
<aeth> And in that example you can't even print it without print-circle because it quickly becomes too large (not sure if 9 does it or if more are needed)
<Bike> "here's some code that does x" is kind of a weird way to try to make the point that you shouldn't write code that does y
<aeth> Bike: my point is that *print-circle* is the only time I've seen that feature used well
salamad has quit [Quit: Mutter: www.mutterirc.com]
<_death> in fact I think you had a style issue with verisimilitudes's code on that matter
<Bike> that's hardly compelling
<Bike> just say it's hard to read or something
<aeth> but it's not hard to read in my example, the alternative is either hard to read or impossible to print, depending on how long you iterate
<_death> his code is full of #n# ... so much that I'd call that abuse ;)
<Bike> your example doesn't use ## syntax. i'm saying if you want to argue not to use ## syntax in code, you should do that, and not talk about something very nearly unrelated
<aeth> _death: I absolutely disagree with verisimilitudes's style on just about everything. Lots of obscure niche features I've never seen in other code (I've read a lot) e.g. &aux
<aeth> _death: But then again I heavily use custom macros in my game engine so it's kind of like throwing stones in glass houses
<_death> aeth: ok, but then you did see code that used this reader feature
karlosz has quit [Quit: karlosz]
<aeth> Bike: it's in the print, it prints as this but on multiple lines for me: #(NIL #1=(NIL) #2=(NIL #1#) #3=(#1# NIL #2#) #4=(#2# NIL #1# #3#) #5=(#3# #1# NIL #2# #4#) #6=(#4# #2# NIL #1# #3# #5#) #7=(#5# #3# #1# NIL #2# #4# #6#) #8=(#6# #4# #2# NIL #1# #3# #5# #7#) (#7# #5# #3# #1# NIL #2# #4# #6# #8#))
<Bike> yes, there's a structure with shared substructure. i understand that.
<Bike> i'm telling you that printing an object with shared substructure is pretty much unrelated to writing code using ##
<aeth> Bike: I'm saying that priting an object (or perhaps even writing a literal object) with shared substructure is the correct use of this feature, and writing code using it is abuse of this feature
<gjvc> _death: looks a lot better with a modern CSS :-)
<_death> personally I think his external interfaces are good, and the implementation is simple enough, so don't mind the eccentricities
<Bike> i know, but you're saying it completely unconvincingly
<Bike> insofar as writing with ## and using printing with ## are even the same feature
<aeth> Bike: which is why I started my remark with "imo"
<aeth> I wouldn't permit it in one of my projects, but I obviously don't have the authority to ban it everywhere. Style is subjective.
<_death> gjvc: I use emacs-w3m (er.. nowadays eww actually, I guess) to view it, so don't care about css
<gjvc> _death: will try that
<aeth> _death: Imo, I don't like code I can't easily read in libraries I use because when something goes wrong the first thing I do is M-.
wxie has joined #lisp
<aeth> _death: That, of course, means that I wouldn't use my own game engine if someone else had written it, but I guess that's why I'm writing my own.
<_death> aeth: sure, I don't think anyone likes code that they can't easily read
keep_learning_M has joined #lisp
<gjvc> _death, eww looks great. thank you.
* gjvc is diving into emacs and lisp with both feet
rumbler31 has joined #lisp
<aeth> _death: I've definitely had my share of losing a day (or more) on trying to read someone else's code (and mine as well, but that's my fault), usually when it uses macros that are far too clever.
<_death> aeth: every abstraction has a cost.. good taste requires appreciating this cost vs. the value provided
<_death> I would call this the bang/buck principle :)
wxie has quit [Ping timeout: 264 seconds]
<aeth> _death: Personally, I find that layers of macros greatly simplifies things assuming M-.
<_death> there's also C-RET
<_death> *C-c RET
<nai> what's M-. ?
<_death> nai: usual key bindings for go-to-definition
<nai> ok
<_death> ok, when spelling degrades, it means I need sleep ;)
<aeth> _death: e.g. if you're inlining functions a lot in macros, use a macro that can do (progn (declaim (inline foo)) (defun foo (...) ...)) and now you've just greatly simplified all the macros that generate inline functions by getting rid of that complexity, and the double-use of the function name
<aeth> Then once you're familiar with that (e.g. through M-.) the actual source of the other macros are much simpler
catchme has joined #lisp
<aeth> nai: Imo it's easier to jump to several definitions and keep things broken up into small pieces then to try to parse the logic of a 150-line macro
<aeth> M-. will take you to the definition in Emacs+SLIME, other IDEs may have another way to do that
nowhereman has quit [Ping timeout: 264 seconds]
gxt has quit [Quit: WeeChat 2.4]
selwyn has quit [Remote host closed the connection]
trocado has quit [Ping timeout: 245 seconds]
Volt_ has quit [Read error: Connection reset by peer]
Jesin has joined #lisp