freenode/#lisp - IRC Chatlog
Search
13:56:49
Xof
I know this was yesterday or even the day before, but it's still in my scrollback and I had a showerthought, so...
13:56:51
Xof
(defun prefix (strings) (reduce (lambda (x y) (subseq x 0 (mismatch x y :end1 (length x)))) strings))
14:12:57
hjudt
do people nowadays use slime or sly? i've tried sly recently and found it offers some good improvements over slime.
14:13:36
phoe
I'm a spacemacs+slime user. I don't really complain, but then again, I haven't tried sly.
14:14:30
ggole
(defun prefix (strings) (if (null strings) "" (subseq (car strings) 0 (loop for string in (cdr strings) minimizing (or (mismatch (car strings) string) (length (car strings)))))))
14:44:19
hjudt
phoe: didn't know about spacemacs, but then i like following the standard emacs way because that's what my distribution provides... i also think about that way about sly, but quicklisp now provides it too so in that case it is fine and i like the features stickers and repl backreferences.
14:46:15
jackdaniel
I think that tasks like codegolf are superficial - there is quite a lot occasions when programmer is in need for small one-time utility during normal course of coding, that's a perfect occasion to make something and be proud of it
14:47:36
hjudt
shka_: it is like slime but has some additional nifty features (i also like the fuzzy search btw) and spares you some config lines. but that's probably it. might also be a matter of taste, but some things just seem to be easier to handle to me.
14:48:13
hjudt
i've only started using it a week ago and never was a very experienced slime user though.
14:49:12
hjudt
the only thing you have to set up in contrast to slime is a keymap for the selector which comes out-of-the-box with slime. that hasn't been very difficult to achieve though.
14:50:16
hjudt
it also has good documentation which helped me a lot, though slime isn't bad in that regard too
14:51:58
hjudt
the great thing was that you can also try it without removing slime. so it's easy to switch back and forth.
14:58:57
hjudt
shka_: sure, you can read up on it here: https://github.com/joaotavora/sly it also has nice demo videos.
15:00:17
hjudt
would be glad if you share your experience with it since you're probably a more experienced slime user than me
15:04:54
hjudt
yes, and there is also a tutorial or walkthrough that works and is perhaps more easier to follow (at least if you aren't a 144hz-accustomed hardcore gamer).
15:15:05
russellw
How do you programmatically generate '(1 2 3 . 4)? cons wants just two parameters, and append and list* both correctly complain that the last element is not a list
15:45:28
beach
But there is a little trick you can use if you don't want to use an external library.
15:47:21
russellw
list-length: Returns the length of list if list is a proper list. Returns nil if list is a circular list. ... It doesn't say what the result is for a dotted list?
15:47:49
beach
Should signal an error of type type-error if list is not a proper list or a circular list.
15:48:08
russellw
I forgot about circular lists. To clarify: what I actually need to test for is a dotted list. - ah! okay, thanks
15:48:55
russellw
I'll probably write my own function, so that will probably involve (and (consp a) (not (consp (cdr a))))?
16:12:13
nixfreak
Does anyone use lisp to create bash 1liners like to find something or parse something out, trying to see if its better to use lisp than bash on linux ?
16:14:21
|3b|
CL tends to be a bit verbose for things that you would usually do in bash, but i think some people have utility libs for making shell-like things more convenient
16:14:49
|3b|
though also depends on whether you already have the data in memory in a running lisp image
16:14:57
Shinmera
As soon as you need to use arrays in bash it gets terrible enough so quick that pretty much anything else would be better.
16:15:34
|3b|
yeah, i guess it depends on where you cutoff is for "something reasonable to do in bash"
16:16:17
on_ion
nixfreak: i would look at emacs' eshell and elisp. it allows mixing lisp (without parens usually) and bash.
16:17:49
|3b|
also CL's spec for file naming and operations doesn't make it very nice for general processing of files at the name/directory level
16:29:05
shka_
https://github.com/sirherrbatka/cl-data-structures/blob/master/src/file-system/find.lisp
16:30:12
shka_
so the code is more complicated, but it works with other things i wrote that expect range as a input
16:32:31
nixfreak
thats really cool , so why not just use find and grep , not being mean about it just curious why you did
16:33:54
shka_
and I already have general utils that work on ranges, so i can leverage those if i have something that works like find
16:34:59
nixfreak
I keep going back and fourth with languages and keep coming back to lisp for some reason
16:35:17
shka_
https://github.com/sirherrbatka/cl-data-structures/blob/master/src/file-system/line-by-line.lisp
16:37:28
shka_
this does not require reading everything to memory at once, works with my aggregation functions, can be chained into multithreaded processing and so one
16:43:16
shka_
nixfreak: anyway, i really prefer to write in lisp so if there is simply no tool that cuts it for me it is natural choice
16:47:45
nixfreak
shka I'm still a big noob in CL but I'm going to focus my attention to it instead of other languages
17:41:54
adlai
"little scripts to mimic unix tools" might not be the right approach for learning CL, as these tend to be rather orthogonal to CL's strengths
17:52:40
shka_
well, yes, but i have issues with unix pipes and string typing and you know the rest of my story
17:59:45
durn
How do I load Slynk in a package? An error is thrown when (slynk-loader:init) is called despite there being (require :slynk) above it.
18:03:59
p_l
https://www.ebay.com/itm/Symbolics-MacIvory-model-3-8-MW-in-an-Apple-Quadra-650-80-MB-9-GB-Genera-8-3-/113295545913?_ul=PL
18:05:08
durn
Has anyone ever considered emulating the Lisp Machine instruction set by defining it as a set of Forth words?
18:38:48
shka_
durn: so locate slynk.asd, get the directory part, substitute #p"~/dir/to/sly", the rest is the same from my understanding
18:59:11
PuercoPop
What I do on my .stumprc is (push #P"/home/puercopop/.emacs.d/site-lisp/sly/slynk/" asdf:*central-registry*)
21:49:23
aeth
You can still define a deep copy by renaming the copy function to %copy-foo and defining an inline copy-foo that does a deep copy
21:50:27
aeth
didi: The standard-object (not CLOS object) way to do it would be to define a copy generic
21:50:34
didi
aeth: But shallow copies can be useful. I'm using it right now. I want a struct just like the original, but with only one slot changed.
21:51:13
aeth
I'm not sure why there isn't a copy method that defaults to a shallow copy for defclass
21:52:13
aeth
jasom: Well, the main point in modern CL is that structs can be optimized for storage and access if :type is provided for a slot
21:55:51
aeth
Except for multiple-value-list and multiple-value-call, if you request the nth value and it doesn't exist, you get NIL as the default value
22:00:12
jasom
the thing I like about the random version is that it is only probabalistically defined to terminate from the standard, but most (all?) real-world implementations it is guaranteed to terminate.
22:02:02
jasom
Bike: if a non-cyclic rng is used, then the probability approaches 1 of it terminating over time, but never reaches it. Real prngs tend to be cyclic though, so there is bounded time for it to terminate (even if it's absurdly large).
22:03:24
Bike
"A cyclic number is an integer in which cyclic permutations of the digits are successive multiples of the number." uh
22:04:11
Bike
most-positive-fixnum is finite, and since it's an integer the distribution is discrete
22:05:20
jasom
Bike: consider flipping a fair coin. Let's say I flip the coin until I get 5 heads in a row. That is not guaranteed to terminate, though it is very likely to for any large number of iterations.
22:06:20
jasom
similarly an implementation with less than (integer-length most-positive-fixnum) state in its prng might never terminate on that.
22:07:02
jasom
and it's guaranteed that there are some values it will never return from (random most-positive-fixnum) if there are that few bits of state in the prng.
22:07:55
Shinmera
jasom: Though the spec does say: If limit is an integer, each of the possible results occurs with (approximate) probability 1/limit.
22:08:44
jasom
Shinmera: no finite state prng can do this when you consider bignums, unless you think the spec implies the state must be larger than the largest allowed bignum.
22:09:28
jasom
Shinmera: if it required each possible result to occure with identical probability, then it would explicitly not allow holes.
22:10:37
jasom
Shinmera: there are lots of imperfect prng with 100% even distribution of values (a simple LCG does this, for example).
22:28:20
adlai
re: "most interesting way to get the value NIL" ... how about "as return value of #'type-of"
0:04:31
aeth
Has anyone seen pillton? I just did a `tail -n 100000 '#lisp.log' | grep '\(pillton\)\|\(Day\)'` and it looks like he was last here 21 August
0:10:44
aeth
I'm recompiling with my cache clear to verify it but I think I get problems with specialization-store and ECL and I always try to verify things like that over IRC first.
0:12:16
Colleen
Bike: drmeister said 36 minutes, 42 seconds ago: (ql:quickload something :verbose t) provides lots of info - thank you.
0:18:04
aeth
Hmm, yeah, in ECL I get "* The macro form (VEC--INTO! TEMP-VECTOR-1 VEC2 VEC1) was not expanded successfully."