freenode/lisp - IRC Chatlog
Search
10:17:16
stilda
I have tried to generate code for multiplication of hypercomplex numbers. My macro takes a list of multiplication rules for imaginary units and output a code for multiplication function. So far it looks like lisp is a very good fit for this.
10:24:43
phoe_
Because, well, you have the whole language at your disposal during read-time, macroexpansion-time, compilation-time, load-time, execution-time.
10:25:14
phoe_
In most languages, only the third of these is guaranteed. In some of the more interactive languages, the fifth is also added.
10:27:55
phoe_
For read-time, there's the #. reader macro; for macroexpansion-time, there's macros; for compile-time, load-time, execution-time, there are the respective eval-when options.
10:28:28
phoe_
(If I understand it correctly. There might be some bugs in the two statements above. If I'm wrong somewhere, please correct me.)
10:44:26
dim
in some cases it's possible to deliver “results” without being asked what tooling you used to deliver, those are good opportunities to use CL
14:12:41
drmeister
ECL uses a scheme for multiprocessing where special symbols maintain a 'binding' slot that indexes into a thread local table of bindings. As you do things like (let ((*foo* 1)) (declare (special *foo*)) ...) it doesn't write the 1 into the symbol-value of *foo* but instead maintains a thread local table of bindings that needs to be expanded in every thread
14:13:06
drmeister
Are there any other schemes out there for supporting multiprocessing and special symbol binding in Common Lisp?
14:13:54
beach
It would certainly be a bad idea to write a new value to a common slot in the symbol.
14:16:15
drmeister
Ah - ECL does have a per-thread binding stack that contains pairs <symbol,value> What I described above describes where the current thread-local value of the special symbol is stored.
14:16:59
drmeister
It's just a vector of objects and as each new special symbol is bound that symbol is assigned the next index into the table.
14:18:04
drmeister
Me too (slightly). My understanding of ECL's method is that it combines both of your two options - so I wonder what your two options are.
14:18:13
beach
The table is thread-local, but the index for a particular symbol is the same in every thread, right?
14:20:09
beach
So I am guessing the binding stack contains previous values. In my option 2, it would also contain current values.
14:23:56
splittist
I wonder how much of the mechanism is, in reality, just handling a million *print-...* specials that are rarely changed.
14:24:15
drmeister
The question is - do special variable binding and lookups come up enough that a simple stack would impact performance.
14:27:35
beach
Option 2 would need a fast way of answering the question "Does this variable have a thread-specific binding in the current thread?".
14:28:23
beach
Otherwise, the entire binding stack would have to be traversed for an access to a global binding.
14:30:32
beach
How does the ECL technique determine whether there are any per-thread binding for a symbol?
14:33:06
drmeister
When it expands the per-thread table it fills the empty slots with a special no_thread_local_binding value.
14:34:06
drmeister
If you read a symbol with no_thread_local_binding - I think it copies the global value into that slot - so now you have a thread local binding that is identical to the global value.
14:36:25
beach
drmeister: Perhaps it stores a special value that is tested for when a variable is accessed. If it is EQ to that special value, it goes to the global binding?
14:38:01
beach
drmeister: Presumably, to assign to a special variable, you modify the value in the table, provided it is the thread-local binding. Otherwise, you modify the global binding.
14:53:54
attila_lendvai
drmeister: FYI, SBCL has an extension called defglobal, which makes sure the binding cannot be made thread-local
15:07:30
ogamita
if you use slot-value in your public interface, then you can define a method on slot-value.
15:08:02
ogamita
if you use an accessor in your public interface, then define a method on your reader.
15:09:21
beach
pebblexe: I am not sure I understand your question then, if it was not about the function named slot-value.
15:10:02
pebblexe
I have this in my class: (timestamp :type integer :initarg :timestamp :accessor timestamp)
15:10:16
pebblexe
ideally I could do this: (timestamp :type integer :initarg :timestamp :accessor timestamp :before 'func1 :after 'func2)
15:10:34
ogamita
So you have to use accessors and define a :before or :around method on your accessor.
15:11:05
ogamita
It would be possible with a specific metaclass that would use specific slot-definitions.
15:11:31
ogamita
pebblexe: It would be possible with a specific metaclass that would use specific slot-definitions.
15:12:16
ogamita
pebblexe: but one of the points of OO programming notably with CLOS, is also that you can split and spread stuff by other categories than just the class.
15:36:02
pebblexe
hey I am trying to load a 2gig file into ram and I am getting this error: (SB-KERNEL::HEAP-EXHAUSTED-ERROR 438632448 2541404000)
15:36:22
pebblexe
http://rosettacode.org/wiki/Read_entire_file#Common_Lisp <- that's the code I'm using to slurp
15:40:16
beach
pebblexe: The default element type for MAKE-STRING is CHARACTER, so you probably allocate 4 bytes for each character.
15:45:32
ogamita
So I'd rather (make-array big :element-type 'base-char :adjustable t :fill-pointer big) and obtain a base-string, but not a simple-base-string.
16:05:02
drmeister
I think if the thread-local-binding table has no_thread_local_binding for that symbol then it modifies the global value.
16:06:29
drmeister
That's what I came up with walking back from class - but it seems like it should work.
16:14:08
Xach
if that message comes up on sbcl, it usually indicates an incomplete or damaged installation.
16:28:36
eschulte
as I recall quicklisp supports project-local installations (effectively project local local-projects, which is hard to google), is this documented somewhere? Is qlot the tool to use?
16:30:56
bpanthi
Xach: (push #p"/usr/local/lib/sbcl/contrib/" asdf:*central-registry*) solved the problem
16:33:25
bpanthi
Xach: may be asdf or quicklisp should include that directory by default. (my asdf version is 3.1.5)
16:34:01
Xach
bpanthi: in a normal installation of sbcl, with asdf loaded, it will work without any work on the user's part.
16:34:31
Xach
bpanthi: that is, (require 'asdf) (asdf:load-system "sb-rotate-byte") will work out of the box.
16:34:45
Xach
bpanthi: if that does not work for you in some circumstance, there is something to fix.
16:37:41
bpanthi
Xach: but when i do CLEAR-CONFIGURATION-AND-RETRY in (asdf:load-system "sb-rotate-byte") restart , and try again , it works.
16:38:13
Xach
bpanthi: that suggests to me that there is an asdf config file that is messing things up
16:40:06
Xach
bpanthi: not sure...they can live in /etc, I think, and ~/.config, and perhaps other places
16:40:24
jasom
okay, where is upstream for quicklisp's esrap? What I get from quicklisp looks nothing like https://github.com/nikodemus/esrap
16:51:38
ogamita
https://gitlab.com/com-informatimago/com-informatimago/blob/master/common-lisp/cesarum/simple-test.lisp
16:51:59
ogamita
example: https://gitlab.com/com-informatimago/com-informatimago/blob/master/common-lisp/cesarum/string-test.lisp
16:56:39
scymtym
jasom: did you see the reference to https://github.com/nikodemus/esrap in the debian package or somewhere else?
17:04:56
phoe_
just don't pass it symbols, because the fleted/labeled symbols aren't globally fbound and that's where disassemble looks for the symbol-functions
17:05:26
jasom
now I'm trying to figuore out how to get the function object; I'm profiling some code and the top 3 functions are all labels/flet
17:07:13
scymtym
jasom: SB-DISASSEM:DISASSEMBLE-CODE-COMPONENT kind of shows it, but you have to map segments to back to functions
17:08:05
scymtym
with sufficient debug policy there will be semi-helpful labels that may help with that
17:09:03
jasom
phoe_: break drops you into the debugger, and from the debugger you can execute arbitrary code
17:11:46
jasom
The tooling is what keeps me coming back to lisp; I do really like macros, and editing s-expressions is much easier than less regular syntax. The condition system is pretty neat too. However the tooling is unrivaled compared to any language implementations that compile to tight machine code, and it's among the best even for highly dynamic interpreted languages.
17:13:46
jasom
mazoe: right, I can change a single function, recompile and get instruction level profiling faster than a single c++ incremental build
17:15:10
jasom
The other day I modified some performance critical code and it got 30% slower; in under 5 minutes I was able to determine it's because changing the code around an IF made a conditional move become a tst/jne and branch prediction is a thing.
17:18:41
Petit_Dejeuner
jasom: I assume SmallTalk is too in-its-own-world for you and Erlang is too functional?
17:21:41
jasom
And yes, SmallTalk has great tooling; historically there's lots of cross-pollination between ST and Lisp.
17:22:57
jasom
Oh, I should also say that there are some commercial tools that have good tooling, but the price means that they are unlikely to be used for hobby projects.
17:24:29
jasom
I'm not poor, but I'm also not going to drop $5k on development tools for software I'm giving away for free.
17:26:47
aeth
$5k is more than most reasonable development hardware expenses for one individual these days. Iirc, it's also more than setting up an LLC, trademarking something, etc. So even if you *were* selling it, $5k could be your highest expense.
18:13:36
TruePika
Both on my VM and on my server, I have directories such as "Perl"/"C++"/"C"/"common-lisp"
18:15:28
TruePika
(with restructuring; one of my projects has a subdir with over 50k images in it, and if ASDF looks in there, stuff slows down a _lot_)
18:16:41
TruePika
My laptop is only slightly better, since almost all my devving is in VM; all I have is "Github" (in ~/Documents) and "common-lisp" (in ~)
18:17:27
aeth
I just put everything under "~/git". I used to also have an "~/svn" and a "~/hg" a long time ago. (The svn one was first... unless I started with cvs, I don't remember.)
18:17:43
aeth
I'm not sure if it's better to have everything, regardless of language or context under ~/git
18:18:42
aeth
(It's not *all* flat under ~/git, I also have ~/git/other for when I have no commit access to that repository)
18:18:58
TruePika
maybe that filesystem idea MS had ages ago, but which would certainly not work with CL's pathnames
18:20:17
TruePika
ACTION has...either one or two more big things to write before he has a sufficient interface to atc(6)
18:20:49
TruePika
I don't know if airplane position prediction should be part of the interface or the AI
18:21:45
TruePika
but I want to be able to test the prediction in runtime against update packets (to validate that the expected next state matches what actually happens), which would mean it needs to be part of the interface
18:22:40
TruePika
(I'm not very concerned about execution speed at this point, since I can hack out the semi-realtime nature of the game for development purposes, if I need to)
18:23:46
dlowe
AI used to be what we can't make a computer do yet. Now it's what we can make a computer do but we have no clue exactly how it does it.
18:24:45
TruePika
meh, I'll have it be part of the bot code, and the assertions will be in the bot code as well
18:25:01
edgar-rft
airplane position prediction is easy, but it's more difficult to convince the pilot to fly to that point
18:26:00
TruePika
(and the RNG is technically deterministic, but not from the perspective of game inputs)
18:27:06
TruePika
coincidentially, the _other_ thing is a "command" class, which is used to issue commands to pilots (and send the keystrokes)
18:29:42
edgar-rft
TruePica, pjb: both versions only tell me that there is no such manual, but thanks for the link!
19:05:04
pebblexe
I installed clozure and now I am getting this error trying to quickload a project: You need ASDF >= 3.1 to load this system correctly.
19:10:52
TruePika
ACTION tests the COMMAND class by writing code which commands everyone to go to 5,000 feet - I expect _something_ to crash
19:12:36
TruePika
The method #<STANDARD-METHOD AUTO-ATC.INTERFACE::COMMAND-CHECK (AUTO-ATC.INTERFACE:ALTITUDE-COMMAND) {1002F59D43}> on #<STANDARD-GENERIC-FUNCTION AUTO-ATC.INTERFACE::COMMAND-CHECK (6)> has no qualifiers.
19:19:04
TruePika
my code looks pretty much like what's in Practical Common Lisp, but using AND instead of +
19:42:22
drewc
TruePika: Is that starting from a from lisp, or a new package, or a new generic function with the old symbol unintern'd first? I am not familiar with the AND method combination, but the code you pasted should work, and works in my *slime-scratch* buffer with a quick test.
19:59:11
TruePika
I tried to issue an altitude change for plane A to 5,000; all that happened was reception of the first "A" (plane ID), then a bell
20:36:02
decuser
I would like to check a list to see if all of its members are integers. I wrote this code - (map 'list #'integerp '(1 2 A)) and it correctly returns (T T NIL). How can I get it reduced to just NIL?
20:36:59
decuser
I tried reduce using #'and, but it complained that AND wasn't a function. I'm using sbcl 1.3.14
20:40:35
jasom
someone (beach perhaps) was working on a representation for lisp source code that preserves more than READ. My searching for it is failing; anyone know what I'm talking about?
20:42:35
drmeister
jasom: I know about the thing that beach is working on to represent source locations and objects.
21:02:46
malice
How can I make quickload print out the compilation errors/warnings, e.g. when compiler cannot optimize something?
21:03:01
malice
I have (declaim (optimize ...)) in my code, and I must do C-c C-k because quickloading won't do
21:25:25
drmeister
The only think I know that exists is page 61 of this: http://metamodular.com/cleavir.pdf
21:29:07
Bike
https://github.com/robert-strandh/Second-Climacs/tree/master/Papers/Incremental-parsing something like this, i think
21:32:07
Bike
alexandria has it as array-index, which is... (integer 0 (#.(1- array-dimension-limit)))
21:56:37
jasom
I'm seeing a lot of poorly optimized lambdas when they close over a value that will be constant for the entire life of the lambda; is there a declaration I can use to hint this to the compiler?
21:57:04
jasom
I see a *huge* speedup by chainging it from e.g. (lambda () bar) to (compile nil `(lambda () ,bar))
21:59:33
phoe
Drakma question: how can I force HTTP-REQUEST to print the request to *standard-output* instead of sending it to the host?
22:00:25
jasom
Bike: no, the lambda does not have dynamic extent; it's just closing over values that are constant.
22:02:22
Bike
i mean, if you have (lambda () bar), it looks it up in a closure cell, if you do the compile it will be in a load time value cell thing
22:04:14
aeth
(declaim (inline constant-lambda-factory)) (defun constant-lambda-factory (x) (compile nil `(lambda () ,x)))
22:05:52
Bike
i'm not sure what optimization jasom is expecting to occur, but they said it does improve performance, so there must be something
22:06:17
Bike
constantly is likely defined in the obvious way, making it equivalent to (lambda (&rest ignore) bar)
22:11:26
jasom
Here's something closer to the real code (defun member-factory (bar) (lambda (x) (position x bar)) (member-factory "1") will generate fairly crummy code.