freenode/#lisp - IRC Chatlog
Search
0:22:25
k-stz
So I was asking recently for a portable way to translate foreign c-arrays to lisp arrays for efficiency, and it ends up that there is no difference for scanning over either of those (the lisp-array was even slightly slower)
0:25:47
pjb
Because he thought he could take advanced functional programming in lisp, before learning the basic lisp syntax.
0:30:00
aeth
Very basic Lisp syntax: foo(x, y) becomes (foo x y) and foo[0] becomes (elt foo 0) and foo["key"] becomes (gethash :foo key) and foo = bar becomes (setf foo bar) and [1, 2, 3] becomes '(1 2 3) or (list 1 2 3) or #(1 2 3) or (vector 1 2 3) depending on if you want a linked-list (sequential access) or a vector (O(1) access to any elt)
0:31:02
aeth
Even with just that, the mistake becomes clear, the ((loop ...)) is a function call (it only wouldn't be in a special form like let)
0:31:46
aeth
you're right, I kinda rushed that, I should just have it written right once and then paste it in whenever basic syntax errors come up
0:45:01
k-stz
im struggling with the ending bit, and getting distracted by efficiency issues, but it won't be long now
4:03:13
Ober
is there some case issue with allegro not finding a function name in this fashion ? (defun star-call () (funcall (find-symbol (format nil "~a-call" *my-type*))))
4:06:32
pjb
Ober: ~A depends on *print-case* and other variables: DO NOT use it to build symbol names!
4:08:41
pjb
Ober: also, this is not conforming code (funcall (find-symbol because implementations are allowed to FBIND any symbol from CL, including CL:NIL, which can be returned by find-symbol.
5:13:47
Ober
(defun star-call () (funcall (find-symbol (string-upcase (concatenate 'string *my-type* "-CALL"))))) ;; more respectable? or string-upcase unsafe in this context? I will be testing if find-symbol returns nil or not. just trying it out in the repl. refactoring a lot of rundundant code
8:02:49
beach
Is anyone here familiar with Doug Lea's memory allocator? It is the one provided by default in many GNU/Linux distributions. I am wondering how it could be simplified if it is known that the use case is different from the typical one. The use case I have in mind would call malloc() many times, followed by free() many times.
8:02:50
beach
In case anyone wonders, this issue is related to Common Lisp, because in SICL every heap-allocated object has a 2-word header that contains (a pointer to) the contents vector (that I call a "rack"). And I am thinking of a garbage collector that uses mark-and-sweep for the headers and a standard memory allocator for the racks.
8:04:43
beach
For one thing, Doug Lea's allocator contains a "cache" so that an chunk that is freed is not immediately coalesced with its neighbors, in case the next operation is an allocation of a block of the same size. This situation won't happen with the use case I am targeting.
8:19:35
kkini
Suppose I have a path of a directory as a string, but I don't know whether it has a trailing "/". What's the best way to get the same valid pathname directory from each?
8:19:35
kkini
(pathname-directory "/foo") is '(:ABSOLUTE) while (pathname-directory "/foo/") is '(:ABSOLUTE "foo"); I want the latter from both
8:20:08
kkini
The obvious way seems to be to just append "/" to the string before calling pathname-directory, since (pathname-directory "/foo//") is also '(:ABSOLUTE "foo") (at least on my machine), but I wonder if there's a more portable way, or something
8:22:36
kkini
shka: vimperator still more or less works on Waterfox ( https://www.waterfoxproject.org ) if you want to try that
8:22:36
kkini
there is also this effort to reimplement something like vimperator that's new-firefox-compatible, though I don't know how alpha-quality it is at the moment: https://github.com/cmcaine/tridactyl
8:25:20
kkini
ah, great. Thanks! (I was scrolling up to see what you meant by "above" until you pinged me a second time :P)
8:29:00
kkini
shka: hmm, actually your solution doesn't seem to work; I get '(:ABSOLUTE "/foo") rather than '(:ABSOLUTE "foo")
8:29:28
kkini
and also when I have nested directories, I get "/foo/bar/baz" -> '(:ABSOLUTE "/foo/bar/baz") instead of '(:ABSOLUTE "foo" "bar" "baz")
8:36:24
kkini
Hmm, I guess I can use (sb-ext::parse-native-namestring "/foo" nil *default-pathname-defaults* :as-directory t) on SBCL
9:08:01
Ober
how hard would it to do clos objects on the leveldb bindings? manardb is really nice, but a bit unportable to other languages.
9:18:19
kkini
Dumb question, but how can I find out whether a (require 'foo) would succeed without actually running it?
9:23:34
jackdaniel
kini: you can't. implementation may provide module-load-hooks, so user may put his own function there
9:24:07
jackdaniel
that potential function during require may try to load it with quicklisp (for instance), or utilise some other means to acquire software