freenode/#lisp - IRC Chatlog
Search
15:03:23
dmiles
i think it is nice to allow: (make-instance 'bar 'z 10) or (make-instance 'bar :z 10)
15:11:24
dmiles
many serialized objects in cyc have "defun based constructors" that mimic the init slots using (foo:make-foo &key foo::z baz::z quux::z ) ...
15:12:29
dmiles
(secretly i thought that was standard until a couple years ago.. and was slightly surprised)
15:13:22
jmercouris
I've defined the following asd: https://gist.github.com/8c7ff859c3b6b4fc51c44c1a48188321 how do I load my subsystem?
15:13:22
minion
jmercouris, memo from jasom: the best way to use asdf and features is to use defsystem-depends-on to require any packages that might set features you need (e.g. trivial-features) and then if-feature inside your defsystem
15:13:53
jmercouris
it doesn't appear anywhere in slime-load-system, it only shows the parent system
15:15:51
phoe
jmercouris: my knowledge might not be enough in this case. I'm no good with more complex ASDF setups.
15:36:47
jmercouris
so if you look at the gist I posted earlier https://gist.github.com/8c7ff859c3b6b4fc51c44c1a48188321, next/cocoa doesn't come up in slime-load-system, but next does
15:37:01
Xach_
oh. slime-load-system is something that works only in a limited set of circumstances.
15:37:55
Xach_
There is no way to know in advance the lst of strings that will return a good result for find-system.
15:38:59
Xach_
jmercouris: when you do (asdf:find-system "foo") -- a precursor to loading a system -- asdf consults a number of functions to convert the string "foo" into a path to a system file (or a system object)
15:39:11
Xach_
This mapping is very handy and is one of the reasons why quicklsp caan do what it does.
15:39:36
Xach_
But it does mean that, when doing auto-complete, there's no easy way to say "give me a list of all systems that start with 's'" for completion purposes.
15:40:03
Xach_
But there is one built-in, standard function that is not so hard to use like that, because it maps from strings to files in the registry config.
15:40:18
Xach_
So you could consult the file system to say "which *.asd files in the registry start with 'f'?"
15:40:41
Xach_
but it can't tell you anything about the subsystems defined in one of those *.asd files.
15:43:18
jmercouris
I see but you could traverse those returned files and pass them to the other function that finds systems right?
15:44:55
Xach_
jmercouris: if you load the system file, you could have more information to use for completion. but loading system files is a pretty heavyweight operation. it could load dozens of supporting systems.
15:45:23
Xach_
a new system should make it easier to explore the mapping without doing an unpredictable amount of work.
15:46:02
jmercouris
Xach_: You could just write a simple parser that looks for defsystem + some string in each of those asd files
15:46:20
jmercouris
it's not necessary to know anything about the system or it's location as asdf:find-system can do that for you later, right?
15:47:42
jmercouris
I'm of course extremely ignorant about what this requires, but I thought that defsystem was ALWAYS followed by the system name
15:49:54
beach
(#.(intern (concatenate 'string "DEF" "SYSTEM") (find-package "ASDF_USER")) name-of-system ...)
15:54:42
beach
In fact, it requires the Common Lisp reader, which in turn requires a running Common Lisp system.
16:04:50
whoman
hmm eye of the beholder. as is life, readers are subjectively processed =) who knows what a person will feel when i wear a shirt consisting of the color Red
16:14:03
jmercouris
So now that Fare is leaving the community, who will further the development of ASDF?
16:18:15
jmercouris
trafaret1: Of course, I may not be able to answer it, though someone else will, in IRC the etiquette is generally to just ask your question
16:19:40
trafaret1
jmercouris: I not a programmer but I want to be, is it good choise to starte learning programing from lisp or it's bad idea?
16:20:47
jmercouris
trafaret1: That is a difficult question, it depends, do you wish to make money as a programmer? What are your constraints in life, etc?
16:21:03
jmercouris
trafaret1: You'll have to tell us your motivations for learning programming before we can give a conclusive answer
16:22:07
jmercouris
trafaret1: What beach says is true about the simplicity of the language, the question is, can you afford to learn lisp and then another language for employment
16:22:46
beach
jmercouris: I think every programmer should know Common Lisp, whether they actually need it in their job or not.
16:25:02
trafaret1
I have recently installed emacs and to be honest I fall in love with it, some ppl in interat says that lisp hard to learn but easy to write same things than in for example c/c++, java
16:26:56
jmercouris
trafaret1: It sounds like you've already made up your mind, might as well learn lisp :)
16:27:30
beach
jmercouris: It is definitely not a luxury. It is a necessity in order to be a good programmer. Well, not necessarily Common Lisp, but some Lisp dialect.
16:28:06
beach
jmercouris: Granted, the industry if full of incompetent programmers, but that's not some advice I would like to give, i.e. to remain incompetent.
16:28:27
jmercouris
beach: If you were in some poor country and had to provide for your family asap, you'd learn whatever language pays money, and common lisp rarely pays money
16:29:23
jmercouris
I'm not promoting incompetency myself :D, but I do believe it is a luxry to become competent, imagine just struggling to survive and provide for you and your family, you will do the minimum you can do to get by, because you have so many other problems going on in your life that you have to manage
16:31:47
jasom
jmercouris: also, the only supported subsytem syntax in foo.asd would be something like foo/bar (i.e. the prefix is the name of the .asd file, followed by a slash)
16:32:33
jasom
jmercouris: but yeah, slime won't autocomplete subsystems (finishing up reading backlog now)
16:46:46
eschulte
Xach_: ah, thanks! I made a breaking change to curry-compose-reader-macros and hadn't updated graph... should be fixed now
17:07:12
Xach_
jasom: http://blog.quicklisp.org/2015/01/getting-library-into-quicklisp.html has some ideas
18:21:54
stylewarning
jmercouris: I’m pretty sure that if you can afford to be somewhat competent enough to become an industry programmer, you can fit Lisp in with it.
18:22:38
stylewarning
I am baffled when there’s this implication that folks are able to really only learn a single language or they must somehow make a presumably lifelong choice and dedication to some single language
18:24:29
stylewarning
rme: but I’ll suppose on the outset that you didn’t think “well, I’ve got one language to learn in my life, which should it be?”
18:27:54
dmiles
jmercouris: knowing and doing Prolog and/or Lisp work has always paid way more than C#,Java,Scala and ASP comvined
18:28:15
beach
stylewarning: I'll be happy to review drafts of it, if you think that would be advantageous.
18:28:53
dmiles
jmercouris: mostly due to being able to work in markets that are starved of programmers
18:29:08
beach
I will do what I usually do, namely submit links to drafts here, so that anyone who wants can review the paper(s).
18:29:15
stylewarning
beach: I’d love that. I’m hoping I can publish about some of this quantum simulation business. We will probably be writing our drafts in a few weeks
18:42:46
rme
I've mostly been successful in earning a living with CL, though there are rough spots from time to time.
18:46:53
jmercouris
stylewarning: The point is that you'll learn one language in your life, I myself have learned dozens of languages for different purposes at different times
18:47:05
jmercouris
the point is, that someone learning to program, as an absolute beginner should only learn one language
18:47:19
jmercouris
they don't have infinity time at their disposal, and they will have to make money with that language, so they better be good at it
18:49:18
jmercouris
stylewarning: Absolutely agreed, learning lisp has changed how I think about programming
18:49:37
jmercouris
I wouldn't say I have "learned" lisp, but I've learned some, and already so many of my old opinions have changed
18:50:09
jmercouris
dmiles: These types of jobs can be very highly paid, IFF they can be found, and that you must admit is more difficult than finding a job in Ruby or Python or some .NET technology
18:50:57
jmercouris
dmiles: rme even provides evidence for my claim, an excellent developer claiming there are rough spots
18:55:03
jmercouris
because by that same logic, whenever you are happy, you should be less happy, because no doubt someone is happier
18:55:17
dmiles
jmercouris: oh definatley, there is probably aobut 1 or 2 lisp/prolog job openings per month that I see :P verses 100s per week of everyhitng else.
18:55:26
minion
KZiemian, memo from beach: One item for CLUS. In the description of the functions for setting macro character or dispatch macro character, the only place to figure out the signature of the function seems to be in the example. It wouldn't hurt to state that signature explicitly.
18:58:07
stylewarning
KZiemian: quantum computing but knowledge of that isn’t necessary. See this video sometime https://youtu.be/f9vRcSAneiw the email to email is at the end (:
18:58:11
fiddlerwoaroof
ACTION wishes there were more remote lisp jobs and/or jobs in Ventur County, ca
19:00:13
dmiles
ACTION would only look for a job that is allowing opensource and letting me work on what i work on
19:00:35
fiddlerwoaroof
The company I work for is hiring senior engineers and we have opportunities to use clojure
19:00:38
stylewarning
dmiles that basically goes entirely against what jobs exist for, for the most part
19:01:06
fiddlerwoaroof
But, I haven't yet convinced them to allow CL yet: they would be willing if someone could present a compelling business case
19:01:13
dmiles
stylewarning: oh the incentive is that I'd get two or three people to do the things i dont like doing
19:01:22
fiddlerwoaroof
stylewarning: it sort of depends on the relationship of your company to the technology
19:01:45
fiddlerwoaroof
In places where network effects matter, e.g. advertising and social media, it's fairly risk-free to opensource your technology
19:03:07
fiddlerwoaroof
Most places you want to work will take demonstrated talent over formal CS education
19:04:09
mlius
21:03 < fiddlerwoaroof> Most places you want to work will take demonstrated talent over formal CS education
19:07:04
fiddlerwoaroof
shrdlu68: if you are interested in living in the LA area, PM me your contact info and I can send your resume to our internal recruiter
19:10:12
rme
I'm living in the Seattle area at the moment, but if anyone wants me in a French-speaking country, let me know.
19:17:51
AeroNotix
Probably. In all honesty ASDF has always lurked in the background of any lisp hacking I've ever done. I've rarely had to use its APIs directly and instead used Quicklisp which works on top of it.
19:20:05
AeroNotix
I don't get exactly what you're talking about here but from the sounds of it you've decided to use CCLDoc in another project and therefore also wanted to document CCLDoc in the process?
19:23:37
KZiemian
AeroNotix: I don't know all detailes because I was working on diffs between CLUS and CLHS when they are debating
19:23:58
AeroNotix
I'm reading about CLUS now. This is a new kind of be-all/end-all documentation project?
19:24:18
AeroNotix
http://phoe.tymoon.eu/clus/doku.php?id=clus:todo seemingly with some kind of interactive UI/webpage aspect
19:25:59
AeroNotix
aside from "This is Common Lisp UltraSpec, a community project to create a contemporary and unified documentation file for the whole modern Common Lisp universe."
19:26:42
KZiemian
AeroNotix: phoe, TeMPOraL, bugrum, mfiano and all other folks on Discord clus-general
19:26:52
AeroNotix
KZiemian: a good starting point perhaps could be to add some nicer CSS/formatting to the clhs?
19:28:06
AeroNotix
it's so damn slow and resource hungry to run it in the browser and "natively", though
19:30:20
KZiemian
AeroNotix: if you want know what CLUS is about you must ask phoe, mfiano or some other big folk. Or read this https://blog.teknik.io/phoe/p/375
19:31:25
KZiemian
AeroNotix: I just quit my embrioning state as CL user and most things about documentation are beyond me
19:32:38
KZiemian
AeroNotix: project menager of CLUS is my bud from kraklisp, which is lisp community now in coma of people living in Cracow, Poland
19:33:47
KZiemian
AeroNotix: and he start looking for help about weeks or so when I uderstand that I never left lisp embrionig state if I not find good project to work
19:34:44
KZiemian
AeroNotix: 2 + 2 = 4 so I ask him that can I join and get deeper knowledge about CL working on CLUS
19:35:36
KZiemian
AeroNotix: so I get in and being in strange position of one of top contributors and at the same worst lispers of all members
19:35:54
oleo
i have edited a definition of a library function from within my init file,but when i load it it does not take effect even tho it shows it as being redefined
19:37:22
AeroNotix
just contribute as you can and see where it goes. Not everything has to be perfect.
19:37:42
AeroNotix
oleo: yeah but what? Who is calling that? What is the --load file? Can you share code?
19:37:58
KZiemian
AeroNotix: yes, Lisp is strange, as my life achivments. This is way I start my journey with this language
19:39:06
KZiemian
AeroNotix: I hope you understand why I can't answer you question why CLUS? But phoe is near so you can ask him if some question left.
19:42:34
oleo
i only see an effect when i edit the source file in place but not when i try to override it from my init file
19:43:42
oleo
but it does not work neither way, the only solution seems to be to edit the source file, then i see an effect otherwise not
19:44:38
KZiemian
AeroNotix: and because I the lowest in CL ranks among them I said: ok, I go to CCLDoc
19:46:04
mfiano
KZiemian: In case you are wondering, you are actually the only one doing work on CLUS. phoe took time off some months ago because life is getting in the way, and I was never part of the project really, just offered suggestions to get it rolling, but it stopped rolling again months ago.
19:46:51
AeroNotix
Hence why I mentioned to stop worrying and just contribute where you can. Stop caring about "CL ranks" whatever that means. :)
19:49:36
KZiemian
mfiano: the only things that is pain in the back for me is that, when I talk about it
19:50:42
KZiemian
mfiano: one ask question: So what is a state, where you are going, why you do it that way? And only answer I can get is: ask phoe or some other folk
19:51:30
KZiemian
mfiano: I always feel bad in all are of my life, when I can't answer directly such basic question
19:52:04
mfiano
There are no answers because there is no support of the project from anyone other than yourself. This may be a sign
19:52:33
KZiemian
AeroNotix: job = it is my duty, but my check is not in dollars but in Lisp knowldge and good words from community
19:53:37
pjb
KZiemian: either you don't do anything and you're a lurker, or you do something and you're a hero.
19:54:28
KZiemian
mfiano: not quite true, there is a reson for using CCLDoc and not cearing about CSS, but I don't know either
19:55:19
rme
KZiemian: Try starting out with something simple: write some documentation in ccldoc format.
19:59:13
pjb
The thing is that receiving a private message should open a new window to dialog with the correspondant, and depending on the IRC client, this can be more or less conspicuous.
19:59:18
KZiemian
AeroNotix: GoogleChrome, I don't have enough energy to learn something more sophisticated
20:01:08
fiddlerwoaroof
Because they need fancy IDE support to be even slightly bearable... and no one I work with wants to learn emacs :)
20:02:00
pjb
fiddlerwoaroof: I say, more code generation! Write emacs lisp to generate parts of your programs; this is the killing feature of emacs.
20:02:34
fiddlerwoaroof
Yeah, I've been really tempted to use ABCL to write some boilerplate-generators
20:03:43
pjb
KZiemian: about asdf, just take a simple project asd file, copy it, and modify it for your needs.
20:04:50
fiddlerwoaroof
e.g.: https://github.com/fiddlerwoaroof/dotfiles/blob/9abf345f72f6754bcc84ac807802ec0126d84895/emacs.d/lisp/lisp-skeletons.el#L108
20:05:21
KZiemian
pbj: open project number 734: learn more elisp to the point you can configure Emacs as you need
20:06:17
KZiemian
If you want know what I more or less know about Lisp and Common Lisp in particular
20:06:26
fiddlerwoaroof
If you want to make an add-on to ccldoc, you probably just want to make a new system that depends on ccldoc
20:06:54
fiddlerwoaroof
And then have whatever processes the documentation depend on both ccldoc and your new system
20:07:20
fiddlerwoaroof
Of course, if ccldoc isn't designed to be extensible, this might not be feasible
20:09:10
jasom
Xach_: clinenoise (my port of linenoise from C to lisp). I just had a bug filed against it so apparently someone other than I has already found it useful
20:09:53
jasom
Xach_: I'm doing things like docstrings and actually exporting symbols right now before I file the PR
20:10:58
KZiemian
fiddlerwoaroof: main point is that, when we both end we marge our threads and make add-ons to CCLDoc
20:12:26
fiddlerwoaroof
Xach_: looks like a readline alternative: https://github.com/antirez/linenoise
20:13:32
KZiemian
I'm sorry, from CLUS project I understand my thread and some of main idea what happens in other areas
20:15:19
jasom
It sits somewhere between cl:read-line and the GNU readline library in terms of features and complexity
20:16:28
jasom
I wrote it to use as the input for my toy shell, as I was dissatisfied with the existing options in various ways
20:26:42
rpg
In SLIME is there anything I can do to resync buffer position, so that warnings, etc. show up in the right place? I find that they drift from their proper position over time.
20:32:09
rpg
jmercouris: It's not the REPL screen position, it's where SLIME "thinks" the defuns are in a lisp file, versus where they actually are.
20:32:40
rpg
If I do slime-compile-defun (I think that's the name) a few times, SLIME loses track of where to place the underlines for the warnings.
21:07:18
Xach_
rpg: I hate to offer a guess, but it's the best I can do right now - maybe try recompiling the whole file? C-c C-k usually.
21:07:47
rpg
Xach_: That's probably right, but if I do that, I think I end up with a fasl pooped out into the source directory, instead of the cache :-/
21:09:21
rpg
I should probably just rerun the ASDF build when I need it. But the conclusion might be that -- despite the fact that it probably was a pretty challenging hack -- putting the warnings on the code, instead of in the minibuffer is a waste of time, at least when you're compiling interactively.
21:27:32
pfdietz
jasom: while catching up on iRC archives, I noticed you asked about lisp compiler fuzzing.
21:28:49
pfdietz
I sent a flurry of bug reports (mostly fixed now) to sbcl recently that were generated by various kinds of that.
21:34:08
jasom
pfdietz: One of the great wins when I last fuzzed a compiler was how many bugs in a short time could be uncovered, which allowed for finding patterns with just short-term data. e.g. one class of optimizations was found to be a large source of bugs, so those were removed or rewritten in a different style. Perhaps 10 years of organic bug reports could have been aggregated to find such a pattern, but having 30
21:34:10
jasom
or so bugs in a few months made it obvious just by "wait, didn't I just fix a bug like this"
21:36:49
pfdietz
I think it's important to keep fuzzing, because development introduces new bugs, but also exposes old bugs. Still finding bugs that go back to CMUCL.
22:34:30
jasom
makomo: https://github.com/jasom/cl-fccs/blob/e01f45a00577c22200ffdf8113efc421d3f00e10/src/util.lisp#L25
22:36:01
jasom
makomo: also note that I use vectors for json lists as well, so nil is unambigously false.
22:39:37
jasom
actually null would also decode to nil, but my data shouldn't have nulls in it for this case.
22:41:36
jasom
makomo: https://sites.google.com/site/sabraonthehill/home/json-libraries#TOC-Quick-JSON-syntax-refresher cl-json decodes 4! JSON types to something that could be nil by default :(
22:43:29
jasom
com.gigamonkeys.json is the only one on the list with a JSON->lisp->JSON that can survive a round-trip by default.
22:44:44
makomo
hm yeah, i only thought about the false/null case, but object/arrays could ofc be empty
22:46:15
jasom
the number of times that I've needed to distinguish betwenn "false" and "null" in javascript code is approximately zero, so that one is the most forgivable.
22:49:30
jasom
hmm, I was bad and didn't use safe-json-intern for making the keyword there though...
23:16:22
stylewarning
So you could product efficient parsers into whatever data structure you prefer
23:28:25
makomo
yeah, that's what i thought. thought there might be some neat way using and/or or something, but they both return either nil or the last value/the first non-nil value
23:35:37
aeth
If you're going to be unclear and use (and x t), you could still use if's implicit nil else and just say (if x t)
23:36:54
aeth
All three should have identical disassemblies with a sufficiently smart compiler. Works in SBCL.
23:38:01
makomo
i agree it's not very clear so i probably won't use it. i was wondering whether a clever trick like that is idiomatic or not.
23:40:49
aeth
Still identical disassembly in SBCL. In fact, all four functions (I called them foo, bar, foobar, and barfoo) have 100% identical disassemblies in SBCL.
23:43:33
aeth
for the lazy: (if x t nil) (and x t) (if x t) (when x t) (not (not x)) (not (null x)) (not (eq x nil))
23:44:28
_death
(let ((m (make-hash-table))) (setf (gethash nil m) nil) (defun bool (x) (values (gethash x m t))))
23:45:15
aeth
That's going to fool SBCL because you're using a mutable data structure and it's not that sophisticated... I think. Let's see
23:47:06
Fare
sjl: ASDF needs a new maintainer... but I don't know anyone paying for ASDF maintenance at the moment.
23:48:09
_death
aeth: (defun bool (x) (case x ((nil) nil) (t t))) seems to give slightly worse results
23:50:04
aeth
_death: I get identical results, as in 100% identical except "disassembly for BOOL" instead of "disassembly for FOO" and a different origin
23:55:56
jasom
(disassemble (lambda (x) (declare (optimize (speed 3)))(when x t))) is what you want, I think
23:57:00
mfiano
aeth, no regression: https://gist.github.com/mfiano/20b05bed9fe971de14085b89e13a9de6
23:58:46
aeth
definitely shorter. CMP MOV CMOVEQ MOV MOV CLC POP RET BREAK and 26 bytes with the disassemble lambda version
23:59:34
jasom
26 bytes for (disassemble (lambda (x) (declare (optimize (speed 3)))(if x t nil))) here
0:00:13
_death
35 bytes.. oh, I forgot that I also have (declaim (optimize (debug 3) (safety 3))) in .sbclrc
0:02:31
_death
it doesn't matter much anyway, since you'd likely also want to declaim that function inline
0:03:00
jasom
_death: I think we were using the disassembly of the lambda for a proxy of the inline code that would be generated
0:04:05
_death
jasom: I'm thinking about some peephole optimizer or something mutilating it into something better
0:06:22
aeth
one way to benchmark more directly would be to compare two functions, one that calls an inline version and one that calls a notinline version
0:36:11
_death
aeth: https://gist.github.com/death/665262a6585d68356095adc28c094f26#gistcomment-2305664 silly code for comparing functions :)
0:43:53
jasom
oh, if anybody has tips for getting SBCL to generate CMOV rather than CMP/JNE, let me know. I have a portable utf-8 decoder that is slower than SBCL's built-in only because of that difference.
0:56:49
jmercouris
well, you see the message, I'm getting really close to completing the GTK port, looking at your code has been very enlightening
0:57:59
jmercouris
AeroNotix: No, I just don't have a lot of energy in general, I sleep like 10 hours a day or so
0:58:22
AeroNotix
Just not a fan of GTK in all honesty. I think it's because of the heavy old style C naming conventions and (IMHO) crappy docs that continually put me off it
0:59:02
jmercouris
can one easily add and remove views from GTK without redrawing the whole display?
0:59:27
jmercouris
but I don't want to have to add all buffers beforehand to the view, it should be possible to add and rmove them right?
1:00:01
jmercouris
I was worried that GTK was going to be a huge pain, and it is because I'm developing in a VM, but programmatically speaking it is quite okay
1:00:06
AeroNotix
You can dynamically add new webkit views to anything really. I think there's a way to hide them from being drawn as well, but it's all long old memory
1:00:23
jmercouris
AeroNotix: Yeah, they can be hidden automagically, they must be told to be rendered
1:00:47
jmercouris
I guess it is not such a big deal if I have to add new webviews to some magic container, I'm just worried about removing them later
1:01:10
AeroNotix
Yes, I had issues with garbage collection and doing dynamic allocation of webkit views
1:01:50
jmercouris
like "prepare-to-close" where it collects system resources, and then some call to dealloc or whatever
1:01:54
AeroNotix
I don't recall now but I seem to remember coming across a more automatically generated set of bindings for webkit-2
1:02:09
jmercouris
yeah, joachim was talking about some generation tools for making the bindings actually
1:02:29
jmercouris
there was an issue opened, and when I emailed him, he mentioned it again, so it is probably a good path
1:03:01
jmercouris
yeah, he is quite busy, but if he can just give me some guidance, I might be able to pick it up
1:04:08
jmercouris
the implementation of the GTK stuff is opaque to nEXT via an API, so it can be improved REALLY easily
1:07:44
jmercouris
_death: didn't know it was a full help prompt and everything, useful to know as well, thank you
1:11:48
earl-ducaine
Hi Lisponians! I'm remembering that it's a bad idea to use defun in a non-toplevel form. But I'm not remember why or what I should use instead. Anyone have anything thoughts? CLHS doesn't seem to have anything to say about it directly.
1:12:36
pjb
earl-ducaine: you can use it, but if it's not in toplevel, then the compiler cannot notice that you defined a function. This is the main drawback.
1:13:04
Bike
but yeah, earl-ducaine, e.g. later code might not be aware that there was a function defined earlier so you get an undefined function warning, kind of thing.
1:13:06
pjb
(declaim (function foo)) (let ((x 0)) (defun foo () (incf x))) (defun g () (list (foo) (foo) (foo)))
1:13:51
Bike
because you don't always need or want functions to be globally accessible through names
1:14:32
jmercouris
I feel like it should be part of the defun spec that you can declare anonymous functions
1:16:55
Bike
Yes, the minimum functionality of defun is basically (defun foo (x) x) => (setf (fdefinition 'foo) (lambda (x) x))
1:17:05
earl-ducaine
Bike: it's a poor mans objects system, i.e. create the binding at run-time based on whether you're running in a Uinx env (CLX) or in an Mac env.
1:17:17
pjb
jmercouris: actually (defmacro defun (name lambda-list &body declarations-and-body) `(progn (setf (fdefinition ',name) (lambda ,lambda-list (block ,name ,@declarations-and-body))) (declaim (function ,name)) ',name))
1:18:44
jmercouris
I always envisioned defun as a special form for declaring a function, but now I see that it is for associating a lambda with a name
1:19:44
aeth
It's more obvious in Scheme, where (define (foo x) x) is just syntactic sugar over (define foo (lambda (x) x))
1:30:34
Bike
and while lambda isn't a special operator, the symbol LAMBDA has a special meaning to the FUNCTION special operator in a way that can be conceptualized as a kind of special operator.
1:31:41
dmiles
backquote would not have entered my mind had quote not been an been a special operator
1:42:13
jasom
man read-byte is poorly optimized on sbcl; slurping a stream with read-byte is slower than slurping a utf-8 stream with read-char...
1:46:10
earl-ducaine
It's been up for a while. (last April) But in case you haven't seen it, the old GigaMos k-machine emulator along with all the associated LMI branch Lisp Machine code has been posted on bitsavers
1:47:32
jasom
If anybody hasn't been able to figure out how to do X with clack, PRs and Feature requests for my tutorial are accepted here: https://github.com/jasom/clack-tutorial/blob/src/pages/getting-started-with-clack.org
1:47:53
jasom
(pretty version here: https://jasom.github.io/clack-tutorial/pages/getting-started-with-clack/)
1:50:51
jasom
There is zero good reason that I can think of for it to be a class, since there is an infinite variation in which keys might be present in it...
1:54:01
jasom
but yes a list of values with no structure is stupid, particularly since defstruct lets you define a tagged list of values...
1:57:41
jasom
where there is one value that you will almost always want, but a second value that you only sometimes want. Plus it avoids consing on most implementations
1:58:11
aeth
values is a nice way to write pure functions where you would otherwise use a very short list or vector that conses to do the same thing, evne if you need the 2nd, 3rd, etc., values.
1:58:55
aeth
Using it a lot will probably add an overhead of maybe one instruction, but it gives you pure functions for "free"
1:59:35
jasom
did they ever figure out a way to implement it efficiently in wasm? There was a tempest in a teapot about that a few years back...
1:59:49
aeth
(It's not really free, but afaik you pay the cost for efficient multiple return values whether you use them or not. But you do need to implement support for them at the compiler level.)
2:00:32
aeth
There are lots of cool things you can do in languages that C++ can't do... good luck getting those efficiently implemented in wasm.
2:03:20
mfiano
Can anyone tell me why uiop:safe-read-file-form coerces floats to doubles (d0 suffix), as compared to uiop:read-file-form which does not?
2:06:55
mfiano
Looks like it's binding *read-default-float-format* 'double-float, but why is it 'unsafe' not to?
2:11:56
mfiano
I just tracked down a bug that stems from this function coercing all my floats to doubles. Looks like I'll have to just safely read on my own. I just don't understand how not coercing is unsafe
2:13:37
aeth
if *read-default-float-format* is 'double-float, you can still get single-float from 1.0f0, 2.0f0, etc.
2:14:30
aeth
I never assume *read-default-float-format* because that has bitten me before, in source code!
2:14:44
Bike
there is no "verbatim". 1.0 can mean any one depending on how it's read. single-float is just the default binding.
2:15:01
Bike
perhaps you could petition fare or whoever mantains uiop to let you provide the float format yourself, though.
2:16:01
aeth
It's always single-float initially. http://www.lispworks.com/documentation/HyperSpec/Body/v_rd_def.htm
2:18:18
mfiano
Thanks. I guess it makes sense to change my machine-generated dsl data format over using my own reader function.
2:19:42
aeth
If I had to read numbers as single-float without the "f0" suffix, I'd probably do what they do in the example to make sure it's single-float and then read it, i.e. (let ((*read-default-float-format* 'single-float)) ...)
2:21:03
mfiano
It makes total sense to change the file data instead, since these files may be used by other developers too.
2:21:14
aeth
e.g. I turn off *read-eval* but I make it configurable just in case someone is using that feature for some reason.
2:21:54
mfiano
ie; unless i write a user api for parsing these files, rather than just provide them for users to do whatever, i should encode the data in an unambiguous method
2:26:31
Fare
Bike, discussed changing the *read-default-float-format* in 2014 or so, and the overwhelming reaction was that ASDF should stick to the standard.
2:27:29
mfiano
The question is, what would be the best way to write out 1.0f0 to a file, such that it is not read and then written as 1.0 ?
2:27:46
Fare
rpg, after it gets merged (or rejected), the document should be updated to reflect the current situation and current plans.
2:28:21
Fare
mfiano, bind *read-default-float-format* yourself inside a with-{safe,standard}-io-syntax
2:32:47
aeth
I tend to just write my own custom writer, though. It's hard to get the output just the way I want it.
2:33:37
aeth
Fare: If short-float is single-float, then it'll write as 1.0, not 1.0f0. It's probably safe to assume a separate single-float and double-float. Conforming implementations that don't do this will probably be broken by some dependency before they get to the unique code.
2:34:20
aeth
It's very easy for some niche Lisp to be broken by a dependency or a dependency's dependency.
2:36:15
aeth
As far as read and write not being portable... ime read tends to work more or less as I want it, but write is trickier because of where it decides to newline long s-expressions.
2:40:44
aeth
Often when I write a custom reader, I'll try to rely on the built-in read where I can get away with using it.