libera/#commonlisp - IRC Chatlog
Search
5:47:42
asarch
One stupid question: how would be better? Using flet (let (a b c) (flet ((foo (bar) …) (baz (spam) …)) …)) or with defun (let (a b c) (defun foo (bar) …) (defun baz (spam) …) …) and why?
5:49:22
asarch
I think it would better with defun because you could use foo immediately in baz, right?
5:49:23
beach
It is always best to limit the scope of your definitions as much as possible, so if the functions are used only locally, then FLET is better.
5:51:37
beach
You want to limit the scope, so that the person reading your code does not have too keep too much information in mind when reading your code. With limited scope, that person can quit thinking about FOO and BAZ whenever the scope of the FLET or LABELS ends.
5:52:08
beach
asarch: This is a general rule of programming, so if you know how to program in any other language, I am sure you have heard about it.
5:53:25
asarch
Is there a way to declare variables and also functions? I remember PROG could that (but I can't find my annotation)
5:53:58
jackdaniel
no, LET* is "nested LET", while LABELS is "shared scope for function names" for lack of a better description at hand
5:54:11
beach
asarch: What do you mean by "declare variables and also functions"? And why do you need to declare them?
5:56:32
jackdaniel
Inline: perhaps stating things that you are not sure about yourself is not that of a good idea, it may confuse others
5:57:02
edgar-rft
CLHS says that "defun is not required to perform any compile-time side effects" what means it can happen that the outer defun is not established when the inner code (calling the outer function) is compiled and you'll get a "funtion not found" error when compiling the code.
5:59:51
asarch
Is there a way to combine both "operations"?: E.g.: (some-exp (a b c ((foo (bar) …) (baz (spam) …))) …)?
6:02:49
jackdaniel
and no, common lisp standard does not propose any operator that would allow mixing binding variables and functions
6:05:30
beach
asarch: If you had answered my question, we would have understood that your terminology ("declare") was wrong (you apparently meant "bind"), and we would have been more efficient in the future. As it is, you will probably continue using the wrong terminology and waste time (mostly your own, but also ours).
6:05:30
Nilby
of course the spec says "let performs the bindings in parallel", so Inline was saying something reasonable, but mixing up let - parallel binding vs. let* - sequential binding
8:23:47
Mrtn[m]
<kaskal> "dbotton do not answer to..." <- How did you arrive at the conclusion that horroar is a troll?
8:34:03
Mrtn[m]
beach: I think I am missing some of the history, and it seems that @horroar:libera.chat already left (not sure if he got help).
8:42:41
Mrtn[m]
jackdaniel: That is very kind of you. I am guessing the "tl;dr" is that it turned out he wasn't really interested in CLOG after all, he just wanted to demonstrate how obnoxious he was.
9:05:11
kaskal
Mrtn[m] because I am an owner of a brain and a common sense, anyways we should ignore this, this is exactly what trolls want
9:08:33
Mrtn[m]
kaskal: I probably lack some history. I only saw him asking for the maintainer of CLOG before your remark. However, given some of the later history, which I read after replying, it is obvious that you arrived at the correct conclusion.
9:49:12
lisp123
What would be a minimal (i.e. easier to implement) subset of Common Lisp that one can embed in other languages?
9:49:40
lisp123
I assume take CLOS out, keep macros in - but keen to get thoughts on what would be a good subset.
9:50:52
lisp123
semz: most use scheme for this, but I couldn't stand a lisp-1 and rather have more normal lisp syntax like defun
9:52:07
lisp123
I'm doing something similar to GOAL at Naughty Dog :) I want to write in a subset of CL and then transpile to the host system's language
9:52:47
lisp123
mfiano: CLOS would be too hard to implement :( I'm starting off from those simple scheme compilers like Norvig's lis.py and making it adaptable for CL
9:54:17
jackdaniel
then you will proudly claim that it is a common lisp implementation (although, pre-ansi one)
9:54:45
rotateq
parts of (ported) things from GOAL still run afaik in newer NaughtyDog games like Last of Us
9:54:57
lisp123
Oh that would be cool ;) And I could publish it as a new language (I'm joking here! ;)
9:57:53
semz
used it before; still pretty alpha stage. they didn't even have proper bignums last time i checked
10:02:03
semz
...neither does JSLisp apparently. What's the point of compiling to Javascript if you're just going to import the broken JS semantics anyway? :/
10:05:12
jackdaniel
not really, some things are done because authors find them fun to work on, not because they want to fix broker JS semantics
10:06:39
semz
do they decide on design choices by coinflip or what. i want to know what was behind the choice
10:08:50
jackdaniel
behind the choice that they have not yet imlemented bignums? or the choice that they are not pursuing fixing broken js semantics? in either case I don't know, you'd have to ask the author; but suggesting that there is no point in doing something because it is not aligned with someone else desires is interesting
10:10:34
lisp123mobile
i’m doing it in python but will use these JS versions as inspiration…plus i hate python (javascript is actually quite nice)
10:41:37
edgar-rft
Tom Almy still maintains XLISP PLUS (based on XLISP 2 by David Betz), a Lisp-2 interpreter without CLOS -> https://almy.us/xlisp.html
10:46:03
edgar-rft
semz: the anwer is not so easy, because for example numbers in CL are a CLOS class but of course arithmetic can be implemented without CLOS.
10:51:29
edgar-rft
GCL (GNU Common Lisp) was one of the last pre-ANSI implementations that didn't have CLOS for a very long time. Not sure if it's really 100% ANSI conform in 2022 -> https://savannah.gnu.org/projects/gcl/
10:57:25
edgar-rft
GCL originally was written to run the Maxima computer algebra system on Windows, you might find more info in #maxima or here -> https://maxima.sourceforge.io/
11:17:04
mfiano
Shower thought: A few languages use backticks for evaluation, such as Bourne-compatible shells. Maybe the parentheses aren't the sole factor of dissuading newcomers to Lisp syntax :)
11:52:26
dirtcastle
I'm new to lisp. lispers really love lisp. emacs lovers love emacs so much. two projects called lem text editor and nyxt browser is going on. both are written in common lisp. when it comes to hackability and configurability , ppl tell lisp is the goto language for that. python too has an interpreter and repl. what makes lisp better.? would emacs be as successful as it is if it were to be written in some other language ?
11:53:51
beach
dirtcastle: Python is not a language in that sense. It is a programming system. And it uses an interpreter, which makes it around 50 times slower than a good Common Lisp implementation like SBCL which uses a compiler.