freenode/#lisp - IRC Chatlog
Search
20:24:48
dmiles
how teribile would it be to define LABLES via defun but on the topelevel but name prefixed by where it was found in?
20:28:19
mrottenkolber
dmiles: https://github.com/eugeneia/microlisp/blob/master/macros/standard.lisp#L155
20:34:38
pjb
(defun foo (x) (labels ((f (a) (* a x))) (loop for a below 3 collect (f a)))) (foo 3) #| --> (0 3 6) |#
0:18:35
paule32
also i understand it so: lambda fetch the last result and re eval it the operatorations that are given?
0:19:19
Bike
there must be resources in your native language. english clearly isn't working for you.
0:19:36
pjb
paule32: the clhs says that (lambda (x) …) is a short hand for (function (lambda (x) …))
0:20:03
pjb
paule32: then you have to click on function to read what function is, because you didn't read a fucking tutorial, so you fucking don't know what this means.
0:23:17
pjb
mason: international language. It's the single word most said in american movies, and understood everywhere in the world.
0:23:32
mason
Hey, a question: Is there something newer than IOLib I should consider if I want a relatively portable socket library that does nonblocking IO, or better, signal-based asynchronous stuff?
0:23:53
mason
pjb: Still. I have to think there's a gentler, nicer way to express the same sentiment.
0:24:38
Bike
paule32 has been around for literally a year, on this same program. they have made seemingly no progress. i don't know what else there is to say.
0:25:12
mason
Josh_2: That looks like general asynchronous execution. I'd be happiest with something that limits itself to socket IO.
0:26:51
mason
Ah, kk. wait-for-input looks like it's essentially select, which is good enough for me.
0:29:08
mason
fe[nl]ix: The docs I randomly found for IOlib looked like they were from 2010. I know old doesn't mean broken, but I didn't know if there was something I should be looking at instead.
0:29:42
pjb
paule32: if you know C++, then you should know what lambda is (approximatively): [](int x){return 4*x;}
0:30:04
mason
Anyway, I'll real about Usocket and IOLib more and see which seems closest to what I want. Thank you all.
0:32:06
mason
Argh, I need to go pick up dinner. I'll be back. I'll read scrollback. (TY in advance for clues.)
1:02:31
mason
fe[nl]ix: Honestly, select is probably enough - what I want is no wasted time if there is no traffic, but since what I really want is to be able to scale up to a fairly large number of connections, I won't realistically end up burning any time idling.
2:01:01
whaack
hi all, I am wondering whether or not it is possible for a function to return itself, and how I would go about doing that
2:03:50
pjb
(defun y (f &rest args) (apply f f args)) (y (lambda (myself) myself)) #| --> #<Anonymous Function #x30200309C69F> |#
2:10:14
whaack
if it returns itself then shouldn't you be able to call it n times and still get foo?
2:13:50
whaack
Bike: ah i see so you can never double parens to call a function returned by another function
2:14:06
pjb
So now the nice trick is to write a set of functions representing states of a DFA, each returning the next state function!
2:14:38
pjb
(loop for state = (function init) then (funcall state input) until (eql (function final) state))
3:57:43
aeth
Is there a way to not give an input stream EOF in uiop:launch-program, but also not hang up forever or fill the heap?
3:59:38
aeth
e.g. something like this: (uiop:launch-program "dc" :input input :output ouput) with a replish application (let's say dc, for simplicity).
4:01:27
aeth
Ideally, I'd want to be able to say something like "1 1 + p" and receive "2" without also sending EOF and ending the program. And then I could say "2 * p q" and get "4", which would only work if the state 2 was remembered. Of course "q" would quit it. (Or quit or exit, depending on the REPLish application running this way.)
4:05:39
aeth
(This would allow all sorts of cool things, including afaik an inferior-lisp emacs-style, at least sort of like how emacs does it.)
4:07:57
pjb
aeth: for bidirectional connection to a subprocess, it is usually needed to use more primitive syscalls.
4:09:15
aeth
How do applications run interactive shells that run interactive command line programs inside of them, then?
4:11:17
pjb
in the case of (let ((pi (uiop:launch-program program :input :stream :output :stream))) …)
4:12:08
pjb
then you can fork a thread to read on (uiop/run-program:process-info-output pi) and another to write to (uiop/run-program:process-info-input pi)
4:14:59
pjb
Notice that interactive programs have no specific synchronization mechanism. In general, they don't flush the input, so the user can input multiple commands before they're processed. (It's actually quite a bother to work with programs that do flush their input before each interaction, but sometimes it's needed, like when you want to read a password without echo, etc).
4:27:08
aeth
pjb: Oh, I see, something like this: (uiop/launch-program:process-info-input (uiop:launch-program "dc" :input :stream :output :stream))
4:28:08
aeth
except of course it'd be more let (let* ((process ...) (input (process-input process))) ...)
4:32:34
aeth
oh, and then of course it hangs because I never send it the quit message, but... success, I guess
7:23:58
aeth
Well, I've officially found something else other than compiling C++ that takes up 100% of all my cores (well, technically, all my threads). Chess engines.
7:24:56
aeth
This is constantly at 100% everywhere so it's actually the most parallel thing I've seen run on my CPU
7:29:02
aeth
There were minutes of this massive computational power before I stopped this chess engine while in the depth of 30, all so it could say "bestmove e2e4"
7:53:37
edgar-rft
aeth: It's definitely worth the massive computation effort, because once copmuted, the bestmove will win *all* future chess games, just because your opponent can't move any better.
7:58:16
B3nszy
I'm only familiar with Python as far as programming languages go and using Spyder as an editor
7:59:03
B3nszy
I got recommended SBCL/Emacs/SLIME for a development environment, what are those things
8:01:26
aeth
Emacs is a text editor, one of the traditional Unix text editors, next to ed (no one uses this) and vim (very popular because it's everywhere, but hard to use). Its main claim to fame is that it's very customizable, with lots of plugins, written in the dialect of Lisp called Emacs Lisp.
8:01:43
aeth
Naturally, it has good support for editing Lisps and Schemes since it's written in a Lisp (but not Common Lisp)
8:02:10
aeth
SLIME is the Emacs add-on that turns Emacs from a text editor into a full-featured Common Lisp IDE.
8:10:54
aeth
SBCL is not the only popular implementation. On IRC (which might be a biased sample), CCL and ECL are also quite popular. Common Lisp is not a single-implementation language and most software tries to be portable to as many implementations as possible.
8:18:32
edgar-rft
B3nszy, tutorials howto setup Emacs, Slime, and Lisp can be found here: <http://www.cliki.net/Getting%20Started>