freenode/#lisp - IRC Chatlog
Search
10:58:46
waynecolvin
is this less bad than using eval? http://lpaste.net/6726387104474988544 inverse-cond.lisp
11:00:14
beach
In recursive code like that, I always handle the base case first, i.e. if there are no clauses.
11:00:37
beach
Otherwise, you have your reader hold his or her breath until the end of the macro to see whether you actually plan to take care of that case.
11:03:44
beach
And your indentation is off. It looks like you are using Emacs Lisp mode. Use the slime-indentation contribution.
11:47:19
phoe
If you are using spacemacs, slime is already integrated in spacemacs's common-lisp layer - I am using this configuration at the moment.
12:50:17
toppler
Is there a library anyone can recommend for immutable b, persistent data structures in CL?
12:52:18
shka
if you like adventures, cl-data-structures: https://github.com/sirherrbatka/cl-data-structures but it is not stable, well tested on all platforms and documentation is fragmented
13:10:17
Shinmera
So #!+ is equivalent to #+ but using the target *features* rather than the host lisp's *features*.
13:11:35
Shinmera
The bang is there because if you're compiling from sbcl, the sb-sys package already exists
13:12:47
beach
And, of course, they don't have first-class global environments, so that can't do it that way either. :)
13:13:13
dmiles
well at this phase they are not yet SBCL.. they are whichever minimal lisp they are hosted on
13:15:45
dmiles
(well i mentioned that since to they'd need everyone elses lisp to have first class envs :P)
13:17:32
beach
There is no emulation involved. It is just a data structure from a library that the SICL compiler is able to use.
13:18:34
Shinmera
beach: Can't wait for all sorts of host weirdnesses to start becoming an actual problem building SICL :^)
13:19:09
beach
I haven't encountered any such problems, except the bug in SBCL that bit me and that had to do with funcallable-standard-object.
13:19:30
Shinmera
It took SBCL's devs quite a long while to get the resulting files to be binary-identical regardless of the host.
15:14:56
beach
What do you need them for? You just type `v' in front of the stack frame shown in SLIME.
15:41:17
Shinmera
Xach: Yes. https://github.com/Shinmera/qtools/commit/551bb9f6332eff4e16b99bfd83f50a94f65962af
16:20:37
flip214
is that an iterate bug, or do I have to tell the outermost iterate explicitly which block to return from?
16:24:34
beach
It looks like you gave the block an explicit name, distinct from nil, so then yes, you have to name it.
16:32:03
pagnol
beach, when I try to jump to my code from the backtrace I get an error 'unhandled DEBUG-CONDITION: #<SB-DI::COMPILED-DEBUG-FUN MINROOT> has no debug-block information.'
16:33:03
beach
pagnol: I have this in my .sbclrc: (declaim (optimize (speed 0) (debug 3) (safety 3)))
16:40:39
phoe
Unrelated: my life became so much nicer when I realized that I can (funcall (fdefinition (list 'setf FOO)) ...) where FOO is a symbol of my choosing.
16:43:22
Shinmera
It's a bit weird actually that function designators do not contain '(setf foo) despite '(setf foo) being a valid function name.
16:54:31
phoe
CLOS question - when I have class FOO, class BAR subclassing FOO, class BAZ subclassing BAR, and all three classes have INITIALIZE-INSTANCE :AFTER methods - when I make an instance of BAR, do all three methods get called by default?
16:54:35
beach
phoe: Speaking of which, KZiemian asked for input to CLUS, and I gave some, but then KZiemian has not been seen. This function designator could also deserve a not in there.
16:58:22
beach
The method combination builds an effective method that systematically calls all the application :BEFORE and :AFTER methods.
16:59:26
specbot
Standard Method Combination: http://www.lispworks.com/reference/HyperSpec/Body/07_ffb.htm
17:02:05
phoe
So INITIALIZE-INSTANCE uses a method combination to take other constructors into account? Like, in case of BAZ, constructors for classes BAR and FOO.
17:02:49
beach
It has nothing to do with constructors. ALLOCATE-INSTANCE is first called, then INITIALIZE-INSTANCE is called with the allocated instance.
17:03:24
beach
When the effective method is computed, all applicable methods are first determined...
17:05:40
Shinmera
You could always do the same thing done in other OOP styles by defining a primary method and calling CALL-NEXT-METHOD.
17:07:09
beach
Shinmera: The point is that doing so after the fact might change the protocol, so that client software needs to be rewritten. I asked that question in a course I held in New Zealand once. And they suggested exactly that. When I explained the maintenance problem, they immediately got it.
17:07:56
fourier
at some point Stroustrup wanted to add :before and :after into C++, and even had a prototype but then the community has decided it makes it too complex though
17:13:31
jmercouris
fourier: Is he the only one who decides the evolution of the language? is there not some sort of community?
17:14:16
fourier
no it was a commitee gathering like once a year. mainly lead devs, compiler devs and vendors
17:16:00
fourier
but until like 85-88 he had some freedom. then the language started to started to spread and he got bounded by "customers" and developers, hence all the stuff which is hard to remove/change
17:18:09
fourier
he has a huge influence on the language though, like he solely practically force commetee to accept STL - the part with iterators/containers/algorithms into the standard practically last moments after 2 days of discussions with Alex Stepanov who has implemented STL, then Stroustrup got the concept of it.
17:22:42
fourier
heh at least it evolves and into the good direction. it is so much easier to write code in c++ now after c++11/14. feels almost like a new language.
17:25:52
fourier
the language itself designed so you can use external gc, nothing to prevent it. the problem is no one needs it - people do manual memory management for reason.
17:36:27
fourier
can anyone explain what is the fundamental difference between Verna's quickref and quickdocs ?
17:47:18
jmercouris
I guess it's easy to get caught up in the echo chambers of the programming community sometimes
18:27:15
fourier
is where in CL or alexandria some function to create a sequence by repeating some element N times ? like (repeat "a" 3) => '("a" "a" "a")
18:27:35
flip214
in case someone is interested: quickdocs references https://common-lisp.net/project/quux-hunchentoot, but that is a 404.
19:31:43
phoe
What is a proper way to curry/rcurry something like (lambda (x y) (make-instance x :name y)) ?
19:48:37
Shinmera
(defmacro define-constructor (class lambda-list) `(defun ,(intern (format NIL "~a-~a" 'make class)) ,lambda-list (make-instance ',class ,@(loop for v in (lambda-fiddle:extract-lambda-vars lambda-list) collect (intern (string v) :keyword) collect v))))
20:01:02
makomo
does anyone have any recommendations where to look for good implementations of combinatorial algorithms?
20:02:10
makomo
algorithms such as generating all of the permutations, n-tuples, combinations (all w/ or w/o repetition), etc.
20:11:54
Shinmera
If I remember correctly Rosetta Code has some stuff, but I'm not sure if it's been translated to CL yet
20:33:32
makomo
if i have nested LOOPs, what's the best way to just forward the result of one of the the inner LOOPs
20:34:14
makomo
the inner LOOP returns the collected items. how do i just forward those out from the outer LOOP?
20:34:56
makomo
or do i have to do something like (LOOP ... :for res = (LOOP ... :collect ...) :finally (return res))
20:39:50
makomo
erm, nvm, i mixed something up, sorry. however, is there a way for LOOP to return the result of the last executed form in its DO block?
20:43:03
makomo
e.g. i would like for (LOOP :for i :from 1 :to 10 :do (list i)) to return (10), instead of the usual NIL
20:45:21
makomo
i see, so that's just how DO is supposed to be used. what would be the best solution then? maybe a :with, a setf, and then a :finally (return)?
20:45:54
makomo
yeah i don't really have a non-silly example. i'm just wondering what's the most elegant way to do something like that
20:56:17
_death
makomo: but you can do better than with/setf even here.. (loop for i from 1 to 10 for thing = (list i) finally (return thing))
21:16:01
pjb
makomo: (LOOP :for i :from 1 :to 10 :do (list i) :finally (return '(10))) #| --> (10) |#
21:31:24
Xach
Baggers: http://report.quicklisp.org/2017-12-30/failure-report/cepl.sdl2-ttf.html#cepl.sdl2-ttf
22:13:12
LexLeoGryfon
u are the swiss guy who gave talk and have few post in lisp magazine or smthn, and have really beautiful homepage with arts n stuff
22:15:27
LexLeoGryfon
u are a cool dude :) but I have personal ( i think) problem with lisp, so I came here to discuss it shortly and confront interests n ideas of this channel...
22:21:04
LexLeoGryfon
i'm mainly a python dev. And I like python very much because of following things: readability, simplicity, dynamism, metaprogramming, ability to write kinda functional style, etc. My problem with lisp is that I made somewhat huge research(in my sense) about it, even tried to code in it (hylang), and for me all this hype around lisp makes no sense, and I find it bullshit.
22:21:36
LexLeoGryfon
I tried to discover advantages of lisps over ruby\python, and found none , practical n useful.
22:21:51
mfiano
I came from Python a decade or so ago, and I can say that all of those are better with Lisp, with the addition of the surprising rapid prototyping aspect.
22:22:19
LexLeoGryfon
there are advantages over languages like C\Java, maybe for their devs LISPS could be mind blowing. but not for python\ruby devs
22:22:24
random-nick
python's meta-programming is a joke compared to most lisps, including common lisp
22:22:52
loli
Python is rather annoying to write in the functional style, where as CL is rather agnostic when it comes to the functional style
22:23:36
White_Flame
and of course, languages like Python and Ruby are their own spin on Lisp-isms, so looking at Lisp will seem kind of old hat, but you won't realize the depth vs shallowness of those featues between languages yet
22:24:17
White_Flame
I'm curious to see an example of Python metaprogramming, if the word even means the same thing
22:25:26
LexLeoGryfon
I wrote two pieces of code to calculate prime number, one in python https://paste.simplylinux.ch/view/88ca76fa which seems ok for me, and one in lisp hylang https://paste.simplylinux.ch/view/9956c6e3 which seems fucking unreadable for me
22:26:48
LexLeoGryfon
pierpa: I don't have issues with perfomance in python world with pypy+cython for cpu-bound, and asyncio+uvloop for io-bound tasks
22:27:23
White_Flame
LexLeoGryfon: lisp is a very, very syntactically regular language. That makes complex code much easier to read than the traditional infix/postfix/prefix mix of other languages
22:27:47
White_Flame
of course, the hylang example doesn't seem to follow quite the same level of regularity, combining both [] and ()
22:28:25
White_Flame
and in metaprogramming and many other features, the benefits of the design decisions behind Lisp emerge when you start writing complex stuff
22:28:28
mfiano
Just read the Hylang README. "It's [Python] really awesome. Oh, and lisps are neat.". Heh
22:29:40
pierpa
OTOH if you are happy with python, don't see any benefit in Lisp, then it's not mandatory to like Lisp. Use Python and be happy.
22:30:19
LexLeoGryfon
can anyone propose me in real world practical daily example of the thing that syntactically looks better in lisp rather than in python? not some rare-meta-bs case that occurs in 1 of 100 days, but something that could occur daily in life of web\script\dev lets say?
22:30:29
White_Flame
and the "Common" part of Common Lisp was a reuniting of an entire family of commercially used, mature Lisps
22:31:17
White_Flame
but any time you create a project-specific macro, your use of it will look better than a macro-less language calling functions & object interfaces to do the boilerplate manually
22:33:08
loli
https://github.com/mariari/Misc-Lisp-Scripts/blob/master/books/Purely-Functional/chapter-3/red-black.lisp#L54
22:33:39
LexLeoGryfon
White_Flame: there are macroses in python . however why not to be happy to insert boilerplate in to functions?
22:33:40
loli
Also most things written in the functional style aren't too well supported in Python due to the lack of a proper list
22:34:22
White_Flame
LexLeoGryfon: because your boilerplate might change, you might typo/forget it, and it creates more inertia to get over to put a new thing into your code
22:35:19
White_Flame
also with pattern matching, lisp macros can reach into your code and extract instances of variables to use for pattern matching directly, reducing the amount of configuration you need to set up to use it
22:36:00
aeth
LexLeoGryfon: The practical use for Lisp over something like Python is controlling when something is evaluated.
22:36:58
aeth
There are lots of ways to control when something is evaluated in Common Lisp. read-eval, reader macros, defmacro macros, modify-macros, symbol macros, inline functions, etc.
22:37:23
White_Flame
as I've said elsewhere, you tend not to even think of those sorts of solutions in other languages, because the tools & work to get there are too complex. But when code generation & transformation is so easy, you're way more empowered even though it's technically feasible elsewhere
22:37:26
LexLeoGryfon
White_Flame: I beleive we can do introspection and change code\instances in runtime too https://stackoverflow.com/questions/4407907/python-how-to-change-functionality-of-a-method-during-runtime#4408225 1-1 lisp vs python
22:37:31
Baggers
Xach: ugh I hadnt pushed the release branch. I'll check the others to see if I have slipped up elsewhere. Is it possible to subscribe to these test results so I see the failures (and hopefully fix them) without bothering you?
22:38:15
White_Flame
LexLeoGryfon: I suggest, if you really want to know the differences, to go through actual Lisp learning/tutorial material to evaluate the differences between the macro systems
22:38:47
random-nick
LexLeoGryfon: but can you easily create a new statement which is just like if but binds the test to a variable?
22:38:50
White_Flame
because no, that's not metaprogramming; that's simply having slots to place function objects
22:39:05
aeth
LexLeoGryfon: You can do most of the things that Common Lisp can do in other languages, but (1) usually it's much harder and (2) you will need to use several very different languages to exactly match the feature set of CL because it's ridiculously multiparadigm