freenode/#lisp - IRC Chatlog
Search
14:10:04
djeis[m]
append and nconc basically ignore nil args entirely, cus there's nothing for them to do.
14:14:56
djeis[m]
Depends a bit on the code you're writing, but in general yea- you ought to use the result of destructive operations instead of relying on side-effects.
14:17:09
djeis[m]
Because most destructive functions don't have well defined side-effects, and because of the edge case where the place you're trying to append to holds nil.
14:20:16
moldybits
is it considered good style to use-package alexandria? as opposed to accessing it with the alexandria prefix.
14:20:57
_death
my rule is to onle use CL and packages that I control.. otherwise I usually import-from
14:21:30
djeis[m]
If there were any package I'd consider it okay to use I'd say alexandria, but I generally don't.
14:22:13
djeis[m]
Ofc, I sometimes break portability and use local nicknames, so I'm probably not the best person to ask.
14:24:46
djeis[m]
Well, for the specific code in which I've used the alexandria package, if that eventually leads to a conflict I'm willing to have to deal with it then.
14:25:47
_death
it may not lead to conflict, but to redefinition, which can make it hard to trace the issue.. this has happened before
14:27:12
djeis[m]
But it's enough for my peace of mind, for the small bits of personal code where I've cut that corner.
14:27:22
Ukari
I have some doubt about function naming. I found 'queue-empty-p' is a widely used name for queue empty predicate, then is 'heap-empty-p' a suitable name for a heap? and is 'ring-empty-p' a suitable name for a circular array? or just use 'emptyp' as a empty predicate is better for all of queue, heap and circular array? or use 'empty-p' instead?
14:28:36
djeis[m]
https://cliki.net/naming%20conventions There's a spot near the bottom where they explain when to use p vs -p
14:29:37
djeis[m]
Whether you want to provide a generic emptiness check or specialized ones is fairly specific to your application tho, not a lot of generic advice to give there.
14:37:50
pjb
there's also a newness and some packing factors involved. For a new defining macro you would be tempted to use define- more than def, and more so if you expect it to be rarely used.
14:39:46
pjb
Ukari: note that the rule of p vs. -p is not trivial: string-lessp because it's the lessp for a string. What does it mean to be ring-empty or to be queue-empty?
14:40:06
pjb
Ukari: if you want the emptyp operator for a ring or a queue, it should be ring-emptyp and queue-emptyp
14:41:04
pjb
On the other hand, if you want to test for the more-optimized-speed it will be more-optimized-speed-p
14:52:38
pjb
with define- you would use in-extenso name, while with def, you can use abbreviations or even puns. What's those UNs we keep DEFining all the time with DEFUN?
15:35:34
nwoob
I apologize if what i'm about to ask has been asked many times and you guys are fed up with these type of question.
15:35:37
nwoob
I want to learn a different paradigm language and I stumbled upon CL and posts and answers saying how great CL is and it has features which todays languages are still catching up to. One must learn lisp to become a good programmer.
15:35:54
nwoob
I want to simply know (if possible) will I learn things that I won’t be able to learn in other languages? Is learning CL still beneficial in 2019
15:37:54
jcowan
nwoob: Definitely. A great many things that have to be laboriously worked around in other languages are already built into Common Lisp, or can easily be implemented. It's called "the programmable programming language" (see the topic line) for a reason.
15:41:48
splittist
nwoob: do, or do not, there is no try. Commit to learning CL on its own terms for period. If it grabs you, great. If it doesn't, you'll have learnt something about yourself and CL. The biggest mistake when learning CL seems to be trying to understand CL concepts in terms of things you already know.
15:42:36
nwoob
it does grab me. I have actually started learning it and i must say i have never enjoyed learning something this much
16:59:55
polezaivsani
Learning ASDF by slogging through manual and best practices, am i missing out on some other good material?
17:46:22
Demosthenex
i've now coded a proof of concept for a CRUD TUI in both npyscreen in python, and tview in go... and i just keep beating myself up for not using lisp. ;] have i missed a tui library for CL?
17:50:21
Demosthenex
there's a big difference between having a screen control lib and having editable widgets
18:02:49
verisimilitude
If you don't want to use Common Lisp linking to C, there's my ACUTE-TERMINAL-CONTROL, Demosthenex.
18:03:24
Demosthenex
i've looked at cl-charms and croatoan, didn't quite fit. verisimilitude yours was just character control again... i didn't want to reinvent the wheel just to update a tiny DB over ssh.
18:03:26
pjb
Josh_2: also, in clisp, there's an implementation dependent SCREEN package, which is very simple to use.
18:09:12
pjb
verisimilitude: it includes the standard itself! and generates the code from the standard.
18:09:33
pjb
ok, a sexpified form of the standard, but it's basically a copy-and-paste, and some search-and-replace.
18:09:54
verisimilitude
I specifically didn't want to create a derivative work of the standard document in this way.
18:10:28
verisimilitude
I wonder if this performs the same optimizations of the control sequence that mine does.
18:11:14
verisimilitude
Is this the only other implementation of the ECMA-48 standard in Common Lisp?
18:15:46
pjb
Note that the ideal situation for me would be to just parse the standard text and generate the code from it, not to include it as sexp. But there are always irregularities…
18:17:19
verisimilitude
That's one way to do it. It was much easier for me to simply write it out in a machine-readable way once and let that be it.
18:18:17
verisimilitude
I see this supports the seven-bit and the eight-bit forms; I've been mulling over how to elegantly work that into mine, but haven't done so yet.
18:19:06
verisimilitude
I'm also lazy, which is why I didn't write code to parse a standard document.
18:21:38
verisimilitude
It doesn't seem this implementation performs the same optimization mine does.
18:37:37
vms14
guys, I wanted to make a final project about lisp, but the teacher switched projects between students. So everyone has the project of another student
18:39:53
Josh_2
wouldn't it be better for that person to go learn about lisp themselves, then they might want to actually learn lisp
18:43:58
vms14
I've put things like "Common Lisp is very good when you need a program which changes and evolves."
18:44:11
Josh_2
Something that blew my friends mind was showing small examples using ' and , to control evaluation
18:46:21
vms14
I have 3 slots in my "programmer"s page and I thought I could put some code, like C code, lisp code and other language, doing the same thing
18:47:35
vms14
what I could put as code example to show that with other languages would be a pain and make that code examples short at same time?
18:47:40
makomo
vms14: i'm going to be in the same position in a month or two and i've decided to just go straight for macros
18:47:47
Josh_2
Show doing something that would practically be impossible in C without writing a lisp xD
18:49:25
makomo
from a lot of tutorials/introductions i got the impression that they always talk how cool lisp macros and code transformations are, but never actually show any cool/worthwhile examples
18:50:00
vms14
makomo, usually is because you cannot show how powerful it is if the reader does not understand some stuff first
18:50:15
jasom
well, I *love* macros, but maybe 1% of the lisp code I write is macros. It's one of those "glad it's there when I need it" but not "use everyday" sorts of things.
18:50:38
makomo
so i'll have to think thoroughly how to structure my presentation to cover just enough so that people can understand macros
18:51:35
vms14
the teacher fucked me by switching the projects, I've wanted to use lisp cgi for make an interactive tutorial
18:53:00
ym
Hi. What does it mean when place in setf is a list of two arguments and new-value form is a lambda function? Like this: (setf (foo bar) (lambda (x) (foo2 x bar2))
18:54:48
makomo
same thing, because (LAMBDA ...) is a macro that expands into #'(LAMBDA ...), i.e. (FUNCTION (LAMBDA ...))
18:56:11
makomo
and FUNCTION is a special operator that doesn't evaluate its (LAMBDA ...) argument but treats it specially
18:56:19
jasom
ym: setf is extendable, so if "foo" isn't something builtin to the language, it's going to be covered by one of 5.1.2.(6-9)
18:57:37
specbot
Other Compound Forms as Places: http://www.lispworks.com/reference/HyperSpec/Body/05_abi.htm
18:58:55
pjb
vms14: you can use lisp to write software for the ISS. It was used for DeepSpace1 so…
18:59:29
makomo
but some of these things you have to know well yourself in order to properly explain them (or at least give a simplified view)
19:00:37
moldybits
vms14: you could give an example of using restarts. another thing is something that takes an arithmetic expression (in sexp form) and simplifies it. you could read the expression from a file with read and output it to another file with write.
19:02:07
vms14
Although Kantz had developed in similar languages before, he had never used Lisp prior to the CPACs project. Further, Kantz wanted to integrate additional functionality and make the CPACs application easier to debug. From his experience with Allegro CL, Kantz now prefers Lisp over any other programming language, and he believes that using Lisp makes applications much more flexible and easy to design, especially for someone getting up to speed in a new
19:06:45
vms14
the problem is I'm so noob and I can just dig a bit, but I'll make a Lisp page sooner or later
19:07:12
pjb
vms14: and in all cases, even if you cannot deliver lisp, you can still use lisp to generate your deliverables. At the very least, use emacs, and write emacs commands in emacs lisp to help you create the deliverables.
19:08:27
pjb
So you implement in lisp some kind of NLP, build a model of the text, apply some algorithm or heuristics to improve then, and NLP back to generate the improved text?
19:08:30
moldybits
vms14: you can write macros for any language, the difference is that lisp makes it easy and, relatively, straightforward.
19:09:45
verisimilitude
The closest thing to Lisp macros in C is an entirely separate program, such as Bison.
19:11:20
vms14
yesterday I was reading one pdf talking about how to make a program able to understand english with lisp
22:21:08
comborico1611
I am trying to run STEP on a compiled file specifically to avoid the weird inner workings of the REPL. But I'm still getting those inner workings printing from STEP.
22:25:58
moldybits
`Lock on package COMMON-LISP violated when globally declaring SPEED SPECIAL while in package COMMON-LISP-USER.'
22:27:12
jasom
moldybits: you shouldn't use CL:SPEED as a function or variable name, no. In addition, you also probably shouldn't have any special variables without *earmuffs*
22:30:02
_death
moldybits: if you defined a function named cl:speed and someone else did too, there would be a problem..
22:30:14
pjb
moldybits: (defpackage "ANIMALS" (:use "CL") (:shadow "SPEED") (:export "SPEED")) (defun animals:speed (snake) 42)
22:30:58
specbot
Constraints on the COMMON-LISP Package for Conforming Programs: http://www.lispworks.com/reference/HyperSpec/Body/11_abab.htm
22:31:13
moldybits
okay, so it can be done. but is it considered good style to do so, as opposed to naming it velocity instead?
22:31:50
jasom
moldybits: If you plan on exporting it, it's up for debate on how wise it is; using it internally is 100% fine IMO
22:32:23
pjb
moldybits: if you shadow it, then users using your package will have to use shadowing-import-from to choose the symbol they will import.
22:33:05
jasom
It makes it harder for other packages to :use your package; that's pretty much the only downside.
22:33:19
pjb
(defpackage "JUNGLE" (:use "CL" "ANIMALS") (:shadowing-import-from "ANIMALS" "SPEED")) …
22:34:06
pjb
so animal-walking-speed animal-running-speed animal-swimming-speed animal-climbing-speed might be better names.
22:34:20
no-defun-allowed
(defgeneric Δs/Δt (animal) (:documentation "The (maximum) change in displacement over change in time for this animal"))
22:34:37
jasom
uiop:define-package has a shortcut for this I think (prefers the first package with the symbol found).
22:35:51
jasom
prefixing accessors with the class name is relatively common in CL; it makes some sense both because of the limitations on arity of generic functions and the near lack of types in CL.