freenode/#lisp - IRC Chatlog
Search
0:40:43
emaczen
how does restart-inferior-lisp work exactly? I would like to perform this function programmatically
0:41:19
Xach
emaczen: i don't know, but if i wanted to find out, i'd look at the source of slime-restart-inferior-lisp
0:42:44
whartung
then the question doesn’t make much sense since the “inferior lisp” is an emacs concept
0:43:07
emaczen
Xach: Yes, my question is how do I perform this same function, preferably without emacs
0:43:38
whartung
you tell the lisp to die elegantly and restart it, or you kill it (politely or forcefully) and restart it
0:44:18
whartung
you restart programmaticlaly just like you start any program programatically (i.e. exec as mentioned)
0:44:19
jasom
emaczen: then wrap lisp with a program that manages it and setup a way to signal it from lisp, or you can try exec hacks if you're on *nix as others have suggested
0:46:01
pjb
Now the thing is that exec is a little violent. Perhaps you would want to terminate gracefully the current process.
0:46:30
pjb
Then you could try something like: (if (zerop (fork)) (progn (sleep 3) (swank/backend:exec-image "ccl")) (quit))
0:49:05
emaczen
Actually, I think I could use run-program in a loop, and use my lisp program as the executable
0:56:01
jasom
evaluating a simple DEFUN on firefox: 258s same DEFUN on chrome under 1s... I'm thinking perhaps I found a GC corner case on firefox
0:59:44
Xach
I believe uiop/foo and asdf/foo are meant to be treated as implementation details, and you are supposed to use uiop:whatever instead.
1:00:23
jasom
but honestly I check uiop for any system functionality that isn't in the hyperspec and alexandria for any algorithmic functionality that isn't in the hyperspec
2:04:43
pjb
whoman: for very simple uses of CLOS, a direct mapping could work. If you declare all your methods virtual.
2:05:59
pjb
whoman: you will have more difficulties translating that, (and even more, such as custom method combinations), into direct C++ code.
2:06:36
pjb
whoman: notice that you could use the MOP in C++, cf. OpenC++ http://informatimago.com/articles/life-saver.html
2:06:54
pjb
whoman: but it's a patch to an old gcc which hasn't been ported to more recent gcc, much less to clang.
2:07:57
pjb
oh, right, it's also easy to find at least light use of the MOP in CLOS programs! Then you won't have a direct translation to C++. (unless you upgrade and use OpenC++ MOP).
2:15:43
Bike
even if it did, it wouldn't really work the same, since in C++ many objects are destructed upon leaving scope
2:20:26
stacksmith
Is there an idiomatic way of 'unflattening' a list - that is turning a list like (a b c) into (a (b (c)))?
2:24:22
Bike
(defun unflatten (list) (cond ((null list) nil) ((null (rest list)) (list (car list))) (t (list (car list) (unflatten (rest list))))) is all i can think of.
2:28:26
stacksmith
It's actually to convert a DSL that is linear to a functional notation. LIke ((fun1 a)(fun2 b)(fun3 c)) to (fun3 c (fun2 b (fun1 a)))...
2:29:46
stacksmith
And insert the result of each function application as an extra argument into the next.
2:30:25
ig88th
I am currently having issues having ASDF/quicklisp load projects. I wrote a better description of my problem here: https://stackoverflow.com/questions/48675274/when-installing-quicklisp-on-windows-10-where-should-i-put-config-common-lis
2:31:12
ig88th
I don't know if anyone else uses Common Lisp on Windows, but I would really appreciate any suggestions
2:34:30
ig88th
Xach: I get the same error when I just try to use ~/quicklisp/local-projects: https://gist.github.com/ig88th/4338184cec847f6eef6e01baa94b538e
2:39:33
pjb
whoman: well, going from C++ to CLOS is another can of worm, sincee in C++ the methods are attached to the classes, while in CLOS they are attached to generic functions.
2:40:10
pjb
whoman: however, it is possible to NOT use CLOS (or use it only as the basis to implement the following), but to implement an object system in CL that matches the C++ object system.
2:40:21
ig88th
Xach: I am using the most recent version of Clozure CL, 1.11.5, and the 64-bit version
2:40:25
pjb
whoman: if you have a lot of code to convert, this would be a good idea to do it that way.
2:41:03
pjb
whoman: in that case, you basically implement the C++ object system into CL, just like CLOS is implemented in CL.
2:41:42
ig88th
Xach: I am getting 'System "swatch" not found [Condition of type QUICKLISP-CLIENT:SYSTEM-NOT-FOUND]' after running (ql:register-local-projects) and then trying to quickload
2:41:48
stacksmith
So (defun chain (list) (when list (append (car list) (list (chain (cdr list)))))) is the best I could do... after reversing...I can't believe there is not a tool for 'functionalizing' lists...
2:42:24
pjb
(you may need to add some syntactic support, ie. define some with- macro to make it simple, otherwise you could have to implement a sophisticated code walker and compiler-like algorithms to implement RAII and destructors with the same semantics as in C++).
2:42:59
pjb
Notice that in most CL implementation, there's a finalizer mechanism that can be used for dynamic destructors.
2:43:05
Xach
ig88th: ok! so can you tell me what you get from (directory "~/quicklisp/local-projects/**/*.asd")?
2:43:39
ig88th
Xach: I get '(#P"C:/Users/ig88t/quicklisp/local-projects/swatch/system.asd" #P"C:/Users/ig88t/quicklisp/local-projects/swatchblade/system.asd")'
2:44:31
pjb
But yes, I would say that RAII is a bad abstraction. We have unwind-protect and with- macros.
2:44:37
Xach
ig88th: Oh, I think I see the trouble. I think it could be a bug in quickproject! I think you might have better luck if you use a trailing slash on the pathname you give to make-project.
2:45:41
ig88th
Xach: same error when I use a trailing slash such as (quickproject:make-project "~/quicklisp/local-projects/swatch2/" :depends-on '(vecto hunchentoot))
2:46:34
ig88th
Xach: now I get (#P"C:/Users/ig88t/quicklisp/local-projects/swatch/system.asd" #P"C:/Users/ig88t/quicklisp/local-projects/swatch2/system.asd" #P"C:/Users/ig88t/quicklisp/local-projects/swatchblade/system.asd")
2:46:56
pjb
whoman: also, perhaps you could consider clasp, since it integrates C++ with CL natively.
2:47:12
Xach
ig88th: Ok. I don't know why quickproject is creating system.asd instead of the proper name. The short-term fix is to rename system.asd to what it really should be, or to not use quickproject for now.
2:47:20
whoman
yes i am on the page now, but i have no system to compile it. i also looked a bit at ECL
2:47:55
pjb
whoman: ecl can be compiled using a C++ compiler instead of a C compiler, but I don't know what that brings in terms of C++ integration with CL. Ask in #ecl.
2:48:24
Xach
ig88th: oh, one more question, what do you get from (ql:where-is-system "quickproject")?
2:49:04
ig88th
Xach: sure. I get '#P"C:/Users/ig88t/quicklisp/dists/quicklisp/software/quickproject-1.3/"' when I run (ql:where-is-system "quickproject")
2:50:02
Xach
ig88th: ok. i see that quickproject doesn't work properly in ccl, so I'll try to figure it out. Thanks for the info!
2:51:33
ig88th
Xach: also I stumbled on this line of code and thought it might be related: https://github.com/quicklisp/quicklisp-controller/blob/master/asdf.lisp#L6247
3:32:13
ig88th
Xach: but it took creating a project using quickproject with sbcl to be able to load it; the quickproject creations under ccl are unable to be loaded
3:42:04
ig88th
Xach: actually it looks sort of complicated. It seems I can only load projects created within that slime session with sbcl; when I restart emacs and slime I can no longer load that project.
3:43:53
Xach
ig88th: i wish i could help but it's time to sleep. interactive debugging will be required.
3:59:24
drmeister
Is there a function that takes a list of symbols and returns the list of unique symbols?
4:14:03
beach
iqubic: When we write LISP, we usually mean some pre Common Lisp language. We have written in "Lisp" for several decades.
4:14:44
White_Flame
but yeah, the modern statistical AI is just math, doesn't need any special language support like symbols & metaprogramming
4:14:53
iqubic
Really? The people in #emacs were telling me that I should use python, and then called me a troll for not knowing much about AI.
4:16:42
pjb
iqubic: for statistical methods, languages more optimized for the current hardware may be more indicated (eg. cuda if you use nvidia hardware).
4:16:54
White_Flame
obviously things like computer vision are going to be crunching lots more numeric arrays than logical inference
4:17:17
pjb
iqubic: however, statistical methods are not the be all-end all of AI methods. Currently, commercial ventures are totally losing sight of symbolic methods.
4:18:01
pjb
iqubic: cf. the point of view about AI of people like Hofstadter https://www.youtube.com/results?search_query=Hofstadter+AI
4:18:46
pjb
iqubic: and then, even if you consider statistical methods, I would consider using lisp to compile high level system definitions and compose statistical modules, including at run-time.
4:18:46
White_Flame
when people say "AI" unadornedly, they're usually talking about some variant of "machine learning" today
4:19:56
iqubic
All I'm trying to do is write a program that works to get the highest score in the game 2048.
4:24:48
iqubic
The original question: "What stratergy do I think will wrok best for a program that plays 2048?"
4:27:14
iqubic
Let me ask another question than. Is there a CL graphics library that works with SBCL.
4:28:42
White_Flame
cepl brings graphics more native to CL style, rather than just being raw opengl bindings
4:30:07
White_Flame
I'd think you're usually opening up a separate opengl context GUI window, so it doesn't matter how you're talking to the lisp image
4:32:25
iqubic
White_Flame: What I really want is emacs company completion and documentation via C-h f / C-h v for whatever library I use.
4:33:24
White_Flame
whether it's a database connector library, or a graphics connector library, or soket connector library, all the same
4:33:54
iqubic
Yes, but I have no idea how to tell emacs what libraries I'm using so that it can fetch the documentation I need.
4:34:25
White_Flame
well, I haven't used documentation features, if you're talking about mor ethan docstrings
4:43:48
beach
iqubic: When we write LISP, we usually mean some pre Common Lisp language. We have written in "Lisp" for several decades.
4:46:31
beach
iqubic: I see two reasonable definitions of "interpreted language". The first one is that the language CAN BE implemented by an interpreter, and the second is that it HAS TO BE implemented by an interpreter. The first definition implies that every language is interpreted, and the second definition that no language is interpreted.
4:47:24
beach
iqubic: Well, you could try doing a little bit of research on your own. Terms like "computer vision" I am sure have Wikipedia entries.
4:48:40
beach
"The term is somewhat vague. In principle, any language can be implemented with a compiler or with an interpreter"
4:52:32
beach
iqubic: I agree with White_Flame. This channel is about Common Lisp, not about you. Try to keep the question more Common Lisp related.
4:53:10
White_Flame
but I think the real fundamental issue is you're probably trying to bite off more than you can chew at once
4:53:32
White_Flame
you need to work with some simpler problems before jumping right into opengl + AI + CLOS + whatever else
4:58:33
pjb
iqubic: you cannot understand OO if you know C++. You have to learn Smalltalk to understand OO. Smalltalk is simple. (It's made for children).
4:59:08
pjb
iqubic: alternatively, you may learn Objective-C, which is C+Smalltalk, but it's more complicated because of the C part.
4:59:48
pjb
iqubic: Sometimes, in universities, one learns OO by implementing it in lisp (or scheme), instead of learning Smalltalk. It's also a good way to do it.
6:21:40
krwq
hello, does anyone know if there is a way to make swig generate valid fields from the header file which uses bitfields? it currently seems to be generating for 4 :unsigned-int fields instead of 29+1+1+1 bit numbers
6:41:08
krwq
I ended up with %ignore in swig file and redefining the struct by myself using a single uint - ifanyone knows a better way to handle that please let me know
10:18:56
flip214
I've got a GF with multiple methods which have EQL specializations on the first argument.
10:19:19
flip214
I can list them via GENERIC-FUNCTION-METHODS, but how would I selectively call one of them?
10:21:27
beach
flip214: That would not be a typical use case for generic functions and methods. It would be best to call the generic function with the EQL specializer in question.
10:23:59
JuanDaugherty
iqubic, because a) it developed over a long time and b) it is the inherently most flexible OOP mechanism, a generic meta one in fact
10:24:54
hajovonta
is it possible for a function to determine the other function it was called from?
10:26:03
hajovonta
like when I call (fun1 param1 (fun2 param2 param3)) and inside fun2 I would need some information that it was called from fun1
10:27:15
flip214
beach: I'm trying to use CLOS as a mechanism to get a kind-of plug-in architecture...
10:27:50
JuanDaugherty
also cl is the more baroque lisp, you might find the scheme oop, whatever it is more to your liking
10:28:03
hajovonta
jackdaniel: thanks. portability is currently not a problem for me as I only have SBCL here
10:28:17
flip214
I quite like the automatic documentation and availability of debugging via swank/slime etc.
10:28:44
jackdaniel
hajovonta: checking where function was called from is also wrong from the technical perspective
10:28:44
flip214
so I should parse the EQL specifier and call the GF with the right first value, right?
10:29:02
Shinmera
hajovonta: Dissect will give you an object representation for the stack rather than just a string like trivial-backtrace does
10:29:07
jackdaniel
if you customize behavior based on that your program will be automatically unintelligible
10:29:16
scymtym
flip214: for a certain style of pluggable implementations, you may find https://github.com/scymtym/architecture.service-provider useful
10:32:41
beach
flip214: I would just use a hash table instead if I understand your use case correctly.
10:35:58
hajovonta
what I don't understand is where are the first two SBCL-CALLs in the environment-stack object
10:37:11
|3b|
flip214: looks like github's .org renderer got confused... makes a bit more sense in original
11:29:44
ecraven
well, I wouldn't call it an improvement ;) but it does make kawa work with slime, which is nice
11:32:18
jackdaniel
I think that scope of change impact is a better metric than scope of changes wrt improvement
12:27:23
Shinmera
Is initialize-instance called for condition objects? define-condition talks about initialize-instance in the :initarg option, but (on SBCL) initialize-instance does not seem to get called when I create a condition.
12:27:51
Shinmera
Which is annoying as fuck, since I'd like to compute some slots based on an initarg.
12:34:02
Shinmera
So what's this about then in CLHS for define-condigion: "The :initarg slot option declares an initialization argument named by its symbol argument and specifies that this initialization argument initializes the given slot. If the initialization argument has a value in the call to initialize-instance, the value is stored into the given slot, and the slot's :initform slot option, if any, is not evaluated."