freenode/#lisp - IRC Chatlog
Search
22:14:56
dim
if I (push :pgloader-image *features*) from a file where then I call sb-ext:save-lisp-and-die, should I expect the image built as a result to have #+pgloader-image?
22:34:04
dim
basically I want some handler-bind, lparallel:task-handler-bind and handler-case to act differently when in an interactive SLIME session and when in an image, to help me with debug facilities (empty condition handling) and to print something non-interactive when /usr/bin/pgloader is being used by a non CL developer
22:34:34
dim
seems I'm missing some things here and there still in the new save.lisp that I intend to use instead of buildapp when it's ready
23:52:11
sjl
Is there something like POSITION-IF that would give me a list of ALL positions that satisfy the predicate, instead of just the first?
23:52:26
sjl
(I can (already have) easily write my own, just wondering if there's something clever built-in I could use)
23:58:15
sjl
I think http://paste.stevelosh.com/8f7bed46c7fb4ca8bf8038741ed6f7e3bb4a6261 is probably good enough for what I need
0:18:03
verisimilitude
You can simply MAP the predicate and then have a SEQUENCE of where it does and doesn't aply, sjl.
0:19:03
verisimilitude
You could easily transform such a SEQUENCE into positional numbers or skip this intermediate step entirely.
0:21:14
sjl
Preferably it should use O(elements that satisfy the predicate) memory too, though I could live without that
0:21:52
sjl
Mapping the entire thing and transforming will allocate memory even for stuff that doesn't satisfy the predicate, which is a waste if only a couple of things do
0:23:51
verisimilitude
I write LOOP assuming COLLECTING is O(1), which any decent implementation would use.
0:24:36
sjl
But yeah, I'll just use my util function that I pasted earlier. It's efficient and works
0:24:44
verisimilitude
This is, again, just a basic implementation, of course; it works for what you want.
0:24:52
sjl
and it's not like I don't already have a giant utils library. what's one more function thrown on the pile
2:58:59
alandipert
is there a way to define a local function that has the function value of some expression? so that it can be called locally without funcall
3:01:39
alandipert
i was hoping to avoid funcall/apply but hey, this is CL, i need to learn to love lisp-2 :-)
3:02:11
verisimilitude
You could get away with using a symbol macro for this, I suppose, depending on what precisely you're doing.
3:02:32
alandipert
actually i think i figured out a more elegant way that doesn't need require doing this
3:21:07
psq
or perhaps I shouldn't worry about "approachability" and just go for what seems interesting?
3:22:05
verisimilitude
Alright; I have a well-documented terminal control library written in pure Common Lisp in less than one thousand lines.
3:23:36
verisimilitude
I've also written it to assume nothing about the character set the implementation uses, so it performs some tests for suitability and optimizes in the case of ASCII.
3:24:31
PuercoPop
pfdietz: Been skimming over the fuzzy-testing code in your ansi-test repo. Pretty cool. One question, what would 'something useful' on package errors be? build a list of the symbols that caused the package errors?
3:25:45
pfdietz
For the reader, it would suffice to have a restart so the code invoking the reader could suggest a package.
3:26:37
pfdietz
The goal of that was to stripmine a large corpus of Lisp for forms that are sort of reasonable.
3:27:10
pfdietz
And then mutate those and recombine them and throw them at the SBCL compiler, trying to get the compiler to signal errors.
3:29:44
pfdietz
I pulled in code from the entire quicklisp distribution and a bunch of other public lisp programs.
3:37:25
pfdietz
I would have liked to have read everything in the actual packages, but that's not possible if I want to read all of quicklisp, as there are many package name collisions.
4:24:43
beach
Commented-out code gives a very strange impression. What is the person reading the code supposed to think?
4:26:55
beach
Comments inside top-level expressions to be aligned with other expressions take two semicolons.
4:27:49
beach
Instead of using reader labels #= and ##, define an abstraction like a function or a macro. Code like that is quite unreadable.
4:29:59
beach
verisimilitude: I think it was a mistake to recommend your code as the first code for psq to read.
4:31:34
verisimilitude
ACUTE-TERMINAL-CONTROL is still a work in progress, but I will defend CL-ECMA-48 as something that is rather finished and good.
4:32:06
beach
verisimilitude: Why do you recommend unfinished unidiomatic code to read for a beginner?
4:32:56
verisimilitude
I recommended ACUTE-TERMINAL-CONTROL because they also wanted something interesting.
4:33:36
verisimilitude
I told them to read CL-ECMA-48 first, anyway; do you have any criticisms that apply to that, beach?
4:34:55
equwal
versimilitude: Because you need version control and git is the best version control system.
4:35:25
beach
verisimilitude: Your code seems to use car/cdr/rplaca/rplacd a lot. That indicates a lack of abstraction.
4:35:58
verisimilitude
The code in DEFCS could be cleaned a tad by introducing more variables to store some results, and I may do that, but it's still fine and nice.
4:36:01
beach
verisimilitude: They are not irrelevant. If you want to expose your code to others, especially to newbies, make sure you follow the established conventions.
4:37:20
beach
verisimilitude: I respect that, but then don't expose your code to others. Especially not to newbies.
4:37:57
beach
verisimilitude: It would be better to wait for a more idiomatic recommendation than to expose unidiomatic code.
4:38:06
equwal
verisimilitude: I don't have recommendations because I'd rather use my time doing something other than reading that.
4:38:44
verisimilitude
That's what the code actually looks like, equwal, and the actual program isn't written like that.
4:39:00
beach
psq: If you could tell us your current level of knowledge, the kind of code you would be interested in, and what other languages you already know, better recommendations could be given.
4:40:36
alandipert
i have a cyclic relationship between a struct and its :print-function (the print function uses accessor functions created by defstruct). is a "forward declaration" like (declaim (ftype (function (t t t) t) print-node)) the most reasonable way to muffle complaints about undefined functions?
4:41:01
equwal
Best recommendation: Make a git repo, put your code in Emacs, M-x downcase-region the code.
4:41:30
verisimilitude
Again, the actual cl-ecma-48.lisp isn't like that, equwal, if you'd actually look at it.
4:42:10
verisimilitude
I'd rather rid myself of torvalds' software than become more dependent on it, equwal.
4:42:28
Bike
alandipert: i think you should just be able to (defstruct ... (:print-function foo) ...) (defun foo ...) and that will be fine
4:43:18
minion
psq: have a 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:43:28
alandipert
Bike thanks, that works, but sbcl emits a style warning about the undefined function that i wish to suppress
4:44:05
beach
psq: I seriously think you should skip the code that verisimilitude recommended. It is not idiomatic and verisimilitude doesn't think it is important to follow established convensions.
4:44:34
beach
psq: But to a beginner, it is absolutely essential that the code follow established convensions.
4:44:34
alandipert
oh, duh, they're in the same file but i'm not loading the file. i'm evaling things form by form manually in slime
4:45:07
beach
verisimilitude: You don't get it do you? It is not about your taste. It is about established conventions.
4:45:14
verisimilitude
You can read my program and see a rather finished, well-documented, well-used, and entirely portable Common Lisp library or you can follow the vague suggestion to read programs in a book, with no particular examples, psq.