freenode/#lisp - IRC Chatlog
Search
17:58:47
shka
it is not urgent, just regarding documentation-utils -- i think that we don't connect perfectly
17:59:21
peterpp
ebrasca, do you happen to have an example of a config file that uses s-epxrs that you could show me?
18:02:05
Xach_
Shinmera: hmm, it's not sufficient just to rebuild qtools with fresh fasls, it seems that other projects that require qtools will trigger the fasl symbol issue.
18:03:04
peterpp
oh man I had no idea stumpwm is so well maintained... I just looked at the recent commit history on github
18:03:41
sjl
peterpp: if you're using READ to parse the config file, be aware that it can execute arbitrary code, e.g. (:username #.(run-program "rm -rf /")
18:04:36
peterpp
no, just generally wanted to take inspiration from config file formats that rely on s-expressions
18:05:40
sjl
so if you want to use untrusted config files, you'll probably want something like cl-secure-read
18:07:04
__sigjuice__
.swank.lisp is another example that comes to mind. https://common-lisp.net/project/slime/doc/html/Other-configurables.html#Other-configurables
18:12:43
__sigjuice__
peterpp: my imagination should be considered very limited, but I can't envision needing anything more complicated than a pile of special variables
18:33:25
sjl
I've looked at Shen a little bit, but the development environment isn't nearly as mature as something like CL+Slime
18:34:45
jasom
makomo: cool, also note cl-json ships with two different ways of generating keywords from strings, one of which will refuse to intern new symbols (which is good if you're concerned about someone sending you a billion different keywords to use up all your server RAM)
18:37:48
peterpp
I'm struggling with how lisp-mode indents my source code: https://gist.github.com/anonymous/d87c3cf2a2c4fc85e0ee60b12e71f183
18:39:37
jasom
peterpp: that would be code that is calling the function named :foo with the arguments :bar :baz :boom
18:42:20
jasom
though I'm not in pure lisp-mode, I'm running slime, I don't think it makes a difference for this case, but I can try in a bit
18:42:38
peterpp
hmm for me lisp-mode still indents the wrong way... good to know it works on your machine though, I guess I messed something up
18:46:02
jasom
hmm, bare lisp-mode does seem to do it the way you see (e.g. *scratch* indents my example wrongly)
18:46:08
parjanya
parjanya: I’m a newcomer (too?), but I’ve seen a good chunk of that attitude of melancholia and lack of interaction with other people
18:51:41
jasom
peterpp: don't worry about it. That sounds like a problem with emacs or slime. If you figure out how to reproduce it, let me know
18:54:52
jasom
parjanya: Taver's essay is problematic, if for no other reason than that the symptoms described are not bipolar.
19:00:33
peterpp
I must say... you folks are a lot more enjoyable to talk to than the folks I met in most other programming-related irc channels
19:04:05
parjanya
jasom: yes, it’s quite an imprecise use of the term... I don’t know enough about lispers to say anything meaningful, but I know plenty of the kind of people he describes, from school on
19:06:11
mlau
: don't worry about it. That sounds like a problem with emacs or slime. If you figure out how
19:20:17
makomo
jasom: mhm, i remember you mentioned that. however, cl-json:*identifier-name-to-key* isn't mentioned anywhere in the docs
19:20:33
makomo
the variable holds the function which turns a string into an object that will be used as the key
19:21:28
makomo
there's just a little note somewhere about JSON-INTERN and JSON-SAFE-INTERN, but no mention of how to actually swap one with the other (or use your own version)
19:21:53
makomo
i.e. *IDENTIFIER-NAME-TO-KEY* isn't documented, at least not in https://common-lisp.net/project/cl-json/
19:22:48
pjb
You can measure how bad a system is by measuring how much it's talked about in help channels. JSON is very bad. Why don't you just use SEXPS?
19:23:28
makomo
well, the data i pulled from the web is in JSON, so i have no other choice right now
19:23:42
makomo
however, i was thinking of switching the data over to either sexps or into an SQL database
19:32:17
peterpp
pjb, in what way do you consider s-expressions superior to json for this purpose? (genuine question from a lisp newbie)
19:35:41
dmiles
JSON implies an exact structural meaning. whereas s-expressions (depending on the content can have differnt meanings beyond structure)
19:36:18
rme
Of course, s-expressions are very easy to print and read from lisp (just like json is in javascript).
19:37:52
dmiles
jasom: yeah true JSON-LD (link data) encourages such meanings to be preformed based on operators
19:38:30
jasom
obviously there are things that you can represent in JSON that are harder to represent in sexps and vice-versa
19:42:03
dmiles
oh true i see what you mean .. if we wanted to we could even have multiple types of nils
19:42:20
jasom
communicating between two lisp programs with JSON is rather silly, but JSON isn't inherently worse or better than sexps for other cases.
19:43:19
pjb
peterpp: the superiority of sexp is that it's designed for lisp objects (mind you, not all of them, but a sizeable subset of them). So it works well to communicate between lisp processes.
19:44:55
jasom
peterpp: I'm not necessarily recommending this, but here's an example of me using an actual lisp file for configuration; I just LOAD it: https://github.com/jasom/cl-fccs/blob/master/config.lisp
19:48:09
dmiles
yeah the point of json-ld is to document the various complex meaning-rich json encodings, just like IKL (Icarus language) document the various complex meaning-rich s-expressions
19:51:02
caffe
silly question.. i've been playing around, and noticed that things like :foo do not result in a debugger prompt or error. is there a use for this, or some way i can define a function to those symbols(?)
19:54:51
rpg
dmiles: I thought json-ld was just to let people smear JSON data across different documents?
19:58:24
caffe
what i was hoping for was a way to define a shorthand command to be used in the repl, similar to commands in the lisp listener prefixed with a colon
19:59:08
rpg
caffe: those commands are defined using special facilities that are not the same as DEFUN.
19:59:27
dmiles
analysis for after the json object is plastered to the page ["loves", "john", "martha"] .. ahah there was a loveful event involving john towards something
19:59:54
rpg
caffe: The :-commands used in ACL's repl or SBCL's ACLREPL are defined with a special defining macro.
20:01:25
rpg
dmiles: OWL was intended to be able to say what a particular data item "means", but has been less than satisfactory for a number of reasons. IMNSHO the use of description logic for its semantics was a total disaster.
20:02:50
rpg
Not only the rule of least power, but also because it's a *logical* notation that *looks like* an object-oriented notation, meaning that the vast majority of people -- even very sophisticated people -- who use it don't understand what it means.
20:03:26
rpg
The essence of OO programming is mutation, so giving people a notation that looks like OO, but in which mutation is forbidden is nutso.
20:03:33
caffe
or rather, are the facilities for defining those macros unique to their implementations? (clim listener, slime, etc)
20:04:43
dmiles
instead of description logic, we should have used situatation/fluent calculus which is what congress paid for in funding the research
20:06:05
rpg
dmiles: Worked on a project where we tried to use OWL-S (the OWL-based webservices markup language). Wow! Having a language for describing computation that has no provision for state change or for the concept of "variable" was a total trainwreck.
20:06:34
rpg
oh yeah, and it couldn't deal with the fact that web services often produce *knowledge* about things in the world.
20:06:37
dmiles
(congress was sold on the abilites of inference engines that used dynamicly mutating situations that transacted using inferred states)
20:07:33
rpg
In my experience there are now tons of systems that use the *syntax* of OWL, but that have widely diverging semantics, or no semantics at all.
20:08:11
rpg
(for those who have heard the "Car Talk" radio show, I should have said "don't get me stahted!")
20:10:03
rpg
caffe: I don't fully understand the comma commands for SLIME because they seem somewhat awkwardly split across emacs-lisp and common lisp.
20:10:43
dmiles
rpg: what relaly bugs me is for 5 years prior to the semantic web, myself and many people were doing all the things the semantic web dreammed of
20:11:25
rpg
what really bugs *me* is that it's clear that no one could have tried to use OWL-S or DAML seriously before trying to foist it on the world at large.
20:11:34
caffe
i don't personally use SLIME much. i'm more familiar with them in clim-listener, but i'd like to hack together something similar that works in a plain sbcl repl just the same as it would in the listener, or slime, etc
20:12:41
dmiles
(yet the semaantic web *prevented* specifically the logical representations required to perform those tasks)
20:13:37
rpg
caffe: I think that would be pretty hard, at least for SLIME, because of the way that its commands must be written in elisp. Also, for reasons I'm too lazy to understand, SLIME and (SB-ACLREPL and ACL's REPL) are incompatible. I think it's probably because SLIME has to parse all the stuff that goes into the repl itself, so commands that are programmed into the underlying lisp aren't understandable
20:14:12
rpg
dmiles: It's afternoon here and I *must* eat or I will start chewing my keyboard. TTYL, I hope.
20:14:32
dmiles
rpg: one day i was translating English to KIF and then back to English (round tripping), my supervisor told me to start billing DAML project
20:16:59
caffe
i'll start by picking apart SB-ACLREPL to get a better understanding of what i'm dealing with, and/or see if that's something i could make use of
20:54:47
antoszka
It may actually give you additional insight into the way your structures actually *reuse* data.
23:02:49
le4fy
jmercouris: definitely sub-optimal word choice w/ "bipolar". but if you're a little forgiving i think it is still a decent point
23:03:36
le4fy
the point being "lispers" tend to work hard on interesting problems, and can easily lack motivation when forced to do something they don't believe in
23:14:56
jasom
le4fy: I'll have to reread that essay, because that's a much kinder interpretation than I remember getting
23:19:08
le4fy
mine was one that was relatively kind to the lisper, but understood the lisper as being stuck in a world of bullshit
23:21:06
le4fy
i read this essay (a couple years ago) at the same time i read this one (http://www.winestockwebdesign.com/Essays/Lisp_Curse.html)
23:51:30
aeth
I personally see Lisp as just another language (1) that is more multiparadigm than most languages (to make up numbers, you can do 45% of the paradigms in most languages and 84% in CL) and (2) where it is much easier to control when non-runtime evaluation happens than with most languages (lots of ways to do it, too).
23:52:04
aeth
I think essays about how Lisp is some special magic language and Lispers are rare geniuses aren't productive.
23:54:15
aeth
And if you're willing to give up portability to all implementations, there are some extensions that give even more power than CLHS offers.
23:54:42
aeth
(A new standard would be great to make all the popular and very useful extensions standard.)
23:57:49
aeth
Ironically, there probably needs to be an essay about how all the popular essays are wrong.
23:58:40
aeth
drdo: I always sneak in "there should be a new standard" as often as possible, in hopes that I can gradually get people used to the idea. Subtle propaganda.
23:59:04
aeth
Right now the ideology is that (1) there shouldn't be a new standard and (2) it's impossible to do one even if people wanted one
23:59:57
aeth
And, yeah, #2 is true if you're going for an ANSI or ISO or whatever standard. But no one cares about those anymore for programming languages. Scheme gets by fine with its rnrs.
0:01:32
aeth
Actually, the de facto Scheme standards are the SRFIs, and Schemes care about (some of) those.
0:01:44
aeth
Which is strange because it's the opposite in the CL world, where the CL equivalent of SRFIs are pretty much entirely ignored
0:02:38
aeth
But I would disagree about no one caring about the rnrs. People care about the r5rs so much that r6rs was rejected and r7rs has to basically be compatible with r5rs.
0:03:51
aeth
A modern Scheme is essentially extensions to r5rs or r7rs-small (and r7rs-small contains an r5rs compatibility mode... so I can just say "extensions to r5rs")
0:04:37
aeth
_death: The only way a new standard would work is if it took things that basically every popular implementation has and standardized them. e.g. gray streams.
0:05:29
aeth
_death: It would be useful to have a new baseline for a standard CL, though. Because a "standard CL" without support for the de facto standards is useless.
0:06:40
aeth
_death: But it would also be nice to up the minimums, and to have set minimums for each bit size. e.g. fixnums for 64-bit implementations should be at a minimum 60-bit signed-byte integers. Nearly every implementation will pass this. I think CLISP's is 48 or something, and only it will fail.
0:07:59
aeth
Afaik, CL standard sizes for things are made to be safe for 16 bit implementations. So... keep those for 16-31 bit implementations, have new minimums for 32-63 bit implementations, and have new minimums for 64+ bit implementations. Now you can make assumptions.
0:08:28
aeth
Right now, any CL application with strings longer than 1024 is technically not going to run on every possible standard CL implementation.
0:10:08
_death
I don't think you appreciate the weight of my statement.. since you seem to throw technical arguments at me :)
0:10:36
aeth
For the most part, no implementation would have to change except for ones that really go out of their way to not follow de facto standards, like CLISP. e.g. single-float and double-float and (unsigned-byte 8) arrays aren't guaranteed to exist. Only bit and character. But almost every implementation has these. (CLISP doesn't have them for floats, though.)
0:11:23
aeth
A ton of libraries assume these de facto standards that are technically not required by the standard.
0:14:01
aeth
Depending on how conservative the extensions part is (not the same as the minimums part), SBCL might not have to change at all. It has almost all of them already.
0:15:19
aeth
Other implementations would benefit, though, because they could rely on programs that are essentially written on and for SBCL.
0:26:15
_death
CL is a haven of stability, where not only your programs will still work in 20 years, but also the values and aesthetics of fellow programmers will remain palatable.. your code, way of writing code, way of thinking about problems won't turn "legacy" just because some committee out there put out a new document, or some dude made a bunch of commits.. CL is flexible enough to remain relevant without change.. that is why CL will never be
0:26:21
aeth
Sizes of things (e.g. fixnum size), which specialized arrays are supported, which extensions are supported, etc., would make a useful table. Perhaps also some popular library support as well (e.g. bordeaux-threads, cffi, etc.)
0:27:28
aeth
_death: A successful extension to the CL standard makes new paradigms implementable in libraries, rather than directly implementing those new paradigms. e.g. things like this should stay as libraries: https://github.com/markcox80/specialization-store/
0:33:50
_death
(to clarify, I meant "successful" in the usual way it is used by professionals, i.e. "popular")
0:35:00
aeth
_death: Popularity doesn't have anything to do with quality, or really anything that a language can control. Languages have network effects, just like Facebook does. You can make a better social network, but that doesn't mean people will go there.
0:35:50
aeth
_death: But on the flip side, that doesn't mean CL will never be popular among programmers. What tends to work with programming languages is the "killer app" concept that works with platforms in general, except instead of "app" it's more about the ecosystem. e.g. Rails is the reason why most people use Ruby (or at least initially used Ruby, even if they switched to something else later)
0:36:17
Xach
_death: is it because the priests of SBCL are interpreting the oracular utterances of the spec?
0:40:04
aeth
(The really healthy languages like C++ and Python have multiple, very different things that draw people to the language.)
0:47:30
_death
I think it's sufficient to consider just the age of SBCL (incl. its origin) vs. the age of ASDF
0:48:01
stylewarning
__sigjuice__: every so often asdf is made “better” by introducing a small backwards incompatibility that fundamentally breaks 1–2% of the ecosystem but propagates transitively to a larger percentage.
0:48:42
aeth
Ah, I think I have the right way to get fixnum size. (integer-length (- most-positive-fixnum most-negative-fixnum))
0:49:07
aeth
(- most-positive-fixnum most-negative-fixnum) should be a bunch of 1s, and integer-length should give the exact length of that bunch of 1s
0:49:52
__sigjuice__
stylewarning: are these sorts of breaking changes known ahead of time via cl-test-grid perhaps?
0:50:09
|3b|
if you need both, the configuration is probably odd enough that a single 'size' number would be misleading anyway
1:25:54
rme
The last time we (ccl hackers) talked about an ARM64 port, we were considering using high tags. This would mean a fixnum would be a (signed-byte 56).
1:27:34
|3b|
could you still do the usual trick of dedicating 1/2 or whatever of the tags to fixnums to get some of the bits back?
1:30:06
rme
I think we were talking about tagging fixnums with sign extension so that fixnump would be quick (like 3 instructions).
1:31:29
|3b|
though fixnum size matters much less on 64bit than on 32... 24-bit fixnum is small enough to limit the size of bit-arrays on a reasonable system, 56 probably isn't :)
1:32:28
|3b|
seems like most of the time i get close to 64 bits i need all 64 bits, so doesn't really matter if fixnum is 56 or 63
1:37:56
fiddlerwoaroof
Is there someway to do something like an "integer pool" so that integers don't need to be tagged?
1:38:41
fiddlerwoaroof
i.e. something like setting aside a certain chunk of memory for integers and telling the garbage collector to ignore addresses in that area?
1:44:47
|3b|
and pretty much the point of a fixnum is that you /don't/ put it in some separate memory
1:45:41
|3b|
though if that was just a general question unrelated to fixnums, specialized arrays are pretty much that
1:45:43
fiddlerwoaroof
|3b|: didn't think of that, I was just wondering if there was some way to use all 64 bits without running into problems like integers being mistaken for pointers
1:46:36
Bike_
like if you had (let ((x (the (unsigned-byte 64) whatever))) ...) and x doesn't escape, sbcl can maybe do that, like it does for floats
1:46:52
|3b|
bignums let you use 64bits inefficiently, declared types let some compilers deal with 64-bit values directly, usually within some limited scope (like you probably still have to tag/box them to pass between functions)
1:52:08
fiddlerwoaroof
There's this: https://franz.com/support/documentation/cl-ansi-standard-draft-w-sidebar.pdf
1:53:49
pransninja
_death: Are you kidding me, right? it is the interface, the content seems okay from a lisp novice point of view.
1:55:30
pransninja
_death: Haha, come on, those script text in pictures and a layout that I still haven't figured out after two days of clicking around is absurd.
1:56:23
fiddlerwoaroof
franz has a different version: https://franz.com/support/documentation/10.1/ansicl/ansicl.htm
1:56:39
pransninja
The documents also lack a clear structure, not arguing that it is not there, typography that needs decipher defeats the purpose of typography.
1:56:45
Bike
what layout is there to figure out? you get to the table of contents and click chapter titles
1:57:46
fiddlerwoaroof
If you use mac/linux, something like Dash or Velocity makes it easier to refer to the relevant sections, but CLHS's license prevents people from modifying it.
1:58:49
fiddlerwoaroof
This has a bunch of the same info, but it's very much a work in progress: http://phoe.tymoon.eu/clus/doku.php?id=clus:todo
1:59:20
pransninja
I like that it makes sense, you go to index, you go to articles, you repeat. No other nonsense.
1:59:29
_death
pransninja: so when you pick up emacs, you can download an offline copy of the clhs and just use eww or emacs-w3m to browse it, and your concerns about typography and pictures will evaporate
2:00:30
fiddlerwoaroof
If you want to learn CL, it's probably better to start with something like Practical Common Lisp, Gentle or some other document
2:00:49
minion
pransninja: please see 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).
2:00:54
minion
pransninja: please look at gentle: "Common Lisp: A Gentle Introduction to Symbolic Computation" is a smoother introduction to lisp programming. http://www.cs.cmu.edu/~dst/LispBook/
2:01:56
fiddlerwoaroof
I think PCL is one of the best introductions to a programming language that I've read, but some people have found it too verbose and its tone irritating
2:03:04
pransninja
fiddlerwoaroof: I am on the second bandwagon, the core content is pretty good so far though.
2:03:28
pransninja
Really like that it is "practical" but there is something about the language that makes me want to chew my nails.
2:06:29
pransninja
So far I love the whole idea of "live" programming with a REPL along with your text editor.
2:07:10
pransninja
I am already worried how bad going back to my "everyday" language would feel like. lol
2:07:45
fiddlerwoaroof
Yeah, I find CL so much nicer than other environments: and very few other programming languages have a similar experience: of the popular ones, only Clojure comes close and it's a bit annoying in some respects.
2:10:41
pransninja
fiddlerwoaroof: I am on learn languages journey, after finishing PCL I will finish Real World OCaml, then learn F# maybe, or possibly Clojure.
2:11:38
fiddlerwoaroof
Yeah, I've finished that journey :), I think I'd suggest Haskell rather than ocaml, but this is getting off-topic;
2:11:51
_death
the "mainstream" CL environment is still a long way from satisfactory in many ways.. there are lessons from emacs, jupyter, R, matlab.. but that requires a ton of work, and we're all busy doing Something Else(TM)
2:13:04
fiddlerwoaroof
Yeah, beach and froggey sometimes seem like the only people doing something about that.
2:13:35
fiddlerwoaroof
I've wanted to, but it doesn't really pay the bills, and I don't have much free time :(
2:16:22
pransninja
fiddlerwoaroof: I like the idea of Haskell, trust me it is on my list of to learn languages, but probably right before I want to learn Rust properly.'
2:17:21
pransninja
fiddlerwoaroof: I want to learn OCaml becuase I think ReasonML is going to be big in my industry.
2:17:49
pransninja
_death: Sure, but I can say with utmost certainty that reading a book is part of learning a language.
2:19:37
fiddlerwoaroof
It's often better to have some moderately complicated project to do in each language you learn and then use books and other materials to help you to implement your project in the language
2:20:14
fiddlerwoaroof
I learned CL by reading like 2/3rds of PCL and then trying to implement a RSS reader in CL
2:20:58
pransninja
fiddlerwoaroof: For sure, I have some ideas in my mind, I actually have a project in back of my mind for years that requires understanding multiple languages to execute it well, along with a solid understanding of type theory.
2:21:21
pransninja
But back to lisp, given things like `(with-open-file (out filename ....))` how do I differentiate a function call from a list passed as a parameter?
2:21:46
fiddlerwoaroof
You can't in the general case: a macro determines the semantics of its arguments
2:23:28
fiddlerwoaroof
Generally, there are two or three common macro patterns: with-* define-*/def* and do* and, within each pattern, the arguments are treated in fairly consistent ways.
2:24:12
_death
you always need the context... (+ 3 5) may look like a function call, but it's not, because surrounding that form is (quote ...)
2:26:25
pjb
The context is not only the surronding form, when you read it, it's the *readtable*, the *package* and other *read-…* variales.
2:28:00
pjb
(defun x ()) (list (quote x) (function x)) #| --> (x #<Compiled-function x #x302002FFC72F>) |#
2:31:27
pjb
Some other functions are named with lists of 2 symbols, the first being CL:SETF, and some functions are unnamed.
2:31:47
pransninja
What I want to understand is that if `(+ 1 2) is not a function call, then what it is?
2:32:38
pransninja
What does " Declared type: (FUNCTION (&REST NUMBER) (VALUES NUMBER &OPTIONAL))" means?
2:33:02
pjb
It's the type of a function that takes 0 or more numbers and returns a number and perhaps something else.
2:35:58
_death
pransninja: and what `(+ 1 2)` is depends on the context.. it can be a function call, or it can be a list of 3 elements, or it can be the textual description of such a structure, for example..
2:37:55
pjb
pransninja: (+ 1 2) is a sequence of character. This is represented as a string in lisp, and a string is represented with the sequence of characters "(+ 1 2)" `(+ 1 2)` doesn't represent anything in lisp. More precisely, it is read as `(+ 1 2) and ` the later being incomplete and provoking an end-of-file error
2:38:00
pransninja
Given the flexibility of lisp and the fact that is uber-meta, anything could be anything?
2:38:26
pjb
"(+ 1 2)" is a string, it is also a sexp. It is read as the sexp (+ 1 2) : (read-from-string "(+ 1 2)") #| --> (+ 1 2) ; 7 |#
2:38:53
pransninja
But I suspect like how overloading could be abused in C++, it is likewise froward upon in Lisp to redefine "common sense" semantics?
2:38:58
pjb
Then the sexp (+ 1 2) can be processed by various functions. When it is processed by EVAL, it is interpreted as a function call: (eval '(+ 1 2)) #| --> 3 |#
2:39:26
pjb
But if it is present in the context of other sexps, it can be interpreted differently: (eval '(quote (+ 1 2))) #| --> (+ 1 2) |#
2:41:43
pjb
(defpackage "ADD" (:use "CL") (:shadow "+")) (defun add::+ (&rest args) `'(let us add ,@args and have fun)) (let ((*package* (find-package "ADD"))) (eval (read-from-string "(+ 1 2)"))) #| --> '(let us add 1 2 and have fun) |#
2:45:23
pjb
pransninja: (setf *read-base* 2.) (let (+ 3 4) (setf + 1 3 1 4 1) (+ + 3 4)) #| --> 3 |#
2:46:02
pjb
In that context, + is just a symbol, and is interpreted by the macro LET as the name of a variable. (3 and 4 too, since the current read base is two).
2:46:54
pjb
But notice that in (+ + 3 4) the first occurence of the symbol + is interpreted as the name of the function +, while the second occurence is interpreted as the name of the variable + bound by the surrounding LET form.
2:47:28
_death
+ is also a fixed-point function when used in the repl... to see that, type + RET a few times and see how it converges
2:48:14
pjb
That's because it's defined to be a special variable that is bound to the last form that is evaluated in the REPL.
2:50:43
parjanya
is there a way to mark if I want a symbol to be interpreted either as a variable or a function?
2:54:18
pjb
parjanya: it's based on the syntax. In the first position of an applicative list, it's interpreted as the name of an operator (function, macro or special operator). In other positions, as the name of a variable (or depending on the macro or special operator).
2:54:28
parjanya
I mean, if I (defun a-test (lalala) lalala) and (defparameter a-test "a string") and do (a-test a-test)
2:54:56
pjb
And then of course, as mentionned by _death, there are symbol macros, but also reader macros that can distort your senses.
2:55:16
parjanya
if I do (a-test a-test) the first one will be the function, the other one the variable, but I wonder if there is a way to say that explicitly, like when one uses 'a-test to just get the symbol
2:56:02
_death
you can use the FUNCTION operator to designate a function.. (function +) ... a shorthand for this operator is the reader macro #' .. so #'+ will also work
2:56:36
pjb
parjanya: not really in general. In the case of global special variables, you can get the value with (symbol-value 'a-test) and for global functions, you can get it with (symbol-function 'a-test), so in that specific case, (a-test a-test) can be replaced by (funcall (symbol-function 'a-test) (symbol-value 'a-test))
3:03:42
fiddlerwoaroof
Lisp, for me, was eye-opening because it disabused me of two things: (1) compiled languages need to be statically typed and (2) compiled languages have to have a slow feedback loop.
3:04:27
fiddlerwoaroof
It was also very satisfying to find a language where I could actually write concurrent programs, since most of the other languages I've used have some form of GIL to make one's life difficutl
3:06:07
beach
fiddlerwoaroof: And it is a bad idea to pretend there is, because it gives people the wrong idea.
3:06:37
beach
fiddlerwoaroof: Then they will think like this: Lisp => interactive => interpreted => slow.
3:07:43
beach
fiddlerwoaroof: It is very important to let people (especially your typical ignorant programmers) that most modern Common Lisp systems compile on the fly, so that the resulting speed is comparable to that of compiled C.
3:08:43
fiddlerwoaroof
and then I recompile the function with (declare (speed 3) (safety 0)) and show the difference in the disassembly
3:08:53
beach
Those ignorant programmers will of course always have an excuse to stay away from Common Lisp, but making sure they understand this issue gives them one fewer reasons to do so.
3:09:28
_death
you can also mention printf vs. FORMAT, and C's lack of compiler macros and of FORMATTER :)
3:10:50
fiddlerwoaroof
Also, emacs macrostep expander is pretty cool when people complain about debugging macros
3:11:13
pransninja
beach: Compile on the fly is called JIT and it is not exactly on par with native code.
3:12:06
fiddlerwoaroof
Common Lisp implementations generally have a compiler that turns your lisp code into machine code
3:13:05
_death
pransninja: you can also compile things on the fly, the language is available at all times..
3:13:13
beach
pransninja: Perhaps you are one of those programmers I referred to who think that interactive implies interpreted.
3:13:24
fiddlerwoaroof
So it's "on the fly", but not in the way a tracing JIT compiles on the fly: e.g. it doesn't take execution patterns into account to determine the compilation
3:13:31
loke
pransninja: It means "automatically when needed". As opposed to the user having to go through a manual compilation phase.
3:14:15
beach
pransninja: It means that between the time you validate an input expression and the time you see the result of executing it, the Common Lisp system has turned it into real native code.
3:15:42
beach
pransninja: It means that between the time you validate an input expression and the time you see the result of executing it, the Common Lisp system has turned it into real native code.
3:16:03
_death
pransninja: (let ((code (progn (print "Enter code: ") (read)))) (disassemble (compile nil `(lambda () ,code))))
3:16:15
pransninja
And how is that different than "offline compiling"? in contrast to your "on the fly"?
3:17:53
pransninja
Look, I think REPL is sexy, I am loving it, this is my first experience with such a "live" coding way.
3:18:10
pransninja
I have used REPLs before, but this level of integration with text editor and such is dope.
3:18:10
Bike
using a repl is a different way to program from writing a program and throwing it at gcc or whatever, as you've already seen
3:18:16
beach
pransninja: Most people think of compilation as a batch compiler producing files containing object code that then has to be linked in order to produce an executable. I use "on the fly" as a contrast to that.
3:19:09
beach
pransninja: I am more interested in why you think the Common Lisp compiler produces something that is not "on par" with native code. Can you elaborate on that?
3:19:11
loke
pransninja: As I said earlier, "on the fly" means that it's done automagically, without you having to go through a compilation phase (like in C, when you have to run "make" separately before testing the program)
3:20:03
pransninja
beach: The common meaning of "on the fly" is JIT, which is on par with native code, but not quite.
3:20:49
beach
pransninja: Maybe you have a different concept of "native code" that most people here do.
3:21:02
loke
pransninja: Actually, JIT can (and has been shown to) produce more efficient code than static compilation. That said, most Common Lisp implementations does not use a JIT (only ABCL does, as far as I know)
3:21:06
beach
pransninja: That is why what the Common Lisp compiler does is not JIT as you were told.
3:21:09
pransninja
In contrast to "offline" compiling where you just have native program, and maybe a runtime, and you CPU just deals with that.
3:22:01
loke
pransninja: True. But it's mostly irrelavent in the discussion of Common Lisp, since most CL's does not use a JIT anyway.
3:23:22
loke
pransninja: OK, type the following into the REPL: (defun foo (x) (declare (optimize (speed 3) (safety 0))) (1+ x))
3:24:27
pransninja
loke: Yeah, so I got to run disassemble with my text editor, I see the disassemble.
3:25:21
parjanya
what’s difficult about "on the fly" meaning "without having to invoke make and then execute"?
3:25:29
pransninja
Many IDEs allows you to do see "disassembly" or even "run" compiled languages with "invoking compile" directly.
3:26:00
loke
pransninja: Indeede. But none (or at least very few) of those languages allow you to recompile code _while_the_program_is_running_
3:26:19
beach
There is no such thing as a "compiled language". That has to do with the implementation strategy.
3:27:02
pransninja
beach: Yeah, which is why I said "the language is compiled" not that "you're using a compiled language".
3:27:44
pransninja
Searching for "on the fly compiler" and see what your fav' search engine brings up: Just-in-time Compiling.
3:28:40
fiddlerwoaroof
pransninja: languages aren't compiled. Almost any language can be implemented by a compiler or an interpreter
3:29:20
_death
pransninja: here is a program: (defvar *program* '(lambda (x) (1+ x))) .. it is not yet compiled
3:29:22
loke
pransninja: You're arguing sematics now. You have some very specific definitions of certain words that does not exactly match the definitions everybody else is using. Now, you may think that our definitions are wrong, but that doesn't matter. I think you have a rough uinderstanding of the way Lisp does things, and it doesn't matter what you or I call it, no?
3:30:06
_death
pransninja: now we have arrived at the moment to compile it, so we compile it, just in time: (compile nil *program*) and call it (funcall * 123)
3:31:17
pransninja
_death: It doesn't matter what. On The Fly Compile is a synonym for JIT, and JIT is basically dynamic translation, if you're not doing dynamic translation, you're not compiling on the fly.
3:31:53
loke
pransninja: We need to call it SOMETHING, and if you're not happy with our definition, what do you suggest instead?
3:32:18
pransninja
_death: I said, search for "on fly compiler" in whatever search engine you like and see what the first result is. If it is not JIT, I will eat my banana.
3:32:41
parjanya
the funny thing is you decreeing the meaning of an expression and saying that we shouldn’t argue semantics ; )
3:33:36
pransninja
I am not decreeing, I have read "on fly compile" refereed JIT that I struggle to see how anyone would think it could mean anything else. :P
3:33:46
loke
pransninja: No. The REPL means read-eval-print-loop. It's just the commandline interface. Even fully interpreted implementations have a REPL.
3:34:10
loke
pransninja: The first non-Java-related hit for on-the-fyl compilation was this article: https://blogs.msdn.microsoft.com/abhinaba/2006/02/09/c-writing-extendable-applications-using-on-the-fly-compilation/
3:35:05
loke
pransninja: That artcile discusses calling the C# compiler dynamically, in a way that is not too disimilar from the Common Lisp way of doing it.
3:35:38
fiddlerwoaroof
"on the fly" is sort of a colloquialism, so one generally figures out what it means by looking at the context it's used in, not by forcing a certain meaning onto the phrase wherever you find it.
3:36:11
pjb
A compiler may still involve a byte-code interpreter or some other form of interpreting for execution.
3:37:42
pransninja
loke: I somehow feel like "Just-in-time compilation" Article on wikipedia is also not "Java" related.
3:37:43
_death
pransninja: but you're a programmer! so we can resolve the ambiguity using code.. so please, tell us what you mean using code
3:37:55
fiddlerwoaroof
Common Lisp implementations will often call the compiler "automatically" when trying to evaluate a chunk of code and, on the fly is a reasonable way of talking about this. In a JIT, the compiler is called at runtime in response to observed patterns of execution, which is another thing to reasonably call "on the fly" compilation.
3:38:49
loke
pransninja: But this all very “whatever” since you have made your point clear, and while we don't agree with you, I think we understand what you mean.
3:40:18
loke
pransninja: Perhaps after using Lisp for a while, you can start to understand why we feel it's important to make these distinctions. Even if you refuse to use our terminology, it will help you explain things to us.
3:40:54
pransninja
Look, my first comment after asking a question when I got here was that I love this whole "live" programming with a REPL + editor setup.
3:41:25
pransninja
I even expressed my concerns about how my everyday programming language envs would feel like after this.
3:42:03
pransninja
But there is no point in repeating that "on the fly" means JIT pretty much just about anywhere I have read it.
3:42:07
loke
pransninja: All right. So let's just drop the terminology discussion, and focus on the important points: How to ensure that you feel confortable with Lisp.
3:42:43
loke
pransninja: I wouldn't say Lispers have a very “different” definition. More nuanced perhaps.
3:43:57
loke
pransninja: And if you want to twist your head even further, remember that ABCL is an implementation of Common Lisp whose compiler generates Java bytecodes, at runtime.
3:44:07
aeth
"on the fly" can be used to implement JIT, right? Is it possible that a language that compiles to CL could be JIT even when the implementation itself is AOT? Or do CL implementations not have enough introspection?
3:45:22
loke
pransninja: So as you can see, at that point it simply doesn't make sense to even talk about the distinction, because ABCL is pretty much “all of the above”.
3:46:51
whoman
for each dictionary entry linking to other entries, forever. how do we even resolve that macro ?
4:01:50
pjb
(defun eval (expr) (funcall (coerce `(lambda () ,expr) 'function))) is a valid CL:EVAL implementation.
4:02:27
pjb
Notice it doesn't imply compilation. Coercing to the type function doesn't imply anything about interpretation or compilation.
4:03:08
pjb
(defun eval (expr) (funcall (compile nil `(lambda () ,expr)))) is another implementation that explicitely invokes the compiler.
4:31:08
aeth
_death: Ime, for technical subjects Wikipedia is good at explaining things, but bad at teaching things. It's okay to read the article on Foo if you already learned about Foo from somewhere else.
4:31:35
PuercoPop
oi, I'm having trouble writing to an unix socket. I've disabled buffering and send finish-output jic. Am I missing something else? https://gist.github.com/PuercoPop/709ac450430cc7097d50d4c02554d304
4:46:00
fiddlerwoaroof
What's the best way to get bindings for a C library? wrapping the types with the groveler than manually writing bindings for the functions?
4:57:07
beach
Or you can write a Common Lisp version of the library that would then benefit the entire Common Lisp community.
5:09:03
fiddlerwoaroof
My goal is to figure out the objective-c runtime well enough that I can fix the beagle backend for clim
5:11:01
beach
whoman: Is that a new discussion topic, or is it somehow related to what fiddlerwoaroof is doing?