freenode/#lisp - IRC Chatlog
Search
9:15:37
beach
In CST, it doesn't preserve comments, but it has hooks for doing that, and I do it in Second Climacs, though Second Climacs is still not using Eclector. I am gathering up the courage go switch.
9:21:46
beach
Such a tool would be great also for the purpose of education. People could submit their code to it and have it comment on the indentation and spacing style.
9:22:07
beach
I guess I should try to isolate that code in Second Climacs so that it could be used also as a separate tool.
9:23:15
MichaelRaskin
Can I just instantiate something like SC buffer and apply the reformatting command?
9:25:00
LdBeth
MichaelRaskin: if you specify corespondent print method for reader macros, it would work
9:25:30
MichaelRaskin
LdBeth: what I would feed the pretty printer so that the comments are even in the data?
9:28:56
LdBeth
I have some primitive ideas, first hack the reader to treat comments as docstrings attached to cons cells
9:45:57
beach
LdBeth: In Second Climacs, I preserve comments and other material for which a reader macro return no values. Eclector can do that as well and I will replace the modified reader in Second Climacs with Eclector soon. You can't arbitrarily insert comments into code, because you would then violate the syntax of many special forms.
9:46:57
beach
If the comment turns into a CONS cell, then it will be parsed as if it were the list of bindings.
9:50:41
beach
flip214: You can omit the nursery collection, but you must do something essentially equivalent, because you need to inform the global collector what objects are live. Otherwise, you have to assume that all object in the global heap that were live after the previous collection are still live, and that would kind of defeat the purpose of garbage collection in the first place.
9:53:18
fm4d
Hi, I am slightly confounded by this behaviour: (funcall #'defparameter (read-from-string "test") 123)
10:00:56
pjb
but instead, you should use a function to define a global dynamic variable at run time.
10:01:15
pjb
I mean, why do you want to define global dynamic variables at run time? This makes no sense, since your program,being already compiled, cannot make use of it!
10:01:54
pjb
Yes, what jackdaniel does would work at compilation-time, so it'd be ok. A better way to do it would be to write a macro expanding to that defparameter form.
10:02:54
pjb
I mean, just store the configuration in some object (structure or CLOS instance) and bind it to a variable known to your program, such as (defvar *configuration* (make-default-configuration))
10:04:14
pjb
fm4d: and think about it: it's much better to keep the configuration in objects, since then you can pass it around as a single reference, instead of having a ton of global variables. It allows you to run easily with different configurations, either at the same time in different threads, or sequentially.
10:05:42
fm4d
Sure, to be honest I just wanted to practice some operations with filesystem etc. and this seemed like a reasonable thing to do.
10:06:24
LdBeth
beach: Simply treat #|form|# as normal atom, which is what the text editor normally do. This reader would not be used for eval
10:06:41
pjb
You only have to document a "configuration language" for the user to use in his lisp configuration source.
10:07:05
pjb
fm4d: (let ((*package* (load-time-value (find-package "CONFIGURATION-LANGUAGE")))) (load "configuration.lisp"))
10:07:39
pjb
This let the user use CL and algorithms to define his configurations. It can be handy for sophisticated users. Like emacs users with ~/.emacs
10:10:29
pjb
fm4d: (defun load-configuration () (let ((*package* (load-time-value (find-package "CONFIGURATION-LANGUAGE")))) (load "configuration.lisp"))) you don't do the load while compiling, this has nothing to do with asdf. This is loading the user's configuration file.
10:11:03
pjb
Actually you would look it up in (user-homedir-pathname) or one of the XDG config directories.
10:13:31
fm4d
Well, I've though that I would make the config loading a part of asdf so asdf:load-system also loads the configurations
10:15:10
fm4d
So what I really want is to do (asdf:load-system ...) (in-package ...) and be ready to go
10:18:35
fm4d
I have to return to the books, I didn't really get into the compilation aspect of common lisp yet
10:20:22
fm4d
Yes, but I have always considered only the runtime aspect I guess, books like SICP or Little Schemer don't delve into implementation details
10:22:58
fm4d
And my workflow with asdf during development is ok, at least? Using asdf:load-system to correctly load dependencies and all files into one package and then in-package?
10:24:10
pjb
If you will. But nowdays, I just use ql:quickload to load everything. So if it happens that a dependency is not installed, quicklisp will download and install it automatically.
10:26:02
MichaelRaskin
beach: by the way, is there a good way to add an entry for the readtable in a way that uses «default read behaviour» for some parts, and would use Eclector if called by Eclector?
10:26:17
fm4d
I mean, I have the defpackage in package.lisp which is loaded first by asdf in serial manner.
10:27:23
pjb
I avoid :serial in asdf, so that only a minimum set of file need to be recompiled and reloaded when I edit one.
10:29:24
MichaelRaskin
But if I use read, Eclector will not save position information for the form I read
10:38:16
MichaelRaskin
When I call read with another readtable, can I easily call eclector if I was called by eclector
10:45:40
MichaelRaskin
And my question was not how to cal eclector, but how to call it only when already called by eclector
10:46:19
MichaelRaskin
pjb: I don't even need to import it, I can funcall the (find-symbol …) if I really want to, I know
10:46:26
pjb
Well, you have to define all the reader macros with the eclector package instead of the cl package, I assume.
10:47:49
pjb
fm4d: however, the implementation techniques taught in LiSP can of course be used in CL. It's just a little more comple in CL, (the CL environments are more complex).
10:48:34
pjb
And you can read the sources of SICL or some other CL implementation while reading LiSP, to see how it's done for CL.
10:50:17
fm4d
Hm. Its quite hard to find a line between actually getting hands-on experience with CL without complete knowledge and just reading books like LiSP, PAIP, Let over Lambda without much experience in CL.
10:53:50
fm4d
Its not that they are too hard (they are hard, but in the way that you simply have to put a lot fo time and concentration into them), but about finding a good line between reading books without actually writing much code (memory fades fast for things you dont put into action) and writing code without having all the knowledge from the books.
10:53:55
random-nick
I think he meant to say that it is hard to know how much of CL you need to know in order to use it
10:54:54
beach
fm4d: I think it is with Common Lisp as with everything else. You start off by doing simple things, and over time, you learn more conventions, more tricks, etc.
10:57:58
fm4d
Yeah, but it really feels like this is much more prominent in CL (comparing with the standard languages used in the industry)
10:58:43
fm4d
Thanks to both scarcity of resources and the.. the way CL is alien to everything else and many features and tools are more elaborate and complicated.
10:59:10
fm4d
Not that I consider it 'wrong', not at all, it just makes things little harder to get into.
11:04:00
fm4d
Maybe its about the order of exposure. I was exposed to C++ when I was about.. 13 or so and then all the stuff like Java, Python, C# etc.
11:04:05
pjb
fm4d: in general, learning programming requires writing and reading a lot of programs. You have to do both: read books, write programs, read programs and loop!
11:04:41
fm4d
And then you come across something totally alien like lisp and not only the language is alien but everything else.
11:05:36
makomo
i know that C++ is an ugly and warty language, but learning it has a lot of benefits
11:05:45
pjb
fm4d: and console yourself, that's nothing compared to the 4,500+ classes and 350,000+ methods of Android, and similar in iOS or any other framework.
11:07:43
beach
fm4d: I agree with pjb. You need to read code, write code, read books, expose your code to others, follow advice, and the loop.
11:08:15
pjb
Nowadays, it's easy to read programs, there are a lot of them available on github, etc.
11:08:21
fm4d
pjb I cant really comment on android, but for example Python, which I spent some years working in professionally, is really large, sometimes not intuitive, complicated etc., but the difference is that you can have literally 80 IQ and still find all your answers online.
11:08:54
pjb
you will also find answers for CL. news:comp.lang.lisp irc://irc.freenode.org/#lisp http://cliki.net etc.
11:09:00
fm4d
Its like.. you don't rely on your own understanding but on the feeling that 'it is somewhere on the net'
11:09:46
fm4d
Thats a funny thing about lisp. You can literally put all the good books on one shelf.
11:11:23
MichaelRaskin
I mean, learning Lisp in 21 days as well as the outcome of C++ in 21 days is completely feasible
11:12:08
minion
fm4d: direct your attention towards AMOP: AMOP: The Art of the Metaobject Protocol, an essential book for understanding the implementation of CLOS and advanced OO. See <http://metamodular.com/CLOS-MOP>
11:14:31
beach
fm4d: You might want to put off reading it until you have some significant experience with using CLOS for ordinary applications.
11:16:02
fm4d
beach: I've decided to just wing it without CLOS, with alists mostly. Its.. maybe dumb but it works for my small projects.
11:16:17
makomo
everything you've ever wanted to know about date, time, timezones, calendars, etc. etc.
11:16:54
beach
fm4d: I see. Using a standard class from time to time is not hard though. The hard part is designing a reasonable protocol using generic functions.
11:18:24
fm4d
I absolutely believe you and I am looking forward to it, I am just trying to mix up theory with practice and exposure to deeply entrench the knowledge.
11:19:07
makomo
well i guess so, but you can always spend some time reading and then go on to programming
11:20:17
fm4d
Yeah, but if you don't follow with practice and instead you spend next 6 times with other stuff, you realize that you don't really remember much.
11:20:19
makomo
i guess the key is actually following up with a programming phase because unless you do, you'll probably forget what you've read
11:21:28
fm4d
BTW I am really looking forward to AOMP, that books has a really strange vibe around it, like some ancient grimoire full of knowledge from different times.
11:26:17
jmercouris
LdBeth: I think your claim is unsubstantiated, if you don't know something for certain, its best to stay mum lest you spread misinformation
11:27:16
fm4d
jmercouris I am also curious about that. To me lists feels a lot like dictionaries in Python. You simply use them for nearly everything thats not complicated enough to use OOP.
11:27:26
LdBeth
jmercouris: I think at the beginning of J for C Programmer there’s a good example, C people implement a poor file scanner by hand, while in J a more efficient build in parallelized form can be used
11:30:47
jmercouris
LdBeth: I suspect there may be truth to what you say, but without evidence, it is not worth saying, or it should be phrased in a way that indicates its uncertainty
11:30:57
RemoteFox
right now I do mostly python (job, my own projects), but I am trying to build a self interpreter
11:31:24
fm4d
jmercouris Yes, you can always turn struct/dict/etc into class later, if you need to bind data with behaviour or to inherit it etc.
11:31:44
pjb
jmercouris: using anything only stunts your growth as a programmer (or anything). When you have a hammer, everything looks like nails!
11:31:58
fm4d
I've always believed that from simple to complicated is a proper pattern of development (at least for rapid prototyping and bottom-up approach)
11:32:44
fm4d
RemoteFox you should mention that 'self' is a language, 'building self interpreter' can be understood in a weird manner.
11:33:21
pjb
fm4d: yeah but actually all way are good ways: bottom-up, top-down, inside-out, outside-in. What matters, is iterative and interactive programming.
11:34:24
pjb
fm4d: mostly, programming is a discovery process, so you can progress in any direction you like or can, starting from known, and discovering the unknown. Otherwise you just use libraries.
11:34:33
fm4d
pjb: That remind me of how wonderful is SLIME, the interactive and reflective capabilities.
11:35:23
pjb
jmercouris: not necessarily. You can have an overview of each tool before going deeper and deeper in each. Since some tools must be used in combination, it's better to do it this way.
11:37:41
jmercouris
pjb: I'm not sure what is better or worse, I've done both and it is hard to tell
11:37:54
jmercouris
for Lisp I started with a very shallow view of everything, and I forgot so many things
11:38:06
jmercouris
it is only now that I am going through a textbook to actually learn the language
11:38:28
jmercouris
if I had done this from the beginning I would be "using a hammer" for everything in the start, but I feel like it would be better
11:38:43
Lauven
For those of you who have read "Structure and interpretation of computer programs" would you recomend it to someone with just couple of years of javascript experience or should I wait until I get a grasp of scheme and lisp before I dive into it and get more experience in general?
11:40:06
jackdaniel
Lauven: SICP is a great book and it is fine to read it without prior scheme / lisp experience
14:31:28
ted_wroclaw
Hi guys. Has anyone tried to build cltl2 from the latex source? I checked github and didn't find anything...
14:52:38
ted_wroclaw
I want to resize it so that it looks a little better when printed on A4 (or us letter) paper
15:04:47
beach
It looks like it is written in an old version of LaTeX and the compatibility mode can not fix it.
15:11:24
beach
ted_wroclaw: No, I was just using pslatex because there seem to be PostScript file for the pictures.
15:14:20
ted_wroclaw
Okay. I got the same error. I'm not a latex guru, but I'll see if I can find something on repairing it. I've always regretted not becoming more proficient with latex.
15:23:03
ted_wroclaw
Me neither. I usually just hack around until I get whatever I'm working on to look nice and leave it at that. Then I forget how I did it. My template document header is an enormous collection of commented out packages. Shameful, really.
18:11:41
skidd0
one of these flags allows the creation of an object by prompting for a name and other info
18:13:08
jackdaniel
normally in the terminal lines are buffered, so you need to end your prompt with a new line (this may be changed, but I don't remember the specifities - it is a terminal emulator setting)
18:17:31
skidd0
has anyone done any work with object persistence? like cl-prevalance, where the objects are serialized and use transactions for updates. Or, another question, what's a common method for saving objects to disk?
18:18:40
skidd0
see, i feel like taking my objects and converting them to sql models is unneccessary
18:21:06
phoe
You should be able to use some kind of simple object store. BKNR.DATASTORE should be a good tool for the job.
19:25:17
flip214
is there some special like *print-base* that says how many digits a float number should be printed with?
19:41:53
flip214
pjb: no, in this case I only care about the first two digits (and the exponent, if not 0)
19:58:41
flip214
pjb: sorry, I'm doing electronic engineering right now... you know, using +-20% capacitors and so on....
20:11:02
pjb
flip214: perhaps it's possible to do something with the pretty printer. Otherwise, wrap your floats in a clos object, and define a print-object method for them.
20:11:36
Bike
right want to do that anyway, so you can have components with the same nominal value but different tolerqances
20:21:50
pjb
flip214: (set-pprint-dispatch (quote float) (lambda (stream value) (format stream "~,2F" value))); seems to work, for: (let ((*print-pretty* t)) (print (list pi 0.12000001d0 0.12999999d0)))
20:28:33
didi
We should decide if we want to deprecate structs or not. /me votes for no, but he is not very bright
20:34:19
buffergn0me
Structs are really useful apart from generic functions and objects. For example with the :type options to generate accessors for lists/vectors returned by various things
20:37:18
Bike
if you give defstruct :type, it mostly just defines a bunch of functions to do (aref x 0) or whatever.
20:37:27
buffergn0me
Yup. See the :type option 2/3rds of the way down the page http://www.lispworks.com/documentation/lw70/CLHS/Body/m_defstr.htm