freenode/#lisp - IRC Chatlog
Search
6:41:29
jackdaniel
asarch: there is a huge gap between "fair share" and "free books", I think that you mistake these two terms
6:43:03
jackdaniel
I'm pretty sure RMS doesn't promote idea of free labor in contrast to fair share and the consumer rights to have control over what he bought / use
6:46:28
jackdaniel
and generally, fsf encourages to buy the manuals from them, but doesn't close the door for people, who are not interested in spending money for other people effort (wikipedia, on the other hand, encourages donations, which for some reason outrage some people)
7:01:26
beach
My solution to expensive books is to self publish and to set a reasonable price on the book. That way, more people can afford it, and I get paid significantly more per copy sold than if I had used a publishing company.
7:06:45
jackdaniel
I like the idea promoted by leanpub (namely: author sets minimum price and suggested price, user may pay any amount [min-price; inf)) and service takes 10% itself
7:07:22
jackdaniel
so royalty for the author is 90% and it is possible to publish book with minimal price 0 (of course it is only for electronic books afaik)
7:08:02
jackdaniel
study shows, that people often pay more for books which have minimal cost $0 if they find them useful
7:10:03
jackdaniel
// one last remark, there is apparently service called lulu, which allows you to print electronical books *you own* for some reasonable fee
7:14:19
beach
https://www.amazon.com/Introduction-Computer-Science-Robert-Strandh/dp/1479206660/ref=sr_1_1?ie=UTF8&qid=1513148554&sr=8-1&keywords=Robert+Strandh+introduction+to+computer+science
7:17:32
beach
https://www.amazon.com/Introduction-Computer-Science-Robert-Strandh/dp/1479206660/ref=sr_1_1?ie=UTF8&qid=1513148554&sr=8-1&keywords=Robert+Strandh+introduction+to+computer+science
7:18:03
beach
I think we should drop the subject now, and pick it up when I have Common Lisp related books to show.
7:24:29
minion
swhc: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
7:24:31
minion
swhc: please see gentle: "Common Lisp: A Gentle Introduction to Symbolic Computation" is a smoother introduction to lisp programming. http://www.cs.cmu.edu/~dst/LispBook/
7:25:59
beach
jackdaniel: Since the maintainer of minion does not want to adapt it to the new format of cliki, I often give minion explicit entries so as to avoid that message.
7:27:41
jackdaniel
asarch: I think this discussion fits better #lispcafe (and I'm aware I did carry offtopic myself ;)
7:40:35
phoe
jackdaniel: depends. MINIX is also available "for free" and yet it's possible to steal it; just don't obey the terms under which it is licensed.
10:40:02
jmercouris
so, I've created this snippet of code here: https://gist.github.com/a16b5106ad918bbd843c304f09918e08
10:40:18
jmercouris
I'm curious, how might some of you write it instead? would you have used map? checked the result of the function etc?
10:40:51
jmercouris
What is the goal of the snippet? To load quicklisp if it is in either one of those directories
10:46:09
beach
I see two small problems. The first is the indentation of the DO clause of the call to LOOP. The second is the name of the function LOAD-QUICKLISP which suggest that it is always capable of loading Quicklisp.
10:47:10
beach
And you can use a quoted list rather than calling LIST, because the list is not going to be modified.
10:49:13
beach
You might consider signaling an error if the file can not be found in any of those directories.
10:50:37
beach
Like rename load-quicklisp to maybe-load-quicklisp and have it return a Boolean value indicating whether it found the file to load.
10:51:28
beach
Then you can write the loop like this (unless (loop for path in ... some (maybe-load-quicklisp ...)) (error ...))
10:53:05
pjb
(find (function maybe-load-quicklisp) '(".quicklisp/setup.lisp" "quicklisp/setup.lisp"))
10:56:30
beach
Well, if the current function is supposed to return a Boolean indicating success, it needs to be rewritten. Because as it is written now, it should only be used for side effect.
11:04:13
pjb
(defun maybe-load-quicklisp (path) (load (merge-pathnames path (user-homedir-pathname)) :if-does-not-exist nil))
11:04:49
pjb
Now there could be other errors while loading. Perhaps we want to ignore them to try the next one.
11:05:01
pjb
(defun maybe-load-quicklisp (path) (ignore-errors (load (merge-pathnames path (user-homedir-pathname)) :if-does-not-exist nil)))
11:12:38
beach
jmercouris: By the way, I like your approach to learning idiomatic code. Some people who come here couldn't care less.
11:33:24
jmercouris
beach: Thanks, I am trying to understand how a Lisper thinks and what are the strengths of the language
11:33:47
pjb
Using FIND-IF as indicated above is simplier than using MAPC. With MAPC you would have to wrap it in a BLOCK and RETURN-FROM it.
11:34:42
pjb
republican_devil: you may try Smalltalk, if you want to benefit from an integrated GUI IDE using eg. Squeak.
11:34:49
jmercouris
pjb: Ah, somehow I missed that part after your nick changed, okay, I got it, thank you!
11:36:08
pjb
republican_devil: the gentle intro is smooth anyways. You may also consider other books or tutorial, see http://cliki.net for references.
11:42:46
republican_devil
I have tried a few times and then I stop and when I come back I forgot msot
11:43:29
republican_devil
so overall programmign experience in lisp is still best once get hang of it?
11:43:31
turkja
republican_devil: for me this was the gentle introduction: http://www.gigamonkeys.com/book/
11:46:24
turkja
productivity... is of course interesting, but personally i don't program in lisp for being productive. For that i'd choose python. Lisp programming is simply fun, and it feels right and correct. Purely personal opinion, obviously.
11:47:35
jmercouris
turkja: As a "expert" python developer and "novice" lisp developer, I would say one is not necessarily more or less suited to productivity
11:47:53
jmercouris
turkja: It depends on your application, if your spec will change and you must update a lot, lisp is infinitely more flexible
11:48:08
jmercouris
if your goal is to hammer something out with a clear spec, python will oft be quicker
12:04:15
pjb
republican_devil: try to write some lisp code everyday to keep sanity after 8 hours of torture with java or whatever.
12:05:21
pjb
I find python way too limited: you only have OOP to work with python. In CL you can use any paradygm you want or need, and you can even invent new ones.
12:06:59
jmercouris
pjb: There's a lot more than just OOP, you could program in a completely functional style in python, functions are first class citizens etc
12:08:59
jmercouris
ah, well, it is annoying to do, but there are other control structures that allow you to break across new lines
12:09:49
jmercouris
way back when I was going to try to make my browser emacs style with a "lisp interpreter" and "c functions" for fast things
12:10:31
jmercouris
It's amazing what you don't know you don't know, that would have been a horrific codebase to work with
12:12:21
jmercouris
One of the best and worst decisions in python was to do code indenting with spaces and no brackets or anything
12:12:42
jmercouris
forces your code to be very neat, and break apart complexities if you see that a line is getting too long, but it is also very infuriating sometimes
12:15:40
jmercouris
pjb: beach: Thanks: https://github.com/nEXT-Browser/nEXT/commit/edda38552c38d7204ac53ab285bcd6e4bafd988d
12:18:10
turkja
For me the biggest strength of Lisp is the compiler integration with slime and friends, and the whole idea of iterative or interactive programming (sorry i can't find better term). That i simply cannot find in any other language
12:21:00
Shinmera
What pains me most about my current Android development is the lack of function reloading and the lack of a REPL to try things.
12:21:28
Shinmera
There's lots of stuff that annoys the hell out of me beside that, but that's what's costing me the most time.
12:22:24
Shinmera
I like to think that the rest of the world has been living with their legs chopped off instead.
12:25:39
jmercouris
if you were feeling particularly hard-core you might look at what is possible with NDK and make bindings
12:28:38
jmercouris
You can do a lot of stuff though with the debugger, it would be worth exploring its capabilities imo
12:30:11
jmercouris
Shinmera: This looks interesting: https://github.com/jasonwyatt/Android-DebugPort
12:53:36
Shinmera
To bring this back around to lisp, my Android work is to create a native app for my lisp chat system. https://filebox.tymoon.eu//file/TVRRM09RPT0=
13:13:06
logicmoo
trying to decide between *default-pathname-defaults* of "" or the current working dir when lisp starts up
13:14:50
Shinmera
The trick is that once you hit the filesystem relative paths automatically get turned into absolute ones by being relative to the cwd
13:15:12
Shinmera
So "" is a good choice as it avoids cluttering up pathnames that get merged with *d-p-d*
13:25:32
logicmoo
i kind of understand that clisp is following the hyperspec in that "." is not an existing file
13:25:52
logicmoo
" TRUENAME: "/home/dmiles/logicmoo_workspace/packs_usr/wam_common_lisp/t/." names a directory, not a file"
13:29:08
logicmoo
mfiano: right on, currently i am writing truename and making sure uiop has somethuing to target https://github.com/TeamSPoon/wam_common_lisp/blob/master/prolog/wam_cl/pathnames.pl
13:30:58
myrkraverk
Ok, there's something about macros in general, or with- macros in particular that I don't understand.
13:31:28
myrkraverk
(defmacro with-foo ((foo) &body body) `(invoke-with-foo (lambda (,foo) ,@body)))
13:35:33
basket
myrkraverk: Backquote is just shorthand for consing together lists, so if foo is bound to bar, then `(lambda (,foo) (fn ,foo)) is the same thing as (list 'lambda (list foo) (list 'fn foo))
13:37:53
myrkraverk
Question, do compilers (sometimes) optimize away the extra funciton calls due to lambdas?
13:39:59
logicmoo
in wam-cl i sometimes convert the lamda into a real call.. but in the case you gave there i probably wouldnt
13:59:17
phoe
I think the CL standard assumes that all pathnames create some kind of hierarchical tree-like structures.
14:12:34
pjb
myrkraverk: theorically, they could. In practice, I don't know if many CL compilers do. This is something you'd find probably more in scheme compilers.
14:13:23
pjb
myrkraverk: similarly, all the functions in CL can be open-coded (implemented as special operators). So a CL compiler is free to transform a mapcar lambda whose result is ignored into a dolist.
14:31:06
Bike
at least, it open codes mapcar so that (mapcar f ...) turns into a loop of (funcall f ...), and i think if f is a constant function it can inline that
16:03:19
jmercouris
I'm trying to develop a macro, but unfortunately, there are two variable length sections, normally I would use something like ,@rest but I can't see how that would work here:https://gist.github.com/07a0cbaedd4f0aebb8d05646c3397426
16:06:52
jmercouris
Yeah, I had this gap in my knowledge, I assumed it consumed every word as a new argument to the macro
16:08:58
jmercouris
Hmm, yes, I'm not sure how to describe it in this context, so I'll just list the words in my example
16:10:09
jmercouris
ok, so here's another thought, what if I wanted to get at the individual arguments within the list, how would I do that?
16:10:23
jmercouris
I don't actually need to do this, I'm just trying to improve my understanding of macros
16:10:46
Bike
So you were worried that if you wrote (defmacro defparen (name lambda-list &body body) ...) and then tried (defparen foo (a b) ...), it would bind lambda-list to a, and body to (cons b ...)?
16:11:37
jmercouris
I guess I should have just tried it first, but I figured maybe there is something else I can learn as well by asking here
16:11:39
phoe
What's the practical difference between (defmacro foo (bar baz qux) ...) and (defmacro foo (bar (&rest baz) qux) ...)?
16:12:19
jmercouris
I'm not saying the system is out to get me, but we don't exactly get a long 100% of the time :D
16:12:45
Bike
jmercouris: have you read PCL or something? i don't mean to be mean, but symbols are pretty fundamental and it worries me that you're so far into an involved program like a browser without knowing about them.
16:13:18
jmercouris
Bike: I actually consulted my notes from the book on Macros while thinking about this issue
16:13:38
jmercouris
In terms of symbols, I'm hesitant to use the word because it feels like I use it in the wrong way every time I talk about it :D
16:15:22
jmercouris
The concepts are clear in my head, but some part of the interface head:mouth jumbles things up
16:15:25
Bike
Anyway here's a brief explanation of macros. Say the evaluator or compiler runs into the form (foo ...), as in a list where the first element is the symbol foo. It knows that there's a macro named by that symbol. To evaluate or compile the form, it looks up the macro function with that name, and calls it with two arguments: the form (foo ...), and the current environment. Then it proceeds recursively, evaluating or compiling, on the res
16:17:23
jmercouris
the compiler knows of that function and looks it up when finding a symbol with a special name
16:17:57
jmercouris
all the arguments to the special macro function are the complete form body of the special named symbol
16:18:28
Bike
The macro function gets two arguments. The first one is the form, the second one is the environment. defmacro arranges things so that it destructures the form into the lambda list you specify
16:18:40
Bike
Like, you know you can do (destructuring-bind (foo bar) '(1 2) (+ foo bar)) => 3, right?
16:19:52
Bike
Let's have a macro (defmacro my-let (var value &body body) `(let ((,var ,value)) ,@body))
16:21:46
Bike
We can have (defun my-let-mf (form environment) (declare (ignore environment)) (destructuring-bind (var value &body body) (rest form) `(let ((,var ,value)) ,@body))
16:22:19
Bike
and if we do (my-let-mf '(my-let x 3 (+ x 7)) nil), we get (LET ((X 3)) (+ X 7)) same as the macro expansion.
16:24:10
Bike
If you don't know destructuring-bind, we can be more verbose and write (let ((var (second form)) (value (third form)) (body (cdddr form))) `(let ...)) instead.
16:24:56
Bike
As it happens we can also get the macro function explicitly, with (macro-function 'my-let). If we do (funcall (macro-function 'my-let) '(my-let x 3 (+ x 7)) nil) it returns the same as my-let-mf.
16:25:04
jmercouris
I have read PCL a couple times now actually, and this is the only time it has made sense to me how they actually work
16:35:51
jackdaniel
(destructuring-bind (&key a b c) '(:a 3 :b 4 :c 6) …) ;is a nice way to destruct things too
17:05:47
TMA
is there a way to distinguish between a list and nonlist argument to format? ~:[ and ~@[ can be used for NIL/non-NIL test, but I would like to wrap ~{ so that it will not error on non-list e.g. in (format t "~{~s~}" 4)
17:07:52
Fare
quickref.quicklisp.org fails the usual way with uiop: it only looks at the first package, uiop/package.
17:08:23
sjl
I wish these autogenerated doc systems had a way to link to the actual docs, for people like me who take the time to write them
17:10:55
jackdaniel
sjl: I think it links whole README.md toplevel file – that might be a good place to point all the pointers
17:10:58
sjl
because if someone finds these "docs" for my stuff and thinks that's all there is, they're going to be disappointed https://i.imgur.com/5gebjQF.png
17:12:05
sjl
jackdaniel: it includes the raw README.markdown, but hilariously it strips out the documentation link in it: https://simple-monosnap.s3.amazonaws.com/The_beast_Reference_Manual_2017-12-13_17-11-17.png
17:16:49
pjb
TMA: you can add a parameter: (format t "…" (listp foo) foo) and then dispatch on it with ~:[
17:17:27
TMA
Bike: in my special case I have either a number or a list that gets printed via "~{~*~:{~*functor(~d, id(\"~a\"), [~{~*~@{id(\"~A\")~#[~:;, ~]~}~}])~%~}~}" -- the list prints fine, the number errors out. I would like to print the number with some other string (say "~S")
17:17:46
beach
sjl: I totally agree with you. I take the time to write the documentation, and this system ignores it. On top of that, it documents implementation details such as slots.
17:19:23
Shinmera
sjl: Another problem with any system other than Staple is that it won't support custom definitions.
17:19:42
TMA
adding (listp ...) there is not an option, so the only thing is a custom format specifier
17:20:25
Shinmera
Staple has a specific extension mechanism so your system can define additional constructs like Radiance's routes: https://shirakumo.github.io/radiance/#ROUTE%20RADIANCE-CORE%3ADOMAIN
17:21:15
sjl
honestly I feel like autogenerating html pages from docstrings is the least important part of documenting a system, but the part that people spend most of their effort on
17:22:06
sjl
I'd rather read a usage guide that outlines the high-level design/API written on a napkin and scanned in as a jpeg than a fancy HTML page that just formats docstrings nicely
17:22:47
Shinmera
That's fine for you, but I frequently use the symbol index, and also refer other people to specific definitions in case questions come up.
17:22:52
pjb
TMA: yes, in that case your only choice is a specific format specifier. You can write it like ~? so that it takes "~{~*~:{~*functor(~d, id(\"~a\"), [~{~*~@{id(\"~A\")~#[~:;, ~]~}~}])~%~}~}" as parameter!
17:24:26
sjl
pjb: I already have tools for parsing and instrospecting systems. Parsing is done by my Lisp implementation, and instrospecting via docstring lookup and jump-to-def in my editor.
17:24:29
pjb
TMA: Something like: (format t "~@{ … ~/fmt:list-or-atom/ …~}" "~{~*~:{~*functor(~d, id(\"~a\"), [~{~*~@{id(\"~A\")~#[~:;, ~]~}~}])~%~}~}" "atom: ~S" list-containing-everything-including-list-or-atom)
17:24:58
sjl
what I *want* from authors is the high-level lay of the land. What are the user-facing parts of the system? How am I intended to interact with them?
17:25:01
pjb
sjl: then once you have that you need to decide on a generated format. Keep in mind pandoc to convert to other formats.
17:26:16
sjl
pjb: I'm saying that I don't care very much if authors generate some formatted output for their docstrings at all. I can look up the docstrings (or code) in my editor.
17:26:40
sjl
I would much rather them spend time giving me a view into the design of the system in their brain
17:29:30
_death
sjl: right, it reminds me of the "any idiot can code" remark by Moon on the runtime experts panel.. but then, the authors of the doc tools aren't going to write the documentation for these 3K libraries, so they write a tool to help a little
17:29:37
pjb
TMA: I'm afraid you will have to make your format specifier very specific, by embedding the formats "~{~*~:{~*functor(~d, id(\"~a\"), [~{~*~@{id(\"~A\")~#[~:;, ~]~}~}])~%~}~}" and "~S" in it.
17:30:07
pjb
TMA: since you want to use it in a loop, you cannot pass those format strings as parameters using ~V,V/list-or-atom/
17:31:09
sjl
_death: the problem is that now we have a broken version of my docs competing with my actual docs in the google results :\
17:31:49
TMA
pjb: It will do with a specific formatter. It would be more elegant to be more general, but the specific will be fine.
17:32:40
pjb
There's no way to take multiple arguments for a custom format specifier, contrarily to ~? which takes a format string, and any number of argument it needs for it.
17:32:41
_death
sjl: right, maybe it'd be a good idea to have an asdf property linking to the official documentation, and such systems can take it into account
17:33:12
sjl
_death: yeah, it would be nice if ASDF had a `:documentation` property next to `:homepage`, `:bug-tracker`, etc
17:33:26
sjl
and if these autodoc systems would use that to just link to the real docs when they exist
17:34:56
sjl
catting out all the markdown files my documentation directory into a giant `:long-description` seems subpar
17:38:17
_death
the quickref thingy also doesn't support package-inferred-systems style very well, for now
17:39:13
_death
(and maybe quicklisp projects are the right place for such tags, not asdf systems..)
17:40:24
sjl
_death: I mean, ASDF already has :bug-tracker. :documentation seems to be roughly the same kind of thing.
17:52:41
_death
maybe the asdf mailing list (which I'm not currently reading..) is a good place for discussing such properties
17:54:31
_death
Shinmera: I think sjl came from the opposite site.. the one with people who document..
17:56:18
sjl
I used to do a lot of Python (especially Django) which has a pretty good documentation culture, yeah
17:57:11
_death
I don't document my public libraries.. my excuse is that they're not expressly intended for public use..
18:08:11
Xach
Hmm! I have a warning condition that is being signaled by someone else's code. Is there a nice way, without wrapping calls that might signal the warning, to neuter the warning by e.g. redefining the condition?
18:11:18
jmercouris
what does it mean to "advise" a function, and how is it implemented in practice?
18:11:38
Xach
jmercouris: it is a little like clos before/after/around methods, and it is implemented via indirection of some sort.
18:12:32
Xach
jmercouris: when you trace a function, it is a specific case of advising something to show output before and after it is called.
18:13:18
Xach
Edi Weitz's regex coach app used LispWorks advice to build an app accessing the internals of the library without modifying the library. It looked like a cool example to me.
18:13:20
jmercouris
I see, is there built in support for this, or does every piece of software have to implement its own advice pattern?
18:13:34
Xach
jmercouris: it is an implementation-level feature. sbcl does not have it. many others do.
18:13:56
Xach
it is not standard and required. the interfaces vary from implementation to implementation.
18:14:16
Shinmera
You can write your own advice facility, but that will lose most of the point of it (being able to advise arbitrary functions)
18:14:45
jmercouris
in which case, your own platform functions are arbitrary functions for those are on your platform, and the point is still kept
18:15:13
Xach
I wish sbcl had some of the traditional bells and whistles like advice and stepping. (Maybe it has stepping now? I haven't checked.)
18:15:34
Xach
jmercouris: if you're designing an interactive or extensible system, i think it would be interesting to study hooks and advice and such.
18:16:22
Shinmera
I've used it a couple of times, but usually it's cumbersome because it's too fine-grained.
18:16:35
sjl
SBCL has a bunch of extensions to CL:TRACE as well http://www.sbcl.org/manual/#Function-Tracing
18:18:03
u0_a166
in your function definitions you could have a slot for prolog and epilog hooks and a global flag for if inside a hook
18:18:28
Fare
Xach: hash-tables with systems as keys are this-a-way. subclasses of system are that-a-way.
18:18:40
_death
I suppose you could set trace output or whatever to a broadcast in before, and restore it in after
18:19:23
u0_a166
that way when your function dispatcher dalls a function it could check hooks before calling, set the flag to not recurse infnitely, cal hook when needed...
18:19:56
Fare
and the properties are deprecated but still haven't been removed yet, for backward compatibility
18:21:50
_death
jmercouris: because that's the design.. there was a Lisp that took a CLOS-like system more pervasively called GOO.. maybe they have slots there
18:22:48
_death
jmercouris: for Common Lisp, the purpose was that you could have a CLOS-less subset of it and still be able to claim with a straight face that it's a Common Lisp
18:23:07
Xach
Fare: When PRIMARY-SYSTEM-NAME moved from ASDF/FIND-SYSTEM to ASDF/SYSTEM, it broke mgl-pax and part of named-readtables.
18:25:11
Xach
Fare: you mean that without loading from fasl, there is a symbol asdf/find-system:primary-system-name?
18:26:04
Xach
The code in mgl-pax has a reference to asdf/find-system:primary-system-name. I don't think that exists in ASDF 3.3.1 any more.
18:26:17
Fare
I mean that it's bad if a new ASDF breaks old mgl-pax fasls, but it's worse if mgl-pax can't load at all
18:26:58
Xach
I don't think mgl-pax can load in sbcl 1.4.2 with asdf 3.3.1 under any circumstance outside of changing its code.
18:27:18
Fare
BTW, I sent PRs to melisgl early this year to fix some of his packages, but I don't think any were merged.
18:27:53
Shinmera
Fare: So in qt-lib-generator when it needs to download the archives, it has to optionally load drakma and zip. I can't make these hard-dependencies because that would force them to be unnecessarily installed on many setups. However, since qt-libs needs to ensure the libraries are ready after it's been loaded, this optional loading of drakma might happen during a current load-op. Any advice on how to circumvent
18:31:18
Shinmera
It seems to currently work on my system if I do a manual ql-dist:install of the dependency tree of the systems and then just asdf:load-system.
18:31:43
Fare
Typically things like loading are done outside of ASDF, in a setup script, or using Quicklisp or some such.
18:33:46
Fare
if you fork, please also fork madeira-port by Nikodemus, who also won't reply to probing regarding https://github.com/nikodemus/madeira-port/pull/6
18:39:17
Fare
I'm grateful to CL and the its community for all they brought to me, but I want things that can't reasonably be done in CL. I'm already enjoying (and cursing) actor programming in Gerbil, for instance. Or its module system.
18:39:32
Xach
Fare: What induces the package variance errors in http://report.quicklisp.org/2017-12-13/failure-report/cl-influxdb.html#cl-influxdb.examples and http://report.quicklisp.org/2017-12-13/failure-report/cl-portaudio.html#cl-portaudio-tests ?