freenode/lisp - IRC Chatlog
Search
4:28:59
cer0
yeah ): ik, i'm starting with land of lisp, but my progress it's a little bit slow with that one.
4:29:40
minion
cer0: 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).
4:31:50
beach
I do research in programming-language implementation, and Common Lisp is both my target and my tool.
4:32:27
minion
cer0: SICL: SICL is a (perhaps futile) attempt to re-implement Common Lisp from scratch, hopefully using improved programming and bootstrapping techniques. See https://github.com/robert-strandh/SICL
4:42:17
cer0
beach: that's cool, really cool. sorry i didn't recognized you, you seem to be really important among the lisp community ( :
4:44:46
cer0
well, writing a re-implementation of cl must not be a easy task, and seems a lot of people found it useful
4:46:22
cer0
I barely wrote a lisp once, ahah, like, the last year i tried, but, my C skills are so bad. I was following this... buildyourownlisp.com
4:48:51
beach
After my Masters degree, I worked in industry for a few years, and I noticed how insufficient the level of knowledge was in the developers. In fact, insufficiently low for the task at hand. So I quit and did a PhD. The rest is the "traditional" career path.
4:50:38
beach
So, I looked at the first page of buildyourownlisp.com, and I am still amused by the fact that it is often assumed that you need a lower-level language in order to build a Lisp system.
4:53:54
no-defun-allowed
Legend has it #c said the code was terrible, and it manages to screw up evaluation and scoping in terrible ways.
4:54:56
no-defun-allowed
It uses something...sort of like fexprs in place of macros, but it wouldn't work with lexical scoping as there is no environment passed through.
4:55:22
no-defun-allowed
Oh, and LIST doesn't evaluate its arguments, leaving CAR and CDR to do that!
4:56:05
no-defun-allowed
The introduction says these changes are merely "different", and we're all old grimpy farts for complaining.
4:57:02
no-defun-allowed
We researched in #lispcafe, from memory someone that did a PhD in computer graphics, and works in game development.
4:58:32
no-defun-allowed
*grumpy rather. My phone felt like autocorrecting this morning, but not now.
4:59:32
no-defun-allowed
One should be terrified by a book that introduces macros before variables and functions.
5:00:30
no-defun-allowed
Well, he may be in computer graphics, and hopefully not while using C for it.
5:01:55
no-defun-allowed
(See http://buildyourownlisp.com/chapter15_standard_library#conditional_functions for CAR evaluating the CAR of its argument.)
5:04:13
cer0
tbh when i started with python and encountered Fibonacci recursive function my brain couldn't handle it, but now, i'm really comfortable with recursion (:
5:04:31
no-defun-allowed
If I could suggest one thing, it's to hold off writing an implementation of a (small) Lisp before writing some non-trivial code in it, because then you'll have an intuition for what's going on when you write the implementation and test it.
5:05:24
beach
cer0: Great! Recursion is not used much in Common Lisp, and certainly not for linear structures. It is mainly used for things like trees, where the depth is limited, and the alternative would make the code incomprehensible.
5:06:52
cer0
no-defun-allowed: thanks for the tip, i didn't knew it wasn't a good material for starting with cl or lisp in general.
5:07:27
no-defun-allowed
I wrote a crappy compiler about two months in, because I was convinced Lisp implementations didn't compile as they don't dump images like batch compilers.
5:08:55
cer0
like, 4 years someone told me about lisp, and i tried to find a book or something to find out what it was, i guess i installed clisp, but that was it, my english reading skills weren't really good at that time, so, i ended up not reading the book, but i always feel like i wanted to learn lisp.
5:09:56
beach
It is a common thing to confuse on the one hand interactive/batch and on the other hand interpreted/compiled.
5:13:42
beach
That's what was so strange about working in industry. There are all those professional developers who have completely insufficient knowledge about basic software techniques.
5:16:10
no-defun-allowed
I would contradict what I said about getting a feel for the language if I suggested you read a compiler book now.
5:16:18
minion
cer0: please look at LiSP: "Lisp in Small Pieces". This book covers Lisp, Scheme and other related dialects, their interpretation, semantics and compilation. To sum it up in a few figures: 500 pages, 11 chapters, 11 interpreters and 2 compilers. <http://pagesperso-systeme.lip6.fr/Christian.Queinnec/WWW/LiSP.html>
5:17:49
beach
cer0: But when you get around to it, it's a great book. And the English translation is an improvement on the French original :)
5:18:31
beach
Though apparently, the author then wrote a new version of the book (also in French), that has not been translated into English.
5:18:52
no-defun-allowed
Now I work with two compilers: one compiling a Lisp-1 to an abstract machine I made, and the SICL compiler which I will use to compile Common Lisp to the Java virtual machine.
5:22:04
no-defun-allowed
Compiler hacking is quite fun, but it makes a lot more sense when you know what you would need to host the language, and how to build that from the features your target provides if you don't control that.
5:24:13
cer0
Well, It's getting late, see you around beach , no-defun-allowed , thanks for the information. I'll stay away from that buildyourownlisp page. (:
5:28:26
no-defun-allowed
Also, to be honest, I think it's silly the title insists it's "your" Lisp when the code you write is mostly copied verbatim from the book, and the rest are from fairly close-ended questions.
5:31:23
no-defun-allowed
But I find it too easy to complain, so I'll just say that the last two chapters of SICP and all of LiSP is a much better resource. My abstract machine is quite similar to that of chapter 5 of SICP.
7:41:30
MichaelRaskin
«answering a few questions with enumerated options» is exactly how choose your own adventure goes, it is a book with forks that re-converge anyway
7:42:56
no-defun-allowed
I would have to check how the "choose your own adventure" books I read when I was younger go, but there is basically one option for each question.
7:44:25
MichaelRaskin
OK, maybe the references I have seen, with forks and merges, were references to the best of class options
7:45:06
no-defun-allowed
And it's intended to be read linearly, so I still don't get it. But I'd rather not discuss it, because it depresses me that the book may have seen some success.
8:17:12
beach
daphnis: If FOO is a special variable, it is badly named. It should have earmuffs on it.
8:19:42
MichaelRaskin
You could macrolet something right around the loop, then let a macro check the presence of this macrolet and decide before expansion, not in runtime
8:20:56
MichaelRaskin
Or you could just save the external value into a different name using «with», and use the same name for the loop variable as you use outside
8:59:21
aeth
yeah... most syntax highlighters highlight keywords in a special way, so LOOP's keywords make sense as keywords, at least if you don't expect syntax highlighters to support LOOP as a special case
9:00:56
jackdaniel
I mean -- I know that top-level defun defines a function, it doesn't need to be blue ;)
9:01:43
jackdaniel
one could argue, that trivial highlight of variables that are not lexical in the scope of a function would be far more useful
9:02:26
beach
Yes, there are so many more useful ways of highlighting. But Emacs can't handle those ways in general.
9:03:10
jackdaniel
right. my point is that syntax highlight is not useful for someone who knows the syntax, and for those who don't know it it won't help much
9:04:20
aeth
jackdaniel: maybe not useful for you, but it helps me visually distinguish between the parts of a long, complicated :for... which seems to happen all of the time in my LOOPs
9:04:22
jackdaniel
another useful thing (but only as an opt-in mode) would be marking how new the code is
9:05:15
jackdaniel
i.e green code is >1y, red code was modified yesterday, and a gradient in between
9:05:45
jackdaniel
MichaelRaskin: sure, my point is that you have a visual marker what could have caused a regression you are investigating
9:06:24
jackdaniel
(not necessarily because the new code is wrong, it might be that it has revealed undetected defect, still it is a useful clue)
9:08:51
aeth
jackdaniel: oh, that's actually really easy, if you define "new" in terms of the git (or other) repository's data. I wouldn't be surprised if someone has already done that. It saves a step over something like magit-diff if you only care about the new half of the diff
9:09:48
jackdaniel
"that's actually really easy" are famous last words of programmers who died in pits of despair
9:11:05
jackdaniel
either way, that's beside the point. I'm only arguing that color is very easy for the eye, so it is a waste to use it for syntax highlight
9:13:11
aeth
jackdaniel: one advantage of syntax highlighting is that you can instantly catch certain typos, especially if you have a string or block comment that's not properly closed (assuming the syntax highlighter understands the full string and comment syntax of the language)
9:15:07
jackdaniel
ACTION has voiced his opinion and dives back into pits of despair, because he is working on something what is actually really easy ;] ciao
9:22:55
MichaelRaskin
beach: the difference is that you assume the information from the text is easily available and Nilby wants the usecase when the colours are the only information
9:24:00
Nilby
I guess I only need a vauge idea, so coarse syntactic coloring is okay. If I need to really know, I'll slow down and read. I've tried doing the subtle shade thing to convey more precice info, but I usually don't see it.
9:24:21
aeth
if you really like colors at a glance... s-expressions probably make it easy to color entire expressions
9:26:26
aeth
maybe s-expression-aware highlighting could be the "killer app" of an Emacs competitor for CL programming
9:27:14
aeth
Yeah, that's the real problem. Terminals don't offer you many colors, and they're usually a pretty bad selection (which could remove some colors just because of the combinations not going together)
9:33:32
Nilby
woe be upon my terminal colors when I try to run on windows, phones, and barren servers
10:20:11
Xach
daphnis: symbol availability is managed through the package system. the tools in this case are defpackage, import, or use-package.
10:50:31
phoe
if you Ctrl+C in the terminal, this sends a unix SIGINT to the process which usually causes SBCL to enter the debugger
10:51:19
daphnis
just quit without printing anything, like normal programmes do. i used --non-interactive, so it doesn't wait for input, but it still prints stuff
10:52:42
daphnis
Xach: that's a bit too advanced for me at the moment. i suppose i can live with this for now.
10:53:02
phoe
or https://github.com/LispCookbook/cl-cookbook/blob/master/scripting.md#catching-a-c-c-termination-signal
10:53:24
Xach
I use https://github.com/xach/buildapp/blob/dd00f18938ccae0a9b406bfcfd882ad32abeb757/buildapp.lisp#L169
10:54:41
Xach
daphnis: if that's the case, i suggest not trying to build a standalone executable yet.
10:55:16
Xach
no-defun-allowed: that's a nice, simple option. for sbcl sb-ext:*invoke-debugger-hook* would be a nice variation.
10:55:30
no-defun-allowed
You can use C-d to tell SBCL to exit like C-c. Honestly, I would keep the debugger because it would be nice if "normal programs" broke into a debugger when they break.
10:55:50
phoe
Xach: trivial-custom-debugger exits for cross-implementation setting of invoke-debugger-hook or whatever it's called everywhere
12:22:48
pve
Hello! I'm thinking about a protocol, but have trouble deciding between two approaches. Which do you think is better? I'm leaning towards #1.
12:24:14
Xach
pve: i like unary predicates (and functions in general) if i intend to map them or do general higher-order programming with them to reduce the use of (lambda (token) (token-kind token 'foo)) vs #'token-foo-p
12:25:07
Xach
although sometimes i make something like (defun =token-kind (kind) (lambda (token) (eq (kind token) kind)) and do (remove-if (=token-kind 'foo) list)
12:27:42
phoe
also, if you want to go full CLOS, CHECK-VALID-TOKEN-KIND could be a generic function with the default method returning NIL and other methods, EQL-specialized on symbols, returning T
12:28:12
phoe
...and then I guess it should be VALID-TOKEN-KIND-P and be a predicate rather than an assertion
12:39:37
Xach
i'd expect a function named check-<something> to signal an error rather than return nil