freenode/#lisp - IRC Chatlog
Search
11:50:39
makomo
does anyone know why (let ((*print-circle* t)) ...) doesn't work but setf-ing it before executing the body of the let does?
11:51:31
beach
makomo: Perhaps you are returning a circular structure and you expect it to be printed as if *print-circle* is true?
12:00:19
Shinmera
beach: It seems like the kinds of people and discussions going on in this channel come in waves and tides, which is why I sometimes give up on it and leave for some time.
12:02:23
Shinmera
I don't ignore on principle because it's not context sensitive and won't stop people from responding.
12:04:51
beach
I have only used it once, and it was when someone explicitly asked to be ignored so that he or she could continue discussing commercial software in freenode without my complaining about it.
12:08:28
beach
Then we could ignore all topics such as "I wish the Common Lisp HyperSpec were different."
12:09:03
Shinmera
Or "common lisp is not popular because", "if people did X then...", "cl has to be popular", etc.
12:11:16
beach
What do you mean? Its name is #lisp, I ought to be able to talk about ANY Lisp dialect here.
12:12:53
Shinmera
I was trying to make a joke about these being the only discussions here, but yeah, enough grumpiness.
12:16:08
jackdaniel
one could wonder, if some (stupid) question is repeated over and over again by independent people could it mean, maybe it is not that stupid but rather there is some environmental misclue
12:19:47
dim
IMO it's mainly people who learn better by talking and don't bother reading docs and trying things out, and come directly here to chat about it, and hopefully build a reasonable mental model of lisp before they try things out
12:20:27
dim
so of course there's a lot of repetition, tutoring new beginners again and again... an eternal september of sorts?
12:21:50
Xach
I do hate "This is dumb and it shouldn't be this way" and "I'm just trying to finish a class, give me the answers"
12:21:51
dim
exactly, me neither, just not every day... (and I don't have proper answers that often anyway) ;-)
12:23:07
dim
some 15 years ago I would complete a friend's lisp assignements (he was sharing them on IRC) using librep (the kind-of lisp implementation for sawmill, then sawfish), it was fun times
12:25:41
makomo
i, for one, appreciate that you guys answer (nooby) questions over and over again because even though i have no problem reading formal references/docs, sometimes an actual dialogue with another human being helps in clarifying stuff
12:26:31
logicmoo
for myself the very advanced concepts are easy.. but very basic ones are not example of a basic one i have right now i do not think i found covered in books.. "would it be better to define symbols say in My-IMPL-SYS:*COMMANDLINE-ARGS* and have them reexported to EXT"
12:27:06
logicmoo
(i mean to say it might not be that simple of a question on but i think it is simple that if i have to ask.. then i really dont need to know)
12:30:32
dim
also CL provides so many ways to do things, sometimes it's hard to guess if you're going to be stuck because of a simple choice
12:30:37
makomo
people should be taught early to recognize such situations and how to deal with them
12:31:42
makomo
dim: i agree, that's usually what should be done. just go with it, don't think, do it.
12:34:21
logicmoo
ok1.. me makes a package called "SYSEXT" and nicknames it SYSTEM and EXTENSIONS .. while i am compiling all of ECL's ABCL's, and CLISP, and GCL systems to get a big ball of non interpreted functions
12:35:55
logicmoo
afterwards I will probly just put it all into system, then see what most of them vote belongs in EXTENSIONS
12:38:03
logicmoo
so far each lisp, supplies a different 70% (from the others) that ends up being ideal in my system
12:42:28
logicmoo
the hardest part in all of this is allowing myself is when i have to give up one or more of an individual well thought patterns by an impl
12:59:48
otwieracz
antoszka: ningle handles PATHNAME correctly. So when your route returns PATHNAME, then instead of somehow-sending-it it streams contents of the destination.
15:01:08
Bike
phoe: #' is basically defined to return `(function ,(read)), so yeah, whitespace is no prob.
15:05:25
crsc
phoe: I use vi more than 20 years now and it's hard to learn emacs. But I'll give it a try.
15:06:17
phoe
you might want to check https://spacemacs.org out since it's based on emacs's evil mode.
15:07:07
phoe
portacle has an upside of being self-contained, but if you have 20 years of vim experience, then I'm pretty sure you can hack your own environment up pretty quickly. (:
15:07:59
phoe
also, #lisp is a good place for Lisp questions but #clnoobs has been created specifically for CL learners.
15:16:45
Xach
More like it's close enough to emacs that the little differences are really distracting and offputting.
15:23:48
warweasle
I wanted a mixture of blender and emacs. It was too large a project for one person.
15:34:45
beach
makomo: #clasp is about the Clasp implementation of Common Lisp and #sbcl about SBCL.
15:35:04
makomo
beach: i've been in #clasp since i've been in #lisp. in fact, it's what drove me to start getting into CL more :-)
15:35:39
makomo
since i come from C++ and got intrigued by lisp, the combination seemed awesome to me
15:36:51
makomo
same with C++/Common Lisp, although they're pretty different languages so the comparison doesn't transfer that well
15:39:25
makomo
however, spacemacs comes with full vim keybinds set up for you (which is why i started using it myself) ;-)
15:50:34
sjl
flip214: no, but I haven't really been paying attention. I've been traveling a lot over the holidays.
15:50:36
flip214
I had a few email exchanges re bugs and features, but got no replies for ~.52 months.
15:51:07
flip214
I'm afraid that something bad happened... perhaps by drawing attention via the emails
15:55:42
flip214
the github contribution picture at https://github.com/l04m33 breaks off at the same time
15:56:58
sjl
It's possible they're just taking a break from computer work for a while. I've done it for a couple of months at a time in the past.
16:51:34
asarch
But I finally could understand the concept. From the point of view of JavaScript: "A closure is created when a function inside another function gets stored outside the outers function's scope while retaining references to a variable from the outer function".
16:52:50
asarch
So, if real life could apply closures, a closure would be like a photograph. Even when the people in the photograph have gone, you can "reference" to them by the picture
16:54:20
asarch
So, my next question is, why would you need closure? You could easy store the return value from a function in a variable
16:56:47
beach
asarch: When that form is evaluated, it returns a function of zero arguments, that, whenever called, returns a larger value.
16:57:30
beach
So the function/closure contains state in its environment, in this case, the value of the variable X.
17:01:12
beach
If you are not using SLIME, start with (defparameter *f* (let ((x 0)) (lambda () (incf x)))).
17:01:24
pjb
You can call the code, the code can process the data, but you cannot touch the data directly from outside.
17:03:21
Xach
Sorry. I need to migrate all that stuff, but it feels like it might be a lot of work :(
17:05:55
beach
asarch: *f* does not print anything, so you need to do something like (loop repeat 10 collect (funcall *f*))
17:08:37
pjb
(let ((x 0)) (lambda () (incf x))) is equivalent to (defclass anonymous ((x :initform 0 :accessor x))) (defmethod m ((o anonymous)) (incf (x o))) (make-instance 'anonymous)
17:09:28
pjb
How would (defparameter *f* (make-instance 'anonymous)) (dolist (i 10) (m *f*)) print anything?
17:16:13
pjb
or: (let (r) (dotimes (i 10 r) (push (funcall *f*) r))) #| --> (10 9 8 7 6 5 4 3 2 1) |#
17:31:26
beach
OK, let's say we have some example list like (defparameter *l* (loop for i from 0 below 10 collect i))
17:32:26
beach
We can use REMOVE-IF-NOT to keep only elements that correspond to a certain predicate. For instance, we can say (remove-if-not #'oddp *l*)
17:34:50
jmercouris
Hey everyone, I just released the alpha GTK port of nEXT, if you like my project, please upvote it: https://www.reddit.com/r/programming/comments/7p8nv0/next_browser_a_powerful_extensible_lisp_browser/
17:35:19
beach
asarch: But now we want to generalize this so that we want a function F that takes an integer N and a list L and that keeps all the elements of L that are greater than N.
17:35:49
beach
asarch: We can do it like this: (defun f (n l) (remove-if-not (lambda (x) (> x n)) l))
17:37:18
beach
asarch: Here, (lambda (x) (> x n)) is a closure, because it refers to the lexical variable n in a surrounding function.
17:40:10
beach
asarch: Here we use the closure to refer to an implicit parameter. The function that we pass to remove-if-not must take a single parameter, but we need two parameters, both the X that receives elements from the list and N which is what we passed to F. The solution is to create a closure with a single parameter X that refers to a closed-over variable N.
17:41:38
_death
furthermore you can create a predicate-building function.. (defun greater-than (n) (lambda (x) (> x n))) this makes it possible to write (remove-if-not (greater-than 3) list)
17:44:36
beach
asarch: As _death points out, with this style, you obtain a collection of very small, very general, functions that you can then compose arbitrarily.
17:46:13
beach
asarch: In a language without closures, you can't do this, because you would have to alter the signature (the number of parameters), and doing so would break the abstraction barriers, so the code is no longer modular.
17:46:47
pjb
You can do it trivially in object oriented programming languages, trivially, but with a lot of boilerplate.
17:47:24
dlowe
sure, iirc, closures in java 8 creates an anonymous class with the free variables as stored members.
17:47:36
pjb
But then, given the above equivalence, "language without closures" excludes OOP languages.
17:48:20
asarch
Yeah, since this concept actually doesn't exist in other language, it would take you more more time to do simply things
17:48:21
_death
in the past a limited form of "closures" was supported ("downward funargs").. but nowadays there's usually no need to distinguish function from closure (yes, there are exceptions when talking about performance, serialization, etc.)
17:53:20
jmercouris
makomo: It's been around a year of work, so not too long, but also not a trivial investment :D
17:54:02
makomo
jmercouris: i've seen it a few weeks ago too but forgot you were the author. it was influenced by emacs i see, which is very neat
17:54:14
makomo
i was thinking of a general framework for building emacs-like applications from time to time
17:54:23
jmercouris
makomo: Yeah, I try not to bring all the baggage of emacs though, but trying to keep it close enough
17:54:31
phoe
it separates the actual computation from the branching, which seems cleaner and more beautiful to me.
17:54:52
makomo
i.e. the standard "you have a minibuffer, you can run commands, you have keybinds and the lisp image of the process at your hands!"
17:55:27
dlowe
phoe: what about when you want to do the computation only on one branch, and you don't really want to nest conditions
17:57:34
dlowe
phoe: a classic example is (cond ((string= input "") ... no input ...) ((null (setf num (parse-integer input :junk-allowed t))) ... bad input ..) (t use num for stuff)
17:58:40
jmercouris
It can be ported to use just about any GUI framework as there is an API between the core and GUI that is extremely simple
17:58:46
phoe
dlowe: can you pastebin this for me? I think I need to read it formatted to understand it
17:58:51
jmercouris
the GTK port took me just 2 weeks, and most of that time was because I don't know GTK
18:13:09
borei
i have question about memory management in lisp. If for example my function is returning array what would be proper solution for this task - request array in the calling function and supply it as one of the argument and then fill with data, or just create array in the called function and then return it ?
18:13:38
Xach
borei: good question! both approaches are ok. in some situations it is better to do one, some the other.
18:14:10
Xach
borei: If your system has to be more strict about creating new things and using memory, passing arrays in to be populated can provide more control.
18:15:37
borei
but, speaking about second option, will that array be cleaned up by GC after called function completed ?
18:16:00
phoe
STATIC-VECTORS are a case where you'd want to pass an array to a function instead of creating a new one.
18:16:19
osune
I'm sorry but to ask such a simple question but I cannot comprehend at the moment the use case for FIND-IF. Or how it differs from FIND. Can somebody please state the obvious for me?
18:17:04
phoe
osune: FIND searches for an object that is EQL to something. FIND-IF searches for an object that satisfies a predicate function.
18:19:19
Xach
osune: it is true that sometimes functionality overlaps, and you could write a :test that would do what find-if does, but it would be pretty convoluted
18:21:00
_death
FIND is similar to (find-if (lambda (hay) (funcall test hay needle)) ...), disregarding certain details
18:21:44
osune
So i would have to 'workaround' with a lambda (x, y) (oddp x) or equivalent to use FIND. Thanks I wasn't able to grasp that at the moment and I started to get annoyed.
18:22:29
phoe
The moment I mention a thing to answer a basic question and other people go "that's advanced stuff, disregard it", I don't think I'm a newbie anymore.
18:26:45
Xach
phoe: I think sometimes when trying to help it can be hard to separate the "applicable knowledge" from the "necessary knowledge" for a situation
18:44:44
Shinmera
I was just reminded that I started writing a plaster.el . I guess I'll take that as a small project between exam studying.