freenode/#lisp - IRC Chatlog
Search
6:40:40
beach
Well, it is hard to tell from your example what it is that you need exactly. I assume some-name is a variable?
6:41:35
sda
I'm trying to convert the string "!name: some-name-could-be-anything" to "<h3>Name:</h3> some-name-could-be-anything<br>"
6:42:04
flip214
sda: either use CL-PPCRE, or write a parser (eg. via ESRAP), or use CL:READ with a custom readtable and a few reader macros.
6:42:37
flip214
Depending on how much time you've spent with regular expressions I'd suggest on of the first two ways.
6:43:22
Nilby
You'd have to specify what the syntax for "!name: some-name" is a little more precicely. For example can "name" have a #\space or a #\: in it?
6:43:35
flip214
sda: do you have some regular grammer that you need? ! => h3, !! => h2, !!! => h1 or so?
6:47:46
Nilby
Here's a free and imperfect regex for you: (ppcre:scan "!([^: ]+):\\s*(.*)$" "!name: some-name")
6:50:22
Nilby
But regexp can have some notorious troubles, so I find it's best to just manually parse out a simple string.
6:50:58
flip214
sda: for HTML generation I generally suggest to use CL-WHO, but if it's only that one line you needn't bother
6:56:35
flip214
well, (multiple-value-bind (full matches) (cl-ppcre:scan-to-strings "^!(.*?): *(.*)" input) ....) will give you the two parts you're interested in in (aref matches 0) and (... 1)
6:57:36
beach
Who was it that said that attempting to solve a problem using regular expressions results in two problems.
7:39:00
flip214
beach: yeah, there's a saying. still, for small, quick text manipulation, RE are as dense as it gets (in both senses of the word ;)
7:41:51
beach
Wow, chapter 4 of Land of Lisp is entitled "making decisions with conditions", but in fact it is about conditionALs. Also, on page 51 the author encourages the use of a list variable as a Boolean, and also reverses the IF branches compared to a proof by induction.
7:45:25
beach
Also on page 51, the author claims that the expressions (), '(), nil, and 'nil are "equivalent" without stating the context that would make them so.
7:46:09
beach
No wonder so many people who come here have troubles with this stuff. We must start by making them forget lots of stuff they have "learned" from this book.
7:48:35
beach
The entire thing is written in a very sloppy way. I wonder who were the editors in charge of catching stuff like that.
7:55:17
Nilby
I don't trust what I read, but I think the spirit and enthusiasm expressed in that book is good. If one can be mostly correct and fun, that's an amazing achievement.
8:00:09
beach
Also, there is a large number of people, me included, who get so distracted by inconsistencies like this, that they have a hard time appreciating the message at all.
8:00:39
edgar-rft
WhenI learned Lisp in the 1990s every second tutorial still used plain lists as conditionals and I agree with beach that this caused me lots of confusion.
8:00:56
beach
A large part of technical writing is to avoid distracting the reader with inconsistencies like that.
8:01:24
Nilby
I basically agree. Which I why I learned from the spec, and looked at that book for entertainment or inspiration.
8:03:10
beach
edgar-rft: Also, have you ever seen a proof by induction that starts with the induction hypothesis and its consequences? Reading code that is structured like that forces the person reading the code to keep in mind stuff that should have been gotten out of the way first.
8:03:54
edgar-rft
I don't consider "Land of Lisp" as a spec replacement but the problem is that it's most often read by *beginners* and then it's important to avoid confusion by all means.
8:07:32
Nilby
I guess that's why SICP is so revered, since I think in manages to be fun and correct and builds the proof from the base.
8:08:21
beach
That sounds right. I certainly don't remember any distractions of this kind from SICP. And that's a good thing.
8:10:32
beach
moon-child: I hope you are not saying that inconsistencies and bad terminology make a book more interesting.
8:12:25
edgar-rft
I'm still thankful to Conrad Barsky for writing a book that doesn't deter beginners with overly technical cruft but as it looks there had been some gaps during the production.
8:12:25
edgar-rft
I also assume that no-starch press is not a super-expensive publisher so we prably have to live with some deficiencies, but maybe there should be a note in the CLiki for example to inform beginners.
8:15:44
Nilby
But I also sometimes think it might be laugh-out-loud funny to see a formal semantics of CL like r5rs.
8:19:18
edgar-rft
engblom: D. Touretzky's "Gentle introduction..." is *very* leightweight, P. Seibel's "Practical Common Lisp" comes next.
8:27:16
engblom
edgar-rft: "Gentle introduction..." seems to be very verbose: much text is used to explain trivial things
8:28:52
edgar-rft
engblom: I like to say that it's "Programming explained for Babies". If you have worked with other progranming languages before "Practical Common Lisp" is better
8:31:29
beach
I guess "Gentle" was written before a top-level SETQ/SETF of undefined variables was undefined behavior.
8:32:14
Nilby
I first resolved to figure out what the words lambda cddar rplaca meant, so I could cheat at a game.
8:33:15
edgar-rft
beach: I learned from Touretzky why a symbol can name a function and a variable at the same time and when it's used as what. Touretzky was the only book with a picture of all symbol slots (symbol-value, symbol-function, symbol-plist, docstring etc.) That picture helped me much when I was still new with Lisp.
8:34:33
beach
edgar-rft: That's what I suspected. Interestingly, that's often the wrong way of thinking about it. Certainly the SYMBOL-VALUE is wrong.
8:37:04
beach
I would have much preferred that the chapter "Environment" in the standard would be about the global environment, and I would have preferred that SYMBOL-FUNCTION and FDEFINITION were specified there.
8:41:34
Nilby
It's weird, I think global environments were a thing that everyone knew, at the time of the spec, were necessary in practice for big things like Emacs or an OS, and that every big implementaion had, but that they didn't want to burden small implementations with.
8:41:52
beach
The code in Touretzky seems to have consistent indentation. That's a plus. Many books get that wrong.
8:43:04
beach
The fact that it is "spread out" in a typical Common Lisp implementation doesn't make it less real.
8:45:48
beach
Yes, especially when the standard seems to encourage the reader to think about it that way.
8:46:56
beach
SYMBOL-FUNCTION is in the Symbols chapter. FDEFINITION is in the Data and Control Flow chapter.
8:48:58
Nilby
I like the idea of an Environment chapter, especially if they were first class, but then what would the existing chapter be called?
8:50:04
beach
Good question. I need to think about that. Also, since it is a matter only of presentation, this issue could be fixed without altering the language. Maybe some future version of WSCL.
9:05:11
beach
I also like Touretzky's CONS diagrams. Those are pretty close to the what I use myself to explain lists to newbies.
11:07:25
kevingal
beach: are you reading Land of Lisp out of some masochistic pleasure, or do you keep running into it in the wild?
11:08:21
beach
I am reading it because it is part of my job to keep me informed about the literature, so that I can then give advice to potential students of Common Lisp.
11:10:29
kevingal
Fair enough! I've always thought that it makes sense to read books you don't like so that you can appreciate the ones that are more to your taste.
11:11:20
beach
luni: Right, my employer would not fire me if I omitted this book from my reading list.
11:12:14
kevingal
Re: Practical Common Lisp, I wouldn't recommend it as a learning resource. It describes features in excruciating detail and doesn't have exercises. Maybe it doesn't suit my style of learning.
11:13:07
kevingal
I like using it as a reference. Or when I vaguely understand a feature and want a full review.
11:13:45
beach
flip214: You are definitely right. Hence my explanation for my reason for reading it.
11:14:47
flip214
well, curiosity is _always_ a valid reason, so I didn't think you'd need to explain anything
11:15:27
beach
edgar-rft: Sure. I meant, whenever I read text books in order to learn something, I never do the exercises. It saves a lot of time. :)
11:15:37
jackdaniel
books are overrated, the true lisper explores their innate deposit of wisdom and complain when the programming language does not match their intuition! :)
11:16:33
jackdaniel
(or asks on #lisp how to solve this particular topic being the beginner material)
11:16:39
edgar-rft
I also don't do the exercises, for exactly the same reasons, what is probably the reason why I never learn anything at all
11:17:39
ldbeth
unless it is sold to students, a good book should always includes answers to exersices
11:19:47
jackdaniel
in the amop book, excercises are marked as easy, demanding, hard and open problems afair
11:21:58
kevingal
I can't be sure that I've learned anything unless there's a way to test my knowledge. I'm actually doing exercises from a textbook as we speak, haha.
11:24:24
kevingal
Then again, maybe the fact that I do the exercises is the reason that I don't finish many books.
11:24:29
jackdaniel
you may find (for free) two chapters of this book as a reference of said protocol here http://metamodular.com/CLOS-MOP/
11:25:19
joga
hey... I just realized I borrowed amop to friend years ago and it's still there, thanks for mentioning it
11:26:26
jackdaniel
is anyone aware of a library that offers a security model for common lisp? (i.e for various users)
11:31:01
jackdaniel
I'm not interested in LM, I'm interested in common lisp library (or, eventually, specification for such security model)
11:33:57
ldbeth
Sounds like you need something a object-oriented access control thing, guess I haven't totally forget it then. http://www.object-oriented-security.org
11:37:38
jackdaniel
thanks, I'm loosely aware what is the capability based security model; what I don't know is whether someone attempted to use it in common lisp
11:38:38
jackdaniel
the site you have mentioned mentions passing "messages" between objects, in Common Lisp enforcing the capability would be probably baked into the generic function
14:25:45
mfiano
Gripe of the day: It's annoying so many CL queue libraries are named with stack semantics (push/pop)
14:41:07
mfiano
Even lparallel uses push/pop. phoe is one of the only people that I can respect with enqueue/dequeue, though I think I suggested that while he was developing it :)
14:51:29
mfiano
Speaking of lparallel, there are quite a few issues, and no developer activity since 2016. Should we sharp that thing?
14:51:49
phoe
push/pop, enqueue/dequeue, insert/remove, add/delete, stuff/pull, suggest/enquire... synonyms suck
14:54:25
splittist
ACTION wonders if the fact his function is 120 lines long is affecting its debuggability...
14:55:09
_death
it's true that push/pop are better associated with push-down lists (stacks).. but it's not exclusive, you can push/pop on either end.. for example C++'s deque (double-ended queue) has (push|pop)-(front|back)
15:05:19
splittist
phoe: yes. But not worth it just yet. It's trying to match identical subtrees using queues and hashtables and all manner of state. The real issue is that I don't quite understand it, yet (: