Search
Tuesday, 26th of September 2017, 17:17:47 UTC
17:20:40
z3t0
how can i create a 2d array indexed by floats?
17:20:53
z3t0
So in my example I have latitude and longitudes for each image
17:25:00
_death
you don't.. array indices are integers
17:28:20
didi
I wish I had a better form than (if predicatep (do-something datum) datum).
17:29:38
oleo
that's exactly what if is for
17:30:27
didi
It is more about the concept. I want to do something to datum only if predicatep.
17:30:58
didi
But then `when' evals to nil.
17:31:00
shrdlu68
(or predicatep (do-something datum))
17:31:25
didi
shrdlu68: It evals to nil too.
17:31:44
didi
Actually, it evals to `predicatep'.
17:32:47
didi
So I want datum if (not predicatep).
17:33:14
oleo
(when (not predicatedp).....
17:33:37
didi
I think it still doesn't do what I want.
17:34:12
didi
That's what I've been doing, yes.
17:34:31
oleo
but we don't get the point
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:36:22
oleo
err dosomething datum i meant yea
17:37:18
didi
Maybe I should write a macro like (do-when predicatep fn datum). Doesn't look better, tho.
17:38:14
_death
didi: indeed, stick with the IF
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:39:11
oleo
what is it about actually ?
17:39:41
oleo
someone is planting on the moon or so ?
17:40:37
z3t0
its a tree data structure that is used for spatial data, eg location
17:41:55
oleo
and why you need a tree for that ?
17:43:12
z3t0
It's a good way to do searches based on space
17:43:30
z3t0
eg if you want to find the number of object within a certain unit
17:43:39
z3t0
Though I'm doing a terrible job explaining it ..
17:43:51
z3t0
Can anyone help me understand https://github.com/rpav/spatial-trees/blob/master/tutorial.lisp line 30
17:45:34
z3t0
actually nevermind i think i've figured it out
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?
17:59:02
oleo
it should be already there try (find-package :rectangles) or so
18:00:17
oleo
https://github.com/rpav/spatial-trees/blob/master/rectangles.lisp
18:00:49
oleo
https://github.com/rpav/spatial-trees/blob/master/spatial-trees.asd
18:02:43
oleo
https://github.com/rpav/spatial-trees/blob/master/package.lisp
18:04:50
oleo
https://github.com/rpav/spatial-trees/blob/master/api.org and read that one too
18:05:08
oleo
it informs you of symbol conflicts between the rectangles and the spatial-trees package
18:05:20
oleo
and how you can resolve it
18:14:22
oleo
did you find your package ?
18:17:59
z3t0
i used a defpackage and used :use rectangles
18:18:07
z3t0
but I can't seem to do that for spatial-trees.nns
18:18:32
oleo
just look thru the sources
18:19:42
z3t0
I think i just need to figure out how packages work
18:20:13
oleo
you need to figure out asdf
18:20:30
oleo
with asdf you only have systems
18:20:43
oleo
some components will be files some modules some other systems
18:20:55
oleo
the files may contain pacakge definitions
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:28
oleo
in order todo that you have to know in which file it is and load it
18:21:45
oleo
or at least know which systems contain it as a component and load one of the supersystems
19:39:54
dxtr
how do I reinstall a package with quicklisp?
19:40:27
XachX
Like, replacing what is there?
19:40:31
dxtr
XachX: Optimally I just want to force a rebuild
19:40:44
oleo
(quicklisp:quickload :blah :force t) ?
19:40:48
XachX
Oh. There are many ways. You could use asdf directly.
19:41:05
oleo
(asdf:load-system :blah :force t) sorry
19:41:05
dxtr
How would I achieve this with asdf?
19:41:06
XachX
Deleting fasls is an option too.
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:42:39
dxtr
So I just wanted to rebuild it and see if that fixes it
19:51:44
White_Flame
dxtr: rm -rf ~/.cache/common-lisp/
19:52:11
White_Flame
and if it's early build stuff, rm -rf ~/.slime/fasl/
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
19:55:56
oleo
quicklisp/dists/quicklisp/software/
19:56:06
oleo
i sometimes deleted some stuff
19:56:52
oleo
i instead should have learned howto register stuff and unregister....
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:17:45
dlowe
it doesn't have to be backquoted
20:17:52
dlowe
backquoting is just convenient.
20:18:09
iqubic
How does a macro work when not backquoted?
20:18:18
dlowe
because lisp is made of data, not text
20:18:18
Shinmera
A macro can consist of any number of body forms, but it can only /return/ a single one.
20:18:33
dlowe
so a macro can return any list
20:18:53
iqubic
Oh. Right you could use list and quote all the elements
20:19:41
dlowe
(defmacro infix (&rest args) (list (second args) (first args) (cddr args))
20:20:24
dlowe
;; TODO: make work with more than three arguments
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:22:50
Shinmera
Read what I said above.
20:23:15
dlowe
iqubic: yes. It can also return a PROGN form, so you can still do multiple things from a macro
20:25:35
pjb
iqubic: nope, you can define macros with multiple body forms.
20:25:39
iqubic
If I quote something, it returns a symbol, right?
20:26:08
iqubic
So 'foo returns the symbol foo?
20:26:57
Shinmera
Quote prevents evaluation, so it returns a literal.
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:27:49
pjb
iqubic: if you quote something it returns something.
20:28:00
iqubic
What is the difference between a symbol and a literal?
20:28:08
pjb
'42 --> 42 '(not a symbol) --> (not a symbol)
20:28:25
iqubic
pjb, that's not explaining it.
20:28:27
pjb
a symbol is a symbol; a literal is what is quoted (or self-evaluating).
20:28:30
dlowe
iqubic: remember I mentioned lisp is made of data objects and not text?
20:28:47
dlowe
iqubic: quoting returns the data objects passed into it
20:28:53
oleo
it has an underlying datastructure
20:28:57
dlowe
iqubic: instead of attempting to evaluate it
20:29:03
pjb
'#S(point :x 1 :y 3) --> #S(point :x 1 :y 3)
20:29:23
oleo
it is woven into the implementation at the time of it's extantiation
20:29:26
dlowe
iqubic: '(+ 1 2) => (+ 1 2) while (+ 1 2) => 3
20:29:54
iqubic
'(+ 1 2) is a list containing three symbols?
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:30:09
pjb
'(+ 1 2) is a list containing one symbol and a list.
20:30:23
pjb
'(+ 1 2) is (quote (+ 1 2)) quote is a symbol (+ 1 2) is a list.
20:30:50
dlowe
iqubic: it's a list containing three "atoms"
20:31:07
pjb
(loop for item in ''(+ 1 2) do (format t "item: ~S is a ~S~%" item (type-of item)))
20:31:39
pjb
(+ 1 2) is (read as) a list that contains something that depends on the *read-base*.
20:31:57
pjb
(+ 1. 2.) is a list that contains a symbol + and two fixnums 1 and 2.
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.
20:43:13
iqubic
Macros are really confusing me right now.
20:46:21
iqubic
And I'm not understanding them.
20:46:47
oleo
you don't do them until you have to
20:53:49
iqubic
Well, I solved my issue. I had forgotten to unquote a variable name in my macro expansion.
21:06:48
iqubic
Now that I have successfully created a macro, I understand how and why you use them.
21:18:54
Fare
congrats, you're now a lisper.
21:23:52
fe[nl]ix
iqubic: now you're in for a lifetime of disappointment
21:37:31
iqubic
I finally got my macro to work.
22:46:30
stylewarning
fe[nl]ix: will you accept some addl features to static-vectors?
22:47:08
stylewarning
fe[nl]ix: I wrote a patch to expose a function that separates SBCL's widetag calculation from the allocation, because I actually want to allocate using something different than the standard foreign allocator
2:19:51
z3t0
how do people generally deal with the lack of libraries for lisp? for the most part I don't have an issue but when trying to use something like opencv (computer vision) or graphics I have a lot of trouble with common lisp
2:20:27
z3t0
Some of these have c bindings so i can use cffi but often they have c++ bindings. I looked up swig but it seems that it only supports allegro common lisp
2:25:55
ebrasca
z3t0: You can write it.
2:26:23
z3t0
ebrasca: I could definitely do that but I have no idea where to start, how do I write a common lisp wrapper for a c++ library?
2:26:58
z3t0
I did some searching before and basically was led to the conclusion that it wasn't a realistic project for a sufficiently complex project
2:27:40
ebrasca
z3t0: I have find this with google. https://github.com/BSeppke/vigracl
2:28:09
z3t0
but they use the c binding wrapper rather than c++
2:28:17
z3t0
at least as far as I can tell
2:31:15
ebrasca
z3t0: Good luck finding it.
2:31:35
ebrasca
z3t0: I need to go to bed.
2:31:36
z3t0
i'll probably just end up using the c library
3:44:18
beach
Good morning everyone!
4:30:00
spaceplu-
** NICK spacepluk
4:53:58
myrkraverk
z3t0: I've made a wrapper for a C++ library, by first making a C wrapper.
5:04:12
pillton
You can also use interprocess communication.
5:05:30
beach
I think that's a much better idea.
5:06:09
Zhivago
The nice thing is that you can then put it on another machine.
5:07:41
z3t0
beach: thanks i was thinking along the same lines
5:07:57
z3t0
I just try and find "pure lisp" methods where possible
5:08:20
pillton
Or you could compile the C++ library to web assembly and interpret the webassembly in common lisp.
5:08:28
beach
z3t0: I totally agree. But then, sometimes you have to bite the bullet and write a library.
5:12:03
z3t0
pillton: please dont even hahah
5:13:56
beach
z3t0: I don't think that was a joke. I think that must be what froggey does in order to run C code in Mezzano. No?
5:14:13
z3t0
I thought we were making a stab at js
5:14:24
z3t0
and their new framewokr every day ecosystem
5:14:59
pillton
asm.js is not WebAssembly.
5:16:08
pillton
I wasn't joking. It is a better strategy long term in my opinion. CFFI allows the foreign function to crash the lisp process.
Wednesday, 27th of September 2017, 5:17:47 UTC