freenode/#lisp - IRC Chatlog
Search
16:08:44
srandon111
guys i wasa reading how to design programs... and i wanted to understand what it means to design data and functions in an orthogonal way so that they are independent
16:09:01
srandon111
can you make me an example of when these are not orthogonal and hence not independent?
16:14:57
beach
srandon111: It depends on what you mean by "data". Typically, an abstract data type has protocol functions associated with it, but there is no explicit definition of the data type in terms of its representation.
16:15:41
beach
srandon111: But if your representation shows in the protocol, then the dependency is there. That is something you would want to avoid.
16:17:44
beach
srandon111: For example, let's say you want to define the data type "editable sequence" and you decide to represent it as a binary tree. If then you have a functions left-child and right-child in your protocol, then it is blatantly obvious that you are representing the editable sequence with a tree.
16:18:41
beach
srandon111: If instead you have only functions for inserting, deleting, and querying the sequence at certain positions, your protocol is now independent of the repersentation.
16:19:46
beach
The very definition of the Common Lisp semantics is "interactive" in that the semantics are defined by a suite of interactions.
16:26:07
phoe
nothing with all the bells and knobs and whistles that you can run in your browser or anywhere.
16:28:47
pjb
Note that "Online tutorial" contains both ONLINE and tutorial, and some online tutorials are really ONLINE!
16:28:56
pjb
such as LispTutor Jr is an online tutorial with interactive exercises to test your knowledge and understanding.
19:32:14
Josh_2
Is there an error here in the hyperspec http://www.lispworks.com/documentation/HyperSpec/Body/m_prog1c.htm see prog2?
20:10:15
aeth
Heh. It looks like the move to the impressive-looking SBCL 2.x got Fedora to finally update its SBCL from the ancient SBCL 1.4.14, at least in the upcoming release. https://apps.fedoraproject.org/packages/sbcl/
20:10:31
aeth
I guess one side effect of major version number bumps is Linux/etc. distros might care more.
21:53:26
aeth
phoe: Continuations are tricky so it's been sort of a line-a-day sort of thing and even then I'm probably making some subtle errors that need to be addressed.
21:54:57
aeth
I've also noticed that my transformation is enough to deoptimize e.g. (defun scheme::+ (&rest numbers) (apply #'+ numbers)) where SBCL normally would optimize most of the overhead away. So I'm going to have to come up with a solution to efficiently transform all of the &rest stuff in Scheme (not just most arithmetic procedures)
21:55:41
aeth
I mean, worst case scenario I can write define-scheme-compiler-macro as a parallel to define-compiler-macro and essentially do it how you'd have to do it if you couldn't open code or inline +.
21:55:57
aeth
Or I could write an inlining system and hope the APPLY gets removed when inlining, which it should.
21:56:38
aeth
Or I could walk through the body and if it consists solely of an apply, I can do something fancy, etc.
21:57:35
aeth
phoe: at the moment, it's about 7000 cycles for arithmetic that would normally be 1000.
22:01:34
ldb
aeth: a typical solution is discriminate binary + and reduced + using some kind of rewriting
22:06:47
ldb
it is easy to conclude this kinds of &rest is a binary operator extended to folding with a unit object
22:08:03
aeth
ldb: yes, but I don't need to go that far, I just need to turn (R7RS::+ ...) into (CL:+ ...) of course with any additional overhead around it (e.g. continuations) although I suppose it's not quite that simple because someone in user code could do something like (let ((+ -)) ...) because Schemes usually don't have something like e.g. SBCL's package lock on CL
22:09:02
aeth
I'll probably just catch CL's TYPE-ERROR around +, too, instead of slowing down arithmetic with my own checks.
22:10:34
srandon111
guys do you think that nowadays all the shining features lisps have are also contained in other programming languages?
22:11:58
phoe
srandon111: CL still has pretty unmatched runtime introspection, interactivity, and debuggability
22:12:20
no-defun-allowed
Macros are either not present in most languages, or they're a bit of a joke because they only perform textual substitution (C) or the syntax is far detached from the data they process, leaving one with a line noise pattern matcher to make macros with (Rust, et al)
22:12:43
aeth
srandon111: CL comes with INCF that's like += and ++ in one (if the number isn't provided, it's like ++, otherwise like +=) but lacks *= but you can just do (define-modify-macro multf (&optional (delta 1)) *) (let ((x 2)) (multf x 42)) => 84
22:12:57
aeth
The point of a Lisp is that you don't have to wait on a new version of the standard for new syntactic sugar.
22:14:49
aeth
ldb: No, Pseudoscheme did a very direct translation to CL, hence the "pseudo" in Pseudoscheme. It lacked key features like call/cc iirc. Also, modern Scheme has syntactically and semantically drifted more in r7rs than in the days of r4rs (where e.g. hygienic macros were just an optional appendix)
22:15:24
aeth
ldb: Airship Scheme is intending to be a conforming r7rs Scheme so it has to introduce overhead where there is a semantic mismatch, but ideally no overhead if there is not.