freenode/#lisp - IRC Chatlog
Search
14:54:48
p_l
(can't test right now, as personal edition no longer works on mac, and I'm too lazy to take a trip for the other laptop)
14:55:06
p_l
beach: it's hooked into "dspec system" according to http://www.lispworks.com/documentation/lw70/IDE-W/html/ide-w-207.htm
14:55:56
p_l
http://www.lispworks.com/documentation/lw70/LW/html/lw-39.htm#41682 <-- this is dspec docs
15:09:22
pjb
|3b|: I would have different files that would each define the current package, and include the common file (eg. with com.informatimago.common-lisp.cesarum.utility:include-file).
15:17:11
pjb
beach: the way break points work depends on the level of the code you're trying to suspend. You can have breakpoints at the source level (eg. inserting (break) forms. You can have breakpoints at the microcode level, either by live-patching the instructions, replacing them by a jump or a software interrupt, a trap, or even an invalid instruction if you can handle it and resume, or by stepping all the execution setting a flag to do
15:18:07
pjb
You could also set break points by configuring the MMU to prevent access to the specfied instructions.
15:19:40
pjb
Working at the source level can be easier: you directly know where the break point occurs, while if you break (or step) low level instructions you have to map their addresses to source expressions (which may be difficult or impossible, depending on the compiler optimizations)
15:20:35
pjb
Indeed, since modifying the code has its difficulties. It may be complicated to do or even prevented by the system…
15:21:25
p_l
or simply you might not want to deal with the trouble of arranging possibly complex jump chain to get the original instruction continued
15:22:02
p_l
debug registers let you create a hw breakpoint that has separate configuration from what application might have used for itself
15:23:07
pjb
One easy way to do it, is to "instrument" the code. It's easy to do at the compilation level (eg. with high debug level). You just insert the instructions needed to step/break.
15:24:21
pjb
You don't need support from the system or the processor, it can work portably and conformingly, and it can give very good results source-wise. The only problem is that the instrumentation changes the generated code, so bugs may appear or disappear when you do that… (should not be a problem if the compiler is bug free!).
15:30:02
beach
pjb: I am specifically interested in the mechanism used by LispWorks. But I see now that breakpoints are part of the stepper, so that should give me some hints.
15:35:29
splittist
one day I will remember the correct order of arguments to get-hash. Today is not that day.
15:37:02
jackdaniel
splittist: you may arrange it as English sequence: "get eggs from the store" is more natural than "get from the store eggs"
15:45:34
p_l
beach: given the list of places that a breakpoint can be declared, I'd say there's good chance that they replace call sequence
16:07:33
p_l
why would it be possible only in the stepper, if they can hijack the call by simply changing the address?
16:23:28
p_l
beach: Rainer Joswig had also made an interesting set of twitter posts of various debug features in LW
18:21:46
puchacz
hi, it seems that variables used in loop are bound as if they were (let ...), so safe to use the same name in inner loop, like here: (loop :for i :from 0 :to 3 :collect (cons i (loop :for i :from 1 :to 2 :collect i)))
18:25:13
pjb
puchacz: note that the standard doesn't specify weither there's one binding per iteration or one bindinig for the whole loop.
18:25:49
pjb
(mapcar 'funcall (loop for i below 3 collect (lambda () i))) #| --> (3 3 3) or (0 1 2) |#
18:25:51
|3b|
(defun foo (i) (let ((i i)) (loop for i from i collect (loop for i below i collect i))))
18:26:17
pjb
(mapcar 'funcall (loop for i below 3 collect (let ((i i)) (lambda () i)))) #| --> (0 1 2) |# if you want one binding per iteration.
18:27:06
puchacz
pjb: I did not know that, thanks. sbcl has one binding for the whole loop if I remember, checking
18:28:09
puchacz
I discovered it some time ago, and use (let...) if I need, I did not know that some lisps may not need (let ...) - of course even those lisps will work fine with extra let
18:28:36
puchacz
so my example with one binding per whole iteration, is it guaranteed to work across all common lisps?
18:50:32
asarch
One stupid question: just like the mini golf, what would be the shortest way to count from 0 to 5?
18:58:36
|3b|
loop starts from 0 if you don't specify, so (loop for i to 5 do(print i)) is a bit shorter, but (dotimes(i 5)(print i)) is shorter than loop
19:06:52
pjb
(loop for i to 5 collect i) #| --> (0 1 2 3 4 5) |# is shorter than (let ((is '())) (dotimes (i (1+ 5) (nreverse is)) (push i is))) #| --> (0 1 2 3 4 5) |#
19:09:43
|3b|
right, building a list is easier in loop, and i should probably test more carefully :/
19:12:32
|3b|
(let(l)(dotimes(i 6(reverse l))(push i l))) is ugly, but still a good bit longer than the LOOP equivalent
19:16:09
|3b|
but then presumably you'd just use a hypothetical golf lib that had any function you want assigned to some unicode character
19:20:05
|3b|
ACTION wonders how long it would take to run out of good characters if you added a function to the lib every time someone suggested a new golf task
19:43:52
pjb
|3b|: unicode has a lot of good characters. But I agree that golf tasks naturally reduce good character in the most mild mannered and educated people…
23:18:50
Mark35
How would one pretty print json in lisp? It appears possible with https://common-lisp.net/project/cl-json/cl-json.html but I'm not sure how to go about it.
23:39:38
Odin-
XP is pretty configurable. Shouldn't be much of a problem convincing it to print Lisp structures as JSON.
0:12:10
HiRE
I read the handling of types section in the SBCL manual but it just left me more confused :(
0:13:07
no-defun-allowed
You can think of the type (MEMBER items ...) as meaning the provided value has to be one of the provided items.
0:15:35
no-defun-allowed
Providing :IF-EXISTS NIL to OPEN will just have it return NIL if the file exists already, which I don't think is used too much as signalling a condition is more appropriate.
0:17:49
HiRE
Is it more idiomatic to put each closing paren on a new line, or all packed in at the end?
0:21:06
torvis
c:/Users/eric/portacle/all/quicklisp/dists/quicklisp/software/iolib-v0.8.3/iolib.asd:
0:25:53
_death
which could be a file containing (error "Unsupported platform, patches welcome") or something
0:59:08
Xach
physpi: practical common lisp and paradigms of ai programming are good books (and free to read)
1:04:40
Xach
physpi: yes, you don't have to do anything special to get sbcl's help on that topic. it can issue more warnings if you make more promises via type declarations.
1:08:17
HiRE
so with keyword arguments - once you specify &key everything after that is treated as a keyword?
1:08:20
Xach
i only use allegro for quicklisp testing so i'm not sure what it might offer in that regard
1:10:24
Xach
for example (defun foo (&key ((:hey you) *guys*)) ...) looks for the keyword :HEY in calls, binds it to the value YOU in the body of the function, and if it's not passed, uses the value from *GUYS*
1:14:15
_death
you could also have you-suppliedp there, which introduces another variable whose value is true if the argument was supplied and false otherwise
1:15:41
HiRE
however I am confused - if the keyword variable isnt supplied that branch of the and statement is NIL right? So wouldn't that invalidate all other branches?
1:16:00
HiRE
I mean obviously (select (where :artist "Joe's band")) works fine - just trying to reason out the way the and is breaking down
1:17:44
_death
if, say, TITLE is not supplied, its default value is NIL, so the alternative branch of the IF is evaluated, in this case the form T, which evaluates to T, which is not NIL therefore true
1:17:56
HiRE
the `t` is in the false half of the if statement, so if it isn't supplied it just defaults true
1:23:13
HiRE
usually I'll learn a language by doing practice problems but since lisp is so different I figured learning from first principles was the best idea
1:24:02
gabc
I use it now as a reference when I want something clear for details (like &key and &optional or `loop')
1:26:45
aeth
HiRE: Imo tThe main distinction besides the syntax that makes it different is that nearly everything is an expression that returns a useful value
1:27:25
HiRE
aeth: yeah its a really nice idea. The result is very clean. At least as far as I've seen from chapter 3 the code is remarkably clean.
1:30:45
gabc
Just keep in mind that the cleanliness is not actually true and that you need to know when it isn't as to avoid pitfalls
1:39:41
Odin-
The Lisp 1.5 manual makes for some ... interesting reading when your chief exposure to Lisp is modern CL code.
2:02:32
Xach
clothespin: I think you can do that by doing (setf (sb-ext:bytes-consed-between-gcs) <some very large number>)
2:10:41
HiRE
clothespin: you could also look at the programming language benchmark game. They use SBCL and iirc they run it without a gc