libera/#commonlisp - IRC Chatlog
Search
19:23:49
rotateq
attila_lendvai: cool also a lib for lazy evaluation :) read yesterday that Simon Peyton-Jones had his last day at the MS research group
19:24:17
attila_lendvai
pve, i suggest getting it from ql because the darcs HEAD contains half baked stuff. or the LIVE darcs repo from dwim.hu... but you're better off with ql.
19:25:44
pve
because as usual, I was contemplating rolling my own, but I'm not sure that's a good idea :)
19:26:35
attila_lendvai
hu.dwim.lazy-eval is closer to a proof of concept. but we used it in live code. authorization in our web ui was done so that a large form was constructed, and then it got lazy-eval'd, and then automagically evaluated at each point where it was needed. we could even generate english doc from who can do what in the system, and the rules were of course editable
19:28:40
attila_lendvai
jcowan, i know... :/ something broke with the entry point a few years ago. navigating from the dwim.hu menu works, but most project has little useful data. (the UI is constructed based on metadata)
19:29:14
attila_lendvai
to be honest, i'm surprised it's still this functional after some 10 years of potential bitrot.
19:34:47
Guest74
anybody know why slime occassionaly starts indenting forms when trying to use autocomplete? It's pushing my stuff to the end of the screen.
19:38:32
lisp123
Guest74: Never saw that before. Try C-h m and see if you have any indent minor modes active
19:39:04
lisp123
I have Electric-Indent, but perhaps you have something else which may be conflicting with slime
19:39:39
lisp123
Also try #Emacs, there used to be a command / way to debug more estoric issues in Emacs, they might be able to help tell you how to
19:40:20
Guest74
random indententations across sessions, stays pretty constant in same session, might increase.
19:40:50
lisp123
I see. Sounds annoying, but unfortunately I haven't faced that yet so dunno what could be the cause
20:47:07
jackdaniel
some progress with the incremental redisplay in mcclim: https://turtleware.eu/static/paste/incrm-table.mp4
21:20:16
hayley
It would be better to maintain the position of the start of the next numeral to match, rather than creating new strings.
22:07:25
pjb
dre: there was no link in a comment to the specifications, so I guessed that the file only contained integers, and that you didn't really want to just take the first integer on each line.
22:07:52
pjb
just using read should be faster than read-line + parse-integer, if the file is well formed.
22:50:27
dre
it should be "count increases" i guess. it's counting the number of increases from the nth value to the nth + 3 value
23:19:22
Guest74
dre: I made the same 'mistake'. It makes not sense to use an if to transform a T or Nil to 1 or 0 to sum the count when you can just (COUNT T list)
23:45:19
pdietz
< is not guaranteed to return T for true, although in most (all?) CL implementations it does.
0:00:04
mzan
I made AoC day 1 part 2, using tap and series packages (a stream library), and I'm happy of the code.
0:32:17
dre
<Guest74> I still think my favourite for part 2 is (COUNT T (MAPCAR #'< list (CDDDR list)))
4:03:28
beach
mzan: There is no reason to have a newline after LET*. And in Common Lisp, we don't have closing parentheses preceded by whitespace (and that includes newlines). Plus, there is no particular reason to have blank lines in the middle of top-level forms.
4:04:49
beach
mzan: And (lambda (ss) (series:collect-sum ss)) can be more simply expressed as #'series:collect-sum.
4:11:35
beach
jackdaniel: I am not sure from your demo what the improvement is compared to what things were before. Any hints?
4:16:43
Guest74
but asking about the function that returns the complement of a fucntion? probably complement?
4:17:06
beach
I haven't had my coffee yet, but perhaps (count nil ... :test-not #'identity) or (count nil ... :test #'not)
4:28:15
Guest74
I guess it probably wouldn't be good style to use it since :key sort of implies an accessor?
4:30:38
hayley
The :key and :test arguments are pretty open to interpretation to me. I recall mentioning some form in #commonlisp a while ago, something like (find 'integer '(fixnum real string) :test #'subtypep).
4:32:08
hayley
Worse, the :test doesn't have to be an equivalence relation. For example, (complement #'=) or #'/= is not an equivalence relation, but using either for :test is preferred over using the deprecated :test-not.
4:32:57
Guest74
well, I will happily abuse this if the opportunity presents itself. I notice clhs doesn't mention anything besides it being a designator for a function.
4:42:40
semz
I definitely find it more natural to enforce a predicate than to describe what I want removed.
4:43:15
semz
Do remove-if and remove-if-not predate the "filter" terminology that's more common nowadays?
4:44:19
hayley
The Standard ML function List.partition partitions into two lists instead, which seems nicer.
4:51:16
beach
I agree with hayley that FILTER is ambiguous. Plus, in Common Lisp there is the distinction between REMOVE and DELETE which is made explicit this way.
5:10:14
hayley
...notably, the competitions where people churn out code as quickly as possible. Not all competitions are based on programming speed.
5:16:25
hayley
Make sure you have loaded the split-sequence system, and then (split-sequence:split-sequence #\space "this is a string")
5:17:07
hayley
I'd usually say something right about now, but I don't have functions that replace and split strings.
5:17:49
hayley
But, yes, CL-PPCRE performs operations on regular expressions, and not just strings, so e.g. splitting on "|" might go sideways quickly.
5:18:16
hayley
I recall my first university assignment involved parsing "database" files which were | delimited, just to throw people off using .split() in Java, which takes a regular expression.
5:19:59
hayley
Amusingly, I was just about to ask something about regexen implementation: somehow an article I wrote on my regular expression compiler got big on Reddit and Hacker News. Someone asked me how I would handle character classes like \w or [:alpha:]. I suspect generating a whole lot of <= for each range is a terrible way to match a character class comprised of many ranges.
5:21:25
hayley
Another approach would be to use a bitmap, but we'd need a lot of bits for every Unicode character. And the generated code is quite fast, so having a large table also would result in more cache misses and more of a slowdown, which would be unfortunate. Is there a clever way to "compress" a bitmap in a way that allows for random access to the bitmap?
5:22:26
hayley
dre: I assume the documentation assumes you have used the package, but that is not a good idea, so you need to include the name of the CL-PPCRE package. Try (cl-ppcre:parse-string "(ab)*")
5:24:02
hayley
Prefixing everything with the package is usually easier on the person reading your code, so I would just do that.
5:24:57
hayley
Not by much. And it's better if your editor can complete names, so (cl-p <tab> p-str <tab> "(ab)*") might suffice.
5:27:52
hayley
Here is a hackish implementation of a "page table" which avoids requiring parts of the bitmap that are entirely 0 or 1 to exist in memory <https://plaster.tymoon.eu/view/2740#2740>, but I would guess testing for the sentinel values could confuse branch prediction.
5:28:19
hayley
Hm, I could hash cons instead, and there would only be one fully 0 page, and one fully 1 page.
5:31:31
dre
if I then redefine the function ( correcting the mistake), and then "Ctrl-D" to get out of the debugger...
5:32:54
dre
but I'm evaluating the defun in the debugger, then leaving the debugger, so I have the old version right?
5:33:33
beach
SBCL has only one global environment, so if you evaluate the DEFUN form in that environment, the old function will be replaced.
5:35:05
hayley
There is SLIMV for vim, though I have heard mixed things about it. Granted, I have also heard mixed things about SLIME too.
5:36:39
dre
I use "vim-slime" which, very basically, will send the paragraph I'm on to *another-terminal* with a <c-c><c-c>
5:37:33
Nilby
or you could be like me and not use SLIME/SLIMV/SLY anything, and even more naughty, use :use/use-package
5:57:28
hayley
It might be better to use DESTRUCTURING-BIND too. e.g. (destructuring-bind (action distance-string) (cl-ppcre:split " " item) ...)
6:07:00
abrahms
Hey commonlisp folks. I'm trying to figure out how to call a function if I have the string representing it's name. (funcall (intern "func-name-here") 1) doesn't seem to work.
6:08:14
hayley
The reader upcases symbol names by default, so you probably need to upcase the name yourself.
6:09:35
Alfr
abrahms, no but it won't intern a new symbol into package if func-name-here is misspelled.
6:10:00
jackdaniel
beach: on master the same code (sans cells are aligned differently, but that doesn't matter here) -- https://turtleware.eu/static/paste/incrm-table-old.mp4
6:16:00
_death
often when I want to have such dispatch equal is more appropriate.. but I do use equalp sometimes, either for such case-insensitiveness or for non-string array equality
6:24:45
jackdaniel
beach: well, the spec is quiet about what does it mean to propagate changes, so not strictly a bug
6:26:27
beach
So was the behavior different before when incremental redisplay was in use, compared to when it was not?
6:28:38
jackdaniel
I've been fixing issues for situation when some record was redisplayed that was not top level
6:31:46
beach
Every day, there are fewer reasons to choose an FFI-based solution to Common Lisp GUI applications. :)
6:57:55
hayley
You didn't provide a variable name to set in the SETF forms that comprise the body of the last WHEN form.