freenode/#lisp - IRC Chatlog
Search
19:18:45
Fare
Note that I don't claim nest is a macro to use everywhere, just that it's sometimes very useful in circumstances where the alternatives like metabang-bind don't convince me.
19:25:02
didi
Fare: I'm unversed on lisp and scheme macros, but your post got me thinking: man, scheme macros are complex.
21:45:46
_death
(defun elevator (number &rest divisors) (floor number (reduce #'* divisors :initial-value 1)))
21:50:29
stylewarning
shrdlu68: the hashlife algorithm from gospers compressing space and time paper
21:52:06
shrdlu68
Mine's so simple, no curses or implementation-specific stuff. and should run in any terminal with primitive support for ANSI control sequences.
21:56:16
shrdlu68
I know, wanted to make this with as little dependencies as possible, which is none.
21:57:35
stylewarning
shrdlu68: rake in all the deps you can get your mitts on! And help fix open source bugs...
21:59:14
didi
So I have a collection of elements that might have some duplicates according to a "samep" function. I want to merge these duplicate elements, by collecting their cdrs into an arbitrary element key. Say I have the collection ((a . resta) ... (b . restb) ...), and (samep a b), I want to merge a and b so the result will be ((a resta restb) ...). Is this a known operation? I am thinking of calling it `merge-duplicates'.
22:04:28
_death
stylewarning: too personal.. I'm guessing stuff on my github is like 10% of my code-at-home
22:04:34
drmeister
Does find-class need to be fast? What if I implemented find-class with an alist - I'm thinking about lockless data structures.
22:06:24
stylewarning
didi look at the function EQUIVALENCE-CLASSES here https://github.com/tarballs-are-good/quickutil/blob/master/quickutil-utilities/utilities/sequences.lisp
22:08:39
Fare
next year ICFP is colocated with StrangeLoop, and quite possibly the Scheme Workshop with it.
22:08:47
pjb
(mapcar (lambda (class) (cons (car (first class)) (reduce (function append) class :key (function cdr)))) (com.informatimago.common-lisp.cesarum.list:equivalence-classes '((1 a) (2 b) (1 c) (3 d)) :test (function eql) :key (function car))) #| --> ((3 d) (2 b) (1 c a)) |#
22:09:08
stylewarning
didi so the call will be something like (mapcar ‘combine-lists (equivalence-classes ‘samep list))
22:13:07
stylewarning
_death it would be cool if you tried to make some public. Most of my lisp-random is garbage
22:15:10
stylewarning
Gems like https://bitbucket.org/tarballs_are_good/lisp-random/src/a595eb662c2dce87f362dd0dd2541a93efe9c902/cxr.lisp?at=master&fileviewer=file-view-default
22:19:38
_death
stylewarning: I sometimes lisppaste/gist snippets.. as in your case, some of them grow to become libraries.. maybe in the future I'll decide to publish a "revised" history
22:50:04
_death
the gifs themselves are pretty cool.. e.g., http://london.harekiet.com/compo/index.php?nick=dila
2:00:11
emaczen
I have a cryptic error from SBCL which says: the value 65583 is not of type (UNSIGNED-BYTE 16) when binding SB-ALIEN::VALUE
2:20:36
White_Flame
but since (LOAD #P"/home/.../.cache/common-lisp.....") is in there, one of the first orders of business is to rm -rf ~/.cache/common-lisp/ and rebuild everything
2:21:12
White_Flame
something might have gotten built and stuck around in your fasl cache that isn't compatible with the version you're running now
2:26:13
White_Flame
I have a feeling that the "/ps/index.js" is being loaded as something that it shouldn't
2:27:40
emaczen
White_Flame: I have a program that generates programs, and then I do (asdf:load-system :program-name)
2:30:35
White_Flame
basically, did you ever install multiple sbcls? as in, maybe one from apt and one from source, or multiple different source builds hanging around?
2:31:25
White_Flame
iqubic: because functions don't transform code, and always evaluate their arguments
2:32:52
White_Flame
and if functions get too unwieldy to use, ie (my-func (lambda (x) ...) (lambda (y) ...)) then maybe you should use a macro to generate the code body instead
2:33:52
emaczen
iqubic: then you can try it yourself and extend it to anaphoric cond and anaphoric case and anaphoric typecase
2:34:06
White_Flame
right, 'if' via function is (iffunc test-val (lambda () then...) (lambda () else...)
2:35:28
emaczen
usually if or cond is a "special builtin" I can't remember the terminology, but then the one that is not "builtin" could be implemented as a macro expansion of the other
2:37:01
emaczen
White_Flame: Ok, so these 3 new programs are about 3 times the size of my other programs just by looking at my databases
2:37:29
emaczen
White_Flame: I don't think that should really matter, but it is the only real difference that I am aware of
2:39:02
iqubic
So, I'm writing my emacs config, and I'm noticing a certain pattern crop up a fair few times. I just want to install a package with use-package and not configure it.
2:40:22
White_Flame
lots of people here (like me) know CL and don't really know the ins & outs of emacs lisp
2:42:53
emaczen
From my experience without doing much work, SBCL gets me faster code but CCL will generally just work (more robust)
2:43:34
White_Flame
the only non-robustness I've hit with SBCL is running it on windows a long time ago
2:43:55
emaczen
Fare: They aren't really failures, I just get the occasional error like this one I have now
2:44:18
emaczen
Maybe CCL is supposed to give an error some of these times, but it just doesn't -- I don't know
2:44:53
Fare
I remember having concurrency issues in sbcl, but that was long ago. The only lingering issue I had was some code that triggered bad behavior in its optimizer, leading to explosion during flow analysis.
2:45:07
White_Flame
Fare: <emaczen> I have a cryptic error from SBCL which says: the value 65583 is not of type (UNSIGNED-BYTE 16) when binding SB-ALIEN::VALUE [19:22:08] <emaczen> http://paste.lisp.org/display/356871
2:45:51
White_Flame
Fare: heh, I remember the slow-macro-expansion behavior. Got killed in build time for a 15+kloc macro expansion
2:46:30
Fare
I remember issues with FFI where the ABI said that high bits should be ignored, but SBCL failed to clear them.
2:47:19
White_Flame
yeah, but when you rebuilt, it put a .fasl there again and loaded it, if you got the same error
2:47:57
Fare
but yeah, I don't think there are a lot of paid sbcl maintainers... last I knew, there was one at Google
2:54:01
iqubic
So, if my functions relies on symbol "foo" and symbol "foo-mode" is there a nice way to get them both, while only passing one in as a parameter.
2:56:22
iqubic
I know I could do (defun simple-use (package-name mode-name) (body here)), but that seems like overkill because I will always call that function like such:
3:00:06
White_Flame
easiest would be to make your window wide enough. :-P That, or nose around the emacs menus
3:05:35
emaczen
I could probably get it through the machine I am using here, but I'll do that in a bit
3:48:06
z3t0
How would I turn this into an object that I can write to a file? Do I simply write this binary data
3:49:48
White_Flame
yes, you can open a file with :element-type 'unsigned-byte, then write-sequence should shove those bytes through
4:06:21
iqubic
Is there a way to take symbol like "foo-bar-baz" and get the symbol whose name is just that with "-mode" appended to the end?
4:07:39
iqubic
So have a function/macro that takes the symbol "test" and returns the symbol "test-mode"
4:11:47
White_Flame
and by using a symbol for the suffix you want to add, it ensures it's using the proper case
4:12:39
z3t0
in python there's {} inside which you can do normal python computation, maybe i should just write a macro
4:16:44
White_Flame
if you need to build a string, FORMAT is the usual go-to, unless you need to worry about performance
4:17:25
Zhivago
And you can write your own macros and functions to do what you want in the way you want.
4:18:18
Zhivago
One alternative to concatenation might be to instead print and capture the output in a string.
4:20:06
pjb
(defun cl-user::ev (stream argument colon at &rest parameters) (declare (ignore colon at parameters)) (prin1 (eval argument) stream)) (format t "Foo ~/ev/ bar" '(+ 1 2)) #| Foo 3 bar --> nil |#
4:21:03
z3t0
For now i am just converting it to strings and then later i'll write up a macro so i dont have to do all of this
4:21:12
pjb
And silly, but that's what you get for asking equivalents from Python (or any other language for that matter).
4:21:56
pjb
That said, there are libraries for interpolated strings in CL… I don't know any code using them.
4:24:12
White_Flame
You could also pour bleach into your eyes and gargle broken glass, just sayin'...
4:24:28
pjb
(But from the examples of cl-interpol, #?"" builds a run-time expression, so it's useless (ie. no read-time evaluation, no string literals).
5:41:27
beach
theemacsshibe[m]: Lesson 1: we have written the name of the language "Lisp" for the past few decades. When you write LISP, most people here think of some very early version of the language.
5:46:24
beach
theemacsshibe[m]: Most people here recommend you use either SBCL, CCL, or ECL for your Common Lisp implementation, and Emacs+SLIME as your development environment.
5:47:28
theemacsshibe[m]
I already use Emacs+Slime and have both SBCL and GNU CLisp (man page didn't have a capitalisation for that so idk) so that seems alright
5:50:19
uint
Xach: I'm not sure if I'll be working on it yet. Just an idea right now. I'll reupload it when/if I have something that works!
6:20:40
|3b|
more or less same as writing a function, with some extra options for the argument list, just remember the input it gets is different from what a function would get if evaluated in same context
6:36:26
iqubic
Does the reader keep expanding macros until there are none left? That's the behavior I need. That's also why a plain function won't do.
6:38:37
|3b|
macro code is just normal CL code, works like any other. code in expansion of a macro is just normal CL code, works like any other (including expanding any macros in it)
6:39:15
|3b|
ACTION isn't sure if you meant a macro used in the definition of the macro, or one in the code it returns
6:44:11
Shinmera
You can be unspecific if you think it helps, but please don't just state blatantly false things. That's never helpful.
6:44:14
|3b|
simplifying is OK, simplifying until it is wrong is bad (at leaast if there is something comparably simple that is still correct)
6:45:00
|3b|
ACTION has the impression getting the distinction between read/evaluate/compile right helps a lot when learning CL
6:47:50
|3b|
ACTION doesn't think it is too important to learn it now, just that you don't learn some of it wrong now :)
6:56:43
|3b|
though now that i think about it, if you are writing macros it may be time to learn about it soon. backquote is one of the places where it starts to matter