freenode/lisp - IRC Chatlog
Search
5:33:37
asarch
I made this script to render the book from HTML pages into PDF with HTMLDOC: https://github.com/asarch/pcl/blob/master/doit.sh
6:01:20
beach
asarch: gigamonkey worked pretty hard to write that. I think he deserves his royalties. Perhaps you should send him some money.
6:01:24
asarch
Besides, I'm saving for "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp", "The Elements of Artificial Intelligence" and "Introduction to Artificial Intelligence"
6:07:02
beach
I am the first to admit that publishing companies are unethical in the way they treat their authors, and in the way they make money. That is why I use self publishing when I write books.
6:08:30
asarch
I thought I could get the hard copy of the book the same way you can get books from the Free Software Foundation
6:15:46
beach
Well, I haven't checked whether what you did is legal; perhaps it is. I just think that the author deserves to be compensated for his work. The FSF does not have as a goal to make money from their publications (though they would be happy for you to order a hard copy, or course). But I pretty sure that gigamonkey did not write that book just to be a nice guy and in order to spread the word about Common Lisp.
6:15:56
asarch
If you need to change some parameters of the book, like the paper size, download the source code and compiles it
6:18:57
beach
But thanks for the information. I am now convinced that I absolutely should not make HTML versions of my books available online.
6:29:09
asarch
Even Wikipedia had a great conversion tool to get the PDF version of each article those days
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