freenode/#lisp - IRC Chatlog
Search
5:51:45
aeth
whoman: Here's a fancy macro in the wild, probably the fanciest I've personally used: https://gitlab.com/zombie-raptor/zombie-raptor/blob/000f644b2aa673249fc2da64ce115d7a68a073b1/examples/shaders.lisp
5:52:09
aeth
It's just GLSL in s-expression form because I kept making stupid syntax errors switching back and forth between CL and GLSL
5:53:07
whoman
one of the first reasons i wanted/needed macros is to avoid repetition, and i always dont feel that the world is right when i see heavy repetition in lisp code. going to check out that code now
5:53:10
beach
Oh, so that's the impression that some people have, i.e., that #lisp is a "Lisp support channel".
5:53:41
aeth
The actual macro is defined here: https://gitlab.com/zombie-raptor/zombie-raptor/blob/000f644b2aa673249fc2da64ce115d7a68a073b1/data/shader.lisp
5:53:51
beach
So, these people think they are entitled to get help for free, even though they make no effort whatsoever to follow the advice they get.
5:55:44
beach
17.05.11:06:52:45 <John[Lisbeth]> so (defun (intern "mystring") () (+ 2 2)) shoudl give me no problems
5:56:03
beach
17.05.11:06:56:11 <John[Lisbeth]> so I can (defun (eval (intern "foo)) () (+ 2 2)) then?
5:56:07
aeth
whoman: It's also probably some of the Lispier code I've written because it's macro-expansion-time so I don't worry about performance that much there. It's iirc basically in the style of The Little Schemer. Iirc.
5:56:51
whoman
it is best not to take things personally in this case especially. buddy is just talking "to internet people" and nothing to do with healthy relationships
5:58:01
whoman
aeth, cool =) i see optimization stuff too, like declaim. (i dont know much about these yet) but i can feel it is good code.
5:58:44
Bike
well, declaim inline is pretty straightforward. just indicates names of functions that should have inline definitions saved and used.
5:58:48
aeth
whoman: oh, if you see declaim/declare in the shader stuff and think it's strange, don't look at the stuff that has to run during the game loop
6:00:15
aeth
(defun foo (x y z) (declare (single-float x y z)) (+ x y z)) ; in most modern implementations, this will type check at safety != 0 and assume types at safety = 0, and use single-float-specific +, not the generic + that operates on the whole numeric tower
6:34:02
aeth
Terrible timing, the power went out just as I was in the middle of typing two code examples, and the second (that didn't get sent) is the one that was more relevant (on declaim, rather than declare)
6:40:40
aeth
declaim goes outside of the defun rather than in the first part, and unlike declare (which has some other common uses like optimization levels) is, at least in my limited experience, almost always just used for inline
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)