libera/#lisp - IRC Chatlog
Search
1:30:02
Spawns_Carpeting
i considered writing the lisp in lisp to learn both at once , so sicp sounds pretty neat
1:33:22
copec
I enjoy taking the approach just diving in too Spawns_Carpeting. I would probably suggest you think of your lisp as a toy language rendered as s-exp post parsing, rather than a lisp
4:40:57
White_Flame
Spawns_Carpeting: a cons cell is just a generic 2-tuple. A list is only one usage policy of cons cells (although the main one)
4:51:09
Spawns_Carpeting
yeah but implementing a generic 2 tuple that can act as a list and everything else in rust is well.... extremely complex
4:52:37
Spawns_Carpeting
it might sound absurd that it's difficult to implement since it's such a simple idea, but it fights you constantly
4:54:27
Spawns_Carpeting
I would like to avoid refcell for a few reasons but I might just use that or unsafe
4:55:02
moon-child
lisp is a sea of pointers. If you would like to implement a sea of pointers in rust, that is how you do it
4:55:34
Spawns_Carpeting
using Rc turns it Rc<Refcell<LispObj>>, and that makes pattern matching and other stuff a pain
5:01:33
Spawns_Carpeting
also I am no l33t master programmer like some here may be so forgive me for not knowing everything. The point of the project is to learn and have fun
5:02:45
amazigh
and learned that reading other people code is very helpful and benefical in the long run
5:11:10
Qwnavery
here's something a little cursed and counterintuitive to the skills developed in SICP and lisp philosophy. https://wizardforcel.gitbooks.io/sicp-in-python/content/
7:00:39
White_Flame
Spawns_Carpeting: the fundamental cons cell doesn't need to "act" like anything else; it's purely external library-style usage to build lists from them
7:22:56
moon-child
White_Flame: that the reader reads "(x y)" as a 'list' and that the evaluator interprets (x y) as a call to function x with argument y indicates to me that listness is not _just_ an arbitrary projection onto conses
7:23:37
White_Flame
I think it is arbitrary. The conses don't care. But most of lisp like this doesn't deal with conses, it deals with lists
7:25:19
White_Flame
but most practically for this, the cons cell interface/implementation still needs nothing but car/cdr/setters/nil, and the list interface can build all the listiness it needs from that
7:25:29
moon-child
the conses do not care, yes. But if you are in the realm of 'conses do not care', then nobody else cares about the conses either. If they are conses in a lisp system--the evaluator is an essential part of the lisp system, and it cares about lists
7:26:05
moon-child
'the list interface can build all the listiness it needs from that' build using evaluated lisp code, which is made of lists
7:26:34
White_Flame
sure, but that doesn't change the simplicity of the cons interface. It doesn't need NTH or whatever else mentioned above
7:27:24
moon-child
here's another way of putting it, maybe: the whole is more than the sum of its parts, and conses will not be meaningful unless they are part of a whole which contains lists
7:27:25
White_Flame
probably restated differently, the cons cell implementation does not need to worry at all about how lists happen to use them
7:27:59
White_Flame
but as I don't know rust, there might be particulars I missed, but things like NTH don't go on the cons cell interface
8:20:21
moon-child
I expect that in #javascript they may not know lisp very well; but since js is much more popular than lisp, it is more likely that a randomly chosen cl person knows js than it is that a randomly chosen js person knows cl
8:24:54
wasamasa
if you declare a variable without let/const/var, then it essentially gives you a global variable
8:25:44
wasamasa
however this is not to be relied upon due to the existence of strict mode and hoisting
8:27:24
amazigh
(unrelated tl;dr: microsoft built a REPL-like ui/ux feature called hot-reload for the OSS .NET SDK then turned it into feature only available in non-oss visual studio https://dusted.codes/can-we-trust-microsoft-with-open-source)
8:28:24
wasamasa
you'd have to look at how stuff like testing libraries work, that would be a natural usecase for dynamic binding
8:30:16
amazigh
but I was thinking about my initial rationale for going with Scheme in the first place, it was because of lexical scoping that looks more like the scoping in JS or Python, and eventually tried to understand better what is dynamic scoping, how would you explain dynamic scoping to a python or javascript or ruby dev? Dynamically scoped variables are globals?
8:31:18
amazigh
AFAIU, according to kernel, dynamic environment is the static environment of the caller.
8:32:23
wasamasa
you walk up the stack of currently active bindings instead of erroring out early because the variable wasn't in the lexical scope
8:33:58
wasamasa
it can be thought of something like (progn (setq foo 1) ... (setq foo original-value))
8:34:48
wasamasa
and the interesting thing is that it affects foo beyond the surface level, even if it's defined in some other function called inside the body
8:36:37
wasamasa
however people eventually realized that it's a bad idea to have it as the default behavior for everything
8:36:43
amazigh
(yes re emacs, I figured that while working on toy editor, I used a global hash-table instead)
8:36:55
wasamasa
and that lexical binding can be implemented more efficiently and gives you closures