freenode/#lisp - IRC Chatlog
Search
9:01:36
beach
ACTION is finally making progress on the implementation-independent lambda-list parser meant to be part of the "Concrete Syntax Tree" library.
12:24:51
splittist
beach: (or anybody) what body of well written, adequately documented code should I be browsing to kick me into thinking protocols rather than objects. (Answers with Swift in them will be ignored.)
12:30:53
jackdaniel
MOP is one, CLIM has dozen of protocols (as specification), beach libraries usually are documented around protocols (i.e Cleavir)
12:31:23
phoe
splittist: also, beach has publicized a chapter of his book that defines what a protocol is. It's good read - you should poke him for it.
12:41:07
_death
for thinking protocols you shouldn't read code, but specs.. the clim one is the primary example I know of
13:11:36
beach
splittist: The documentation is fairly complete as well, and specifically talks about protocols.
13:12:48
beach
splittist: It is fine to mention classes (in particular protocol classes) in a protocol. And it is fine to mention :INITARGs. But it is not fine to mention slots.
13:14:57
splittist
beach: yes. I was just thinking that multiple inheritance avoids many of the problems other languages are re-inventing protocol orientation to ameliorate.
13:17:45
dim
multiple dispatch but also dispatch on all types (hash-table, list, array) not just “objects”, and including dispatch on specific values (eq dispatch)...
13:22:58
dim
what I mean is that standard types are objects as far as dispatch is concerned, you can actually dispatch on list
13:24:24
jackdaniel
yes, but for instance double-float is a type, but spec doesn't mandate being it built-in class
13:24:38
jackdaniel
so you can specialize on float, but specializing on double-float is implementation dependent
13:25:03
jackdaniel
this is very useful diagram: http://sellout.github.io/2012/03/03/common-lisp-type-hierarchy/
13:25:43
dim
in Java you can't do anything with an int, you need to use an Integer, but you can't say Integer + Integer, it's Integer.add()
13:26:56
Xach
dim: long before i knew anything about lisp, jwz's rant about BigInteger math struck me.
13:28:06
dim
I don't know about that article Xach, but I know I refused to admit that Java like OOP was anything useful to write good code and then “saw light” when finally read about CLOS
13:29:02
Xach
(jwz's rants also helped me grok that you can refer to and work with "objects" without having direct language support)
13:30:54
Xach
something i also saw reinforced when alvy ray smith explained his object-oriented implementation of sprite image editing in C...
14:21:02
doby162
Is there a standard way to deploy executable binaries to an OS that I don't have access to? Or is the best way to just get access to that OS?
14:21:42
jackdaniel
what do you mean, that you don't have access to it? putting executables to system you have no access to would be breaking its security :-)
14:21:50
Xach
doby162: That sounds like an interesting challenge, but it does not seem especially lispy.
14:28:48
phoe
note that CCL does not work under wine AFAIK, though CCL is one of the two suggested implementations for Windows (the other being SBCL).
14:29:46
doby162
I use sbcl by default so I'll probably start with that. I saw some old google groups discussions about cross compilation but they all linked back to http://sbcl-internals.cliki.net/ which seems to be dead
14:34:07
|3b|
they were probably talking about building the base sbcl executables rather normal user programs, and even for that you still need to run the final part on the target platform
14:34:47
|3b|
(and some of the intermediate parts as well i think, so it can detect features of the target environment)
14:44:21
phoe
my solution so far - grab a RAM upgrade and run Windows inside VMs for testing purposes
14:45:37
doby162
Lol, maybe I'll just ask to use someone else's computer every time I make a release
14:49:31
doby162
Yeah. Eventually, given unlimited dev time, the plan is to write the game's client in javascript or something that compiles to javascript and have it be a browser game. The client is basically just an ncurses UI for the server, where all the logic happens
14:50:20
pjb
doby162: you could write a CL compiler that would generate lower level lisp source code. Then you could in an installation phase, compile and load this low-level (perhaps obfuscated) lisp source on the target systems.
14:51:59
doby162
That seems like more effort than a windows script to automatically download and install sbcl/quicklisp + my github repo.
14:52:36
doby162
That said, is cross compiling an achievable goal for sbcl? I'm not exactly a seasoned hacker but it could be a thing to work on someday
15:39:29
paule32
in python, there are following code possible: "for iteration in xrange(number_of_training_iterations):"
16:19:13
jasom
paule32: if you don't need a counter (loop repeat number-of-training-iterations ...) is preferred
16:23:09
jasom
doby162: sbcl for windows works great under wine for building, but as others have said, you may want to test on a windows vm occasionally
16:28:18
doby162
Awesome. Yeah, the only hitch I'm expecting is that croatoan might need another patch to run on windows. I had to patch it for mac
16:40:47
loke
paule32: Before anything else, please try to use standard code style. No one puts closing parens on its own line.
16:40:49
beach
paule32: The first mistake is that you have whitespace preceding closing parentheses.
16:41:25
beach
paule32: Three semicolons are used for top-level comments, not for comments inside a function.
16:41:42
loke
paule32: You can't just put parens around a list of forns to group them. You are probably looking for PROGN.
16:42:30
beach
paule32: You have already been told about these problems. Please fix them before you submit code.
16:58:17
loke
paule32: PROGN takes a number of forms, executes each in sequence and returns the return value of the last one.
16:58:38
minion
paule32: please see pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
16:58:40
minion
paule32: have a look at gentle: "Common Lisp: A Gentle Introduction to Symbolic Computation" is a smoother introduction to lisp programming. http://www.cs.cmu.edu/~dst/LispBook/
17:01:54
BernhardPosselt
hi, why do i need a car to get an element out of a list? http://www.lispworks.com/documentation/HyperSpec/Body/f_firstc.htm#first
17:03:46
jasom
BernhardPosselt: lists in lisp are implemented as linked lists with CAR being the value and CDR being the next part of the list. The naming is historical due to assembly instructions on a PDP
17:03:50
Bike
it stood for "Contents of Address Register" at some point. the etymology isn't important.
17:08:38
jasom
The 704 is apparently also why a lot of older lisp symbols are truncated to 6 characters; that's how many characters fit in 1 word of memory on the 704
17:14:48
phoe
BernhardPosselt: Contents of the Address part of Register (CAR) and Content of the Decrement part of Register (CDR)
17:15:23
phoe
so if you had a linked list, then CAR would point at the head (data) and CDR would point at the tail (the rest of the list)
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"