freenode/#lisp - IRC Chatlog
Search
13:27:06
|3b|
ACTION 's ideas so far are: convince asdf to change the .fasl name for each instance. "include" the code file into 3 separate wrapper file that set the package etc. write some ugly defining macros to duplicate the definitions with package prefixes
13:30:22
|3b|
end-goal is to implement some code once and have versions specialized on single-float, double-float, or real. user code would then specify which it wants with package local nicknames
13:56:54
|3b|
or if it is unsigned-byte 8 array, maybe use nibbles to copy 4 or 8 bytes at a time, depending on length and alignment
14:03:36
|3b|
if you can use static-vectors to avoid copying at all, that might be better, though it requires manual memory management which makes it annoying for some things
14:04:10
|3b|
ACTION usually does element-by-element copies for lisp->foreign though, if static-vectors isn't applicable
14:05:33
asdf_asdf_asdf
Hi. I do C-M-s and typed regex. It marked words. How changing marked to "selection", that able copy more than one marked words?
14:06:18
varjag
this is is in my alsa code… worked fine on faster systems, but on an arm target beginning to get underruns with sample rates at 32k+
14:08:16
|3b|
might see if ccl has some way to get a pointer to the vector data, and call memcpy or similar on it
14:08:53
|3b|
(wrapping it in some portability thing that copies if it has to, if you care about other implementations)
14:10:25
|3b|
or just use cffi:with-pointer-to-vector-data, but then you might pay double copy cost on implementations that don't have a way to get a pointer
14:13:12
|3b|
looks like there is also a make-shareable-byte-vector you should use with it for complete portability, but the extra copy on some implementations usually means i don't want full portability when i use it anyway
14:13:49
varjag
we're moving to lispworks for prod but would really like to sort it out with ccl first
14:14:26
|3b|
looks like lispworks might want make-shareable-byte-vector for use with with-pointer-to-vector-data
14:16:48
_death
for sbcl I implemented (a POC) mmaped memory as lisp arrays, so you can use shared memory naturally
14:17:58
|3b|
looks like cffi uses http://www.lispworks.com/documentation/lw71/FLI/html/fli-122.htm on lw, which wants special allocation
14:21:23
|3b|
sbcl and ccl can apparently get pointers to any vector, so it just makes a normal array
14:26:36
beach
I am looking at the LispWorks manual, specifically the section about the debugger. It looks to me like the LispWorks debugger is no more sophisticated than the one in SBCL/SLIME. Am I right? In particular, I don't see a way to set a breakpoint before a program is started. Can anyone who has used LispWorks confirm this interpretation of mine?
14:27:27
Xach
beach: I don't know, but I do know that the lisp-hug mailing list is always very helpful.
14:45:43
p_l
beach: also macro tracing (this switches code to evaluator instead of compiled, afaik) and working Who Calls database
14:47:24
beach
I am mostly interested in breakpoints and how they work. Specifically if you can set a breakpoint in system code, like CONS or POSITION.
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')