freenode/#lisp - IRC Chatlog
Search
10:06:37
beach
How can I implement the standard method combination if I have no evaluator (no compiler, no interpreter)?
10:07:27
beach
You can assume that the methods themselves exist and have been loaded as binary code from (say) a file.
10:19:53
specbot
Standard Method Combination: http://www.lispworks.com/reference/HyperSpec/Body/07_ffb.htm
10:21:01
beach
And you would turn the applicable methods into an effective method which is a function that needs to be created at runtime.
10:21:26
phoe
Your CALL-NEXT-METHOD may simply invoke a method that is found via some dynamic variable.
10:23:11
phoe
If you know that you will want to have a CALL-NEXT-METHOD local function, then you can take a step back and, whenever you compile the methods, simply force them to have an ignorable local function CALL-NEXT-METHOD that refers to some dynamic variable and expects it to be bound.
10:24:36
beach
Related question: Suppose I have a (possibly empty) list of :BEFORE methods, a (possibly empty) list of :AFTER methods, a (possibly empty) list of :AROUND methods, and a (possibly empty) list of primary method. Can I, without any other information, always know what to do when call-next-method is called?
10:24:47
phoe
If it's for bootstrapping, the end user will not be able to notice that they have a function that is global but should have been local.
10:25:47
beach
2. If the list of :AROUND methods is empty, but the list of :BEFORE methods is not, then call all the :BEFORE methods in that order, and then set the list to '().
10:26:17
beach
3. If the list of :BEFORE methods is also empty, but the list of primary methods is not, then pop the first primary method off and call it.
10:26:40
phoe
The algorithm in CLHS seems well-defined. Your code should be able to always guess what to do next.
10:27:16
beach
4. If the list of primary methods is also empty, but the list of :AFTER methods is not, then call the methods on the list in that order.
10:29:00
phoe
Let's assume that you have *PRIMARY-METHODS* that holds the list of all primary methods for a function.
10:29:23
phoe
grab the CAR of this list, rebind the variable to the CDR, call the method-function of the CAR.
10:29:41
phoe
This way, CALL-NEXT-METHOD may refer to the next method by grabbing the CAR of *PRIMARY-METHODS*.
10:31:22
phoe
CALL-NEXT-METHOD can check on *AROUND-METHODS* if the CAR of this list "matches" the CAR of *PRIMARY-METHODS*.
10:33:38
beach
some of which are primary, some of which are auxiliary. No :AROUND method is attached to another method.
10:36:04
beach
Given four lists *AROUND-METHODS* *BEFORE-METHODS* *PRIMARY-METHODS* and *AFTER-METHODS*...
10:36:40
beach
To invoke the effective method, I actually call the global function CALL-NEXT-METHOD, and that one does the following...
10:38:06
beach
2. If *AROUND-METHODS* is empty, it calls all the methods in *BEFORE-METHODS*, then sets that list to the empty list, pops the first primary method off and calls it.
10:38:35
Shinmera
beach: You have to check whether there's a primary method at all first, and if not, error.
10:39:18
beach
3. If both *AROUND-METHODS* and *BEFORE-METHODS* are empty, then if *PRIMARY-METHODS* is empty, then error.
10:39:52
beach
4. If *PRIMARY-METHODS* has a single entry on it, then pop it off, call it, and then call all the methods in *AFTER-METHODS*.
10:40:12
phoe
But if there is no primary method when there are after/or before methods, then it is an error.
10:40:49
beach
Since this is bootstrapping, we can assume that the code is correct, so that CALL-NEXT-METHOD is not called unless it is allowed.
10:42:53
beach
Correct, but if it has a single entry, it is the last one, so the after methods should be called.
10:43:35
phoe
You only call the first one - it is the method itself that may call next methods if it wants to.
10:44:17
phoe
If the method wants to call more, then it must invoke CALL-NEXT-METHOD inside its body.
10:50:31
pjb
aeth: the best thing in CL are the names! If you're not happy with them, you can define your own in your own package! (:use "AETH-LISP") !
10:52:28
aeth
pjb: thanks to specialization-store we now have a (semi-portable) way to easily define type-generic functions on numbers and sequences that behave like #'+ and #'map
10:53:12
aeth
Which means arithmetic functions could be defined to support inline sequence functions and hopefully have no performance penalty with the existing arithemtic functions!
10:56:03
pjb
Well arithmetic with more than two arguments has the inconvenient that the dispatch has to be done by analysing the whole argument list types.
10:56:58
aeth
I think another problem is that arithmetic with vectors/matrices would cons heavily unless there was something fancy going on.
10:57:04
pjb
Well, AFAIK the standard would allow (reduce op arguments), but you'll get more precise results by sorting out the arguments.
10:58:26
aeth
(Also, matrices would have to be represented with 2D arrays, not sequences, or else there's no way to tell them apart from vectors, at least as I just described things.)
11:08:17
aeth
pjb: I think you just pointed out why this wouldn't work, though. Argument lists can be as close to infinite as 64-bits allows (probably the most positive 63-bit fixnum value)
14:10:39
flip214
using CLON for argument parsing I came upon this problem: a STROPT (say, "-l") has value NIL if the cmdline argument has a "-" in front.
14:11:16
flip214
Is that on purpose? Can I tell CLON that the string "option" isn't optional but required?
14:11:38
flip214
My use case is getting an integer from the command line - but negative values don't work so well, as you can see.
14:36:09
flip214
jackdaniel: no, the problem is that passing "-l -1" on the command line looks like the two options "-l" and "-1" to CLON
14:39:08
jackdaniel
https://www.lrde.epita.fr/~didier/software/lisp/clon/enduser/Valued-Options.html#Valued-Options
15:14:17
phoe
KZiemian: I think it refers to data stored in a tree structure, where you have nodes that can point to other nodes without cycles, and leaves are the nodes that do not point to anything.
15:36:33
pagnol
there's a library I would like to use (https://github.com/heegaiximephoomeeghahyaiseekh/lisp-binary) but for some reason ql:quickload gets stuck during compilation
15:46:03
zazzerino
pagnol: I'm also on debian stable, and would recommend https://github.com/roswell/roswell for this task
15:56:00
phoe
yep. AFAIK there are workarounds, look on the github page of the project, in the issues.
15:57:59
zazzerino
Looks like an interesting library. I tried loading it in quicklisp and have the exact same issue (quickload hanging while loading [package lisp-binary]. Sorry, I don't have a solution, but it's not just your machine!
15:58:34
zazzerino
Also, looks like the main dev opened an issue about a month ago with the title "Dependencies are fucked" lol
15:59:26
phoe
zazzerino: it's not QL hanging. It's SBCL running out of heap space while compiling it.
16:00:55
zazzerino
phoe: yeah, I think you're right. I just meant "ql:quickload" was the function I was running to load the library (which was in my local-projects dir)
16:15:00
zazzerino
maybe try ccl? if you've installed roswell it should be as easy as "ros install ccl" and I think "ros use ccl"
16:26:42
beach
ebzzry: When it looked like the xxx-if-not family was going to be removed (because of being deprecated) complement would have been more useful. But then, most people now agree that they are undeprecated.
16:41:03
Xach
An implementation may choose not to signal this error for performance reasons, but implementations are forbidden from defining the failure to signal an error as a useful behavior.
17:00:17
pjb
ebzzry: you have to distinguish two cases: #'foo where foo is a symbol exported from CL and #'foo where foo is not exported from CL.
17:04:59
pjb
11.1.2.1.2 points 2 and 3 (the exceptions deal only with flet/labels), mean that the implementation is free to fbind symbols exported from CL.
17:06:45
pagnol
phoe, zazzerino, jackdaniel on #sbcl suggested I run sbcl with --dynamic-space-size=8192, and it worked
17:14:18
pagnol
being new to lisp I had to google to find out what this refers too and am reading http://wiki.c2.com/?SmugLispWeenie
17:27:52
drmeister
I'm writing allocation profiling code for Clasp - is it better to keep track of the total memory allocated or the number of allocations?
17:28:56
drmeister
It seems to me the number of allocations is more valuable - there's overhead associated with each allocation.
17:33:50
Colleen
Bike: drmeister said 10 hours, 42 minutes ago: bclasp seems rock solid now - no more exception handling problems that I can see.
17:33:50
Colleen
Bike: drmeister said 10 hours, 40 minutes ago: It was a very, very longstanding problem in the WITH-TRY macro when an exception bubbles up the stack.
18:19:19
oisjdfoasidf
https://pastebin.com/61SjuyYV I get "*** - CONCATENATE: #\a is not a SEQUENCE", help?
18:20:22
oisjdfoasidf
I am brand new to lisp (coming from years of Python experience), and finding it very hard to get used to lisp. trying to write basic hangman game..
18:21:35
beach
oisjdfoasidf: IF in Common Lisp is a form with a value, so you can write: (setq result (concatenate 'string result (if (find c guesses) x y)))
18:21:53
pjb
oisjdfoasidf: but more probably, you'd want to use a functional expression, not a procedural one!
18:22:17
beach
oisjdfoasidf: Only in languages where IF is a statement must you duplicate the (setq result (concatenate 'string result ....))
18:22:19
pjb
oisjdfoasidf: also, your function doesn't do I/O, so don't include "PRINT-" in its name!
18:23:19
pjb
(defun current-matches (word guess) (map 'string (lambda (word-char guess-char) (if (char= word-char guess-char) word-char #\-)) word guess)) (current-matches "apple" "ajkle") #| --> "a--le" |#
18:25:12
pjb
(defun revealed-word (word guesses) (map 'string (lambda (word-char) (if (find word-char guesses) word-char #\-)) word)) (revealed-word "apple" "ajklexyz") #| --> "a--le" |#
18:32:03
AeroNotix
Shinmera: Just asking. I see you and baggers chatting often (in his stream etc) and you are working on different but similar things. Just think it's interesting
18:32:52
AeroNotix
I usually don't watch streams because they're too slow and end up waiting til they're on youtube so I can put them on 2x or 3x speed
18:33:16
AeroNotix
not that the content isn't interesting, https://www.youtube.com/watch?v=_DjEK3DMY_0 I'm watching this right now
18:34:01
AeroNotix
no experience with anything like this. I find CEPL tricky to just "get started" in it.
18:35:34
Shinmera
Getting into graphics stuff is tough. There's a lot of crap to learn up front before you can get anything done.
18:36:00
AeroNotix
yeah exactly. I'm a proficient programmer and have been programming for years but there's something about graphics libraries that seem so daunting
18:37:17
AeroNotix
It'd be good if for people's games libraries they literally made an example game which had you move a square inside a box.
18:38:29
Shinmera
For Trial there's https://www.youtube.com/watch?v=0v6iv_3BLeo, but it is pretty detailed (and slightly out of date by now)
18:38:48
Shinmera
So I don't know how helpful that would be. Honestly can't recommend anyone to get into it right now that doesn't want to just do engine work.
18:39:13
aeth
My nowhere-near-complete engine has an examples directory. I'm done developing the API when the examples are elegant. Very useful for me to have. I'm sure more complete projects have the same idea.
18:39:26
AeroNotix
It's amazing watching these streams, going from drawing a ground/wall tile to having it appear in a game and then loading up sprites that then shoot seems so simple. But you're clearly familiar with the API.
18:42:20
aeth
It's hard to tell what's out there because the line between library, framework, and engine is blurry
18:42:53
AeroNotix
aeth: it's not just a CL problem, there's TONNES of graphics libraries and related things to use. Kind of paralysing if you want to just jump into something
18:45:53
aeth
AeroNotix: (1) It's complicated enough for many different abstractions to make sense but not complicated enough to seem impossible, (2) most things wind up being outdated and it's easier to NIH than to update an older library
18:46:33
Shinmera
I've always had the bad habit of writing more engine than application code, so here I am never getting any actual games out
18:46:44
aeth
But #2 mostly doesn't apply to Lisp. It only has a few heavily-outdated libraries. It explains a few things, though, like cl-glfw vs. cl-glfw3
18:50:02
Shinmera
The closest to an actual game was Shirakumo's last LD entry: https://ldjam.com/events/ludum-dare/39/rush
18:54:13
aeth
I intentionally don't release things, although I'm getting closer to 70% or so of a basic game (ignoring some ignorable things like sound for now). Anything released would become a maintenance nightmare if the API isn't final. I suspect many others are in a similar situation.
18:58:34
aeth
itch.io hosts Lisp game jams regularly (where "Lisp" there means "the Lisp family", but it's mostly Common Lisp). e.g. https://itch.io/jam/lisp-game-jam-2017-easy-mode/entries
19:07:35
phoe
AeroNotix: I have already managed to succeed with the parsing, thank you for the offer though.
19:09:13
Xach
I had a macro IN-ANONYMOUS-DIRECTORY that would make a temporary random directory, set *d-p-d* to that directory, evaluate a body, and then clean up the directory.
19:09:48
Xach
but I had a typo and had something like (in-anonymous-directoryk (write-report *default-pathname-defaults*) (upload-report *default-pathname-defaults*)))
19:10:48
Xach
and evaluation rules meant that each part of the body ran. but it started publishing way more stuff than i wanted.
19:11:41
Xach
i actually lucked out because i had an encoded pathname and it broke the request signature
19:12:23
Xach
Back in ye olden times, people sometimes did "touch ./-i" to force rm to be interactive.
19:13:08
pjb
Well, I was bitten by: rm -rf ${DIR}/${SUBDIR} ; tested well under user accounts, but under root, DIR and SUBDIR were empty!
19:14:38
AeroNotix
something off topic but I hate how slack downloads snippets with the filename "-.txt"
19:56:56
jmercouris
I see that you can name your own markup you like via :markup to any value supported by pandoc
19:57:30
jmercouris
The only question is, for things like images, how do you like them let's say if you are using emacs org mode, will it be smart enough to see a link to the static dir and make an appropriate link?
19:59:56
knobo
I'm using websocket-driver, and I need to keep som extra data in the websocket object. I could extend the class, and do a change-class after it is created.
20:01:40
knobo
Is that the library has it's own make-websocket-class function that does some initiation.
20:04:01
knobo
the wsd:make-server does some things to the object that is returned to me.. (apply #'make-instance 'server .......)
20:14:42
malice
knobo: Why do you need to keep the data in the websocket object, and why couldn't you for example wrap the object in other object?
20:16:13
knobo
I can not keep it in the session object, because a user can be connected with several browser windows, and multiple connections in same window.