freenode/#lisp - IRC Chatlog
Search
17:33:34
dlowe
takitus: the advantage it has over "goto cleanup" is that defers can be conditionally added
17:34:44
dim
ah yes I like your with-defer macro, in so much as it shows why I'm tired of languages with a syntax...
17:37:13
dlowe
The advantage of lisp is you get to have any syntax you want, without having to wait for some faraway language implementor to add it.
17:40:35
dim
dlowe: I meant the other way round, if you want with-defer in Go you have to wait until the language designers make it happen, or in Java, or etc... whereas you could just make it happen
17:48:22
dlowe
speaking of macros, Fare's latest blog entry is pretty neat: https://fare.livejournal.com/189741.html
17:51:27
dim
I've been using bind in places and I like it better: I like indentation and as he suggests I think needing more of it is a mistake in the code
17:56:35
_death
yes, nest is a crutch like chain (or "->" as some like to call it) is a crutch.. the latter may make sense in rare cases
18:08:03
takitus
dim: That was my thought on reading that as well. To paraphrase Linus Torvalds, if you need that much indentation you're screwed anyway.
18:31:16
didi
Eer, I bet everyone knows this, but did you know you can use NIL to discard bindings on `destructuring-bind'? Cool.
18:45:45
dim
How can I have the equivalent of (ccl:make-external-format :character-encoding :ascii :line-termination :crlf) in SBCL?
18:45:50
didi
Oh well, better have our hopes and dreams shattered sooner rather than later, I guess.
18:48:32
Xach
didi: erann gat's BB macro is like if LOOP was turned into a binding/nesting construct
18:54:50
dim
(subseq line 0 (+ -1 (length line))) ; am I the only one confused by the - operator enough so to do (+ -1 ...) ?
18:57:48
Shinmera
I sometimes use negative constants if there's more than one element in the addition
18:59:46
dim
Xach: what I really don't like is when adding a let and then all the code underneath moves, which means a huge diff instead of a +1 line
19:02:19
didi
dim: For lists, if I know I will keep adding things to it, I keep the closing paren by itself.
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).