freenode/#lisp - IRC Chatlog
Search
19:08:37
beach
jmercouris: So if you traverse a tree, for example, recursion is often preferable to iteration.
19:09:14
shka
if your code needs to construct stack in order to iterate, you are better off with recursive function
19:11:19
jmercouris
I'm a software engineer too, don't confuse me being a noob with lisp that I am a noob in general, I understand the importance of developer time, I am just wondering if there is ever a scenario in which a recursive implementation is more performant than an iterative one
19:12:32
jmercouris
not necessarily time complexity, but on actual hardware, an example of a recursive solution being quicker
19:12:40
jackdaniel
if problem is better expressed iteratively, then you're better of using iteration. It's not always the case though
19:13:03
beach
I think that depends a lot on the implementation and on the architecture of the underlying computer.
19:13:06
jmercouris
state machines are a great use case for recursion, trees, as well, but will it every be quicker?
19:13:40
shka
jmercouris: if your stack is vector and it reallocates, you may hit sweet spot where performance degrades badly
19:14:31
jackdaniel
jmercouris: given perfect implementation, which maps nicely into thought, what is faster: (loop over states if match my-state (do-my-state)) or maybe rather (do-my-state) ?
19:17:21
jackdaniel
jmercouris: if you can do a tail call, you just call a function (and you are done), if you have a loop, you need to wait until function returns and decide what to do next (so the caller controls the execution)
19:18:56
scymtym
shka: known limitations, rather. it can be useful if you are aware of the limitations but it won't give you anything like scheme's call/cc or reset/shift
19:22:35
jackdaniel
scymtym: I can send you a pdf (it was removed from documentation when they were removed, but it builds fine when you go back in time in git)
19:24:32
scymtym
Shinmera: i think that one argues against call/cc specifically, not necessary against e.g. reset/shift (which closer to the style cl-cont supports)
20:27:35
jurov
Hi all, when I do (ql:quickload 'usocket) (usocket:socket-server #(127 0 0 1) 8910 nil nil) I get undefined function error.
20:28:31
jurov
NFI how to approach this? In dists/quicklisp/software/usocket-0.7.0.1/ the function does exist
20:30:39
jurov
(ql:where-is-system "usocket") has output ~/quicklisp/dists/quicklisp/software/usocket-0.7.0.1/ which is right, and which I've checked
20:35:01
Xach
jurov: i don't think usocket:socket-server is meant to be a function, is it? is it documented as such?
20:35:41
jurov
(do-external-symbols (s (find-package "USOCKET")) (print s)) does list USOCKET:SOCKET-SERVER
20:37:39
jurov
it is definitely something that can be called. and it worked fine on this machine few months ago.
20:38:03
_rumbler31
jurov: can you restart your lisp, ql usocket and then re-issue your test and paste full output?
20:40:42
Xach
jurov: i think it would be good to discuss on the list, because that seems like a strange oversight
20:46:36
jurov
paule32:but that has no influence on whether the function exists. and I remeber this working with the vector parameter
20:48:53
paule32
jurov: if you would like to set the vector value, try: (setf ip-address (vector 127 0 0 1))
20:55:43
Xach
jurov: (ql:quickload "usocket-server") will load the file that defines what you want to use.
20:56:22
jurov
Yep, I found it announced here: https://mailman.common-lisp.net/pipermail/usocket-devel/2016-October/000618.html
21:09:52
pjb
Zakkor: (defmacro defun (name lambda-list &body body) `(setf (symbol-function ',name) (lambda ,lambda-list ,@body))) ; basically.
21:10:07
Bicyclidine
(defmacro myquote (form) (list 'quote form)). now (myquote (7)) => (7), whereas (print (7)) would be an error
21:10:17
pjb
lambda is a macro that expands to (function (lambda …)) and function is a special operator, so special rules.
6:54:19
whoman
is there a way to create a graph of lisp forms, like "box notation" from gentle introduction to symbol computation ?