freenode/lisp - IRC Chatlog
Search
18:29:52
fiddlerwoaroof
(length (flatten (mapcar (lambda (f v) (if (funcall f v) (1) ())) functions values)))
18:37:41
_death
jackdaniel: heh.. at first I was puzzled.. TRON operator? then I recalled TRON/TROFF...
20:53:30
aeth
LdBeth: If what you said was valid then it would constantly be setting a to 1 and then a to 2 every iteration of the loop. It doesn't seem to be valid in SBCL, it says "duplicated variable". verisimilitude has the answer.
20:53:44
verisimilitude
In any case, you should be using the integer stepping clauses for this, instead.
20:54:51
aeth
(loop :repeat 5 :for a := 1 :then (1+ a) :do (format t "~A~%" a)) is equivalent to (loop :repeat 5 :for a :from 1 :do (format t "~A~%" a))
20:55:11
aeth
The advantage of the second form is that you can add a terminating condition right in it instead of writing your own elsewhere.
20:56:03
LdBeth
well, Emacs' cl-loop don't signal an error on duplicated variable and just complains "unused variable a" when byte-compiled though
20:56:10
aeth
You can also count 0-based and by steps greater than 2. (loop :for a :from 0 :below 10 :by 2 :do (format t "~A~%" a))
20:57:39
aeth
LdBeth: The way I would have interpreted it if it was valid would be to have a set to 1 and then incremented by 1, so both a's would be used, sort of like (let* ((a 1) (a (1+ a))) a)
21:23:04
fiddlerwoaroof
it has most of the features of CL's generic functions, but adds &context arguments and a couple additional kinds of specializers
21:23:34
fiddlerwoaroof
the &context arguments let you dispatch based on things like the currently active mode, etc.
0:43:31
slightlycyborg
I am trying to get asdf to load a system that I placed in ~/common-lisp. I load quicklisp on sbcl boot. I am getting "component <system_name> not found" after (asdf:load-system "<system_name>")
0:46:31
slightlycyborg
I think I found the error. I named my file <system>.asdf instead of <system>.asd
3:01:09
hectorhonn
verisimilitude: hello verisimilitude. cl just keeps surprising me with its features
3:01:29
verisimilitude
It's a rather comprehensive language, as it was designed to unify several dialects.
3:01:54
verisimilitude
Being practically oriented, it also includes many facilities that certain programs would require; the various time facilities are a good example.
3:02:56
fiddlerwoaroof
restarts, multimethods and method combinations were the features that most attracted me.
3:03:10
aeth
More importantly, CL was designed to be (just barely) efficiently implementable on 1990s hardware.
3:04:03
aeth
CL has two decades of Moore's law over newer languages of comparable features since people tend to target the hardware they have right now.
3:05:04
aeth
hectorhonn: generally the advice on IRC is to not ask to ask but to ask because IRC is fairly slow moving for a chat protocol.
3:05:08
verisimilitude
Common Lisp has certain restrictions in place that let a concerned implementation optimize well. Newer languages, such as Python, have been ``designed'' without this foresight and the results are clear.
3:06:06
aeth
verisimilitude: Interestingly, Python's only 6 years newer than CLtL. I think one of the key differences is that by 1990, C had won so languages were going for niches (like scripting) whereas CL was designed for the whole stack.
3:08:10
hectorhonn
if, in a macro, i do (let ((sym (gensym))) `(defun ,sym () (...))), will this defun get garbage collected at the end of the macro?
3:09:08
fiddlerwoaroof
But, if there are no references to the name, I think it will eventually get gced
3:10:01
verisimilitude
It would only be garbage collected once it becomes unreachable, but that's not enough.
3:10:21
verisimilitude
I'm just letting him know it's possible the symbol is saved, which would prevent this.
3:11:27
fiddlerwoaroof
But after *** it should be discarded eventually, if there's no other reference
3:13:39
hectorhonn
this came up because i was trying to write test cases in the source. if i do (defmacro check-equals (expected actual) (unless (equal expected actual) (error "..."))), when the error comes up in the debugger i can't press v to go to the source. so, in the macro, i wrap it in a defun and call it. that way i have a frame that i can press v, and go to the source
3:13:40
verisimilitude
Also, there's the case where the macro is run, but not before being picked apart, so the symbol could be accessed by that as well.
3:17:44
fiddlerwoaroof
Also, the most useful tool I've found for debugging macros is the macrostep expander
3:17:57
verisimilitude
(let ((integer 6)) (assert (= 5 integer) (integer) "Expected 5 but got ~d" integer))
3:18:45
aeth
oops, verisimilitude beat me to it and I didn't read it before posting because verisimilitude used a different variable name
3:19:08
aeth
You can do this, as well: (let ((x 41)) (assert (= x 42) (x) "Expected ~D, but got ~D" 42 x))
3:19:23
verisimilitude
As a rule, I suggest seeing if Common Lisp already has what you want before trying to roll your own solution, hectorhonn; Common Lisp is very flexible and comprehensive.
3:20:30
hectorhonn
i was doing (assert (= 5 6)), where the test-form is moderately long, and got annoyed when it printed "The assertion <form> failed"
3:21:15
aeth
(defun assert-= (expected-number) (lambda (number) (assert (= number expected-number) (number) "Expected ~S, but got ~S" expected-number number)))
3:25:24
aeth
What's really enlightening is that FORMAT strings show up in more places than you would think, such as in ASSERT and ERROR
5:01:45
no-defun-allowed
Probably not, you'd be trying to make an ice sculpture by melting ice with your breath.
5:03:42
fiddlerwoaroof
In theory, this would allow VSCode to have access to at least some of the information it needs to support common lisp
5:04:26
no-defun-allowed
I don't think LSP has the interactivity SLIME (or even a straight CL REPL) offers.
5:06:15
no-defun-allowed
The limitations exist in LSP itself to my knowledge; there are no commands for sending code to a language process.
5:06:59
djeis[m]
You need something like a debugger adapter if you want to send code to a process in VSCode.
5:07:36
no-defun-allowed
Admittedly, a larger particle such as the top quark would have been a better namesake.
5:07:40
fiddlerwoaroof
otherwise, unless you want to use emacs, your choices are lem (written in CL, but has an electron frontend, I believe) or vim
5:08:13
fiddlerwoaroof
There are at least two different vim plugins that I've heard that people use: slimv and vlime
5:08:40
no-defun-allowed
The difference between Atom and Emacs's memory consumption is comparable to the difference in electron and top quark sizes. Anyway, back to Lisp.
5:08:41
djeis[m]
Honestly Lisp is best used with very tight editor integration, and atom slime covers the basics but the best integration is with emacs.
5:09:40
fiddlerwoaroof
Also, lem looks like it might be better than either, if I could be bothered to learn a whole new editor without much of a community :)
5:09:45
djeis[m]
Imo they only lag behind slime/sly by a small bit, and sometimes have interesting unique features.
5:09:51
c4droid
fiddlerwoaroof: If i want to use emacs, i need a pretty good configuration, I wroted configuration is too simple, not modulized
5:10:56
fiddlerwoaroof
Although, both of those might be more for people that want a vim-like editing experience
5:11:21
c4droid
fiddlerwoaroof: I don't like that, that to heavy to me. I like lightweight development environment
5:11:29
djeis[m]
I've used both spacemacs and doom. Doom is a little less simple to set up, and catching up on features still, but it looks nice and is really snappy.
5:13:26
no-defun-allowed
Some of the greatest Lisp editors actually ran in the Lisp they were controlling.
5:13:56
no-defun-allowed
beach: there are more opinionated configurations for Emacs that come with a lot of packages preinstalled or managed.
5:13:58
djeis[m]
Emacs is already a really heavyweight editor, and much of spacemacs and doom is just defaults for other packages.
5:14:54
no-defun-allowed
For example, spacemacs comes with (optional) vim emulation and quite a fair bit of theming out of the box.
5:15:14
djeis[m]
But I understand the instinct to build your configuration yourself so you understand it.
5:15:23
beach
no-defun-allowed: But who cares if you don't use it? Is it the cost of the disk space?
5:16:13
c4droid
beach: yeah. I like myself to write configure code to change emacs let me can free to code.
5:16:19
aeth
I hope doom-emacs is a modification of the Doom source release to integrate GNU Emacs into Doom (the original, not the 2016 one, obviously)
5:16:30
no-defun-allowed
Well, I think Spacemacs is a good way to convert vim users, so it feels a bit like a vim replica more than an Emacs.
5:16:34
fiddlerwoaroof
personally, I found that alot of the fancy emacs configs were too much for me
5:16:45
verisimilitude
File storage space, RAM, speed, and other considerations are still important and likely always will be, so long as wasteful crap exists.
5:16:59
fiddlerwoaroof
And I could put together something decent with use-package + referring to my preferred vim setup for ideas
5:17:04
aeth
You don't really need fancy Emacs configs anymore now that Emacs has a package manager.
5:17:19
no-defun-allowed
The keybindings and chords in Spacemacs are often quite different to the classic *macs keys too.
5:18:34
c4droid
Only write `package-install' fuction wrapper, after that, you can install any package and to configure it.
5:20:01
no-defun-allowed
So, beach, my problem isn't that Spacemacs installs a lot of packages and utilities, it's that those utilities change Emacs in quite a way I wouldn't be comfortable using.