freenode/#lisp - IRC Chatlog
Search
8:47:37
|3b|
the layout specification changes rarely, and compiling a function on change is acceptable
8:51:00
|3b|
so i need to specify and generate some complicated CL data structure, then figure out how to write to /that/ efficiently, instead of just extracting it from whatever it was already stored in?
9:14:12
|3b|
so any transformation of input data (like if i pass a clos instance and want to get the actual value from a slot of a value stored in that instance, or if i want to add a constant to it), would be implemented as more code in compile-store-specification?
9:14:48
|3b|
ACTION took a while to parse the code since it looks like it was working backwards from what i'm trying to do... still not 100%
9:15:41
pjb
of course, as a simple compiler, it has a structure that is very similar to an interpreter (to the classical EVAL function).
9:16:50
pjb
If you have to compute offsets, etc, then there may be an intermediate phase, where you will generate a list of "store operations", and then you will number this list, computing the offsets, before generating the actual operations with literal offsets.
9:18:03
pjb
Or if it stay simple, you may just pass the current offset to the compile-* functions, and let them compute the updated offset for their continuation.
9:18:50
|3b|
can just pretend the destination if a big lisp array, and there is just a mapping of names to indices in that array
9:19:42
pjb
Then now you're free to do whatever you want, to generate whatever code pleases you in this lambda expression.
9:21:41
pjb
You may also have a look at https://groups.google.com/forum/#!msg/comp.lang.lisp/gnGCIasIrKo/o9wfrltLqxsJ https://groups.google.com/forum/#!msg/comp.lang.lisp/uc9fLw7i0Fo/HDoDDhx3DRkJ
9:22:09
pjb
Here, the processing of the data is made not according an external type specification, but using the type of the data itself!
9:22:34
pjb
But the principle is the same: we have a big case/cond dispatching on the type, and then we do what needs to be done specifically for this type of data.
9:23:42
pjb
But it could be defined as a macro generating the code, instead of an interpreter function.
9:30:29
Shinmera
If I wanted to write Scheme I'd just use Scheme, not complain about how CL is not Scheme in #lisp.
9:31:49
pjb
Well, you can also use pseudo-scheme in CL. A r7rs implementation embedded in CL would be welcome too.
9:34:09
larsen
loke: http://repository.readscheme.org/ftp/papers/ai-lab-pubs/AIM-349.pdf although I guess this is not what you were looking for
9:37:13
|3b|
seems like a full DSL would either require constant updating, or end up turing complete (and thus presumably even worse than a code walker)
9:37:42
pjb
|3b|: orthogonal to your question, you can implement the translation of CL source to whatever you want by using a different package than CL. Cf. CL-STEPPER!
9:38:22
pjb
|3b|: and the nice thing is that in CL, any function in CL can be opencoded (and any macro in CL can be a special operator).
9:38:30
|3b|
and being able to work on it interactively like CL code is why i have to deal with it at runtime
9:39:38
pjb
|3b|: so you can define a DEFUN macro (and say, LAMDBA, DEFGENERIC, DEFMETHOD macros), to process those setf and expand them to stores in this vector.
9:49:04
|3b|
B was the (setf (slot-value ...) ..) calls, A was equivalent to binding A and S there, while providing type information to B
9:52:41
|3b|
and another goal is that it could have a (declare (type (simple-array :single-float (*)) z)) declaration somewhere, so the generated function wouldn't need to do any checking on the individual values from Z to decide if it could write them as a float
9:56:10
|3b|
other notable features are that the runtime spec doesn't have any data for 'foo2 in toplevel, or 'c in bar-type, and similarly, the person-written code doesn't write 'baz or 'd, but code is generated for them (and no code is written to write default values for other slots that are then overwritten by user code)
11:14:31
theemacsshibe[m]
What's a good way to save an object? I've just been formatting ~s objects to files and using read to read them again but using format feels a bit odd.
11:17:26
theemacsshibe[m]
Docs suggest that, seems pretty straightforward. I'll install Quicklisp in the morning.
13:36:03
didi
Why does https://github.com/tarballs-are-good/quickutil/blob/5adb3463d99095145325c4013117bd08a8f6cac2/quickutil-utilities/utilities/sequences.lisp#L118 declare FLET functions as dynamic-extend? I only know about dynamic-extend because of Costanza's c.l.l. post.
13:39:40
lieven
and in old speak to state that they're downward funargs. that also enables some optimisations.
13:55:17
didi
stylewarning: I am interested in why did you declare the labels functions as dynamic-extend in `equivalence-classes'.
13:56:39
stylewarning
didi: generally if I don’t want to save the function objects created by labels, I’ll declare them as dynamic extent, so the compiler knows it can allocate and free the memory right away
15:38:59
z3t0
is there a construct in lisp where i can do x and then evaluate if and then do x if the if evaluates to false?
15:39:45
z3t0
here's what i have, http://sprunge.us/eZNY Except I want the input to precede it as well
15:41:03
beach
(progn x (unless condition x))? Is that what you mean. I am having a hard time understanding what you want.
15:41:45
z3t0
okay so essentially I want to loop a request to the user for some input, as long as the input is not valid
15:48:49
z3t0
Just so I understand, the reason for funcall is because I am storing a function inside a variable?
15:56:31
z3t0_
okay so I have (until (funcall x y )) which exits the loop as needed but then how do i return y there?
16:05:30
z3t0_
Any recommendations for parsing floats from strings? There seem to be many different ways it is done?
16:20:48
z3t0
I am trying to write an (if b (something) (else)) but it seems to complain that the form is incorrect
16:25:27
Bicyclidine
that's perfectly helpful, you can see you have :type-converter set up as a keyword parameter
16:31:47
dim
using uiop:run-program :output :string here, is there a way to somehow plug babel or something in there?
16:31:51
didi
I'm back. If anyone want to comment on <https://paste.debian.net/hidden/bcf2c844>, please.
16:40:39
z3t0
can anyone recommend a resource that explains how to use loop but is also easy to approach for beginners
16:54:45
didi
I thought of using `listp' and `vectorp', but then I remembered SBCL has extensible sequence types.
17:02:22
z3t0
I am creating a program in lisp that stores a set of images with latitude and longitude coordinates for the center of the images
17:03:10
z3t0
I need to create a system so that I can store all of the images with lat and lng and then write a function that takes lat and lng and then finds the closest image
17:03:11
_death
stylewarning: uh, no... it is passed to MAP.. but then, there shouldn't be an NREVERSE anyway, unless it's meant to be a destructive operator
17:04:05
didi
_death: I used `nreverse' for performance reasons, because `subseq' creates a new sequence anyway.
17:05:10
stylewarning
didi this isn’t universal among all lisp users but I prefer to prepare my data before executing on it, especially if it contains somewhat complicated logic
17:05:46
stylewarning
Here you have the logic of slicing and reversing, and it’s nice to make that evident before mapping (IMO)
17:08:51
_death
z3t0: if you're using a database, it is also possible that it has a solution for that
17:12:28
_death
z3t0: it seems redis added spatial queries.. guess I'll have to update my lredis library at some point in the future :)
17:35:34
_death
(funcall (if condition #'do-something #'identity) datum) ; if you like convoluted code
17:35:55
oleo
(progn (when (not predicatedp) datum) (dosomething predicatep)) or if you are in an implicit progn would do too
17:37:18
didi
Maybe I should write a macro like (do-when predicatep fn datum). Doesn't look better, tho.
17:38:42
z3t0
I'm trying to understand spatial-trees and I get the idea of it but am a bit confused regarding implementation
17:43:51
z3t0
Can anyone help me understand https://github.com/rpav/spatial-trees/blob/master/tutorial.lisp line 30
17:54:37
z3t0
how do i use the package "rectangle" from https://github.com/rpav/spatial-trees/blob/master/api.org
17:55:03
z3t0
I am using quickload which gives spatial-trees as an object but i cant figure out how to access the rectangles package
17:58:10
Bicyclidine
it looks like there should be a rectangles package as part of the spatial-trees system?
18:05:08
oleo
it informs you of symbol conflicts between the rectangles and the spatial-trees package
18:21:08
oleo
by loading systems you get the packages but there's no way to get the packages alone via asdf
18:21:45
oleo
or at least know which systems contain it as a component and load one of the supersystems
19:41:54
oleo
well if you deleted some of your directories in the quicklisp branch, just do another load with quicklisp and it will redownload some stuff
19:42:26
dxtr
My actual problem is that cl-sdl2 broke and I suspect it might be because I have updated sdl
19:53:54
White_Flame
quicklisp itself doesn't hold anything but the project sources, so you don't need to erase & redownload those, unless you suspect your filesystem is corrupted or something trampled the data there
20:17:26
iqubic
So a macro can only consist of a single body form? Which is expected to be the backquoted replacement code?
20:18:18
Shinmera
A macro can consist of any number of body forms, but it can only /return/ a single one.
20:22:11
iqubic
Can a macro have multiple s-exps in the body, so long as it only returns a single s-exp?
20:23:15
dlowe
iqubic: yes. It can also return a PROGN form, so you can still do multiple things from a macro
20:27:30
pjb
(defmacro one-of ((&body body) &rest other-bodies) `(case (random ,(1+ (length other-bodies))) (0 ,@body) ,@(let ((i 0)) (mapcar (lambda (body) `(,(incf i) ,@body)) other-bodies)))) (macroexpand-1 '(one-of ((print 'hi)) ((print 'fizz) (print 'buzz)))) #| --> (case (random 2) (0 (print 'hi)) (1 (print 'fizz) (print 'buzz))) ; t |#
20:29:56
pjb
iqubic: Common Lisp: A Gentle Introduction to Symbolic Computation http://www.cs.cmu.edu/~dst/LispBook/ http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/user/dst/www/LispBook/index.html
20:32:28
pjb
If the *read-base* is 2. then (+ 1 2) is read as a lists containing two symbols, + and \2, and a fixnum: 1.