freenode/#lisp - IRC Chatlog
Search
9:05:07
loke
Oh here you are... Being all logcal and reasonable again. How are the rest of us going to be able to look smart? :-)
9:08:40
beach
dmiles: More to the point, if you assign to that slot in one class, it would not change in the other.
9:14:04
dmiles
well you mean in the case the subclasses allocation (on its prototype) is differnt than the superclasses's allocation?
9:14:45
beach
No, when they are the same. There will be one prototype for each class, so there would be two places to store the shared slot.
11:36:28
veckon
Do you know if there are any manuals for the 3D design/rendering software the Symbolics Graphics Divison created?
11:54:27
Cymew
Probably. Were they included in the Genera distriubution? If not, you probably need to get them from the same source as the software.
11:54:52
veckon
I don't think they were included in the Genera distribution, actually, but I am not sure
12:09:17
dmiles
ty for suggerstions .. i am making it all the way thru https://github.com/TeamSPoon/wam_common_lisp/blob/master/t/sanity-test-1.lisp#L158
12:44:25
phoe
I have a string like ":FOO :BAR :BAZ :QUUX". Is there a function that will read it as a list?
12:44:54
phoe
Like, I want something better than to define my own function that does (READ-FROM-STRING (CONCATENATE 'STRING "(" STRING ")")).
12:53:14
pfdietz
Can also use the second return value of READ-FROM-STRING, which is the position of the first character not read. Also, the :START keyword parameter of READ-FROM-STRING.
12:55:11
pfdietz
You would need to read from S, with eof-error-p false, and a distinct eof-value you'd check for to terminate the loop.
12:56:17
phoe
13:44 < phoe> Like, I want something better than to define my own function that does (READ-FROM-STRING (CONCATENATE 'STRING "(" STRING ")")).
12:58:31
Zhivago
(with-input-from-string (s ":foo :bar") (loop for x = (read s nil) until (null x) collect x)) ; like this, surely?
12:59:44
pfdietz
(read (apply #'make-concatenated-stream (mapcar #'make-string-input-stream (list "(" string ")"))))
13:03:09
Zhivago
(with-input-from-string (s ":foo :bar") (loop for x = (read s nil s) until (eql x s) collect x))
13:04:27
oleo
* (with-input-from-string (s ":FOO :BAR :BAZ :QUUX") (loop repeat 4 collect (read s)))
13:09:46
antoszka
how about just catching the END-OF-FILE condition and not specifying the number of repetitions?
13:09:54
oleo
you can use two loops one for counting how many reads it does that will determine the length of the string
13:11:36
Zhivago
antoszka: That is what (with-input-from-string (s ":foo :bar") (loop for x = (read s nil s) until (eql x s) collect x)) does.
13:31:28
oleo
(with-input-from-string (s ":FOO :BAR :BAZ :QUUX") (loop as x = (read s nil s) while (not (eql x s)) collect x))
14:12:50
phoe
I have been committing a lot of sins related to comparing symbol names of symbols from different packages.
14:21:20
dmiles
matching "(member 1 '(1 2 3) :test #'=)" to (defun member (item list &key test test-not key) .. )
14:25:30
phoe
Then you will want to match only *the* symbol :TEST and not any other symbol like FOO:TEST.
14:26:23
dmiles
whnen i am returning the error message i would like to let the user know that they should have used a keyword
14:28:34
phoe
2) when the user uses 'TEST which is not a keyword but is STRING= to a valid keyword - you want to inform the user that there is a keyword available that perhaps should have been used.
14:29:00
phoe
3) when the user uses a thing like 'KJAFKJHF that is not EQ or STRING= to anything - you just want to err out.
14:35:47
pjb
(defun foo (&key test ((test #:bad-test) nil bad-test-p)) (when bad-test-p (error "You should have used :test not 'test")))
14:37:01
pjb
But the question is why you want to test those cases? a bad keyword is a bad keyword, the lisp system already reports them.
14:38:01
dmiles
i understand it is wrong heads to ever compare symbols by name.. that anyone doing that is obviously doing something wrong
14:38:26
pjb
dmiles: the implicit point here being that 'test might be exactly what the keyword should be, if the user programmed it so!
14:38:51
pjb
dmiles: there's only one place where you need to compare symbols by name, it's with LOOP keywords.
14:39:09
dmiles
pjb: yes indeed that is what is happening in 44mb of work code.. we dont have to actually use keyword names in cyc.. we have to use the right key from the right package is all
14:40:30
pjb
ie. you cannot just compare with string=, you have to compare with (and symbolp string=)
14:51:18
dmiles
my other usecase i am setting up for is durring make-isntance that i respect slots from differnt classes that came from differnt packages
14:55:23
dmiles
loke: i was going to make that argument.. but technically we can compile :x in the parse and have it bind to foo:x in the body
14:56:58
loke
The interesting thing is that :INITARG for DEFCLASS is indeed processed that way. You can specify an initarg in any package, not just KEYWORD:
14:57:20
loke
(defclass bar () ((val :initarg z))) (slot-value (make-instance 'bar 'z 10) 'val) ⇒ 10
14:59:13
loke
Plenty of times have I forgot to add the colon in front of an INITARG argument. Annoying :-)
14:59:35
dmiles
parsing initargs i have to pass once over wwith #'eq then again over with (equal (symbol-name their-keyword)(symbol-name read-symbol-not-in-keyword))
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)