freenode/#lisp - IRC Chatlog
Search
3:05:37
fiddlerwoaroof
minion: memo for emaczen: I've looked into Obj-C exceptions, but I don't think there's anything you can really do about them
3:06:07
fiddlerwoaroof
minion: memor for emaczen: see the recent-ish comments in #ccl from eschatologist
3:06:11
fiddlerwoaroof
minion: memo for emaczen: see the recent-ish comments in #ccl from eschatologist
4:34:19
Ukari
is there a test framework which could run assert asynchronously? like (test test-foo (bt:make-thread (lambda () (is (eq 1 1)))))
4:36:47
Ukari
because some of my test will run in another thread, and if the test framework support assert asyncly it will be more easy to write tests
4:41:40
pjb
Ukari: you see now why my stance on tests is that everyone should write their own test framework, instead of trying to use an existing one?
4:42:12
pjb
Ukari: the requirements on a test framework depend strongly on the kind of system you want to test.
4:42:49
pjb
Ukari: you could take an existing test framework, and add the required features to be able to run them in parallel in different threads.
4:44:23
pjb
I would suggest com.informatimago.common-lisp.cesarum.simple-test, which is simple, and you may be able to extend easily to support threads. ;-) patches welcome.
4:46:05
pillton
Ukari: There are other ways to solve this problem which don't require a new test framework.
7:35:50
didi
How do I break out of a recursive function without going through all the recursions? I wrote something like <https://paste.debian.net/hidden/430c13d2>. Is it too gross? I thought of using signals, but it sounded like too much. It looks like a continuation, but I have control of the scope, that is, I'm using the lexical scope.
7:37:13
no-defun-allowed
Safari asks me what client certificate to use, and the server will not accept them.
7:38:47
no-defun-allowed
Though, it'd probably be too complex for a FLET, and I'd move it into a DEFUN.
7:39:29
didi
no-defun-allowed: Yeah, mine is growing beyond a screen page, so I think I should break it.
8:59:46
schweers
when sbcl claims to have no more memory ... is there something I can do in that image to investigate? i.e. find out where all the memory went?
9:32:26
schweers
I’ve now got it running in SLIME, I’ll see what I can do when that point comes again. I guess it won’t be for another few hours though. So thanks for your tips, espectially about ROOM. I had completetly forgotten it.
10:04:37
makomo
fengshaun: yeah, go with PCL as a beginner. later on check out advanced books like On Lisp, Let Over Lambda, etc.
10:35:15
makomo
yup, purely aesthetic. you can use whatever symbol you want, as LOOP only checks the symbol's name when looking for "loop keywords"
10:44:08
loke
moldybits: LOOP also supports various other variations, like so (LOOP WHILE X UNTIL Y DO (something) UNTIL Z DO (something-else) WHILE ZZ)
10:47:12
jackdaniel
that comes from the fact, that DO (among other things) is a syntactic sugar for a tail recursion
10:47:39
jackdaniel
(I won't elaborate on that because I need to take care of something else, but it is nicely explained in peter norvig style guides)
10:47:40
pjb
moldybits: try: (defpackage "MY-LOOPS" (:use "CL") (:export "WHILE")) (loop do (print 'hi) while nil) (use-package "MY-LOOPS")
10:49:46
moldybits
pjb: you mean just to see it in action? how does defininig a package for it help, though?
10:50:35
moldybits
it is a bit verbose. i think i'll use the loop version as i feel i need to fully embrace it.
10:52:58
moldybits
the last expression causes a name-conflict between my-loops:while and common-lisp-user::while
10:54:33
pjb
Notice that some lisp have macros named WHILE, UNTIL, etc. (eg. emacs lisp) and some package may also export operators such as COLLECT, SUM, MAXIMIZE, etc. So those collisions are not academic.
10:55:22
pjb
(in-package "MY-LOOPS") (defmacro while (condition &rest body) `(do () ((not ,condition)) ,@body))
10:57:01
_death
so the issue usually manifests itself in interactive development, if you're using a package that exports these symbols
10:58:35
moldybits
when i misspell a symbol in slime, it starts showing up as a completion, which is annoying. is the way symbol interning works (or whatever it's called) ... good/sensible?
10:59:11
loke
moldybits: You should be able to filter out symbols in the completion list that are not bound to a variable or function.
10:59:35
loke
moldybits: However, you may still want to complete on it (it may be a CLIM presentation type, for example)
11:00:07
White_Flame
in theory, this could be done in the repl by detecting an abort, and containing what it had interned up in the meantime, undoing it after the fact
11:01:20
jackdaniel
actually you'd need to trace function intern (so in practice, you'd need to hack the reader, and reader as is isn't very comprehensible)
11:01:26
loke
White_Flame: That would be very bad... What about this: (setf (gethash h 'foo) n bar (error "foo"))
11:02:44
moldybits
i just remember finding symbols and packages unexpectedly confusing last time i tried understanding them. would you people consider it to have been properly designed?
11:03:28
White_Flame
and only if that symbol was interned newly on that attempt, and only if used for hat
11:07:26
White_Flame
of course, if you botch a short name that you don't use completion for, none of that helps
11:08:08
no-defun-allowed
Then, I wonder how it'd fare with cl-arrows and other syntax-moving macros. It probably should not be enforced on the user, only just the default action, or maybe double-tab would bring up all suggestions or something clever.
11:11:51
no-defun-allowed
Better yet, write a program to step out exactly what the inputted program would do.
11:17:40
moldybits
hm. i combined all files into one (just 200 lines for now), with headings and ^L. i wonder if i'll feel inclined to split it up as it grows.
11:57:35
p_l
not sure if there's one such book. You'd probably have to cobble it together from multiple ones?
11:59:49
heisig
vms14: Just hack something in Lisp, and I promise you will find out why so many programmers love it.
12:00:24
p_l
SICP teaches you computing science with definitive lisp bent. PAIP will show you a bunch of techniques that will do a lot of good (including writing an optimizing compiler!)
12:00:48
vms14
but I wanted to see if you knew a book that shows the essence, because lisp is not only a language
12:01:00
p_l
Gentle Introduction to Symbolic Computation will open to you various alternative uses of Lists (though, iirc, it didn't do much about symbol-plist, which is kinda forgotten thing in CL)
12:01:31
vms14
and that they dissect it different, like every function is a little step that takes a previous function and is taken for another function
12:02:53
vms14
I mean learn to think as a lisper, even if that's matter of time. Sure there are books that show this fact, more than the others
12:17:05
vms14
what things of lisp you guess are part of this "enligthenment" that changes your way of think about programming?
12:18:21
schweers
But also Common Lisp in particular gets a lot of things right which are not limited to lisp like languages. CLOS is one thing, conditions and restarts is another.
12:19:04
schweers
Having the whole language available at all times is also something I had to get used to and cannot do without anymore.
12:19:09
vms14
and that you don't write programs, but write a new language which adapts to your needs
12:20:23
jackdaniel
I think you've read some of pg essays. there is some truth in them, but part of it is just a salesperson speech
12:21:11
vms14
but the "lisp fans" are talking so high about lisp in a way I've never seen before with other languages
12:21:13
Demosthenex
i'd say there's a bit of the epiphany still. i came from a procedural algol style background, and when i worked with lisp for a while and it clicked, it was quite a feeling ;]
12:22:04
Demosthenex
i had been skeptical about the epiphany claim myself, and it's not like the heavens part and light shines down, but it changes the way you think
12:22:26
jackdaniel
well, I'm working with CL almost exclusively and I can tell with certainity that it is no silver bullet - a very good language with well-thought qualities and some flaws
12:22:32
Demosthenex
vms14: no, i don't mean learning functional. i mean lisp, and programming with lisp.
12:23:22
vms14
also what I see is that most of modern languages are "modern" and have "modern features" that lisp had forever
12:23:30
jackdaniel
(some of the flaws I talk about are not inherent to the language itself, but to the ecosystem and such)
12:23:33
Demosthenex
frankly i've said to many friends that i wish i'd learned lisp first in highschool. i feel like it made me a better programmer in every langauge as a result of learning it.
12:23:52
vms14
and it's strange to know that an ancient language like lisp is more modern that most of languages we know
12:24:35
schweers
vms14: Don’t confuse lisp the idea with Common Lisp the language. The latter was standardized in ... 1994?
12:24:43
vms14
also I guess learning lisp is a bit like start again to learn programming, due to the fact lisp is different to most languages
12:24:58
vms14
and that most languages are very similar, sharing the same syntax, the same loops, etc
12:25:01
Demosthenex
vms14: if you spent a few weeks learning lisp with a pet project, i think you won't be disappointed.
12:26:04
vms14
also the goal is to learn lisp in order to understand what is that "enligthenment" and to steal concepts from lisp the day I'll make a toy language
12:26:32
vms14
Demosthenex, I don't want to learn emacs, but it seems is the only way to program in lisp
12:27:00
vms14
also that if you invest time with emacs, and learn how to configure it, you'll be happy and start to think why you didn't come before
12:28:07
schweers
vms14: I don’t know anything about Sam, but you can use bare evil-mode in emacs or spacemacs (which is what I use)
12:29:26
Demosthenex
schweers: i just can't stand those who get wrapped up in font effects and cute gui tweaks instead of the power of the thing in front of them. :P
12:29:57
heisig
vms14: There is also Portacle (https://portacle.github.io/), which is easier for getting started than standard Emacs.
12:36:16
moldybits
vms14: for me it's that it has little tools to make incremental development easier, which makes it fun. i don't know if or care how useful it is or is not in the real world.
12:51:46
schweers
I wonder how (in)efficent jumping around a file and writing is on sbcl (or ccl for that matter)
13:58:52
schweers
I get an error claiming that the defmethod form has an invalid qualifier and that only append and :around are valid.
14:00:30
pjb
schweers: no, I'm not sure how append is implemented, but if it uses append, returning a literal list may be a problem for the last argument to append, since it won't be copied.
14:01:32
pjb
schweers: setting the file position with file-position should be as efficient as fseek, ie. very on usual file systems. Only if your file is stored on tape, should it be slow.
14:02:13
schweers
pjb: no, I am worried about issuing a syscall on every jump. Not sure that would happen, though.
14:03:08
pjb
syscalls are fast. But granted, on small files, it might be faster to just load the whole file in the userspace, mutate it in RAM, and save the whole file back.
14:04:13
schweers
Currently I mmap the whole thing and operate on it as foreign memory, so I have no syscalls for the actual operation.
14:05:25
jmercouris
I want to do (format nil "~{~a~^ ~}" list) but insert a newline instead of a space
14:06:21
jmercouris
I am looking at the page and I was just going down a rabbit hole trying to find it
14:09:31
makomo
jmercouris: SLIME has a hyperspec.el module which you can use to look up stuff from CLHS. it even has a special function just for FORMAT directives: common-lisp-hyperspec-format
14:09:52
makomo
very very useful. i also find myself always digging through the CLHS just to find that list of FORMAT's directives. quite annoying :-)
14:12:12
makomo
it's a great timesaver once you start consciously stopping yourself from using the web browser to access CLHS
14:13:23
makomo
jmercouris: yeah, i use that too (thought it was part of hyperspec.el, but it seems it isn't)
14:14:53
jmercouris
(slime-setup '(slime-fancy slime-company slime-asdf slime-indentation hyperspec))