Search found 94 matches
- Sun Mar 17, 2013 12:23 pm
- Forum: Common Lisp
- Topic: ANN: cl-4store, a SPARQL client library for RDF manipulation
- Replies: 1
- Views: 5253
Re: ANN: cl-4store, a SPARQL client library for RDF manipula
Cool! I've been wanting to play around with 4store for a while now. Maybe I can finally get around to doing so.
- Sun Mar 10, 2013 2:45 am
- Forum: The Lounge
- Topic: What music genre do lispers listen to?
- Replies: 7
- Views: 27516
Re: What music genre do lispers listen to?
P.D.Q. Bach.
- Sat Mar 09, 2013 3:42 am
- Forum: Common Lisp
- Topic: newbie question: floating point addition operation
- Replies: 8
- Views: 16594
Re: newbie question: floating point addition operation
You can convert rationals to floats: (float (+ 232/100 1/1000)) -> 2.321 Technically, that (somewhat) reintroduces the problem... L> (format t "~E" (float (+ 232/100 1/1000))) 2.3210001e+0 NIL L> (= 2.3210001 (float (+ 232/100 1/1000))) T The Right Thing[TM] would be to use something like...
- Thu Mar 07, 2013 10:22 am
- Forum: Common Lisp
- Topic: newbie question: floating point addition operation
- Replies: 8
- Views: 16594
Re: newbie question: floating point addition operation
If you want exact rationals, use exact rationals.hajovonta wrote:Maybe it was my high expectations
Code: Select all
CL-USER> (+ 232/100 1/1000)
2321/1000
- Thu Sep 20, 2012 11:38 pm
- Forum: Common Lisp
- Topic: Capitalize Lisp
- Replies: 4
- Views: 7572
Re: Capitalize Lisp
samohtvii wrote:I'm also looking to take a string and 'inspect' the first character so with : "example" i would want to get e as a variable.
Code: Select all
CL-USER> (char "example" 0)
#\e
- Wed Aug 22, 2012 12:36 am
- Forum: Homework
- Topic: first, rest, second, last
- Replies: 3
- Views: 10705
Re: first, rest, second, last
The reason is that LAST does not return the last element of a list, but actually a list of the last N elements (actually the last N cons-cells), where N happens to default to 1:cos wrote:Why does first return 1, second return 2, and last return (3)?
Code: Select all
(last '(1 2 3) 2)
(2 3)
- Mon Aug 13, 2012 6:10 am
- Forum: Common Lisp
- Topic: printing Struct
- Replies: 5
- Views: 8735
Re: printing Struct
Also:
Code: Select all
CL-USER(1): (defvar *x* (make-point2d :x 10 :y 20))
*X*
CL-USER(2): (mapcan #'(lambda (slot-name) (list slot-name (slot-value *x* slot-name))) (mapcar #'sb-mop:slot-definition-name (sb-mop:class-slots (class-of *x*))))
(X 10 Y 20)
- Mon Aug 13, 2012 6:07 am
- Forum: Common Lisp
- Topic: printing Struct
- Replies: 5
- Views: 8735
Re: printing Struct
mparsa wrote:I want to get the value of the b
Code: Select all
CL-USER(3): (defstruct point2d x y)
POINT2D
CL-USER(4): (make-point2d :x 1 :y 2)
#S(POINT2D :X 1 :Y 2)
CL-USER(5): (slot-value * 'x)
1
CL-USER(6): (slot-value ** 'y)
2
- Tue Aug 07, 2012 2:45 am
- Forum: Common Lisp
- Topic: (setf a-new-symbol 'value) at the top level
- Replies: 4
- Views: 10082
Re: (setf a-new-symbol 'value) at the top level
Setting a variable at the top level sets the global value of the variable without proclaiming it special. Yes, it does on some implementations, but conforming programs may not rely on this behavior. In Lisp you don't need to declare or define variables. But if you bind a variable like in (let ((x 1...
- Sat Jul 28, 2012 12:21 am
- Forum: Common Lisp
- Topic: printing Struct
- Replies: 5
- Views: 8735
Re: printing Struct
The MOP functions illustrated by the following REPL transcript might or might not be useful: CL-USER(1): (defstruct point x y) POINT CL-USER(2): (defvar *a* (make-point :x 10 :y 20)) *A* CL-USER(3): *a* #S(POINT :X 10 :Y 20) CL-USER(4): (sb-mop:class-slots (class-of *a*)) (#<SB-PCL::STRUCTURE-EFFECT...