freenode/#lisp - IRC Chatlog
Search
18:28:17
axion
I will say that is incredibly better to look at than the code you posted 2 weeks ago here (which was some of the worst I have seen)
18:28:31
axion
Are you actively trying to learn Lisp from a better resource now as we have suggested?
18:30:50
axion
I mean, I can read what the intentions here are at least, compared to http://paste.lisp.org/display/346046
19:04:00
axion
Infact, my own was just added this week, but it is specific to 3d transformation matrices (4x4)
19:04:23
greentea
as a side project i'm trying to implement an irc-like chat server. I was thinking of doing this in lisp. does anyone know anything about using lisp as a language for this sort of task? or would i be better off using something like c, or maybe erlang such as whatsapp did
19:06:01
jasom
greentea: don't use C; chatservers is mostly moving strings around and network code, both of which are fairly painful in C.
19:07:03
phoe
greentea: what jasom said; chat applications won't really suffer from small GC pauses - use this to your advantage and grab a language with automatic memory management.
19:08:56
greentea
jasom: cool, i'll try to do it in lisp then. i was thinking of writing it as efficient as possible in terms of memory usage on the server, and network usage. c/c++ is known to be very efficient which is why i thought of using it
19:09:50
|3b|
some lisp implementations have a relatively large initial memory cost compared to C/C++, since they tend to include a VM,standard lib, tools, etc
19:10:07
axion
jasom: You may be out of luck then. It is non-trivial to generalize them. Just 4x4 has been a 3 year project of mine, to support euclidean/homogeneous transforms
19:11:34
jasom
greentea: in terms of per-user ram usage it shouldn't be too large though, but there is the initial overhad as |3b| said. Also some GC overhead (which can be minimized by invoking the GC periodically)
19:15:10
greentea
tens of MB shouldn't be too much indeed. whatsapp used to use erlang when they had millions of users. i don't know much about erlang, but lisp has probably similar memory usage as erlang right? so it should be possible in lisp
19:23:18
|3b|
probably hard to compare lisp and erlang, particularly on that scale, since 'memory usage' is sort of non-linear (as in it gets a lot more expensive once you hit the amount you can get in a single device) and erlang is easier to spread across devices
19:25:52
_death
programming erlang has a chat server example, so I'm guessing that's "typical" use for it..
19:27:10
phoe
greentea: Lisp won't be minimalistic when it comes to memory usage but, properly used, will be pretty minimalistic when it comes to development time
19:37:24
greentea
phoe: indeed, less development time is very important too, it would probably be alot more work in c
19:38:19
phoe
greentea: use the fact that you can work on your application interactively, add and modify parts to it as it lives.
19:39:01
phoe
in a way, programming in Lisp is like a vivisection, except there's no blood (unless you really screw up multithreaded code :P)
19:40:01
phoe
there's nothing more pleasant than getting multiple threads thrown into the debugger all over your screen after you make a really bad redefinition.
19:42:06
rpg
_death: I think the claim for Erlang is fault tolerance -- when one of your actors goes down your program will survive. That and the fact that actors are very cheap to stand up.
19:48:51
rpg
I played around with Erlang some once, but OMG, I can't imagine why anyone would have chosen to lift the syntax from Prolog of all things.
20:22:34
mazoe
Hi all. I have a quite vague question :( but I’ll try and phrase it in a useful way. I’m finding myself calling `EVAL’ to evaluate one of the arguments to a macro-generating-macro. It feels icky. Is it ever idiomatic to do something like this? The macro is `deftag’ in the `spinneret’ library…
20:23:18
Bike
a macro-generating-macro sounds complicated enough to maybe need it, but it's hard to say without context. lemme look
20:23:24
White_Flame
the only time you should be using EVAL is if you're generating or loading source code after runtime has started
20:23:53
Bike
https://github.com/ruricolist/spinneret/blob/master/deftag.lisp#L46-L64 this? i don't see any eval calls in this file
20:25:21
Bike
why not just skip the eval and have :value-pairs ((1 . "a") (2 . "b")) in the macro form?
20:26:24
White_Flame
it looks like you're trying to pass non-literal runtime data into a macro? that most assuredly won't work
20:27:52
White_Flame
if the field after :div.menu is evaluated, then (:div.menu (loop for pair in ,value-pairs) ....)
20:28:02
mazoe
yep agreed about not passing in non-literal runtime data, but I don’t believe that’s what I want to do
20:28:05
White_Flame
if the field after :div.menu is evaluated, then (:div.menu (loop for pair in ,value-pairs ...))
20:29:12
Bike
get-some-pairs fundamentally needs to be called at macroexpansion time since you use the value in the macroexpander (not the expansion)
20:29:38
White_Flame
again, I'm not familiar with the library, and what gets turned into macro arguments vs is evaluted
20:31:07
Bike
i don't think that's how this system works. it seems like you need the tags all there at the same time.
20:31:52
Bike
so i get the feeling you have a static html generator and you want it to not be static.
20:34:10
Bike
so maybe you can have (:div-menu (loop for pair in ,value-pairs) do (:div.item :data-value ,(car pair) ,(cdr pair))))
20:35:49
rpg
shrdlu68: Very hard to do because CL doesn't have enough of a filesystem and process API.
20:39:55
rpg
shrdlu68: It's not that you can't do it, it's just that you can't do it *with only the ANSI standard CL*
20:40:17
White_Flame
in lisp machines, you just have a repl, and can call normal file-manipulating S-expressions
20:41:12
White_Flame
well, some also had "commands" that weren't s-expressions, but the same form of typed parameter input. I don't recall seeing any magic syntax like |, >, & etc you get from bashalikes
20:41:49
White_Flame
there's also mouse-based file operations. Print a directory, and select a file visually
20:46:40
rpg
White_Flame: I think one could make some of the magic syntax, if you wanted it. Trying to do shell scripting, e.g., without syntax for interpolation, is pretty painful.
20:48:04
White_Flame
sure, but you either give up too much of Lisp, or too much of the shell either way
20:48:30
rpg
White_Flame: I agree. I'm not at all convinced that shell scripting in Lisp is even desirable
20:49:31
rpg
If someone wishes to, good luck, but I don't see a win in spending an enormous amount of time to make an inferior version of perl with nicer syntax.
20:55:47
aeth
I don't think shell scripting in Lisp would work well. I think some clever abstractions could replace an *interactive shell* (i.e. what you run in a terminal) with Lisp, though.
20:57:44
aeth
A bunch of shortcuts, pre-imported libraries, implicit ()s at the top level if there's no ( at the start of the line, etc. Like this: directory-files "~/foo/bar/baz"
20:59:48
aeth
The problem with trying to replace shell is that shell is a horrible language *except* for what it does well, and that's no coincidence. If it's above 100 lines, fear a .sh file, but if it's under 20 lines, you probably can't find another language that can do the same thing in under 100 lines, at least ime.
21:03:31
aeth
There are several weaknesses, such as being really old (and thus favoring things like conciseness too much, like old languages usually do (with Lisp as an obvious exception)) and serving two fairly different roles (as I said before, attack one or the other, not both)
21:03:54
rpg
aeth: same for perl -- if you want to write a unix-style text file filter, it's really hard to beat.
21:05:24
aeth
pre-systemd, I'd say sh is going to be around as long as Unix is, but these days? Who knows.
21:15:04
jasom
I have a partial implementation of sh in lisp, that includes the ability to substitute in arbitrary lisp expressions
21:23:56
pookleblinky
Fish's attitude toward posix basically turned their scripting into an uncanny valley.
21:24:36
pookleblinky
If it'd stayed as compliant as zsh, it'd be a great shell. If it'd gone wild and chosen a modern scheme shell, it'd be amazing.
21:26:52
pookleblinky
Imagine a modern scsh, buit on chicken (scsh-process, etc) with modern autocompletion and paredit/etc so it can be used interactively.
21:32:13
aeth
I really think iteractive use vs. scripting use are too opposite to really work well (and they're probably a source of many of sh's flaws in the first place)
21:46:02
sukaeto
I like to take the view that the UNIX shell is a programmable interface to your computer, and sh (the language) is how you build new commands out of already existing ones
21:46:22
sukaeto
maybe you build a new command interactively and then make a function of it when you determine it's something you're going to do all the time
0:53:08
deba5e12
sukaeto: i was just saying the same thing today. it's a good way of explaining what a shell is (as a repl & a scripting lang).
2:48:43
axion
What does anyone think about naming reader/writer/accessors the same as slot names? I remember hearing good arguments in both directions here before, but I forgot.
3:11:57
beach
axion: I give them separate names so that client code would not be tempted to use SLOT-VALUE, etc.
3:13:55
beach
The counter-argument (Xach, for instance) is that SLOT-VALUE itself should set off as many alarms as `::%'.
3:17:58
axion
Well one typically does not prefix slot names, only accessors. The generic function approach of accessors amoung different objects is nice.
3:19:16
axion
(width instance-of-class-1) / (width instance-of-class-2) vs (class-1-width ..) / (class-2-width ..)
3:21:00
beach
That is why I use (defclass sheet (...) ((%parent :accessor parent))) so that I can write (parent pane) and (parent sheet).
3:21:27
axion
Thinking about it, it almost always makes sense to prefix all slot names with '%'. I disagree with SLOT-VALUE, WITH-SLOTS and the like in most cases.
3:22:46
beach
You disagree with what aspects of SLOT-VALUE etc? Using them? With me about not using them?
3:23:57
beach
I don't even use them internally anymore. I much prefer to establish an internal protocol so that I can extend my own software in a modular way.
3:24:34
axion
In some rare cases I use WITH-SLOTS when I'm accessing some long accessor name[s] multiple times in a verbose function
3:26:37
axion
In some even more rare cases i use WITH-SLOTS when I define only a reader method and I want to assign a slot after object creation, when I'm not using initialize-instance
3:30:55
axion
I have not visited any CLOS code in about a year until today, and looking at old code of mine made me question it a little bit.
3:31:12
beach
Sure. Discussions like this are always very helpful. I am convinced we (as suppliers of free Common Lisp software) must pay more attention to modularity etc., so as to decrease the total burden of maintenance.
5:24:09
jasom
something like: (defun mmap (name &rest lists) (map (lambda (&rest args) (apply #'send name args)))
5:24:50
jasom
something like: (defun mmap (name &rest lists) (apply #'map (lambda (&rest args) (apply #'send name args) lists))
5:26:38
jasom
the one advantage send has is that name collisions are not a problem with it; short names for generic functions can collide preventing you from importing two methods
5:29:26
pillton
i.e. One set of methods for a generic function perform a task that is different to what is done by others.
5:32:52
jasom
I was thinking of semantically differing overloads in less capable object systems (most famously C++'s (ash stream "foo") for output)
5:34:29
jasom
like much of C++ I waver between admiring it's cleverness and running away in horror at it's ugliness
5:36:08
beach
jasom: You would have to give up lots of Common Lisp standard functions, or make them harder to use. Consider the :TEST and :KEY of the sequence functions. You now have to wrap them in (lambda (object) (send 'key object)) etc.
5:36:54
beach
jasom: Again, I think part of the reason for CLOS generic functions was to maintain the usefulness of existing Lisp functions like the sequence functions, the mapping functions, reduce, etc.
5:37:14
jasom
I was wondering about the motivation for CLOS as the object systems that predate it were mostly of the SEND variety
5:37:56
pillton
Where they the send variety where the processing of the "invocation" was done asynchronously?
5:45:37
pillton
I guess it boils down to subjective concepts like granularity, modularity, reusability and some others I've forgotten.
6:07:53
flip214
> there is cl-cont which works by CPS transformation, so if performance is your concern it's not ideal.