libera/#commonlisp - IRC Chatlog
Search
8:14:28
zacque
Hi, question: Why does `(apply (car '((lambda (x) (= x 2)))) (list 2))` give type error? I'd expect it to return T
8:16:59
beach
You would have to convert the lambda expression to a function, so you would have to use EVAL or COMPILE.
8:21:02
zacque
Hmmm, right now, the lambda predicate is supplied by my own, I'm storing these predicates inside a list
8:21:35
zacque
What I have in mind is to apply them one by one against a data until one that returns T
8:21:54
beach
If you construct the list to contain functions in the first place, you should be fine.
9:02:55
hayley
Has anyone got any favourite benchmarks? I'm aware of cl-bench, but am looking for more garbage collector-intensive programs, and perhaps parallel programs too.
9:08:16
hayley
Hm, could be interesting to test a web server, but there's usually very little that survives between collections. My Regrind fuzz tester already has that kind of allocation behaviour.
9:14:15
hayley
ACTION needs to ask for a license for one of the benchmarks she used. Whoops. Can't un-remember how that code works now.
10:09:10
splittist
There are problems that can only be solved by staring out a train window or walking in the woods. There are problems that can only be solved at the keyboard and letting your fingers do the thinking. I wish I knew ahead of time which is which.
10:45:53
jcowan
hayley: rather than a web-ized file server, a stateful app server might be the thing fwiw
10:46:36
hayley
Sure, but what application? Shouldn't be too hard to interact with, since I need to automate that, but it should do interesting work.
11:42:40
hayley
I've recorded pause times for Kandria and made some pretty graphs, but not sure how to automate it.
11:45:14
hayley
The ideal would be to run through some kind of recording of inputs, so that it does roughly the same work in each test, and have it print out "#.MOST-POSITIVE-FIXNUM ticks in 0.0001 seconds". Except maybe not the last part.
11:50:49
hayley
Then it should be fine. Next question, for myself to figure out, is how to meaningfully combine measurements of pauses. Gil Tene says thou shall not take averages of percentiles.
11:52:20
hayley
There was a joke about someone suggesting to add Minecraft to the DaCapo benchmarks (for Java). That someone denied having said it, but appears we can have video games in benchmark suites for CL.
11:53:50
hayley
Minecraft refused to run under Azul's JVM. And there was a bug report for OpenJ9 about poor performance there. Close enough!
11:56:37
hayley
https://github.com/eclipse-openj9/openj9/issues?q=minecraft but I'm getting off topic. Thanks, I'll have a see about making a Kandria demo to benchmark.
13:20:51
zacque
I'm using let-over-lambda for a "static" variable for a function. Is it okay to return variable as in `(let (prop) (defun foo () prop))`? Will the client be able to modify `prop` value outside my designated closure function(s) as in Java/C?
13:21:41
hayley
I don't see how that could happen in Java or C. But the client cannot modify the value of PROP, no.
13:22:49
hayley
Those languages do not use pass by reference (with the exception of taking a reference using prefix & in C).
13:24:28
hayley
Would I write e.g. "static int prop; int foo() { return prop; }" in C, calling foo will return the value of prop at that time.
13:25:36
pjb
zacque: have a look at http://informatimago.free.fr/i/articles/usenet.html#C-like-pointers-in-Lisp
13:26:05
pjb
places are not first class objects, but you can wrap them in closures that are first class objects.
13:26:16
hayley
In that case, the value is a reference, but the function returns a value. Yes, a caller could modify the list.
13:27:34
pjb
that said, conceptually, it might be better to think in terms of high order functions in general, rather than in terms of references to variables. You may do more than set a variable in a function parameter.
13:27:39
hayley
http://metamodular.com/common-lisp-semantics.html may explain the situation; I am heading off to bed.
13:29:06
beach
zacque: You are confusing two things. Call by reference means that the function call does not evaluate the argument, and instead requires an l-value so that a reference to the storage where the object resides is passed instead.
13:29:09
beach
zacque: Call by value means that the function call evaluates the argument before passing it to the function. It just so happens that the values in Common Lisp are (usually) references to memory. But that does not make it call by reference.
13:47:48
zacque
Okay, to sort out my mind, in the case of `(let (prop) (defun foo () prop))` where PROP is a list, I want to prevent my clients from modifying PROP, so I should instead return `(copy-list prop)`. This is because the value return by FOO is a reference to the actual value of PROP
13:49:04
beach
zacque: It is not clear what you mean by "modifying PROP". It could either mean to change the value of the variable or to modify the object that is the value of that variable. I guess you mean the latter.
13:49:26
phoe
tell the users that the list is immutable and if they mutate it then they are in UB zone
13:49:27
hayley
The value is a reference to a list, which doesn't have anything to do with the variable named PROP anymore.
13:50:07
beach
zacque: I agree with phoe. If you can't trust your clients, you should find new ones.
13:51:13
beach
zacque: It is very common to see in documentation a phrase like "It is not specified whether a fresh list is returned. Do not modify the list being returned"
13:51:44
phoe
another is SYMBOL-NAME of any symbol; mutating the strings returned by SYMBOL-NAME can transport you to Narnia
13:52:15
hayley
Would I have "static int *prop; int *foo() { return prop; }" the return value is not related to the variable prop; modifying the value of prop will not affect values returned by foo before.
13:52:38
hayley
"The value of prop" and "the CAR and CDR of the value of prop" are very different things still. I had a diagram for this, even.
13:53:11
phoe
Lisp isn't C++ or Java where you absolutely have to divide your stuff into public and protected and private and have friends and nonfriends; it's sort of a trustful language that places the blame of abusing said trust on the user rather than the programmer
13:54:22
phoe
"The consequences are undefined if an instance of class PHOE is made to hold any beer."
14:11:34
beach
zacque: Also, I recommend you join #clschool. This channel is not really meant for newbie questions, although they are tolerated to some extent.
16:24:18
Josh_2
https://plaster.tymoon.eu/view/3648#3648 I am pretty sure I have had this issue before
16:26:08
phoe
maybe a solution would be to replace (the ub64 ...) blocks with (ldb (byte 64 0) ...) to ensure trimming
16:28:12
Josh_2
Hmmmmmm I am using the binary version of sbcl 2.2.9, Is that compiled with --fancy :thinking: