@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13



Comments:

<0> Can _any_ character occur inside a double-quoted string except "?
<1> quotemstr: yes.
<1> quotemstr: and " can occur too.
<1> (if preceded by \)
<2> \ in common lisp simply escapes the next character, whatever that character is
<3> quotemstr: however, beware of encoding and line terminations. In some case, it may be suprizing.
<3> s/su/sur/
<0> pjb: Right.
<0> I'm just trying to figure out an efficient encoding of blobs of data. I'm using read to read ***ps, but once in a while, I have to read a known-length chunk of arbitrary octets
<3> You can use a reader macro for that.
<0> I can just put the length in the ***p, then, immediately after reading it, read the corresponding number of bytes..
<0> Or a reader macro. :-)
<0> I'm reading about those in the CLHS now.
<3> For example, to read a bit vector, we use #*10101010101111000111...100011
<3> So you could define #{whateverformatofblobdatayouwanthere}
<0> I can define arbitrary reader macros like that?



<3> Yes.
<3> There are macro characters (any char may be one, some are already defined like ; " ' ( etc), and there are dispatch macro character. One is defined: #
<0> Ah, I see.
<3> the various notation starting with # are dispatch macros: #' #x #o #b, #c, #a etc.
<0> Why use a dispatch macro instead of a macro character?
<3> Some characters are reserved for user programs, other may be used by the implementation (but you can always overwrite them).
<3> The advantage of dispatch macro is that it's isolated from the other characters. Since you can use almost all the characters in the standard set for identifiers or number syntax, it avoids collisions.
<0> Ah, I see.
<0> I noticed there's an optional numeric prefix. Is that p***ed to the macro function?
<3> Yes, in the case of dispatch macros.
<3> clhs set-dispatch-macro-character
<4> http://www.lispworks.com/reference/HyperSpec/Body/f_set__1.htm
<3> clhs set-macro-character
<4> http://www.lispworks.com/reference/HyperSpec/Body/f_set_ma.htm
<0> Thanks. This neatly solves my problem.
<5> Too bad that standard readtable hacking can't solve my problem so easily. :-/
<3> nyef: packages?
<5> Parsing non-lisp languages
<0> nyef: I saw a yacc port in the list of available asdf-install packages.
<3> #tC{ int c=1+2; return(c)}
<3> At least, you can read non-lisp languages...
<5> quotemstr: Too bad YACC ****S then, isn't it?
<0> pjb: #c is already taken.
<3> That's why I used #t
<5> Isn't #t reserved for Scheme compatability? ^_-
<0> pjb: http://www.cliki.net/CL-Yacc
<3> #tPascal{ var c:integer;begin c:=1+2; end;}
<0> Does Scheme have the same sort of reader customizability?
<6> Not standard.
<3> Not specified.
<0> Wow, somebody's made a .NET implementation of CL.
<7> Riastradh: what schemes have non-standard reader customizability?
<5> I also managed to realize, just now, that I completely forgot about error cases for my tokenizer. :-/
<6> housel, Scheme48, MzScheme, Gambit, MIT Scheme...probably Gauche...
<0> Oh, cool. #n for recursive definitions.
<3> that's ## and #+
<3> #= i mean
<3> shift on laptop keyboards is shi*ty...
<2> quotemstr: a .net impl or a .net layer?
<0> http://weblogs.asp.net/rmclaws/archive/2003/10/12/31623.aspx
<0> RDNZL is a ".NET Layer"
<2> they may have included a simple lisp interpreter
<2> i'm not sure if that qualifies as CL
<2> if Microsoft produced a full CL compiler I'd think I'd have heard of it by now =)
<8> There was some posting about L# macros on cll a little while ago. It looked very unlike CL.
<9> patrick dussud gave a talk on lisp for .net at the last ILC.
<2> has there been one since 2003
<9> he's one of the CLR architects. he got a pretty frosty reception from the ILC crowd.
<0> ILC?
<10> emu: yes, ILC '05, which is what lemonodor is referring to
<10> Clinger seemed kind of down on the technical merits of the CLR for a Lisp implementation during his Common Larceny talk, too
<6> ...for instance, the complexity of using a hairy exception device to emulate tail recursion...
<8> That doesn't sound too great.
<2> "but tail recursion is not a requirement!" :P
<2> clearly the designers of CL were thinking ahead
<8> emu: Larceny is Scheme...
<2> gosh they have to use the same abbreviation do they ;)
<0> What's the right way to do (setf (function thing) (lambda () ...)) ?
<2> defun or flet or labels
<0> You can't ***ign functions directly?
<10> or (setf (symbol-function 'thing) ...)



<2> if you literally want to change the function ***ociated with a symbol you can use (setf (symbol-function 'foo) (lambda () ...))
<8> quotemstr: (setf (symbol-function ...) ...) or (setf (fdefinition ...) ...)
<0> Ahhhhhh, symbol-function.
<10> you can't ***ign to a lexical function, no
<2> yea do not use that for local definitions
<6> I was once told, I think, that (SETF FDEFINITION) was better than (SETF SYMBOL-FUNCTION), but I can't recall why.
<11> but you can bind one with labels or flet (:
<2> one confusion of people coming to lexical scope is that they don't realize variables and symbols are not the same thing
<2> (and correspondingly, function variables and symbols)
<8> I don't know what the difference between symbol-function and fdefinition is, come to think of it.
<10> I know what the difference in return value is, but I don't know why it matters for SETF.
<12> re
<8> Ah. fdefinition accepts non-symbols.
<0> So is it better style to use (let ((x y)) (defun foo() ...)) or (setf (symbol-function 'foo) (let ((x y)) (lambda () ...))) ?
<2> former
<0> Or is using closures for the equivalent of C function statics frowned upon?
<2> no, it's fine
<10> quotemstr: the former by far.
<2> you may change your mind in the presence of multiprocessing though
<0> emu: Well, it's read-only. I'm creating a shared readtable, instead of creating a new readtable each time I call the function.
<10> it's often preferable to use special variables, whose extent you can control explicitly
<0> I don't understand. Isn't the extent less-well-controlled with a global special variable?
<10> not if you don't define the variable globally, but instead bind it around all calls to your function
<10> I'm not referring to scope; I'm referring to lifetime.
<2> specials aren't like global variables in other languages
<3> (let ((d)) (defun create () (setf d 'o)) (defun do () (use d)) (defun kill () (setf d nil))) ???
<3> I don't see what (declare (special d)) would bring.
<8> pjb: In threaded implementations that let you control which special bindings are thread-local, it might.
<10> nothing, provided you always remember to reinitialize d every time its value needs to be reset
<10> and what rydis said
<3> Oh, right.
<10> you can be that person!
<2> i know: ln -s sbcl clisp
<3> Indeed, as soon as I get some time to do it.
<13> that's a good idea, pjb somebody!
<3> :-)
<8> Who's doing development of clisp, nowadays? Is it mostly Haible or Steingold, or some other people?
<3> Mostly them.
<14> pjb: it would be nice, considering the number of small computers on which only clisp runs.
<0> Is there a function that represents the standard (instead of the current) readtable?
<0> err, variable.
<3> (copy-readtable nil)
<0> Ah.
<15> I think it's been mainly Sam lately. IIRC Bruno said a while ago that he would be taking a hiatus from clisp development
<8> OK. Thanks, both of you.
<16> ladies!
<8> pundai: You might be off in your targeting, if that's what you're looking for. ;)
<0> Oh, cool.
<0> You can set up more than once dispatch macro character.
<0> Say, 'j'.
<3> I'd try $ or % rather...
<3> Or if you have iso-8859-1 or utf-8, anything not in the standard character set.
<0> I know. :-)
<0> Does the lisp reader handle arbitrary unicode characters?
<3> etc...
<17> is there support in sbcl for a #'string< that is aware of unicode characters?
<3> Depends on the implementation, but most implementations nowadays handle unicode well.
<2> sb-unicode would be the place to check
<15> sb-unicode what?
<16> with-gensyms, if i use the one from the practical common lisp book, it works as expected, if i don't i get weird errors... http://paste.lisp.org/display/24263
<17> emu: my sbcl only has sb-ext:
<3> (apropos "" :sb-unicode)
<17> hm, i need to check the compile config file
<3> pundai_: some implementation export with-gensyms from their implementation specific package.
<8> attila: It certainly seems like it. (string< "<lambda>-less" "<lambda>-free") => nil; the other arg-order => 2.
<16> pjb, so why doesnt it work?
<3> Always use your own package, with an explicit use list: (defpackage :mine (:use :cl)) (in-package :mine) ...
<3> Different implementation.
<15> attila_lendvai: you probably don't, I have no idea of what emu and pjb are talking about (there's no sb-unicode package)
<3> You can see what it expands to with (macro-expand '(with-gensym ...))
<2> it's a feature
<3> We say: #+sb-unicode
<17> i've got it (it's on by default and i didn't turn it off)


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #lisp
or
Go to some related logs:

#suse
konversation connect to quakenet
#math
ubuntu i865 patch
profits for quiznos
#lisp
undernet creative-minds
kxkb fc5
L2TP server OpenSuSE
#ubuntu



Home  |  disclaimer  |  contact  |  submit quotes