freenode/#lisp - IRC Chatlog
Search
7:50:07
jackdaniel
for instance: you define functions for rows and columns and they are different only in x y argument order
7:50:08
Shinmera
I also sometimes allow myself "pleasures" in local macros that I don't in global ones, such as not using gensyms or making them anaphoric in some sense.
7:53:34
dtornabene
i think what took me aback was the original cause for this finding a top-level definition using macrolet in the sbcl sources
7:54:03
Shinmera
I also use macrolets if I just need to do a trivial expansion like here: https://github.com/Shinmera/crypto-shortcuts/blob/master/digests.lisp#L24
7:55:23
dtornabene
https://github.com/sbcl/sbcl/blob/9ee5e0873f5c2e0cbffef4c701222dc902cbdc3c/src/assembly/x86/arith.lisp#L16
7:56:41
Shinmera
Grepping through my sources I found one of my favourite tricks again, ha ha. https://github.com/Shirakumo/trial/blob/master/toolkit.lisp#L380
7:58:22
Shinmera
dtornabene: I mean, that's just me, but I feel like the define-generic-arith-routine could easily be a standard macro definition too.
7:59:14
dtornabene
hahahaha, sweet. that makes me feel better. even though I had no idea macrolet existed before tonight and am glad to have learned about it
8:00:48
dtornabene
which is weird, because I've frayed my copy of seibels book with use. I must not have read that chapter that close
8:03:07
jackdaniel
truth to be told it is not commonly used operator and one could live happily without it. that said it comes handy at times
8:05:29
jackdaniel
you may check out also symbol-macrolet. you could use it for something like (symbol-macrolet ((my-hash (gethash :foo *ht*))) (setf my-hash 10) my-hash)
8:26:09
stacksmith
I think both are quite useful. Without symbol-macrolet you couldn't have with-slots and such. And macrolet becomes very handy for serious macro work.
8:56:23
stacksmith
Is name-char only capable of names like "LATIN_CAPITAL_LETTER_A"? My SBCL doesn't like "A" or 'A
9:21:11
solene
hello, I'm currently thinking about packaging lisp libraries for an operating system but I wonder if any software would benefit from this. I only know stumpwm as a lisp software. Does someone know some lisp software that would be interesting to package in an OS ?
9:23:33
solene
i'm looking for lisp software which could benefit from packaging libraries, to become available as packages. I don't know if I explain well :D
9:24:08
Shinmera-
In my opinion it's wrong to package language libraries with the OS. We already have systems in place that do this, specifically for the language, in a better way than the OS ever could.
9:25:14
Shinmera
Shipping language libraries with the OS only leads to the following: an incomplete, outdated, unmaintained set of libraries that will confuse newcomers.
9:28:50
flip214
Shinmera: I would actually prefer if there was an OS-package-management compatible channel (so, eg. for Debian something like "testing" or "unstable"),
9:29:30
aeth
The only reason to put a library in an OS package manager is if an application that's also in the OS package manager uses those libraries. e.g. If your OS ships with stumpwm, and if stumpwm has any dependencies, then that's where it makes sense.
9:29:31
flip214
and if that kept older versions (like archive.debian.org) as well, it would be much cleaner to install such software.
9:31:11
flip214
ISTR that hunchentoot (or cl-who or ...?) had a function that returns an URI with the current parameters, but with a few overrides?
9:31:17
Shinmera
The problem is Linux has too many distros. It is not feasible to maintain your package in every damn distro out there. And people are gonna run to /you/ for problems with their outdated OS packages.
9:31:47
aeth
I meant that if your distro ships stumpwm in its package manager, then it makes sense for your OS to also ship CLX, a dependency of stumpwm. In that case, the distro's CLX is not for you, the CL programmer. It's for users of the distro's (outdated, but stable) stumpwm.
9:32:17
solene
Shinmera, I understand your opinion, but I think it as pros and cons to ship language lib in the system. At least if the package maintainer does it well, you are make sure the programs will run well because you tested it
9:32:53
jackdaniel
actually some distributions maintain clx package, I have a request from time to time to make a release, because they want to update
9:32:59
Shinmera
I for one would be vehemently opposed to having any of my libraries in any of the linux distro package managers.
9:34:19
solene
at least quicklisp runs as a user and is simple. Installing perl cpan modules in userland is a bit cumbersome in comparison
9:34:59
aeth
Oh, Debian. That would frighten me as a library author. People using code I wrote many years ago?!
9:35:41
Shinmera
We already have this problem: debian ships wildly outdated versions of libraries, and every so often someone thinks they should use them and then stumble in here wondering why nothing works.
9:37:25
Shinmera
Ideally the lisp application would be shipped as a binary anyway, in which case it already has all the libraries in it. So the only thing needing access to libraries is the one making the package
9:37:58
aeth
I don't like it when some distros try to package literally every library on some language's package manager. Libraries from a language package manager (excluding C/C++ if they ever get one) should be strictly for dependencies for applications shipped in the distro package manager. But... there's no real way around it, or else they can't add that application at all.
9:38:35
solene
Shinmera, you can't ship a binary into the package, you have to put the build recipe to create the package, so you need others packages for the dependencies
9:40:27
solene
currently it's what I've done to package stumpwm, the build system download the few libraries to compile the stumpwm binary and it get packaged
9:42:06
Shinmera
Not necessarily. After all, the binary will include a full Lisp, so you can just ask the user to download the sources somewhere and then direct stump to upgrade using those.
9:43:46
Shinmera
In other news, Didier and I are testing the ELS registration in live mode now, so registration should be open today or tomorrow!
9:43:53
aeth
Shinmera: The binary won't necessarily include a full Lisp. Eventually, tree shakers will come.
9:49:22
Shinmera
Plus even with a tree shaker, anything using CLOS will likely pull in the full compiler anyway, so
9:59:26
beach
I personally think we should have a Common Lisp implementation with most of its system code, including the compiler, in a shared library. That way, we have the full functionality of the system, without any complaints about the size of application binaries.
10:03:41
jackdaniel
and all compiled systems (i.e alexandria.fas) are in fact shared objects by default
10:41:36
jmercouris
jackdaniel: I saw the post you made on /r/lisp about thrift, have you tried it perchance?
10:46:38
jmercouris
jackdaniel: so, if my understanding of the project is correct you can call functions/pass data back and forth between any of the supported languages?
10:47:25
jmercouris
jackdaniel: and the calling of these functions must be two separate processes right?
10:48:15
jackdaniel
you can't call a service method if there is no entity which provides the service
10:49:31
jackdaniel
sure, good luck. when we fix the missing bits for CCL and ECL I will submit it to Quicklisp
10:50:39
jmercouris
it's definitely going to be a much less friction approach than me effectively reinventing a high level approach of that in my frontends
10:51:48
jmercouris
jackdaniel: can you explain why someone would choose a different protocol in thrift?
10:52:08
jmercouris
jackdaniel: when I say protocol, I mean this: https://thrift.apache.org/docs/concepts#protocol
10:52:34
jmercouris
jackdaniel: as in, why should the user care what the "transport language" is (xml, json, plain text)?
10:53:05
jackdaniel
transport language is important for things like data send performance (if you call services over the network)
10:55:31
jackdaniel
I think you'll be better served by the actual implementation and Thrift documentation than my faulty memory (and not-so-perfect English)
12:42:32
hajovonta
like (multiple-value-bind (a b) (list 1 2) (list a b)) but it doesn't work because list only returns 1 value and the other will be nil.
12:48:45
jmercouris
what if the values in the list are like this (list "key1" "value1" "key2" "value2") what's the best way to turn that into an easy to access data structure like a hash-table?
12:49:26
Bicyclidine
(loop with result = (make-hash-table :test #'equal) for (key value) on list by #'cddr do (setf (gethash key result) value) finally (return result))
12:50:14
jmercouris
Bicyclidine: I was hoping for some built in, a library I'm using returns json results in that manner
12:51:02
jmercouris
Bicyclidine: Doesn't matter, just means I'd have to make a "utility" function, I wouldn't like embedding that snippet into my codebase
12:51:55
flip214
jmercouris: but if there are not that many entries, a simple list might be faster to process.
12:52:10
flip214
jmercouris: or you could tell your json library to return a hash-table in the first place!
12:52:44
jmercouris
What I currently have is like a (position "key" list) and then do nth +1 on the position of the key I'm looking for
12:53:38
jmercouris
flip214: Not too many, so it is okay, I think it'd be smarter to change the json lib return though, you're right
12:53:54
jmercouris
there is (yason:parse stream :object-as :plist), I'm sure there is :hash-table as well or something
12:55:31
jmercouris
e.g. (yason:parse ...) and my cursor is there, can I jump to the docstring for that function somehow?
12:56:55
jmercouris
sigjuice: That is quite useful, that one I did know about though, imagine something more like a help buffer
12:59:08
jmercouris
yeah, I wish it included a list of "keyword arguments" ... which "can be used to override the parser settings"
12:59:41
jmercouris
so maybe it does make more sense to just jump to source instead of opening a help buffer with the docstring
13:00:13
jmercouris
yeah, I see the following: (check-type *parse-object-as* (member :hash-table :alist :plist) as possibilities
13:00:59
sigjuice
I didn't read far enough to see that %parse was a thing. I saw *parse-object-as* and immediately mmmdotted
13:03:16
sigjuice
also a quick experiment: CL-USER> (with-input-from-string (s "{}") (yason:parse s)) => #<HASH-TABLE :TEST EQUAL :COUNT 0 {1008D960A3}>
16:09:19
borei
some non-technical thoughts, but rather more language philsophy. Using lisp for last 8 months i started to realise that im using (or trying to use) it in the same way like i used to use "traditional languages" - like C/C++ or python. The same classes, functions, program structure etc etc. Recentely i found very interesting book - "Let over lambda". That book is targetting to change approach in regards to programming in lisp. Now i'm trying
16:09:19
borei
to find how to implement "true lisp" solution to particular problems. Not easy task id say.
16:11:41
jackdaniel
borei: LoL doesn't show how Lisp practicioners solve problems. It may be amusing though.
16:14:12
borei
can't say, but it opened eyes is absolutely different way. I finally started to understand what is closure, but don't know how to use it, except for couter-like problem.
16:14:27
dlowe
borei: unlike some, CL is not an "opinionated" language, so you should feel free to work however you want. You can pick tricks up along the way.
16:15:47
borei
true, but i think very important part is - to know your "tools set" and to how to use that tools in most efficient way.
16:20:03
jmercouris
it really depends on the problem at hand, different approaches lend themselves to different tools, in the context of lisp, that may mean different paradigms that it supports
16:20:33
jmercouris
what others have said is true, lisp is not opinionated, this flexibility allows you to adapt your style to the problem at hand
16:21:47
pjb
borei: the only difference, is that closures are anonymous, and have all their methods (functions) in the same lexical scope, while with CLOS, methods are written all over the place.
16:22:51
pjb
So in terms of software engineering, you will usually want classes, as soon as it becomes more complex than an anonymous object with one or two methods.
16:23:12
jmercouris
what about this (defvar something (lambda () (print "my function"))) is my lambda still an anonymous function?
16:23:49
jmercouris
but I have a symbol pointing to it (or whatever the word for "something" in this context is)
16:24:47
pjb
And I argue that (lambda (x) x) is the name of the function (lambda (x) x), since we call functions with (<name> …) and ((lambda (x) x) …) shows that (lambda (x) x) is the name.
16:26:06
pjb
borei: one advantage of closures over CLOS objects, is that it takes its slots from the lexical environment. So "object construction" is easy and almost invisible.
16:27:26
Bike
when we talk about anonymous functions, what we're actually trying to emphasize is that functions are values like anything else, rather than some details of how binding works.
16:28:07
Bike
many programming languages do not allow functions to be dealt with as values, and only allow referencing them less directly through names. that's it.
16:28:08
hajovonta
what I really liked is that the author showed that it's possible to keep the lexical environment
16:28:36
pjb
Well, really, there's no (function-name f) operator, so we could say that in lisp, no function is named.
16:29:01
pjb
You can implement function-name returning a list of symbols fbound to the function. Not very satisfatory, and very slow.
16:29:06
beach
jmercouris: All Common Lisp objects are anonymous in that respect. But we have references to them. Otherwise the GC would get them.
16:34:12
jmercouris
beach: I just looked it up in CLHS which led to global environment, then indefinite extend
16:42:07
beach
_death: I think the minion maintainer has declared that the Cliki format changed and he is not going to modify minion to recognize the new one.
16:42:23
jmercouris
I feel like Guy Steele is a name I've seen before, is there something he is famous for in the context of lisp?
16:45:52
pjb
And of course, there's always will be FizzBuzzEnterpriseEdition. What a legacy! https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
16:47:36
jmercouris
beach: I didn't live in a pre-java world, so it hard for me to judge what life was like then, but java is a great language, with great ideas, it's just a little too verbose for my taste
16:48:18
beach
jmercouris: It had no new ideas. But it had the syntax that made C++ programmers think it was not too different. Boy were they wrong. It is closer to Common Lisp.
16:51:01
beach
jmercouris: If you have no GC, you can't really program only with references (or pointers) as we do in Java or Common Lisp, because you never know how many references you have. So you get this very complex programming style with templates, copy constructors, smart pointers, you name it.
16:51:49
jmercouris
I wish I knew C++ so I could understand the differences, I only know some basic C which doesn't have any of those features as far as I know
16:52:51
beach
jmercouris: Correct, C doesn't have those, which makes it totally impossible to write applications in it. The C++ features are there to make it somewhat possible.
17:15:22
beach
jmercouris: If you ever get stuck with using C or C++ to write applications, the best thing to do is to link you program with the Boehm/Weiser garbage collector and then you use pointers for everything just like we do in Java and Common Lisp. That's the only sane way to write applications in those languages.
17:17:44
jmercouris
beach: thanks for the advice, but I don't plan on working any C/++ jobs anytime soon :D
17:48:31
dim
well I still spend some time writting applications in C... in PostgreSQL-C that is... it's special, but not that bad
19:37:05
comborico1611
Why is it when you do M-del in Slime, all the text is deleted except for all the parentheses?
19:43:01
comborico1611
pjb: Hmm. I never realized that. I am new to Emacs, though. I just thought I would have realized that by now. Weird.
19:44:48
pjb
Instead of editing the text, with indiscriminate structure, with paredit you're editing the sexp, with it's tree-like structure specified by the parentheses.
19:45:15
pjb
So you have commands to process the text itself, and commands to process the structure of the sexp.