Search
Friday, 14th of July 2017, 7:58:59 UTC
8:17:51
earl-ducaine
No meddling in the dark arts tonight. Learned my lesson with the pail and broom. Thanks for the help!
12:31:36
Thetabit_
I'm having some trouble with Emacs + Slime + SBCL. I have a fairly bare bones setup because I have to do my development on a windows box. But SBCL keeps crashing and locking Emacs up. I don't experience the crashing in a linux environment so I am wondering if Emacs + SBCL + Slime are the best when working in Windows. What do you guys think?
12:37:19
|3b|
Thetabit_: sbcl+emacs+slime works fine for me on windows
12:38:48
|3b|
ACTION uses emacs from msys2/mingw, slime from quicklisp, and sbcl from git
12:39:51
Thetabit_
Use I am just using the msi version of emacs
12:40:03
Thetabit_
I'll give the mingw a try
13:29:32
thetabit
I'm reading PCL and going thru the function section. I am trying to 'call' each function in a list which using a loop, instead I am looking to (apply #'funcall (list fn1 fn2 fn3)) but this does not seem to work. What am I missing
13:31:00
phoe
(apply #'funcall (list fn1 fn2 fn3)) should work
13:31:28
thetabit
let me get a paste of the full source.
13:31:36
phoe
(defun fn1 () (print "hello")) (defun fn2 () (print "allo")) (defun fn3 () (print "hola")) (apply #'funcall (list #'fn1 #'fn2 #'fn3))
13:32:26
phoe
(mapc #'funcall (list #'fn1 #'fn2 #'fn3))
13:32:38
phoe
if you want the result values, use MAPCAR instead of MAPC
13:32:58
thetabit
http://paste.lisp.org/display/350831
13:33:33
phoe
first of all, STX-PROCEDURE has a &REST lambda list
13:34:01
phoe
and second, you want to use MAPC instead of APPLY in DEFUN STX-PROCEDURE
13:34:15
phoe
and then call (stx-procedure 'stx-procedure-1 ...)
13:34:27
thetabit
Oh, &Rest not correct? Is it not necessary?
13:34:51
phoe
except &rest captures all remaining arguments to a function
13:35:02
phoe
like, #'+ has a &rest lambda list
13:35:09
phoe
so (+ 1 2) and (+ 1 2 3 4 5 6 7 8 9) works.
13:35:19
phoe
but you don't call (+ (list 1 2))
13:35:34
phoe
that's why I say the final line of your quote has a redundant call to LIST
13:36:48
thetabit
Alright, I will rework it.
13:36:52
thetabit
Thanks for the pointers
13:38:16
phoe
that's a 64-bit pointer, hope it's useful
13:42:08
axion
How can I loop over a list of plists with LOOP, and destructure the values of each?
13:42:41
phoe
axion: destructure the values of each? what do you mean?
13:42:59
axion
like :for (v1 v2 v2) :in ...
13:43:18
phoe
(loop for plist in plists do (loop ...)) first and foremost
13:43:39
axion
Ok, I was wondering if i neded to nest
13:43:52
phoe
and in the inner list, you have a plist, and you want to iterate over a set of plist key/value pairs, correct?
13:44:05
axion
I know how to do it if it's nested
13:44:06
specbot
http://www.lispworks.com/reference/HyperSpec/Body/f_get_pr.htm
13:44:28
phoe
and if you have two layers of iteration, I think you always need to nest with LOOP
13:47:17
axion
Hmmm I'm pulling out keys
13:52:46
thetabit
phoe, used the mapcar... wow cl is really cool! :D
13:52:53
phoe
thetabit: welcome to the CL land :)
13:55:28
tetero
thetabit: It sure is :-)
16:37:40
random-nickname
** NICK random-nick
16:50:13
slark
Hello, i learnt how to create closures in the gigamonkeys tutorial, but i am not sure how and why to use them.
16:50:36
slark
do you have some ideas on where closures are good to be used?
16:50:52
beach
slark: Suppose you want, for a given X, find the first element in a list that is greater than X.
16:51:26
beach
slark: You could do (defun find-greater (x list) (find-if (lambda (y) (> y x)) list))
16:51:44
beach
Now, (lambda (y) (> x y)) is a closure.
16:52:12
slark
beach: indeed i used to use this, but didnt think at all it use the power of closure
16:52:47
slark
beach: ok i understand :)
16:53:13
slark
beach: but i mean you ahve to use closure in this expression
16:53:27
slark
you have no choice i think cause it is designed this way ?
16:53:37
beach
I am not sure what you are asking.
16:54:08
slark
beach: yeah sorry.. i mean when i am designing code, in general, where should i use closure ?
16:54:11
beach
Dinner. I'll leave you in the hands of other #lisp participants.
16:54:39
slark
beach: nice :) good lunch
16:54:44
Bike
you use closures when they help, like in this example
16:54:51
Bike
it's not something you need to think too hard about
16:59:27
nosefouratyou_
wow I completely don't understand (defun find-greater (x list) (find-if (lambda (y) (> y x)) list))
16:59:59
nosefouratyou_
so (find-greater (5 ('1 9 4 19)) -> 9
17:00:51
Bike
find-if finds the first element of list that satisfies the predicate (lambda (y) (> y x))
17:01:15
nosefouratyou_
Bike: right, I get what it does, just not how it does it
17:01:24
Bike
you don't get how find-if works?
17:01:39
nosefouratyou_
because initially x is a number, but the inner find-if call passes a function as x, right?
17:02:29
Bike
i don't even know what you're saying, but x is just 5 for you.
17:03:20
nosefouratyou_
Bike: my bad, I thought find-greater/find-if were the same function. I was misreading it.
17:15:25
slark
in the chapter 6 in gigamonkeys tutorial there is this footnote: http://paste.lisp.org/display/350852
17:16:52
slark
what does it mean? does it mean we can use dynamic bindings in multithreaded application without problem ?
17:17:39
slark
let say a global variable *stream-output*
17:17:58
kang0
Which books in computer science or coding field; one must have /recommended to have in hard copy or printed form instead of ebooks
17:19:01
knusbaum
slark: Sure you can use dynamic bindings.
17:20:31
slark
knusbaum: so i will not have to mess up with "lock" and kind of stuff if my threads have access to this *stream-output* if i use dynamic bindings ?
17:21:04
knusbaum
That's not quite what I meant.
17:21:37
knusbaum
If multiple threads are accessing the same object, you still have to synchronize that access.
17:21:49
knusbaum
But that has nothing to do with dynamic binding.
17:22:54
slark
knusbaum: ok i understand
17:23:50
knusbaum
slark: This is what the footnote was talking about: http://paste.lisp.org/display/350854
17:23:56
slark
knusbaum: dynamic binding is kind of global variable shadowing with the same name as the global variable
17:24:27
slark
knusbaum: thx for the snipet
17:28:08
slark
knusbaum: ok so the second thread take the variable as global cause the dynamic binding is related to the 1st thread
17:28:23
slark
knusbaum: thx :) i fully understand the notes now
17:48:27
beach
slark: Dinner, not lunch. But, what Bike said. Closures don't play a great strategic role in Common Lisp. They are used for tactical reasons in situations like I showed.
17:48:58
slark
beach: ok, was just asking cause in javascript closures is kind of BIG THING
17:49:06
slark
a lot of debate around it
17:49:11
beach
slark: Sorry to hear that.
17:49:23
beach
kang0: You need to start sticking to the topic of this channel.
17:53:20
beach
slark: The book SICP (based on Scheme) uses closures strategically, because they allow encapsulation of state. But Common Lisp has CLOS, with its classes and generic functions (which is more flexible and more powerful), so we don't use closures that way.
17:54:58
beach
Anyway, time to go hang out with my (admittedly small) family.
17:58:09
kang0
Which programs or softwares needs to be installed in computer while reading or trying book sicp
18:03:37
slark
kang0: i use emacs + slime and my lisp is common lisp
18:04:26
slark
kang0: but in scip they use scheme, so if you are a bit familliar with lisp in general it should be OK to work with common lisp while reading scip
18:04:46
slark
kang0: else it is probably better to install scheme
18:04:49
knusbaum
I would stick with scheme.
18:05:57
Bike
i think racket has a sicp mode.
18:06:28
slark
kang0: a text editor and scheme is enough i think
18:07:23
kang0
Not sure whether I have common lisp or not
18:08:15
kang0
Can you link me scheme for Linux? slark
18:11:54
knusbaum
kang0: http://racket-lang.org/
18:12:07
slark
kang0: all linux distro use great official reposority where you can download everything you want in 1 command line check your distro package documentation
18:12:45
slark
kang0: if for some reason your linux distro doesnt provide racket follow knusbaum link
18:20:00
slark
kango, for a solo beginner maybe you should go common lisp (clisp/sbcl) more materials on it, book, tutorial and communauty
18:20:51
slark
kang0: this is a common lisp interpreter as is clisp
18:21:56
kang0
Perl has something equivalent
18:22:10
kang0
What's such equivalent in lisp and scheme
18:22:18
kang0
Is it called collection of modules?
18:23:23
knusbaum
https://www.quicklisp.org/beta/
18:34:56
kang0
Was disconnected lost the log
19:13:25
nosefouratyou_
does anyone here use sly?
19:55:11
Xach
slime is on my "try soon" list
Friday, 14th of July 2017, 19:58:59 UTC