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.
<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.
<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)
<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
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>
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>
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?
<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 :/
<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
<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], ...]]] ;)
<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]
<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 ()
<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>
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
<_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]