freenode/#lisp - IRC Chatlog
Search
2:45:16
beginner_supreme
Does anyone feel as though there is a built-in function for every little thing? Every time I write some code I wonder if I should be using some sort of built-in instead...
4:25:10
beach
asarch: And, there is no such thing as a "lambda function" in Common Lisp. There are functions, and that's it.
4:27:26
beach
The situation is not ideal in Austalasia. When I lived in Auckland for a year, I found that there was only a handful of Lispers within a 3 hour flight. Here in Europe there are hundreds within such a radius.
4:29:57
montxero
Starting out with the SCIP videos but doing the exercises in common lisp. Fun so far...
4:31:28
montxero
every now and then, I have to do some mental gymnastics to get over the single/dual namespace difference
4:33:56
beach
Yeah, it can be tricky. Nowadays there is Portacle that packages those things conveniently.
4:34:31
beach
Make sure you use the slime-indentation contribution for SLIME. At least I *think* that is still only a contribution and not the default.
4:40:59
beach
montxero: Also, the function that you thought would be local seems to be using tail recursion with an accumulator. That is also a Scheme-ism because in Scheme, iteration is really tail recursion under the hood. In Common Lisp, you would use iteration instead, especially since Common Lisp does not guarantee tail-call merging.
4:44:35
montxero
I just noticed... not sure why that happened. https://pastebin.com/EG2FGJby just repasted the original
4:45:43
beach
It may have to do with TAB characters in your source. Pastebin may not handle them right. I suggest you make Emacs use spaces all the time. Other tools don't do TAB characters very well either.
4:47:51
montxero
So, labels / flets rather than nestd defuns.. Is there a particular reason for that? like the functions leaking out to global scope?
4:49:26
beginner_supreme
Example reference: (defun add (a b) (+ a b)) --> (add 1 2) => 3 is the usual way. (labels ((add (a b) (+ a b))) (add 1 2)) => 3 is the labels way.
4:56:41
montxero
Okay cool... I'm reading clhs for flet and labels. This portion: "labels is equivalent to flet except that the scope of the defined function names for labels encompasses the function definitions themselves as well as the body." seems a bit opaque to me; almost like it is hiding a very subtle warining
5:01:16
montxero
Oh!!!!!, so if I want to define a recursive function inside the scope of another function, I would be better off using labels (rather than defun). If I were to define said recursive inner function with FLET, on calling the function, I will get a symbol (unbounded / undefined) error or someting to that effect. Is that it or am I missing something else?
5:03:42
beach
Right now I am having my coffee in order to wake up, so any more taxing intellectual activity shall have to wait anyway.
5:09:24
montxero
beginner_supreme: Thanks for that. The namespace demo captures a lot of the problems I've encountered
5:09:34
beach
beginner_supreme: It is not common to use #'(lambda...) anymore. You can just use (lambda ...) instead.
5:11:46
beginner_supreme
That took a while to write up because I still haven't learned enough emacs.
5:16:25
beach
montxero: If you know how to program in other languages already, PCL may be a better alternative to SICP.
5:16:34
minion
montxero: look at PCL: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
5:18:10
minion
Are you a bot: An error was encountered in lookup: Parse error:URI "https://www.cliki.net/Are you a bot?source" contains illegal character #\ at position 25..
7:02:04
jdz
It depends on what you want to achieve. But (defun coerce-all (type &rest args) (loop while args collect (coerce (pop args) type))) should work.
7:04:16
pillton
You are probably drawn to common lisp because of the power of macro functions. The irony is that macro functions should be the last thing you use.
7:12:54
beach
littlelisper: Make sure you practice cases that actually need macros. Otherwise, you will get into all kinds of strange coding practices.
7:15:03
beach
Interestingly, since SICP is Scheme and Scheme does not have macros, that might be the wrong source for practicing macros.
7:18:25
beach
littlelisper: Macros are used only when the evaluation rule for functions will not work.
7:23:44
pillton
littlelisper: I find the best explanation of the difference between functions and macro functions is in section 3.1.2 of the hyperspec. It also helps highlight the difference between form syntax and character syntax.
9:09:20
shrdlu68
In Hunchentoot, within the body of an easy handler, when I log to *standard-output*, *terminal-io*, or *error-output*, the output appears in the *inferior-lisp* window rather than, as I expect, the slime repl.
9:10:24
shrdlu68
I guess hunchentoot is binding these vars locally to something else. How can I get the usual output to the slime repl despite that?
9:10:25
_death
it runs in a different thread where these variables aren't bound to slime output streams.. you can use a proper logging library, like log4cl
9:12:07
_death
there's hunchentoot:log-message* .. if you think hunchentoot support for logging is sufficient
10:17:21
jmercouris
I'm working on an interactive command prompt. I can complete/tab complete command names. I'm now working on completing command
10:17:33
jmercouris
I would like each argument to be able to provide its own set of completions to guide the user.
10:18:28
jmercouris
the only thing I've thought of so far is defining separate functions for each argument completino
10:19:11
jmercouris
so something like (define-command command-x (arglist)) followed by (command-x-arg1 () ...completion logic..) (command-x-arg2 () ... completion logic...)
10:19:33
dim
jmercouris: did you manage to write the README first? (RDD method, I like it), that is, how are you going to use it, what do you expect to see as completion choices in several situations?
10:21:18
jmercouris
I have one concrete application in mind, but I don't know how the application will evolve
10:22:00
jmercouris
I guess I will spend some more time thinking about how the product will actually be used
10:22:16
dim
my usual technique for that kind of question is a 1h walk at good pace (walk fast enough that you could not sustain a chat at the same time, that's how the brain is best oxygened)
10:23:52
dim
going for a walk only gives good results when you understand the problem clearly enough, which looks like it's the case here
10:23:53
xificurC
A: how can I do Y? B: what is the real problem X? A: it is ... B: Ah ok, I suggest you go for a walk then
10:24:53
jackdaniel
jmercouris: McCLIM has commands which have types and interactor provides completions of various type (list, string, number etc)
10:25:39
jackdaniel
putting aside presentations and how buggy the whole mechanism is in McCLIM, design may be at least worth studying (CLIM II specification is fine if not too engineered)
10:50:20
loke
shka: Well, some things that should be simple is very hard. Other things are almost magically automatic. :-)
10:50:39
jackdaniel
it is a working software with bugs (as we know, none of Lisp software has bugs, so it must be an accident) and plans for the future
10:51:31
jackdaniel
if the question is: is there a hope you'll use it, then you must answer itself. if the question is: is there a hope it will work? then it works, like right now
10:51:41
loke
shka: I make a playlist: https://www.youtube.com/watch?v=AvC82EjoPYU&list=PL6AQVVynH5Dg3Wwpk3zNT962GntKfssje
10:53:00
loke
shka: Things like subexpression selection in the equations are automatic in CLIM, which is cool.
10:53:09
shka
jackdaniel: well, ideally, i think that McCLIM should work on major platforms (that would be osx, windows, x11 and wayland), require modest ammount of time to build usefull applications and don't be very buggy, given the scope, this task list appears to daunting
10:58:37
jackdaniel
shka: you basically present a wishlist, not something to justify queationing for any hope for the software, so I still don't understand
10:59:14
loke
shka: I think that's my biggest advantage to Wxmaxima, which, while doing proper maths rendering, looks quite bad.
10:59:24
jackdaniel
it is like if I had asked: is there any hope for lisp? I think it should be faster, work on more platforms and have first-class global environments implemented
10:59:38
loke
shka: Well, believe it or not, it's sthings like the completions popup, where I had to build everything from scratch.
11:00:05
loke
Also, being able to manpilate the graph (using the buttons) also took quite a bit of convincing CLIM ;_)
11:01:10
loke
shka: Just getting the commandline (“interactor”) to accept plain text was tricky to say the least.
11:01:35
loke
shka: The entire thing is deeply tied to the idea that your application is driven by a commandline which is a Lisp REPL.
11:02:13
loke
shka: In Maxima, input is onbviously the Maxima language, which meant that I had to reimplement the entire input loop.
11:02:56
loke
shka: For reference, here is the code to simply read the Maxima expressions on the commandline: https://github.com/lokedhs/maxima-client/blob/master/src/cmdline.lisp#L174
11:04:13
loke
shka: Another issue is that since it's inherently single-threaded, and the inptu loop is imperative, managing more than one input loop is incredibly hard
11:05:18
loke
shka: You can open a second window by running a separate thread, but there is zero support for interacting between them, so you have to build everything yourself. I don't even want to think about what it would take to implement drag-and-drop between windows.
11:06:10
loke
shka: Generally you should attempt to build you application absed on CLIM concepts, not try to convince it to behave like a “normal” GUI application.
11:07:57
loke
shka: THere are aspects of it that are really cool too, but I never mentioned any of those.
11:08:41
loke
shka: well, that was how the Lisp machine worked, and CLIM is basically a lisp machine interface :-)
11:09:40
random-nick
it's not really a REPL, it accepts program-defined commands too that are not lisp code
11:10:26
loke
and commands can be invoked not jst by typing them, but also by clicking buttons, or clicking on objects on the screen, where each object is an actual Lisp object
11:10:53
loke
shka: You don't have to type at all. You can expose all your commands as buttons or clickable “things”
11:12:44
loke
So in the maths renderer I built, each equation is a “thing” that renders as an expression. They consist of other “things” which are the subexpressions. There is also a translator that converts these things into text (which happens to be the maxima language form of the same equation.
11:13:29
LdBeth
ACTION I know it’s probably like asking “when will the next version of Common Lisp spec come out” (^O^)
11:13:46
loke
That's why you can click on a subexpression while typing a maxima command, and the nexessary code is autoamtically pasted. It's because there is a command translator that is applied when clicking which in that context.