srandon111 has quit [Read error: Connection reset by peer]
hiroaki_ has quit [Ping timeout: 265 seconds]
<Josh_2>
is there any advantage to using psetf over setf?
VincentVega has quit [Quit: Connection closed]
Jesin has joined #lisp
<Gnuxie[m]>
Using something earlier in the form in one of the pairs and not wanting the updated place
jprajzne has quit [Quit: Leaving.]
<Bike>
Josh_2: they're different operators that do different things
<Bike>
are you asking about efficiency or something?
<Josh_2>
well they aren't all that different, seems similar to let and let*, one guarantees the order, the other doesnt
<Bike>
let and let* are also different operators that do different things
<Bike>
you decide which to use based on which thing you need done, is all
<Bike>
let* guarantees that bindings take place in an order. let guarantees that bindings do not take place. similarly, setf guarantees that one assignment takes place after the other, and psetf guarantees that they don't
<Bike>
well, rather than assignments taking place, psetf guarantees that all values are evaluated before any assignments take place
frost-lab has joined #lisp
hiroaki_ has joined #lisp
rtypo has quit [Ping timeout: 260 seconds]
<Josh_2>
Right, so is there any advantage to use psetf? like efficiency
<Gnuxie[m]>
I would be very cautious to assume an efficiency guarantee from anything like this, even if there did exist one
<Bike>
yeah, if your compiler is smart enough it won't matter
sjl has quit [Ping timeout: 260 seconds]
<Gnuxie[m]>
Mostly because it's a waste of time to think about, and will rarely ever be considerable enough to count even before considering how idiomatic it is
skapata has quit [Remote host closed the connection]
<Josh_2>
I agree, I just don't see the point of psetf
<Josh_2>
Whats the point of psetf?
<phoe>
when your places depend on one another
<Alfr>
Josh_2, try (psetf x y y x) for some bound x and y.
<Bike>
when you want to write a bunch of places with values affected by those places
gitgood has joined #lisp
<Bike>
setf and psetf aren't competing, or something. they just do different things. if you asked whether lists are better than arrays i'd be like, well, depends on what you're doing. same principle
<Josh_2>
Alfr: thanks
<Josh_2>
Ofcourse Bike
<Josh_2>
I didn't understand why someone would need psetf, but now I do :P Thanks
<aeth>
Use it when you don't need to do something fancy, too. It tells the reader that in this gigantic list of like 10+ PSETFs, none of them are supposed to depend on another (and it prevents the programmer from introducing a bug that accidentally does so)
<aeth>
You probably want to default to PSETF because you normally don't want dependencies between lines in a multiline SETF
<aeth>
Just like you should default to LET and only use LET* when you need it
<Josh_2>
Okay noted
niac has joined #lisp
<aeth>
(* Default to using PSETF when there's more than one form. Otherwise, SETF is the simpler form. So there is a bit of stylistic complication.)
hiroaki_ has quit [Ping timeout: 260 seconds]
kevingal has quit [Remote host closed the connection]
anticrisis has quit [Read error: Connection reset by peer]
anticrisis has joined #lisp
charles` has joined #lisp
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 256 seconds]
notzmv has joined #lisp
nicktick has quit [Ping timeout: 260 seconds]
semz has quit [Ping timeout: 260 seconds]
nicktick has joined #lisp
Lycurgus has joined #lisp
semz has joined #lisp
semz has joined #lisp
gitgood has quit [Read error: Connection reset by peer]
<Bike>
oh, and psetf always returns nil, which is pretty useless, unlike setf which returns the last stored values, which is sometimes useful
<ozzloy>
is there a way in common lisp to see what variables are currently defined?
<ozzloy>
i try searching, but get a bunch of "how to define a variable in common lisp" pages
orivej has joined #lisp
<Bike>
Global variables or what?
<ozzloy>
sure, anything that's defined at and usable at CL-USER>
<Bike>
you could use do-symbols to iterate over all symbols and see if they're bound
<Bike>
(let (c) (do-all-symbols (s c) (when (boundp s) (push s c))))
<Bike>
on my system there are 5619 such variables, so be careful
<Bike>
this will not include variables that are proclaimed special but not bound, as by (defvar *whatever*)
<Bike>
if you want variables in the cl-user package specifically, you can use do-symbols or do-external-symbols instead
<Bike>
"variables named by symbols in the cl-user package" to be more scrupulous about it
Lord_of_Life_ has joined #lisp
Lord_of_Life has quit [Ping timeout: 260 seconds]
Lord_of_Life_ is now known as Lord_of_Life
<aeth>
Bike: good point
<aeth>
So it should be phrased as: If the is just one set, use SETF. This sometimes has a useful return value, too. If there is more than one consecutive set, then unless you need the dependency between them, prefer one PSETF over one SETF (and especially over many SETFs in a row).
contrapunctus has left #lisp ["Disconnected: closed"]
<aeth>
Simpler in code.
<aeth>
(setf x 42) (psetf x 42 y 53 z 64) (setf x 42 y (+ 11 x) z (+ 11 y)) ; extra caveat: always linebreak... this is one line just for IRC
cartwright has quit [Remote host closed the connection]
aindilis` has quit [Ping timeout: 246 seconds]
<ozzloy>
Bike, i just did (length (let ((res (list))) (do-external-symbols (sym *PACKAGE*) (when (fboundp sym) (push sym res))) res)) and got 0
<ozzloy>
even though i've defined at least one method. what am i doing wrong?
<Bike>
what is *package*?
ex_nihilo has joined #lisp
<ozzloy>
i read that it is the default. when i evaluate that, i get #<PACKAGE "COMMON-LISP-USER">
cartwright has joined #lisp
<ozzloy>
so i thought that was where i should look. now i'm guessing that's wrong?
<Bike>
and is your method named by an exported symbol of cl-user? or, more likely, did you not export it, or define it in some other package?
<ozzloy>
um... i defun'ed it?
<ozzloy>
is this not a way to find all defun'd things?
<ozzloy>
i'm looking to find all defvar'd and defun'd things, not necessarily things that have been exported
<Bike>
okay, then you should do the do-all-symbols one, not do-external-symbols.
<ozzloy>
oh
<Bike>
do you know what a package is?
<ozzloy>
i'm getting a feel for it. seems like it's analogous to a package in java, or a module in racket, etc
<Bike>
packages are namespaces, so it's similar to some other languages, yes. although you should keep in mind it's strictly a naming thing. for example functions don't "belong to" packages, only their names may.
<ozzloy>
hmm... when i do all symbols, i get 14150 things. is there a way to see just the ones i've made during a session?
<Bike>
anyway, so symbols are divided into these namespaces. the namespace you start out in, cl-user, is not something made for an external interface, it's more for messing around in the repl in.
<ozzloy>
makes sense
<Bike>
do-all-symbols iterates over all symbols in all the packages. do-symbols and do-external-symbols only iterate through the symbols in one package.
<Bike>
(there are also symbols that are not in any package, but they don't usually name global variables or functions, so i'm skipping that)
<ozzloy>
ah
<Bike>
there is no particular way to see just what you've defined. a problem with that is that functions newly defined since the lisp started up may include e.g. IDE stuff you didn't define yourself
Sheilong has quit []
<Bike>
you could approximate it doing... let me write this out
<ozzloy>
so with do-symbols, i get 1005 things
<ozzloy>
oh, thanks! but don't worry if it turns out it's kinda a hairball
<Bike>
(let (c) (do-symbols (s "CL-USER" c) (when (eq (symbol-package s) (find-package "CL-USER")) (push s c))))
<Bike>
this will collect symbols that are (a) accessible from the cl-user (repl) package, and (b) are not part of some other package
<ozzloy>
thanks!
<Bike>
for example your do-symbols form will include every symbol in the CL package, which is accessible from the cl-user package
<Bike>
and which includes 900-something symbols
<Bike>
you probably don't want those
<Bike>
my form here gets me 29 symbols, which isn't too bad
<Bike>
you can of course impose boundedness conditions as well
<ozzloy>
all right, that's much more manageable, 63 things
<ozzloy>
very nice
<ozzloy>
yep, those all look familiar. thanks Bike
<ozzloy>
apparently i defined add1 at some point and it's not a built-in
<Bike>
glad to be of assistance
<Bike>
there is 1+ built in
<ozzloy>
\o/
<ozzloy>
lol, really?
<Bike>
yes indeed
<Bike>
very laconic
<ozzloy>
b .bb.b but prefix!!!
<ozzloy>
shouldn't it be +1 ?
<alandipert>
(1+ 2) has a cool infix vibe though
<Bike>
1- always confuses me a little
<Bike>
not that -1 would be any better
<Bike>
+1 and -1 would be interpreted as numbers
<ozzloy>
i mean, i guess the operator is named "1+" and so it is still prefix... but the "+" though!
<ozzloy>
oh wow, 1- is kinda ugly
<ozzloy>
(1- 5), well that's 4 of course!
<beach>
Good morning everyone!
asdflkj has quit [Ping timeout: 265 seconds]
<ozzloy>
common lisp is fun though
Alfr is now known as Guest91137
Alfr has joined #lisp
Guest91137 has quit [Ping timeout: 260 seconds]
iamFIREc1 has joined #lisp
iamFIREcracker has quit [Ping timeout: 245 seconds]
orivej has quit [Ping timeout: 260 seconds]
froggey has quit [Ping timeout: 240 seconds]
froggey has joined #lisp
notzmv has quit [Ping timeout: 260 seconds]
charles` has quit [Ping timeout: 264 seconds]
notzmv has joined #lisp
rumbler31 has joined #lisp
rumbler31 has quit [Ping timeout: 276 seconds]
froggey has quit [Ping timeout: 256 seconds]
froggey has joined #lisp
antonv has quit [Ping timeout: 276 seconds]
Necktwi has quit [Read error: Connection reset by peer]
Nilby has joined #lisp
kaiwulf has quit [Ping timeout: 245 seconds]
cartwright has quit [Remote host closed the connection]
cartwright has joined #lisp
Lycurgus has joined #lisp
Lycurgus has quit [Client Quit]
asarch has joined #lisp
<asarch>
Is there any tool to render calendars?
<asarch>
Just like the Unix cal tool does?
<beach>
asarch: I think you should take that on as a project, using McCLIM.
<beach>
Then I can give up Google calendar
aindilis has joined #lisp
<asarch>
I need it as text to send it to a template in a web application
<beach>
OK, then forget what I said.
<asarch>
Oh :-(
<beach>
I can't stand the web. Not use it, and even less program it.
Bike has quit [Quit: Lost terminal]
gkeramidas has joined #lisp
_paul0 has joined #lisp
shka_ has joined #lisp
paul0 has quit [Ping timeout: 272 seconds]
luni has joined #lisp
vaporatorius__ has joined #lisp
vaporatorius has quit [Ping timeout: 265 seconds]
gzj has joined #lisp
sauvin has joined #lisp
gkeramidas has quit [Remote host closed the connection]
bitmapper has quit [Quit: Connection closed for inactivity]
Lycurgus has joined #lisp
waleee-cl has quit [Quit: Connection closed for inactivity]
Bourne has joined #lisp
orivej has joined #lisp
ech has quit [Ping timeout: 268 seconds]
orivej has quit [Ping timeout: 260 seconds]
orivej has joined #lisp
aartaka has joined #lisp
asarch has quit [Quit: Leaving]
orivej has quit [Ping timeout: 260 seconds]
Lycurgus has quit [Quit: Exeunt]
orivej has joined #lisp
nicktick has quit [Ping timeout: 260 seconds]
mindCrime has quit [Ping timeout: 240 seconds]
nicktick has joined #lisp
nsrahmad has joined #lisp
shka_ has quit [Quit: Konversation terminated!]
contrapunctus has left #lisp ["Disconnected: Replaced by new connection"]
contrapunctus has joined #lisp
iskander has quit [Quit: bye]
IPmonger has joined #lisp
IPmonger_ has quit [Ping timeout: 240 seconds]
contrapunctus has left #lisp ["Disconnected: closed"]
asarch has joined #lisp
iskander has joined #lisp
contrapunctus has joined #lisp
<asarch>
If I have: "<p>Lorem ipsum</p>", how could I remove the HTML tags with a regexp?
<beach>
And thanks to call-site optimization, compiler macros may soon be a thing of the past. :)
<Gnuxie[m]>
yay
ebrasca has joined #lisp
beinnblade has joined #lisp
gitgood has quit [Read error: Connection reset by peer]
aartaka has joined #lisp
luna_is_here has quit [Quit: luna_is_here]
luna_is_here has joined #lisp
jonatack_ has joined #lisp
jonatack has quit [Ping timeout: 260 seconds]
lowryder has quit [Ping timeout: 258 seconds]
lowryder has joined #lisp
waleee-cl has joined #lisp
jorts is now known as nckx
andreyorst has joined #lisp
VincentVega has quit [Quit: Connection closed]
gitgood has joined #lisp
iskander has joined #lisp
Blkt has quit [Quit: No Ping reply in 180 seconds.]
kenran has joined #lisp
Blkt has joined #lisp
Lycurgus has joined #lisp
mindCrime has joined #lisp
alecigne has joined #lisp
alecigne has left #lisp [#lisp]
iskander has quit [Quit: bye]
jonatack_ has quit [Quit: jonatack_]
jonatack has joined #lisp
Guest7312 has joined #lisp
Guest7312 has quit [Quit: Leaving]
heisig has quit [Quit: Leaving]
oldtopman has joined #lisp
lansiir has quit [Read error: Connection reset by peer]
ewd has joined #lisp
iskander has joined #lisp
nullman has quit [Ping timeout: 260 seconds]
ljavorsk has quit [Ping timeout: 245 seconds]
casual_friday_ has quit [Remote host closed the connection]
Lycurgus has quit [Quit: Exeunt]
orivej has joined #lisp
casual_friday has joined #lisp
casual_friday has quit [Remote host closed the connection]
casual_friday has joined #lisp
vaporatorius__ has quit [Quit: Leaving]
vaporatorius has joined #lisp
vaporatorius has joined #lisp
luni has joined #lisp
nullman has joined #lisp
ebrasca has quit [Read error: Connection reset by peer]
brandflake11 has joined #lisp
brandflake11 has left #lisp [#lisp]
brandflake11 has joined #lisp
anticrisis has joined #lisp
ech has joined #lisp
terpri_ has joined #lisp
rogersm has joined #lisp
terpri has quit [Ping timeout: 240 seconds]
<brandflake11>
Hey all, I am having trouble with some lisp programming I am working on with Common Music. There is a function called (rhythm) that takes a symbol that represents a music rhythm (quarter-note 'q, eighth note 'e). I made a function that can parse a list and return these symbols, but rhythm doesn't like its output. I get an error "Can't parse QUOTE as a rhythm." Would anyone be willing to look at a pastebin and see where I'm going wro
<Nilby>
I would guess it would have to be like: (setq test-list '(0 e 1 s 2 q 3 e 4 q 5 s 6 t))
<Nilby>
In other words, you don't need the internal quotes.
<Nilby>
Since there's a quote at the front of the list.
<brandflake11>
Nilby: The rhythm function needs the quote though. Without it, I get the error "The value e is not of type number"
<brandflake11>
Is there anyway to turn a quote into a symbol?
<brandflake11>
The documentation for rhythm says it takes symbols, so maybe something like that?
<brandflake11>
Nilby: Oh, actually, my fault, that was the problem. I was doing something silly. Thank you Nilby!
joster has joined #lisp
<Nilby>
Glad to help. Good luck!
choegusung has joined #lisp
kenran has quit [Remote host closed the connection]
maier has joined #lisp
yitzi has joined #lisp
joster has quit [Quit: Connection closed]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #lisp
rogersm has quit [Remote host closed the connection]
<brandflake11>
Okay, another problem. If I do the rhythm function in a loop, like (rhythm (list-select)), I get "The value e is not of type number when binding sb-kernel::x".
<Nilby>
It's passing i to list-select which expects it to be number, and it's a symbol every alternate time. So you'd probably have to do something like (loop for (i s) in test-list ... ) so that i would only be the numbers.
<Nilby>
I was lucky that a fellow who wrote it showed me a demo.
<brandflake11>
That's cool, so you know someone who wrote the software? The only other lisp composer that I found so far was Andrew Sorensen, and the pieces on http://commonmusic.sourceforge.net/
<Nilby>
There's some cool videos on youtube of people livecoding music with lisp.
<brandflake11>
Nilby: I never thought that kind of thing was super interesting, until I saw it done with lisp. That changed everything for me
<brandflake11>
Lisp just looked faster than other languages when it came to live-coding music
<Nilby>
It's very impressive when someone can live code decent music and visuals.
<brandflake11>
Totally, especially if there's also visuals. I think it would be cool to also integrate some kind of body controller that can affect the music
terpri has joined #lisp
terpri_ has quit [Ping timeout: 264 seconds]
terpri has quit [Remote host closed the connection]
contrapunctus has left #lisp ["Disconnected: closed"]
terpri has joined #lisp
aartaka has joined #lisp
contrapunctus has joined #lisp
terpri_ has joined #lisp
terpri has quit [Ping timeout: 240 seconds]
aartaka has quit [Ping timeout: 256 seconds]
<phantomics>
A while back I was experimenting with using April to generate midi notes, vector languages are good for live coding thanks to the terse syntax
pankajsg has quit [Ping timeout: 260 seconds]
p9fn has joined #lisp
<phantomics>
Combine it with Slime and you can have a code file that serves as an interface, where you can C-x C-e code blocks to produce different effects
<brandflake11>
phantomics: That's what I'm doing with common music. At this point anyways, text editing with anything else but emacs is tough for me :)
<brandflake11>
I've never heard of April, I need to check it out