freenode/#lisp - IRC Chatlog
Search
21:54:50
lottaquestions
Hi all, has anyone gotten the code from Practical Common Lisp Working on SBCL?
22:01:24
lottaquestions
I modified the code in Chapter29, in playlist.lisp so that the param *silence-mp3* points to an actual mp3 file
22:02:02
lottaquestions
but when loading the source code from asdf, somehow it attempts to run this code and fails to open the said mp3 file
22:09:24
pjb
lottaquestions: you could use termbin.com : #!/bin/bash \n nc termbin.com 9999 | tr -d '\000'
22:12:14
lottaquestions
no problem, its actually the source from the book Practical Common Lisp. Here is my change to playlist.lisp: https://pastebin.com/9rPtGkBB
23:05:05
pjb
lottaquestions: Undefined function id3-p ; I don't find it in the id3v2 system I have …
23:07:07
pjb
and there's no com.gigamonkeys.id3v2 system in quicklisp. System "com.gigamonkeys.id3v2" not found.
23:19:18
_death
lottaquestions: it expects the stream to be a binary stream, and the code in PCL's id3-p does pass :element-type '(unsigned-byte 8) so maybe you forgot it in your copy
23:19:58
pjb
lottaquestions: anyways, the problem is in com.gigamonkeys.id3v2:read-id3 which doesn't open the file as a binary file.
4:26:29
uabobbobobo
I'm fooling around with SHOP3 (and automated HTN planner https://shop-planner.github.io). I'm trying to produce a graph (shop3-graph-planner) of a plan as generated from shop3/shop3/examples/rovers/pXX.lisp. I've noticed that (find-plans-stack 'problem1 :plan-tree T :verbose T) produces what seems to be multiple output streams (the plan, plan-tree,
4:37:10
buffergn0me
uabobbobobo: Do you mean bind the *ENHANCED-PLAN-TREE* variable? If you look at the definition of FIND-PLANS-STACK, that is what :plan-tree keyword does
4:43:48
uabobbobobo
buffergn0me after running plan-tree, how/where do I access *enhanced-plan-tree* ?
4:52:02
buffergn0me
uabobbobobo: Common Lisp functions can return multiple values, that is what you are seeing. The second return value is a list of plan trees
4:55:00
aeth
multiple-value-bind, multiple-value-call, multiple-value-list. And for the opposite: values and values-list
4:55:19
aeth
There are a few others that I'm leaving out. Most notably, you can SETF values (on both sides)
5:01:32
uabobbobobo
Very happy to see this! So I'd so something like (setq *dgraph* (multiple-value-bind (x y z) (find-plans-stack 'roverprob :plan-tree T :verbose 3) (list y)))
5:02:34
uabobbobobo
aeth, yes! I was fiddling around with multiple-value-list and multiple-value-call. Thank you, these are both very helpful
5:05:03
aeth
I'm a bit disappointed that LET didn't have a parallel (let (((values x y z) (values 1 2 3))) ...) to SETF's setting of values. m-v-b shouldn't be necessary and when it nests it can get ugly
5:08:01
aeth
in case I was unclear, the LET version doesn't work, but the SETF version does, and I was upset that there wasn't a parallel there like there is for e.g. values-list vs. multiple-value-list
5:21:31
Bike
if you go farther with that you get the idea let should bind places... which someone has written macros for, i remember seeing it on cliki
5:23:52
aeth
Well, when I get back to it. One of the reasons I've procrastinated it is because I'd have to write my own Emacs indentation for it because it is essentially designed for flat binding of all of the binding forms, like flet and labels (iirc, consecutive blocks of labels counts as one labels expansion)
5:24:39
aeth
Mainly because I'm a bit annoyed at those rare functions where I might have like 5-6 layers of binding nesting if I e.g. have a let, a m-v-b, and a flet
5:26:55
Bike
(defmacro nest ((&rest binds) &body body) (if (null binds) `(progn ,@body) `(,@(first binds) (nest ,(rest binds) ,@body)))), i think that's how it goes
5:36:24
buffergn0me
That is, make variable binding/destructuring generic, like "lvalues" are generic in Common Lisp assignment
6:04:50
no-defun-allowed
I heard of something similar on Lisp Machine Lisp; how should LETF act with threads though?
6:07:19
buffergn0me
no-defun-allowed: I am not sure I follow. Destructuring is non-destructive, and you would be binding either lexical or dynamic variables.
6:13:00
no-defun-allowed
Hm, I was thinking like (letf (((car x) y)) ...), which in my mind would RPLACA X then RPLACA it back.
6:13:42
trittweiler
LETF is getting the existing value of a place, setting it to a new value, and the resetting it to the old value in the cleanup form of an unwind-protect. Obviously not thread-safe. The only way to make this thread-safe is if every place goes through another level of indirection (where the thread-local value would sit)
6:14:55
aeth
no-defun-allowed: I can see the use of that sort of functionality, but you're almost reinventing dynamic/special variables at that point.
6:17:50
buffergn0me
I guess I picked the wrong name. I did not mean generic place binding, just a generic way to describe destructuring into variable bindings.
6:49:02
uabobbobobo
What does this output mean? (NIL (#<HASH-TABLE :TEST EQ :COUNT 108 {1001B70FC3}>)) ?
6:53:31
White_Flame
(gethash <key> (second *)) where * refers to the previous return value at the repl
6:53:58
White_Flame
if you have alexandria loaded, it has functions to convert hashtables into alists so you can dump the contents pretty easily
6:55:45
White_Flame
oh wait, that would be (first (second *)), since the hashtable is in a 1-element sublist of the returned list
6:59:21
White_Flame
anything wrapped in #< ... > is not a readable literal; it's a print-only form of some internal structure
7:00:04
White_Flame
and yeah, the braces hold an "identity" field which is usually the current address (GC can move things around)
7:00:26
uabobbobobo
Oh I see. In order to access that internal structure, I need to bind the results to a variable I define?
7:01:06
White_Flame
it's just a value; whether you store it into a variable or use it inline doesn't change anything
7:06:45
buffergn0me
uabobbobobo: (loop for x being the hash-key of *hash-table* collect x) to get the keys of the hash table
7:14:34
splittist
The ELS site says nothing about when registration as an attendee opens, or works. I'm worried I'll miss out in the stampede...
7:14:48
uabobbobobo
if *pt* is ((NIL (#<HASH-TABLE :TEST EQ :COUNT 108 {1001B70FC3}>))), is this excessive: (car (car (cdr (car (list *pt*)))))
7:17:26
buffergn0me
uabobbobobo: LOOP does do list comprehensions, and other things like control flow. It is like an infix programming language inside Common Lisp.
7:24:33
uabobbobobo
I've been needing to ask people about lisp-stuff for years now, and today I'm a growing wizard.
7:24:44
uabobbobobo
Thank you all, I'm so happy to get these things working as well as to learn so many new and nifty things. :-)
7:25:32
White_Flame
there's also #clschool, whereas you might sometimes get overcomplex answers here or crowded by larger discussions here
7:26:11
White_Flame
(unless you want overly pedantic answers with tons of specifics, in which case this is your place ;) )
7:27:54
uabobbobobo
It's taking some time to make sense of what's being shared, but the exploration of ideas, discovery of inner-workings and new features, and the enlightening of my mental bulbs is extremely enjoyable.
7:28:23
uabobbobobo
I do imagine that when the channel is a bit busier, keeping-up may become quite the challenege
7:29:20
uabobbobobo
Either way, if my questions are okay here - however mundane they may appear to be - I'm assuming it's okay to challenge my own confusion here.