malice has quit [Remote host closed the connection]
FreeBirdLjj has joined #lisp
fikka has quit [Ping timeout: 248 seconds]
<fiddlerwoaroof_>
ping
wmannis has quit [Quit: wmannis]
jmercouris has joined #lisp
<jmercouris>
fiddlerwoaroof_: pong
<jmercouris>
fiddlerwoaroof_: How's your bridge going?
convexferret has joined #lisp
FreeBirdLjj has quit [Ping timeout: 264 seconds]
Achylles has quit [Ping timeout: 248 seconds]
FreeBirdLjj has joined #lisp
vap1 has joined #lisp
lemonpepper24 has quit [Remote host closed the connection]
wmannis has joined #lisp
msb has quit [Ping timeout: 248 seconds]
fikka has joined #lisp
FreeBirdLjj has quit [Ping timeout: 268 seconds]
vaporatorius has quit [Ping timeout: 268 seconds]
dented42 has joined #lisp
msb has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
Oladon has quit [Quit: Leaving.]
FreeBirdLjj has joined #lisp
wmannis has quit [Quit: wmannis]
FreeBirdLjj has quit [Ping timeout: 248 seconds]
iqubic has joined #lisp
fikka has joined #lisp
markong has quit [Ping timeout: 268 seconds]
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.1)]
FreeBirdLjj has joined #lisp
<iqubic>
Anyone here?
<iqubic>
Or is it an empty room?
smurfrobot has joined #lisp
<jmercouris>
Yes
<jmercouris>
What makes you think it is an empty room?
<iqubic>
No one was talking at all.
<jmercouris>
Well, it is a saturday night
<jmercouris>
I was about to leave to go out myself
pierpa has joined #lisp
<iqubic>
Oh. I see. Most people want to hit the town.
fikka has quit [Ping timeout: 256 seconds]
fortitude has joined #lisp
<jmercouris>
Yeah, why not :)
<jmercouris>
this is our chance to be O/T since no one else is around
FreeBirdLjj has quit [Ping timeout: 240 seconds]
damke_ has joined #lisp
dddddd has quit [Remote host closed the connection]
smurfrobot has quit [Ping timeout: 260 seconds]
damke has quit [Ping timeout: 264 seconds]
dieggsy has quit [Remote host closed the connection]
dieggsy has joined #lisp
fikka has joined #lisp
proteanthread has joined #lisp
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FreeBirdLjj has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
dented42 has joined #lisp
<iqubic>
I see. So, if want to learn Lisp, how should I start.
orivej has quit [Ping timeout: 240 seconds]
<iqubic>
I'm using Emacs as my development environment, so I think that'll help me.
turkja has joined #lisp
FreeBirdLjj has quit [Ping timeout: 248 seconds]
<jmercouris>
Well, that's a tough question
<jmercouris>
what's your ultimate goal?
<jmercouris>
Simply learning lisp? or do you have some application in mind?
<Bike>
install slime if you haven't. write a bunch of programs
<jmercouris>
If you want to start with a "premade" emacs so you don't have to faff around with emacs in the beginning, you can look at portacle https://portacle.github.io
<jmercouris>
Here's the very very high level description, 1. Install a Lisp implementation of your choice 2. Install setup slime for emacs/your implementation 3. Install quicklisp 4. Install/setup Paredit 5. Install/setup Smartparens 6. Get started learning
<jmercouris>
Bike: I have a question for you if you have a moment
<Bike>
shoot
<jmercouris>
It's also kind of an opinion question
<jmercouris>
that is effectively designed for "interactive" functions (using emacs terminology)
<jmercouris>
e.g. functions that are M-x invokable
<Bike>
you don't need that make-condition call
<jmercouris>
before we go off on that tangent let me finish this thought
<jmercouris>
otherwise I will forget what I was going to ask
<Bike>
yeah sure, just a small note
<jmercouris>
so I was thinking wouldn't it be cool to combine some sort of ability to embed a (with-buffer) macro inside?
<jmercouris>
Imagine the syntax could look liek this
<jmercouris>
(defcommand some-command-name "Some-docstring of sorts" \n :with-active-buffer \n (body...))
<jmercouris>
What do you think? is this a stupid looking syntax?
<jmercouris>
I just don't want to have people needing to manually form closures every time they wish to work with a buffer for the duration of a function
<plll[m]>
Anyone running lisp on the beaglebone black? Couldn't find sbcl in the Debian repos
<jmercouris>
because the *active-buffer* may change during the execution of the function
<Bike>
well, i'm not sure i understand what this active buffer thing is, but i'd say if you're going to add options you should have a dedicated list for it in the syntax, rather than picking them out of the body
<iqubic>
So what's the best way to set up emacs for Lisp coding?
<jmercouris>
iqubic: Did you read any of what I wrote?
<iqubic>
Not yet.
<Bike>
install slime (from melpa, or there's quicklisp-slime-helper), and that's it
<jmercouris>
GO ahead and read it, you'll find the solution there :)
<jmercouris>
Bike: What do you mean by a dedicated list?
<jmercouris>
where would this list reside?
<iqubic>
What is paredit, and smartparens?
<jmercouris>
Something like (defcommand (special-list) (normal-args-list))?
<pransmonkey>
I am sorry, but that is not very helpful.
<pransmonkey>
If I could figure it out, I wouldn't have asked here.
<pransmonkey>
RTFM is cool, but useless.
antonv has joined #lisp
<Bike>
basically it looks through the list to see if there's an existing keyword pair
<pransmonkey>
I fail to think of another way of doing `(setf (getf *ps* :blah) bleh)` which would help me understand the whole thing.
<Bike>
and if it's there, alters the value
<Bike>
if there is no existing keyword pair, it puts a new one at the front of the list
<pierpa>
pransmonkey: the answer is: you can't do what you are asking using standard CL. Standard CL uses macros which expand to implementation dependent things
<pransmonkey>
Bike: Thanks, after you have explained, and looking at the macro expension, I understand how it works.
<Bike>
it's perfectly possible to do the behavior of setf getf without using setf or getf, it's just list manipulation
<pransmonkey>
What I am trying to know is, whatever, that is the "standard" way of doing it, and it is often that macros map functions passed with completely different things.
<Bike>
setf is a pretty special case
fikka has joined #lisp
<Bike>
but in principle any macro could do something like it, yeah
<Bike>
on sbcl there's a compare-and-swap macro that works similarly to setf, in that (cas form ...) is going to macroexpand into something different based on the cas expansion
oleo has quit [Ping timeout: 255 seconds]
<Bike>
conceptually, in (setf (getf ...) ...) the getf form is not a function call, it is a "place"
FreeBirdLjj has quit [Ping timeout: 264 seconds]
<pransmonkey>
Aha.
warweasle has joined #lisp
<pransmonkey>
So a place isn't necessarily a real memory location or list reference or anything.
<iqubic>
I don't have a .quicklisp directory.
<iqubic>
Is that bad?
<Bike>
pransmonkey: yeah, a place is just anything setf knows about, kinda
<Bike>
which is why places shouldn't be thought of like pointers
<Bike>
iqubic: also, by default it's just 'quicklisp' without the ., i think.
<pransmonkey>
Bike: I was thinking of place as some kind of pointer or reference, and so `(setf (getf *ps* :non-existence-pointer-or-reference) bleh)` didn't make sense.
<sjl>
Common Lisp Recipes has a good section about them, but it's not free
<Bike>
i see, yeah. that's kind of a common confusion i think.
<Bike>
one place that falls apart is CLOS accessors, which are just generic functions
<Bike>
so you can define methods to do literally whatever you want
<pransmonkey>
interesting.
<Bike>
you can also define normal setf functions, which also do whatever you want
fikka has quit [Ping timeout: 256 seconds]
emacsomancer has joined #lisp
<iqubic>
Bike: I have loaded and installed quicklisp. At least I think I did.
<Bike>
when you start up sbcl again, does (find-package "QL") get you anything, or just NIL?
dented42 has joined #lisp
<iqubic>
I get nil.
<iqubic>
NIL
<jmercouris>
any mailing list software exist in common lisp?
<Bike>
okay, then you didn't. what happened when you loaded the quicklisp setup file?
<jmercouris>
iqubic: Did you do (ql:add-to-init-file)? or whatever it's called?
<iqubic>
No.
<iqubic>
Bike: If I run (quicklisp-quickstart:install) I get this:
<iqubic>
Quicklisp has already been installed. Load #P"/home/avi/quicklisp/setup.lisp" instead.
<jmercouris>
iqubic: within sbcl: (ql:add-to-init-file)
<iqubic>
Oh, wait...
fikka has joined #lisp
<iqubic>
I got it working now
emma_ has joined #lisp
emma_ has quit [Changing host]
emma_ has joined #lisp
<antonv>
have anyone ever received a multicast UDP packed in CL? I see no API for that.
<iqubic>
Alright, I still don't have a .quicklisp file.
<iqubic>
s/file/directory.
<Bike>
do you have a quicklisp directory?
<iqubic>
no.
<jmercouris>
Are you sure?
<Bike>
okay. when you start sbcl does the find-package get you anything?
<iqubic>
yes.
<iqubic>
Yes.
<Bike>
okay. did you specify a different install directory or anything?
<jmercouris>
iqubic: I'm very ready to say, give up, install portacle, and if you like common-lisp, go ahead and set this up later
<Bike>
you should be able to get the directory name with ql:*quicklisp-home*
<pransmonkey>
How do I pretty print a tree?
<Bike>
pprint
<pransmonkey>
I was more thinking of a graphical representation.
<pransmonkey>
Boxes and arrows, and all that jazz.
<iqubic>
Oh, wait. For some reason the directory is not hidden.
<Bike>
that's why i mentioned the dot
<iqubic>
It's just standard "quicklisp"
fikka has quit [Ping timeout: 268 seconds]
<Bike>
pransmonkey: nothing built in
<iqubic>
So what should I do now.
<Bike>
well, now you have quicklisp and slime
<Bike>
you can start sbcl in slime, i guess, so now your environment's set up all right
<iqubic>
(find-package "QL") only works if I have loaded the right file though.
<Bike>
you didn't put it in your init file?
<iqubic>
How do I do that?
<Bike>
(ql:add-to-init-file)
<Bike>
i think the installer should have prompted you for this
<iqubic>
Yeah, that just hangs sbcl.
emma_ is now known as em
<iqubic>
I'm not sure that's actually doing anything.
<Bike>
uh... that's weird.
<Bike>
maybe your init file is write protected or something.
<iqubic>
How long should the command take to run?
<Bike>
it writes to a file. shouldn't take long.
<Bike>
well, forget it.
<iqubic>
Bike: I'm using Nix-os, which might be my issue here.
<Bike>
ah, maybe
<Bike>
well, just make an .sbclrc if it doesn't exist, and put (load "wherever/quicklisp/setup.lisp") in there
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Bike>
that's pretty much all add-to-init-file does
<pransmonkey>
And include `(load "/path/to/quicklisp/setup")`?
dented42 has joined #lisp
<Bike>
what?
<pransmonkey>
In the sbclrc to make sure quicklisp is loaded?
<iqubic>
That works.
<iqubic>
Well, now I have a working lisp devel evironment. Thanks all.
<iqubic>
Also running (exit) hangs sbcl
<Bike>
pransmonkey: is that not what i said?
<Bike>
iqubic: i have no idea what's going on there, sorry
<iqubic>
Bike: I don't think I should be running sbcl in eshell.
<iqubic>
LOL.
<Bike>
that's... probably problematic, yeah
<Bike>
did slime not work?
<Bike>
like, M-x slime
<iqubic>
No, slime works.
<Bike>
then why eshell?
<iqubic>
IDK man.
<Bike>
i mean, slime provides a repl
<pransmonkey>
I use sbcl with vlime (vim).
<pransmonkey>
And quicklisp.
<Bike>
that not happening?
<pransmonkey>
So far so good.
<pransmonkey>
I don't have to jump ship into the evil that Emacs is.
SpikeMaster has joined #lisp
<iqubic>
Bike: M-x slime works for me, and gives me a repl.
ebzzry has joined #lisp
<iqubic>
I'm not sure why I was using eshell.
<Bike>
oh, okay.
openthesky has quit [Quit: Page closed]
<jmercouris>
Syntax highlighting for macros?
<whoman>
o_O
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<whoman>
lisp syntax highlighting should truly be contextual and depth-ual, rather than literal lettered identifiers
<whoman>
or even no highlighting at all.
<jmercouris>
whoman: so, no?
orivej has quit [Ping timeout: 246 seconds]
<Bike>
by default slime just does some dumb shit like coloring operator names beginning with "def"
<Bike>
works pretty well for me in practice
<pransmonkey>
You can have at least some highlighting for s-expressions.
<pransmonkey>
With matching pran highlighter.
patche has joined #lisp
damke has joined #lisp
d4ryus1 has joined #lisp
<whoman>
jmercouris, the question lacks an existential word ?? like "is" or "are" or query words like "when" or "how" ....
<whoman>
didnt feel it was a full question so i went on my own thing about stuff
<whoman>
sry
fikka has joined #lisp
<jmercouris>
whoman: "How to enable syntax highlighting for macros"
<jmercouris>
Bike: Yet, it is not highlighting my "defcommand"
<jmercouris>
What is going on :(
<jmercouris>
The indentation is also all wrong
<jmercouris>
I am starting to wonder if these are CCL specific issues
<iqubic>
Are you the one working on the next browser thing?
<jmercouris>
Yes sir!
damke_ has quit [Ping timeout: 264 seconds]
<iqubic>
Cool. How far are you in the project?
<jmercouris>
Well, pretty far :)
d4ryus has quit [Ping timeout: 256 seconds]
<jmercouris>
trying to make it easier right now to write commands and to customize, then release a package manager, then some quality of life things to make it easier for noobs
<jmercouris>
like "hydra" and stuff like that
<iqubic>
I see.
makomo has quit [Ping timeout: 240 seconds]
<jmercouris>
Anyways, gotta go for now, talk later!
<jmercouris>
Please email me if you have any questinos
SpikeMaster has quit [Quit: ERC (IRC client for Emacs 27.0.50)]
<whoman>
questinos !
<whoman>
spanish [in]quests
<whoman>
jmercouris, How to complete sentence.
<iqubic>
Preguntas?
<whoman>
how to maximize our communicative duties here in the metaverse
<iqubic>
That's spanish for questions.
fikka has quit [Ping timeout: 265 seconds]
pransmonkey has quit [Ping timeout: 260 seconds]
<whoman>
i would have never guessed that. kotae[ru] is 'to answer' in japanese
asarch has joined #lisp
wxie has joined #lisp
pagnol has quit [Ping timeout: 248 seconds]
damke_ has joined #lisp
warweasle has quit [Quit: Leaving]
ckonstanski has quit [Remote host closed the connection]
damke has quit [Ping timeout: 264 seconds]
dented42 has joined #lisp
<antonv>
so, no-one used multicast upd?
fikka has joined #lisp
fikka has quit [Ping timeout: 260 seconds]
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DeadTrickster has quit [Read error: Connection reset by peer]
DeadTrickster has joined #lisp
<pierpa>
You should at least say which implementations you are interested in. I seem to remember thare was a library for this for lispworks, but I have not first-hand experience.
raynold has joined #lisp
jmercouris has quit [Ping timeout: 268 seconds]
fikka has joined #lisp
wxie has quit [Ping timeout: 246 seconds]
fikka has quit [Ping timeout: 246 seconds]
FreeBirdLjj has joined #lisp
fikka has joined #lisp
FreeBirdLjj has quit [Ping timeout: 268 seconds]
JuanDaugherty has quit [Quit: Ex Chat]
wheelsucker has quit [Ping timeout: 240 seconds]
dented42 has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
<dmiles>
multcast udp is differnce than normal udp ?
xrash has quit [Read error: Connection reset by peer]
<dmiles>
one would set up the broadcast streams each with its own destination?
fikka has joined #lisp
antonv has quit [Read error: Connection reset by peer]
<beach>
Good morning everyone!
<iqubic>
Morning Beach.
fikka has quit [Ping timeout: 246 seconds]
<beach>
iqubic: How is learning Common Lisp going?
<iqubic>
Slowly.
<iqubic>
I've taken a break from all coding because school was really hard.
<iqubic>
So the last time I've done any lisp coding was like, last October.
fikka has joined #lisp
<iqubic>
Also, I haven't found any lisp tutorials that I actually like. So that's fun.
<whoman>
heh
<whoman>
marriage itself is the best tutorial for marriage. imagine reading a how-to for dummies on marriage, written by some dude having one marriage and knowing other dudes having marriages, but still not knowing how your marriage will go. just get married - life is the best teacher
<whoman>
also curious what you are focused on in school iqubic ?
asarch has quit [Quit: Leaving]
<whoman>
also some1!!! please help me!!!!!!!!!!!! the topic is still SBCL 1.4.0 and we are a bit further than that
<beach>
iqubic: What is wrong with the ones you have found?
<iqubic>
beach: I haven't found any.
FreeBirdLjj has joined #lisp
<beach>
You have been recommended PCL.
<iqubic>
whoman: I'm in American High School, so I'm learning a bit of everything at the moment.
pragmaticmonkey has joined #lisp
<iqubic>
beach: I also don't know what I should make with Lisp. It all seems so hard.
<pragmaticmonkey>
iqubic: Make a lisp dialect, written in lisp, that makes lisp work the way you want to lisp.
<iqubic>
I figure it shouldn't be too hard to port to lisp.
fikka has quit [Ping timeout: 268 seconds]
Xal has quit [Ping timeout: 256 seconds]
Xal has joined #lisp
pragmaticmonkey has quit [Ping timeout: 260 seconds]
fikka has joined #lisp
schoppenhauer has quit [Ping timeout: 268 seconds]
schoppenhauer has joined #lisp
<Pixel_Outlaw>
iqubic, for what it's worth there is #lispgames where a bunch of weirdos hang out.
<Pixel_Outlaw>
A few game engine options for you to choose from for that kind of simple case.
<Pixel_Outlaw>
Sorry for the plug, I'm just one of the weirdos over there now. :)
sz0 has joined #lisp
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
proteanthread has quit [Ping timeout: 264 seconds]
Bike has quit [Quit: Lost terminal]
Tobbi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
patche has quit [Quit: Lost terminal]
red-dot has joined #lisp
wxie has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
<aeth>
a 2048 clone should be very easy to do in Lisp
<aeth>
Anything that's abstract, non-realtime 2D can be written many, many ways. Efficiency isn't really an issue
<aeth>
And if you don't really have physics, that's a major plus. That makes things much easier.
wxie has quit [Remote host closed the connection]
fikka has quit [Ping timeout: 248 seconds]
fikka has joined #lisp
<aeth>
Think of game design like a graph. The x axis is similarity to an MMOFPS. The y axis is similarity to Dwarf Fortress. Difficulty to implement is roughly how far that game is from 0. 2048 is pretty close to 0 on that graph.
FreeBirdLjj has joined #lisp
<aeth>
(And DF-style complexity would be much easier to write in CL than MMOFPS-style complexity.)
Pixel_Outlaw has quit [Quit: Leaving]
aking has joined #lisp
aking has left #lisp [#lisp]
ineiros has quit [Ping timeout: 255 seconds]
pierpa has quit [Quit: Page closed]
<iqubic>
Does Lisp have support for global variable?
damke_ has joined #lisp
damke has quit [Ping timeout: 264 seconds]
<aeth>
iqubic: Yes, but Lisp's global variables are special
<aeth>
Lisp's local variables are (by default) lexically scoped. They behave like you expect in most programming languages. Lisp's global variables are dynamically scoped (unless constant or implementation-specific). This is rare in languages these days.
<iqubic>
I don't know what dynamic scope means?
<iqubic>
I don't the difference between dynamic and lexical scoping in lisp
<aeth>
Dynamic scoping basically means that the variable refers to the most recent binding. So if you do (let ((*standard-output* some-new-stream)) (format t "Hello, world!~%")) it will print to some-new-stream even though you told format to use t (i.e. *standard-output*)
<aeth>
That's because you don't have to pass the variable in, it checks the most recent binding
<iqubic>
So dynamic scoping let's you shadow existing variables?
<aeth>
The advantages of dynamic scoping are: (1) it's easy to implement, (2) you don't have to pass the variable deep down the call stack (so you could redefine *standard-output* at the start of your program and it will go to the right spot every time you say format t)
<iqubic>
Yeah. I get what you mean.
<aeth>
The disadvantages are: (1) it's slower (the compiler has less information because it's dynamic), (2) it often doesn't do what you want and it makes things harder to understand (you never actually know for sure where format t will print, especially in a multi-threaded application)
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
<iqubic>
So what is lexical scoping now?
red-dot has joined #lisp
<aeth>
lexical scoping deals with the concept of environments
<aeth>
You essentially go backwards up a list of environments, looking for the first one that defines foo
<aeth>
up to the global environment
<iqubic>
How does that differ from dynamic scoping?
<aeth>
here's an example of lexical scoping: (let ((foo 42)) (let ((foo 7)) (print foo)) (print foo))
<iqubic>
Let me guess. First 7 is printed, then 42?
<aeth>
right
<aeth>
here's another example of lexical scoping: (let ((foo 42)) (let ((bar 7)) (print foo)) (print foo))
<aeth>
it doesn't see foo in the bar environment, so it uses foo in the outer environment this time
<aeth>
s/the bar environment/the environment that only contains bar/
<iqubic>
So 7 is printed twice?
<aeth>
right
<aeth>
Actually, in this example, the same thing would happen with lexical and dynamic scoping
<aeth>
(I think)
<iqubic>
yeah.
<aeth>
But the way they look things up is different
<aeth>
(let ((foo 42)) (defun foobar () foo))
<aeth>
This creates a closure. Because the only function retrieves the value and no function sets the value, the compiler can turn this into a function that constantly returns 42.
<aeth>
This is very nice to have.
<aeth>
Let's do the same thing with a local special variable (even though special variables in CL are normally global, and you'll see why): (let ((*foo* 42)) (declare (special *foo*)) (defun barfoo () *foo*))
<aeth>
First note that barfoo cannot efficiently be compiled to return the constant 42
<aeth>
Now try to call barfoo
ebzzry has quit [Ping timeout: 246 seconds]
<aeth>
(The *foo* convention is just so we know that they're special, btw. Your compiler might warn you if special variables do not have *s on either side.)
<iqubic>
I'm not sure what that will do.
ebzzry has joined #lisp
<aeth>
Try it in a REPL. Lisp is best learned that way.
<aeth>
If you don't have a REPL available I can tell you what happens
<iqubic>
*foo* is unbound. I get an error trying to call that function.
arquebus has joined #lisp
<aeth>
right
<iqubic>
Why the hell is that?
<aeth>
It bound *foo* to 42 but *foo* only existed within that dynamic scope and no longer exists
<aeth>
That's one reason why dynamic/special variables are probably not what you want most of the time.
<aeth>
You probably want something like foobar, that constantly returns 42.
<iqubic>
How can I tell if a variable is dynamic vs lexical?
<aeth>
Let's get rid of the error with a global: (defparameter *foo* 7) (let ((*foo* 42)) (declare (special *foo*)) (print *foo*) (defun barfoo () *foo*)) ; I added a side effect print statement so you can see that *foo* is 42 inside the let
<aeth>
iqubic: By convention (and your compiler might warn if it violates the convention) special variables (the CL term for dynamic variables) always have the earmuffs
<aeth>
That's how *foo* differs from foo
<aeth>
If you don't do this, you're going to be surprised one day.
<aeth>
iqubic: Do you think the second (barfoo) will return 7 or 42?
Kevslinger has quit [Quit: Connection closed for inactivity]
<iqubic>
I thought it was going to be 42.
<iqubic>
But it returns 7
<iqubic>
The print statement and the barfoo return value are different.
<aeth>
the print statement is within the let. If you did a (print (barfoo)) after you define barfoo, it will also be 42.
<aeth>
But once you're outside of the let, (barfoo) is looking at the global *foo*, it doesn't remember the environment it was defined in. It looks at a dynamic environment.
<iqubic>
But the defun is also inside the let.
<aeth>
You almost always want lexical variables.
<iqubic>
Is the defun inside the let too?
<aeth>
iqubic: Here, let me help you. Closures are what we're talking about. Another name for "closure" is "lexical closure".
<iqubic>
I don't know what a closure is.
<aeth>
The alternative name might help explain why foobar works as expected. It's using a lexical variable.
<aeth>
iqubic: This is a closure: (let ((foo 42)) (defun foobar () foo))
<aeth>
If you really want to have fun, let's play with this version: (let ((foo 42)) (defun foobar () foo) (defun foobar+1 () (incf foo)))
<aeth>
This was a major selling point of Lisp for a long time until everyone started copying it.
<aeth>
Note, though, that closures require the lexical variables to work. The normal ones, without the earmuffs.
<iqubic>
How the heck does that closure thing work?
<aeth>
It remembers the environment in which the function was created. This works for all functions, even anonymous (lambda) ones.
<iqubic>
The foobar+1 function is what I'm talking about.
<aeth>
Both functions remember the same environment.
<aeth>
Both refer to the foo in that environment because there's no foo in the local environment of either function.
<iqubic>
So both functions are defined inside the same let environment?
<aeth>
So they refer to the same foo, which is remembered
<aeth>
Yes.
<aeth>
You can even do it with anonymous functions instead of globally
<iqubic>
slime even warns me that (foo 1) is never used.
<aeth>
Everything is nice and contained, and you shouldn't have any surprises when working with lexical variables.
<aeth>
I mean, it might be a bit surprising that foo increments, but not too surprising if you look at the whole environment
<iqubic>
Yeah, that does what I want.
<iqubic>
yeah. Calling foobar+1 a couple times, then calling foobar shows a number bigger than 42.
<iqubic>
42 being the starting value of foo.
Oladon has joined #lisp
<aeth>
So it has to be at least 42.
<aeth>
iqubic: What do you think would happen if you incremented foo 50 quintillion times?
<iqubic>
Stack overflow?
<aeth>
Try it yourself with this shortcut: (+ (* 50 (expt 10 18)) 42)
<iqubic>
What should I call?
<aeth>
That should work in the REPL by itself
<aeth>
If you're correct, that should similarly stack overflow, instead of producing fifty quintillion forty-two
<aeth>
(or, integer overflow, actually)
<iqubic>
Nope. I get fifty quintillion forty-two
<iqubic>
Now, how long would it take to call foobar+1 that many times?
<aeth>
You can do this if you want to verify that it will hold in our other case: (let ((foo 42)) (defun foobar () foo) (defun foobar-inc (x) (incf foo x))) (foobar-inc (* 50 (expt 10 18))) (foobar)
<aeth>
That will save you time.
<iqubic>
Yup. That works.
<iqubic>
Nothing confusing about that.
<aeth>
In Common Lisp, integers are the mathematical integer. The efficient representation is called a fixnum and the inefficient representation is called a bignum. You will be able to go as large as you have memory.
<aeth>
If the compiler knows that it will stay a fixnum, it will be just as efficient as C. If you forget to do this, at least you still have an integer of some sort.
<iqubic>
That's wild.
<aeth>
In the foobar example, you probably want an integer and not a fixnum. So that's what you get.
<iqubic>
Yeah.
<iqubic>
So closures are cool.
<iqubic>
Have any other cool closure demonstrations for me? Or was that it?
<aeth>
Most cool uses of closures use anonymous functions, called lambda. That way, you don't have to do everything globally.
<aeth>
Do you know about lambdas yet?
<iqubic>
I know what a lambda is.
<iqubic>
they show up in just about any modern programming language.
<aeth>
If you don't give it an argument, it will be 42
<aeth>
You can make it more robust like this: (defun foo (&optional (foo 42)) (check-type foo integer) (values (lambda () foo) (lambda (&optional (x 1)) (incf foo x))))
<aeth>
Now you know it'll always be something incrementable
<aeth>
You can bind both functions with multiple-value-bind. You can call these functions with funcall. You can do something like this now: (multiple-value-bind (foobar foobar-inc) (foo 42) (funcall foobar-inc) (funcall foobar))
<aeth>
I wish we still had lisp paste because line breaks probably would help here now that things are getting more complicated.
<iqubic>
So what did that first defun do.
<iqubic>
the one that defined foo.
<aeth>
The first defun is the same as the second, except the second also checks that foo is an integer, so the user doesn't give it a bogus value
Xal has quit [Ping timeout: 256 seconds]
<iqubic>
How does that first thing work then?
smasta has quit [Ping timeout: 268 seconds]
<aeth>
The defun creates an environment with foo, just like our let, except it lets you define it
<iqubic>
How do I call the functions in the environment?
<aeth>
You can say (foo 37) or (foo -2)
rippa has joined #lisp
<iqubic>
but how do I increment that value?
<aeth>
Common Lisp has multiple namespaces. That's why both the function and the variable can use the name foo. That means, though, that to call the anonymous functions you just created, you need to use funcall to tell it to treat a variable namespaced thing like a function
<aeth>
So you now have to (funcall foobar-inc) instead of (foobar-inc)
<aeth>
You also have to define them somewhere.
<aeth>
That's what the multiple-value-bind is for. There are two return values because there are two functions. It's just like let, except it defines it from multiple return values, e.g. this foo will start at -1: (multiple-value-bind (foobar foobar-inc) (foo -1) (funcall foobar-inc) (funcall foobar))
<aeth>
If you don't like multiple return values you can always put them in a list, vector, standard-object, struct, hash-table, etc. of course.
<aeth>
Functions are first class here.
<iqubic>
But it doesn't return the foo environment does it?
<iqubic>
the multiple-value-bind thing.
<aeth>
The foo environment is stored away in some place that foobar and foobar-inc (formerly anonymous functions, now named) can access
<aeth>
So you're emulating objects with functions.
<aeth>
(You don't have to do this. Common Lisp has an object system.)
<aeth>
The function foo should probably be called make-foo because it's making our foo.
<iqubic>
but once I make a foo thing, I can no longer seem to call the functions related to foo.
<aeth>
You need to bind them somehow in order to name them
<iqubic>
How can I do taht?
<aeth>
There are several ways to get multiple values.
<iqubic>
multiple-value-bind didn't seem to work.
<aeth>
One is multiple-value-bind. Another is multiple-value-list, e.g. (multiple-value-list (foo))
<iqubic>
Yeah, there's a book shop near me that specializes in technical books like this.
<iqubic>
I've seen that on their shelves before.
<aeth>
Afaik, it's very advanced.
<iqubic>
But there was no let in your foo maker though.
<aeth>
iqubic: The defun implicitly has a let
<aeth>
or at least, you can think of it that way
<aeth>
multiple-value-bind is the same way
<aeth>
They create environments just like let would.
<iqubic>
So your point is making a closure around a lambda/
<iqubic>
That's the key point?
<aeth>
yes
<aeth>
let itself can be defined in terms of a lambda, actually!
<iqubic>
Closures are really cool.
<iqubic>
Is let a macro in lisp?
<aeth>
yes, I think
<aeth>
It's probably handled specially, but in some Schemes, let might be defined as a macro over lambda.
<phoe>
LET isn't a macro.
<phoe>
It's a special form.
<phoe>
But an implementation is permitted to implement it as a macro, AFAIK.
<iqubic>
For built in stuff I don't care whether a thing is a function, macro, or special form, because they all work mostly the same.
<beach>
phoe: Correct.
<iqubic>
However when writting I'll need to know the distiction.
<beach>
phoe: "special operator" is more accurate. A form like (LET ...) is a special form.
<aeth>
iqubic: Roughly: (funcall (lambda (x) (format t "~D~%" x)) 42) <=> (let ((x 42)) (format t "~D~%" x))
<aeth>
iqubic: In some Schemes, the Scheme equivalent of that might be exactly true. I'm sure someone here can tell me why that's not exactly true in CL.
<iqubic>
Yeah, I get that.
<aeth>
Only one form is strictly necessary if you're into minimalism
<aeth>
CL people are more into efficiency than minimalism, though
fikka has joined #lisp
<phoe>
beach: thanks.
<aeth>
iqubic: multiple-value-bind actually uses a very similar principle in its implementation, except with multiple-value-call instead of funcall.
<aeth>
At least in SBCL, it's implemented this way.
<iqubic>
I'm not too worried about the differences.
<aeth>
It multiple-value-calls a lambda to produce essentially the same result as a let
<aeth>
It lets you do this to do partial function application: (mapcar (alexandria:curry #'+ 10) (list 1 2 3 4 5)) => (11 12 13 14 15)
<iqubic>
How could you do that without curry?
<iqubic>
Isn't that like partial function application?
<aeth>
It lets you do this to do partial function application: (mapcar (lambda (x) (+ x 10)) (list 1 2 3 4 5)) => (11 12 13 14 15)
<iqubic>
I see how that works.
<aeth>
curry just creates the lambda for you and makes it a lot more concise (especially if you import curry so you don't see the prefix)
<iqubic>
That's basically just a simple let over lambda.
smasta has joined #lisp
<phoe>
yep
<phoe>
or rather, just lambda. no let required there.
<phoe>
since you are not closing over any variables. 10 is constant in there.
<aeth>
well, it's the implicit arguments again
<aeth>
a lot of the time the let is just not there
<iqubic>
Why is the function called mapcar, and not just map?
<aeth>
you can use the function arguments
<phoe>
iqubic: MAP is another function.
<aeth>
iqubic: map works on all sequences, mapcar only works on lists and returns a list
<aeth>
(map 'list ...) is roughly equivalent
<aeth>
Except you're able to use any sequence with map, even if the result type is a list
<phoe>
MAPCAR works on lists, applying the function to each CAR of the list. hence, MAP-CAR.
holycow has joined #lisp
smasta has quit [Ping timeout: 246 seconds]
<aeth>
The worst part about CL is the names. CL chose to be compatible with much older Lisps rather than break compatibility (Scheme broke compatibility). But, hey, I'll take ugly names over many other flaws a language could have.
<aeth>
And ugly names are probably better than not being compatible with older software, too.
<aeth>
Whenever there was a design decision CL chose the uglier, more practical decision. It's designed for industrial use.
<aeth>
Most of the names are fine, but some older things (including mapcar) don't really follow the language's idiomatic naming style because they predate it.
makomo has joined #lisp
Arcaelyx has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Shinmera>
CL didn't choose to be compatible. Compatibility is the reason it exists.
<phoe>
so it chose to exist
<beach>
A wise choice.
damke has joined #lisp
<phoe>
...for some reason, I wanted to google "a wise choice".
<beach>
Well, typically you would create the CALL-NEXT-METHOD function on the fly.
<beach>
And you would turn the applicable methods into an effective method which is a function that needs to be created at runtime.
<phoe>
You need to build the lists of methods in most-specific order anyway, right?
<beach>
Right.
<phoe>
Your CALL-NEXT-METHOD may simply invoke a method that is found via some dynamic variable.
<beach>
Exactly my thinking.
<beach>
So call-next-method would be a global function.
<phoe>
If you have no compiler, then it would need to be.
<phoe>
Because I think that you need a compiler to create local functions in methods.
<phoe>
...or do you?
<beach>
As long as the code is static, I don't need the compiler at runtime.
<phoe>
If you know that you will want to have a CALL-NEXT-METHOD local function, then you can take a step back and, whenever you compile the methods, simply force them to have an ignorable local function CALL-NEXT-METHOD that refers to some dynamic variable and expects it to be bound.
<beach>
So I can create a closure from some compiled code, no problem.
<phoe>
So CALL-NEXT-METHOD does not need to be a global function.
<phoe>
That's what I understand, at least.
<beach>
That might work, but it is OK if it is global.
<phoe>
Okay.
<beach>
It is only for bootstrapping.
<phoe>
Ooh. In this case, choose the simplest solution.
Karl_Dscc has quit [Remote host closed the connection]
<beach>
Related question: Suppose I have a (possibly empty) list of :BEFORE methods, a (possibly empty) list of :AFTER methods, a (possibly empty) list of :AROUND methods, and a (possibly empty) list of primary method. Can I, without any other information, always know what to do when call-next-method is called?
<beach>
I am thinking this:...
<phoe>
If it's for bootstrapping, the end user will not be able to notice that they have a function that is global but should have been local.
<phoe>
beach: let's look at the algorithm,n.
<beach>
1. If the list of :AROUND methods is not empty, pop the first one off and call it.
<beach>
2. If the list of :AROUND methods is empty, but the list of :BEFORE methods is not, then call all the :BEFORE methods in that order, and then set the list to '().
Folkol has quit [Max SendQ exceeded]
<beach>
3. If the list of :BEFORE methods is also empty, but the list of primary methods is not, then pop the first primary method off and call it.
<phoe>
The algorithm in CLHS seems well-defined. Your code should be able to always guess what to do next.
<beach>
Yes, but I am thinking about how to do it without remembering what I just did.
<beach>
4. If the list of primary methods is also empty, but the list of :AFTER methods is not, then call the methods on the list in that order.
<beach>
Ah, no, that's wrong.
<Shinmera>
c-n-m with no next method should error
<phoe>
You need to call the most specific primary method.
<beach>
Yes, yes.
<phoe>
If the list is empty, you need to call NO-NEXT-METHOD
<beach>
But I think I can find something that works.
<phoe>
I think so, too.
<Shinmera>
You need to call after once the primary method returns.
<beach>
Yes, absolutely.
<beach>
Right.
<Shinmera>
So call them in the same line as the :before s
Folkol has joined #lisp
<beach>
I think it is doable.
<phoe>
Let's assume that you have *PRIMARY-METHODS* that holds the list of all primary methods for a function.
<beach>
Sounds good.
<phoe>
grab the CAR of this list, rebind the variable to the CDR, call the method-function of the CAR.
<phoe>
This way, CALL-NEXT-METHOD may refer to the next method by grabbing the CAR of *PRIMARY-METHODS*.
<phoe>
And so on, and so on.
<beach>
Yes, but you need to take the auxiliary methods into account as well.
<beach>
But I think I can do it.
<phoe>
Auxiliary? What do you mean?
<beach>
non-primary.
<beach>
Isn't that the term?
<phoe>
You don't need to care about the :BEFORE and :AFTER ones, they're called elsewhere.
<phoe>
You only need to care about :AROUND, I think.
<phoe>
CALL-NEXT-METHOD can check on *AROUND-METHODS* if the CAR of this list "matches" the CAR of *PRIMARY-METHODS*.
<phoe>
"Matches", I mean, the specialization.
<phoe>
If yes, it calls the :AROUND method; if not, it calls the primary method.
<phoe>
I actually wonder if you can do a trick like that...
kajo has joined #lisp
<phoe>
Let's assume you have methods FOO, BAR, BAZ, QUUX, in this order of specificness.
<phoe>
BAR and BAZ have :AROUND methods.
<phoe>
Can your *PRIMARY-METHODS* look like:
<beach>
phoe: You are speaking nonsense.
<phoe>
wait.
<phoe>
am I?
<beach>
phoe: Start with all the applicable methods.
<beach>
some of which are primary, some of which are auxiliary. No :AROUND method is attached to another method.
knicklux has joined #lisp
fikka has joined #lisp
<beach>
OK, let me see if I can get it right this time...
<phoe>
Yes.
<phoe>
Auxiliary methods in the standard method combination are :BEFORE, :AFTER, :AROUND.
<beach>
Given four lists *AROUND-METHODS* *BEFORE-METHODS* *PRIMARY-METHODS* and *AFTER-METHODS*...
<beach>
To invoke the effective method, I actually call the global function CALL-NEXT-METHOD, and that one does the following...
<beach>
1. If *AROUND-METHODS* is not empty, it pops off the first one and calls it.
<beach>
2. If *AROUND-METHODS* is empty, it calls all the methods in *BEFORE-METHODS*, then sets that list to the empty list, pops the first primary method off and calls it.
<Shinmera>
beach: You have to check whether there's a primary method at all first, and if not, error.
<beach>
Sure, fine.
<phoe>
Shinmera: s/error/call NO-NEXT-METHOD/
<beach>
3. If both *AROUND-METHODS* and *BEFORE-METHODS* are empty, then if *PRIMARY-METHODS* is empty, then error.
nirved has joined #lisp
<Shinmera>
phoe: Right
<phoe>
beach: actually it's a bit more complicated. There can be :BEFORE and :AFTER methods.
<beach>
4. If *PRIMARY-METHODS* has a single entry on it, then pop it off, call it, and then call all the methods in *AFTER-METHODS*.
fikka has quit [Ping timeout: 240 seconds]
<beach>
phoe: I just took that into account.
<beach>
I hope.
<phoe>
But if there is no primary method when there are after/or before methods, then it is an error.
<phoe>
(defmethod foo :before ()) (foo) is an error if there's no (defmethod foo ()).
<beach>
Since this is bootstrapping, we can assume that the code is correct, so that CALL-NEXT-METHOD is not called unless it is allowed.
<phoe>
Okay. Good.
<beach>
I think it works.
<beach>
It will be slow, but it will work.
<phoe>
> 4. If *PRIMARY-METHODS* has a single entry on it,
<phoe>
It doesn't need to have a single entry.
<phoe>
It must simply be non-empty.
<beach>
Correct, but if it has a single entry, it is the last one, so the after methods should be called.
<beach>
Hmm, yes, there is something fishy there.
<phoe>
You don't call *all* primary methods though.
<phoe>
Only the most specific one.
<beach>
Yes, yes. I need to think a bit more.
<phoe>
You only call the first one - it is the method itself that may call next methods if it wants to.
<phoe>
You pop the first element from *PRIMARY-METHODS* and call it.
<phoe>
If the method wants to call more, then it must invoke CALL-NEXT-METHOD inside its body.
<beach>
When it returns, call the after methods.
wxie has joined #lisp
<phoe>
Yes.
<beach>
right.
<beach>
I think I can figure it out from here.
red-dot has joined #lisp
<beach>
Thanks for the help phoe and Shinmera.
<beach>
Amusing little problem.
<phoe>
No problem! Hope that I helped more than I confused things.
<phoe>
Hm?
<beach>
It always helps to see more angles of the problem.
fikka has joined #lisp
wigust has joined #lisp
<beach>
Anyway, lunchtime. I'll be back later.
<phoe>
Bon appetit!
random-nick has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
shka has joined #lisp
<pjb>
aeth: the best thing in CL are the names! If you're not happy with them, you can define your own in your own package! (:use "AETH-LISP") !
<aeth>
pjb: I'd considering doing it, but just for the arithmetic.
<aeth>
pjb: thanks to specialization-store we now have a (semi-portable) way to easily define type-generic functions on numbers and sequences that behave like #'+ and #'map
<aeth>
Which means arithmetic functions could be defined to support inline sequence functions and hopefully have no performance penalty with the existing arithemtic functions!
<aeth>
stuff like (* scalar matrix)
<aeth>
or (* matrix vector)
quazimodo has quit [Ping timeout: 265 seconds]
<aeth>
It might be very tricky to do that with more than two arguments, though
d4ryus1 is now known as d4ryus
jfb4 has quit [Ping timeout: 256 seconds]
<pjb>
Well arithmetic with more than two arguments has the inconvenient that the dispatch has to be done by analysing the whole argument list types.
fikka has joined #lisp
<aeth>
I think another problem is that arithmetic with vectors/matrices would cons heavily unless there was something fancy going on.
<pjb>
Well, AFAIK the standard would allow (reduce op arguments), but you'll get more precise results by sorting out the arguments.
jfb4 has joined #lisp
<aeth>
(Also, matrices would have to be represented with 2D arrays, not sequences, or else there's no way to tell them apart from vectors, at least as I just described things.)
damke has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
damke_ has quit [Ping timeout: 264 seconds]
knicklux has quit [Quit: Leaving]
knicklux has joined #lisp
fikka has joined #lisp
thijso has joined #lisp
<aeth>
pjb: I think you just pointed out why this wouldn't work, though. Argument lists can be as close to infinite as 64-bits allows (probably the most positive 63-bit fixnum value)
<aeth>
reduce could work but it wouldn't be interesting/efficient.
fikka has quit [Ping timeout: 246 seconds]
damke has quit [Ping timeout: 264 seconds]
damke has joined #lisp
damke_ has joined #lisp
quazimodo has joined #lisp
damke has quit [Ping timeout: 264 seconds]
lnostdal has joined #lisp
damke has joined #lisp
lnostdal has quit [Max SendQ exceeded]
lnostdal has joined #lisp
fikka has joined #lisp
damke_ has quit [Ping timeout: 264 seconds]
safe has quit [Read error: Connection reset by peer]
lambda9 has joined #lisp
varjag has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Achylles has joined #lisp
scymtym has quit [Ping timeout: 256 seconds]
jfb4 has quit [Ping timeout: 240 seconds]
jfb4 has joined #lisp
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
red-dot has joined #lisp
markong has joined #lisp
fikka has joined #lisp
Lord_of_Life has quit [Changing host]
Lord_of_Life has joined #lisp
Lord_of_Life has joined #lisp
scymtym has joined #lisp
fikka has quit [Ping timeout: 256 seconds]
fikka has joined #lisp
lambda9 has quit [Ping timeout: 240 seconds]
fikka has quit [Ping timeout: 246 seconds]
pagnol has joined #lisp
EvW has joined #lisp
fikka has joined #lisp
Tobbi has joined #lisp
FreeBirdLjj has quit [Remote host closed the connection]
fikka has quit [Ping timeout: 256 seconds]
FreeBirdLjj has joined #lisp
wxie has quit [Remote host closed the connection]
fikka has joined #lisp
random-nick has quit [Remote host closed the connection]
FreeBirdLjj has quit [Ping timeout: 240 seconds]
xfwduke has joined #lisp
fikka has quit [Ping timeout: 268 seconds]
FreeBirdLjj has joined #lisp
ebzzry has quit [Ping timeout: 256 seconds]
void_pointer has joined #lisp
FreeBirdLjj has quit [Ping timeout: 260 seconds]
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
fikka has joined #lisp
red-dot has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
FreeBirdLjj has joined #lisp
dddddd_ has joined #lisp
random-nick has joined #lisp
dddddd has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Ping timeout: 248 seconds]
dddddd_ is now known as dddddd
FreeBirdLjj has joined #lisp
xfwduke has quit [Remote host closed the connection]
heurist has quit [Ping timeout: 246 seconds]
solyd has quit [Quit: solyd]
FreeBirdLjj has quit [Ping timeout: 240 seconds]
heurist has joined #lisp
fikka has joined #lisp
Oddity has quit [Ping timeout: 248 seconds]
JuanDaugherty has joined #lisp
ebzzry has joined #lisp
fikka has quit [Ping timeout: 256 seconds]
fikka has joined #lisp
FreeBirdLjj has joined #lisp
Kevslinger has joined #lisp
SAL9000 has quit [Ping timeout: 240 seconds]
shifty has quit [Ping timeout: 268 seconds]
dxtr has quit [Quit: leaving]
fikka has quit [Ping timeout: 246 seconds]
SAL9000 has joined #lisp
FreeBirdLjj has quit [Ping timeout: 240 seconds]
pagnol has quit [Remote host closed the connection]
zazzerino has joined #lisp
EvW has quit [Ping timeout: 246 seconds]
SAL9000_ has joined #lisp
SAL9000 has quit [Ping timeout: 268 seconds]
zazzerino has quit [Remote host closed the connection]
milanj has quit [Quit: This computer has gone to sleep]
fikka has joined #lisp
pedh has joined #lisp
FreeBirdLjj has joined #lisp
dieggsy has joined #lisp
zazzerino has joined #lisp
fikka has quit [Ping timeout: 256 seconds]
Bike has joined #lisp
FreeBirdLjj has quit [Ping timeout: 248 seconds]
dented42 has joined #lisp
FreeBirdLjj has joined #lisp
fikka has joined #lisp
FreeBirdLjj has quit [Ping timeout: 246 seconds]
fikka has quit [Ping timeout: 246 seconds]
DeadTrickster has quit [Read error: Connection reset by peer]
milanj has joined #lisp
pedh has quit [Quit: pedh]
fikka has joined #lisp
pedh has joined #lisp
<flip214>
using CLON for argument parsing I came upon this problem: a STROPT (say, "-l") has value NIL if the cmdline argument has a "-" in front.
<flip214>
Eg. "-l -1" means NIL, while "-l-1" works as expected.
<flip214>
Is that on purpose? Can I tell CLON that the string "option" isn't optional but required?
<flip214>
My use case is getting an integer from the command line - but negative values don't work so well, as you can see.
fikka has quit [Ping timeout: 260 seconds]
FreeBirdLjj has joined #lisp
fikka has joined #lisp
brendyn has quit [Ping timeout: 256 seconds]
lnostdal has quit [Ping timeout: 246 seconds]
pagnol has joined #lisp
fikka has quit [Ping timeout: 260 seconds]
<JuanDaugherty>
funny that there are 3 clons
FreeBirdLjj has quit [Ping timeout: 256 seconds]
fikka has joined #lisp
quazimodo has quit [Ping timeout: 240 seconds]
lanu has joined #lisp
<JuanDaugherty>
(aware you mean the 'option nuker')
lanu has quit [Client Quit]
<jackdaniel>
it should be just "l" for stropt, clon does recognize - convention
fikka has quit [Ping timeout: 246 seconds]
<jackdaniel>
so (getopt :short-name "l" :long-name "long-flag")
<jackdaniel>
will pick either -l or --long-flag
<jackdaniel>
flip214: ↑
lnostdal has joined #lisp
<flip214>
jackdaniel: no, the problem is that passing "-l -1" on the command line looks like the two options "-l" and "-1" to CLON
<flip214>
so I can't easily pass in negative numbers
<jackdaniel>
ah. what about --long-option=-3 ?
lnostdal has quit [Max SendQ exceeded]
<flip214>
jackdaniel: yeah, of course, if the user is reading the documentation.
lnostdal has joined #lisp
<flip214>
but I'm worried that "-l 1" works, "-l1" works, "-l-1" works, but "-l -1" doesn't.
<flip214>
that's too irregular for me.
<jackdaniel>
I'd have to dig the clon manual to check this up
<jackdaniel>
you have to make option argument value mandatory
<jackdaniel>
if you don't want to be forced to "stick it"
Bike has quit [Ping timeout: 256 seconds]
<jackdaniel>
afk for a while (sorry)
FreeBirdLjj has joined #lisp
lnostdal has quit [Ping timeout: 248 seconds]
<flip214>
thanks for the pointer, found :ARGUMENT-TYPE :MANDATORY
makomo has quit [Quit: WeeChat 1.9.1]
fikka has joined #lisp
makomo has joined #lisp
wmannis has joined #lisp
FreeBirdLjj has quit [Ping timeout: 240 seconds]
makomo has quit [Client Quit]
ckonstanski has joined #lisp
makomo has joined #lisp
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
fikka has quit [Ping timeout: 260 seconds]
orivej has joined #lisp
makomo has quit [Client Quit]
makomo has joined #lisp
lnostdal has joined #lisp
fikka has joined #lisp
makomo has quit [Client Quit]
makomo has joined #lisp
solyd has joined #lisp
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fikka has quit [Ping timeout: 268 seconds]
KZiemian has joined #lisp
pedh has quit [Quit: pedh]
<KZiemian>
hello world
<KZiemian>
in comments in one lisp file I find
<KZiemian>
"A STRING represents leaf data"
<KZiemian>
what is a leaf data?
<phoe>
KZiemian: which file?
<KZiemian>
ccldoc representantion.lisp
sonologico has quit [Quit: WeeChat 1.9.1]
<phoe>
KZiemian: I think rme on #ccl will be able to answer better
<phoe>
he knows the ccldoc internals.
<KZiemian>
phoe: I just need to know what leaf data mean in general
<KZiemian>
basic data?
<KZiemian>
most primitive type?
<phoe>
KZiemian: I think it refers to data stored in a tree structure, where you have nodes that can point to other nodes without cycles, and leaves are the nodes that do not point to anything.
<KZiemian>
yes, that make perfect sens
<KZiemian>
thank you!
fikka has joined #lisp
red-dot has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
pmetzger has joined #lisp
antismap has joined #lisp
lnostdal has quit [Read error: Connection reset by peer]
<phoe>
i do not require much from it though, to me, it's a pretty nice SBCL installer. (:
<pagnol>
zazzerino, ah thanks!
pedh has joined #lisp
pedh has quit [Client Quit]
solyd has joined #lisp
mepian has joined #lisp
solyd has quit [Client Quit]
<pagnol>
phoe, so apparently you used this library yourself in the past?
<phoe>
pagnol: (:
<phoe>
I *tried* using it.
<pagnol>
ah, so this issue actually prevented you from using it?
whoman has quit [Ping timeout: 240 seconds]
<phoe>
yep. AFAIK there are workarounds, look on the github page of the project, in the issues.
<zazzerino>
Looks like an interesting library. I tried loading it in quicklisp and have the exact same issue (quickload hanging while loading [package lisp-binary]. Sorry, I don't have a solution, but it's not just your machine!
lnostdal has joined #lisp
<zazzerino>
Also, looks like the main dev opened an issue about a month ago with the title "Dependencies are fucked" lol
<pagnol>
I saw this issue too
<phoe>
zazzerino: it's not QL hanging. It's SBCL running out of heap space while compiling it.
<phoe>
(AFAIK)
makomo has quit [Quit: WeeChat 1.9.1]
<pagnol>
and apparently it was removed from quicklisp
<phoe>
yes, because of this.
<pagnol>
ah
fikka has joined #lisp
<pagnol>
duh
<zazzerino>
phoe: yeah, I think you're right. I just meant "ql:quickload" was the function I was running to load the library (which was in my local-projects dir)
<phoe>
yep.
nika has joined #lisp
milanj has quit [Quit: This computer has gone to sleep]
fikka has quit [Ping timeout: 264 seconds]
nika has quit [Ping timeout: 246 seconds]
xristos has joined #lisp
<iqubic>
What's going on here guys?
xristos is now known as Guest36652
warweasle has joined #lisp
Guest36652 is now known as xristos`
xristos` is now known as xristos
xristos has quit [Changing host]
xristos has joined #lisp
milanj has joined #lisp
<pagnol>
nice... with sbcl 1.4.3 I get the exact same error
<zazzerino>
maybe try ccl? if you've installed roswell it should be as easy as "ros install ccl" and I think "ros use ccl"
<beach>
iqubic: What do you mean?
fikka has joined #lisp
wmannis has quit [Quit: wmannis]
Achylles has quit [Ping timeout: 256 seconds]
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
dieggsy has quit [Remote host closed the connection]
solyd has joined #lisp
<ebzzry>
I’m curious, do people actually use COMPLEMENT?
red-dot has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
<beach>
No. :)
whoman has joined #lisp
<beach>
ebzzry: When it looked like the xxx-if-not family was going to be removed (because of being deprecated) complement would have been more useful. But then, most people now agree that they are undeprecated.
<ebzzry>
Hm. I thought the same. I got reminded by it because of :test and :test-not.
Oddity has joined #lisp
nika has joined #lisp
knicklux has quit [Quit: Leaving]
gargaml has joined #lisp
Arcaelyx has joined #lisp
Karl_Dscc has joined #lisp
<ebzzry>
Why is #'defmacro permitted in SBCL?
<phoe>
ebzzry: implementation-dependent
<phoe>
it is undefined.
<phoe>
so the implementation may do whatever it feels like.
fikka has joined #lisp
<phoe>
but #'foo where FOO is a macro is not standard Common Lisp.
<Xach>
phoe: not exactly!
<phoe>
Xach: gasp
<Xach>
An implementation may choose not to signal this error for performance reasons, but implementations are forbidden from defining the failure to signal an error as a useful behavior.
<Xach>
(quoting the spec)
<phoe>
oh, right. this one.
<ebzzry>
hm
Ven`` has joined #lisp
<ebzzry>
gcl segfaults with #'defmacro
<phoe>
don't use gcl
<phoe>
it's not even fully conformant.
fikka has quit [Ping timeout: 248 seconds]
EvW1 has quit [Ping timeout: 246 seconds]
<ebzzry>
what can you say about clasp?
<beach>
ebzzry: Ask drmeister.
<phoe>
or #clasp
<beach>
He would be the first one to know.
lnostdal has quit [Ping timeout: 248 seconds]
<ebzzry>
ok
lnostdal has joined #lisp
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Achylles has joined #lisp
Ven`` has joined #lisp
DeadTrickster has joined #lisp
<iqubic>
What is clasp?
<phoe>
Common Lisp implementation that aims for C++ interoperability.
<phoe>
#clasp will tell you more.
ssake has quit [Remote host closed the connection]
<pjb>
ebzzry: you have to distinguish two cases: #'foo where foo is a symbol exported from CL and #'foo where foo is not exported from CL.
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
red-dot has joined #lisp
<drmeister>
I'm writing allocation profiling code for Clasp - is it better to keep track of the total memory allocated or the number of allocations?
<drmeister>
It seems to me the number of allocations is more valuable - there's overhead associated with each allocation.
<drmeister>
I'll do them both.
Ven`` has joined #lisp
turkja has quit [Ping timeout: 268 seconds]
<Bike>
isn't the overhead pretty tiny?
<Colleen>
Bike: drmeister said 10 hours, 40 minutes ago: It was a very, very longstanding problem in the WITH-TRY macro when an exception bubbles up the stack.
<Colleen>
Bike: drmeister said 10 hours, 42 minutes ago: bclasp seems rock solid now - no more exception handling problems that I can see.
<Bike>
oh
<drmeister>
Hi Bike
GuilOooo has joined #lisp
<Bike>
hi
nowhere_man has quit [Ping timeout: 268 seconds]
nika has quit [Quit: Leaving...]
drewc_ has joined #lisp
knobo4 has joined #lisp
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DeadTrickster has quit [Ping timeout: 264 seconds]
drewc has quit [Ping timeout: 248 seconds]
Oladon has joined #lisp
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nowhere_man has joined #lisp
DeadTrickster has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
varjag has quit [Remote host closed the connection]
varjag has joined #lisp
Achylles has quit [Ping timeout: 240 seconds]
fikka has joined #lisp
khisanth_ has quit [Ping timeout: 260 seconds]
scymtym has quit [Ping timeout: 246 seconds]
fikka has quit [Ping timeout: 264 seconds]
fikka has joined #lisp
Achylles has joined #lisp
<pagnol>
phoe, may I ask what you were planning to use lisp-binary for initially?
chens``` has quit [Read error: Connection reset by peer]
<beach>
oisjdfoasidf: That code has several problems.
<beach>
oisjdfoasidf: What is result for instance?
<oisjdfoasidf>
I am brand new to lisp (coming from years of Python experience), and finding it very hard to get used to lisp. trying to write basic hangman game..
<beach>
oisjdfoasidf: It looks like a non-existing variable, and that is not allowed.
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
SpikeMaster has joined #lisp
red-dot has joined #lisp
scymtym has joined #lisp
<AeroNotix>
Shinmera: trial is completely unrelated to cepl?
<Shinmera>
Yes
<AeroNotix>
ok
fikka has joined #lisp
<Shinmera>
Why are you asking?
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.1)]
<AeroNotix>
Shinmera: Just asking. I see you and baggers chatting often (in his stream etc) and you are working on different but similar things. Just think it's interesting
<Shinmera>
Ah, sure.
<Shinmera>
Starting my gamedev stream in 30 minutes, by the way.
<AeroNotix>
Shinmera: oh I thought it already finished
<AeroNotix>
just meant that I prefer them to be a little faster
<Shinmera>
Sure, I can understand that.
<AeroNotix>
really making me want to write a little 2D game :)
<AeroNotix>
no experience with anything like this. I find CEPL tricky to just "get started" in it.
dented42 has joined #lisp
<AeroNotix>
I'd love to make some wicked 2d game mixing CL+Erlang
<AeroNotix>
multiplate
<AeroNotix>
multiplayer
<Shinmera>
Getting into graphics stuff is tough. There's a lot of crap to learn up front before you can get anything done.
<AeroNotix>
yeah exactly. I'm a proficient programmer and have been programming for years but there's something about graphics libraries that seem so daunting
<AeroNotix>
lots of terminology and extremely baroque libraries
fikka has quit [Ping timeout: 248 seconds]
<AeroNotix>
not that trial is, I'm more talking about the raw C libraries
<Shinmera>
Well, I'm sure Trial isn't easy to get into either
<Shinmera>
Mostly cause it's very unfinished and there's zero documentation
<AeroNotix>
haha, will check it out.
<AeroNotix>
It'd be good if for people's games libraries they literally made an example game which had you move a square inside a box.
<AeroNotix>
anyway, will check the stream and trial out tonight
<Shinmera>
So I don't know how helpful that would be. Honestly can't recommend anyone to get into it right now that doesn't want to just do engine work.
<AeroNotix>
Shinmera: thanks. Will check that out
SpikeMaster has quit [Quit: ERC (IRC client for Emacs 27.0.50)]
<aeth>
My nowhere-near-complete engine has an examples directory. I'm done developing the API when the examples are elegant. Very useful for me to have. I'm sure more complete projects have the same idea.
<AeroNotix>
It's amazing watching these streams, going from drawing a ground/wall tile to having it appear in a game and then loading up sprites that then shoot seems so simple. But you're clearly familiar with the API.
<AeroNotix>
aeth: why so many game engines :)
<Shinmera>
When the tooling works making games can be amazing.
<pjb>
NIH
warweasle has quit [Quit: Leaving]
<aeth>
AeroNotix: I started before anything existed. It just takes a very long time.
<AeroNotix>
aeth: understandable
<aeth>
Even now, maybe 2 or 3 are actually not under construction
<aeth>
(Probably 6 are unstable in their APIs)
<AeroNotix>
Shinmera: what are you streaming today?
<Shinmera>
AeroNotix: says so at the bottom of the event page
<aeth>
It's hard to tell what's out there because the line between library, framework, and engine is blurry
<AeroNotix>
Shinmera: my bad
<aeth>
Some engines are built on other engines, too
<AeroNotix>
aeth: it's not just a CL problem, there's TONNES of graphics libraries and related things to use. Kind of paralysing if you want to just jump into something
<AeroNotix>
idunno, just me citing other reasons for being lazy and not jumping in :)
pyx has joined #lisp
pyx has quit [Client Quit]
epony has quit [Read error: Connection reset by peer]
Oladon has quit [Quit: Leaving.]
<aeth>
AeroNotix: (1) It's complicated enough for many different abstractions to make sense but not complicated enough to seem impossible, (2) most things wind up being outdated and it's easier to NIH than to update an older library
<Shinmera>
I've always had the bad habit of writing more engine than application code, so here I am never getting any actual games out
<aeth>
But #2 mostly doesn't apply to Lisp. It only has a few heavily-outdated libraries. It explains a few things, though, like cl-glfw vs. cl-glfw3
<aeth>
(cl-glfw3 was probably easier for the author than updating the original)
attila_lendvai has joined #lisp
EvW has joined #lisp
<AeroNotix>
are there any popular games written in CL? E.g. something indie on steam
<aeth>
AeroNotix: dto has released many games on itch.io and ported at least one to Android
<Shinmera>
Other than that all I've produced were prototypes that never got anywhere
fikka has joined #lisp
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<aeth>
I intentionally don't release things, although I'm getting closer to 70% or so of a basic game (ignoring some ignorable things like sound for now). Anything released would become a maintenance nightmare if the API isn't final. I suspect many others are in a similar situation.
* jackdaniel
used binary-types succesfully in the past
<Xach>
I had a macro IN-ANONYMOUS-DIRECTORY that would make a temporary random directory, set *d-p-d* to that directory, evaluate a body, and then clean up the directory.
<AeroNotix>
Xach: are you going to say you accidentally rm -rf /?
<Xach>
but I had a typo and had something like (in-anonymous-directoryk (write-report *default-pathname-defaults*) (upload-report *default-pathname-defaults*)))
<phoe>
did that compile?
<Xach>
yes, sure. no problem referencing undefined functions.
<phoe>
or did it overwrite your vanilla *default-pathname-defaults*?
<phoe>
since the arg is evaluated first
<Xach>
and evaluation rules meant that each part of the body ran. but it started publishing way more stuff than i wanted.
<phoe>
args*
<Xach>
the uploader expects the report to be the only contents
<Xach>
instead it was uploading my entire system, practically
<phoe>
but it was your whole homedir instead
<phoe>
Yowza
<Xach>
i actually lucked out because i had an encoded pathname and it broke the request signature
<jackdaniel>
sounds like a plan for transparency ;-)
dieggsy has joined #lisp
<Xach>
Back in ye olden times, people sometimes did "touch ./-i" to force rm to be interactive.
<Xach>
I wonder about other poison pills for my mistake...
<pjb>
Well, I was bitten by: rm -rf ${DIR}/${SUBDIR} ; tested well under user accounts, but under root, DIR and SUBDIR were empty!
<pjb>
so touch ./-i woudn't be of use…
<phoe>
$ sudo rm /usr /lib/thunderbird/*
<pjb>
That's when I patched rm itself (and now gnu rm has a similar patch).
<AeroNotix>
something off topic but I hate how slack downloads snippets with the filename "-.txt"
yeticry has quit [Read error: Connection reset by peer]
fikka has joined #lisp
fikka has quit [Ping timeout: 246 seconds]
<aeth>
pjb: are you serious? That's bad.
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
red-dot has joined #lisp
smasta has joined #lisp
<Bike>
wait, doesn't the shell interpolation just give rm "/"? how could it detect that?
EvW has quit [Ping timeout: 246 seconds]
EvW has joined #lisp
jmercouris has joined #lisp
<jmercouris>
good evening everyone
<jmercouris>
Shinmera: Just wondering, why is it called "Treehouse"?
fikka has joined #lisp
Achylles has quit [Ping timeout: 268 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
fikka has quit [Ping timeout: 260 seconds]
Murii is now known as webgl2
BitPuffin is now known as webgl
webgl2 is now known as BitPuffin
BitPuffin is now known as Murii
webgl is now known as Muresan
Murii is now known as BitPuffin
Muresan is now known as Murii
fikka has joined #lisp
Murii is now known as Allah
Oladon has joined #lisp
BitPuffin is now known as Ahbar
Allah is now known as BitPuffin
Ahbar is now known as TOFastForYa
TOFastForYa is now known as Murii
dilated_dinosaur has quit [Remote host closed the connection]
<jmercouris>
I see that you can name your own markup you like via :markup to any value supported by pandoc
fikka has quit [Ping timeout: 246 seconds]
<jmercouris>
The only question is, for things like images, how do you like them let's say if you are using emacs org mode, will it be smart enough to see a link to the static dir and make an appropriate link?
<jmercouris>
s/like/link
knobo has joined #lisp
<jmercouris>
I guess I'll have to test it to find out
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dilated_dinosaur has joined #lisp
<knobo>
I'm using websocket-driver, and I need to keep som extra data in the websocket object. I could extend the class, and do a change-class after it is created.
fikka has joined #lisp
<knobo>
But someone once warned me against using change-class. But I don't remember why.
<phoe>
knobo: can't you subclass it?
<knobo>
Yes, that's what I want.
<phoe>
so what is preventing you?
<knobo>
I could do that. And that is what i was planning.
damke_ has joined #lisp
<knobo>
The reason I need to do change-class after it is initiated
<phoe>
how are the instances constructed?
<knobo>
Is that the library has it's own make-websocket-class function that does some initiation.
<knobo>
And I don't want to duplicate that code.
josemanuel has joined #lisp
<phoe>
so not using make-instance.
damke has quit [Ping timeout: 264 seconds]
<knobo>
the wsd:make-server does some things to the object that is returned to me.. (apply #'make-instance 'server .......)
<knobo>
I just did not want to duplicate that code.
<knobo>
Even though it's not much code, it makes it dificult to maintain.
payphone has joined #lisp
jmercouris has quit [Ping timeout: 248 seconds]
mepian has quit [Ping timeout: 248 seconds]
<knobo>
So, no obvious resons to not use change-class..
igemnace has joined #lisp
<phoe>
sounds like change-class would be the necessary evil in this case.
<malice>
knobo: Why do you need to keep the data in the websocket object, and why couldn't you for example wrap the object in other object?
<knobo>
I don't know how to wrap objects.
<knobo>
:P
<_death>
knobo: I think change-class is acceptable in this scenario
<knobo>
I can not keep it in the session object, because a user can be connected with several browser windows, and multiple connections in same window.
<knobo>
Thank you guys for the support :)
Karl_Dscc has quit [Remote host closed the connection]
Pixel_Outlaw has joined #lisp
ebzzry has quit [Ping timeout: 260 seconds]
smasta has quit [Ping timeout: 240 seconds]
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
Bike has quit [Remote host closed the connection]
red-dot has joined #lisp
xrash has joined #lisp
smurfrobot has joined #lisp
fikka has quit [Ping timeout: 240 seconds]
fikka has joined #lisp
dxtr has joined #lisp
dmiles has quit [Ping timeout: 255 seconds]
Bike has joined #lisp
eminhi has joined #lisp
dmiles has joined #lisp
dxtr has quit [Ping timeout: 276 seconds]
mepian has joined #lisp
mepian has quit [Changing host]
mepian has joined #lisp
smasta has joined #lisp
zazzerino has quit [Ping timeout: 256 seconds]
epony has joined #lisp
smasta has quit [Ping timeout: 248 seconds]
BitPuffin has quit [Remote host closed the connection]
dtornabene has joined #lisp
dxtr has joined #lisp
fikka has quit [Ping timeout: 248 seconds]
smasta has joined #lisp
fikka has joined #lisp
pmetzger has quit []
smurfrobot has quit [Remote host closed the connection]
fikka has quit [Ping timeout: 246 seconds]
nowhere_man has joined #lisp
random-nick has quit [Remote host closed the connection]
eudoxia has joined #lisp
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
Murii has quit [Quit: WeeChat 1.4]
red-dot has joined #lisp
fikka has joined #lisp
zazzerino has joined #lisp
eivarv has joined #lisp
shifty has joined #lisp
DeadTrickster_ has joined #lisp
DeadTrickster has quit [Ping timeout: 268 seconds]
Folkol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
shka has quit [Ping timeout: 248 seconds]
eivarv has quit [Quit: Sleep]
<Shinmera>
::notify jmercouris Cause it's a place to hang out with friends and chill on the weekend.
<Colleen>
Shinmera: Got it. I'll let jmercouris know as soon as possible.
lnostdal has joined #lisp
eivarv has joined #lisp
DeadTrickster has joined #lisp
DeadTrickster_ has quit [Ping timeout: 246 seconds]
warweasle has quit [Ping timeout: 240 seconds]
wxie has quit [Remote host closed the connection]
eivarv has quit [Quit: Sleep]
<pagnol>
Shinmera, hey, how you are doing? :)
dented42 has joined #lisp
<Shinmera>
Tired because it's late, stressed due to upcoming exams, and salty as I had a losing streak in Splatoon a while ago.
<Shinmera>
Otherwise fine though
earl-ducaine has joined #lisp
warweasle has joined #lisp
<pagnol>
Have you been working on the kanji thing?
<iqubic>
So lisp only supports prefix notation?
<Shinmera>
No, I'm currently working on hardly anything.
<pagnol>
How so?
<Shinmera>
The exams I just mentioned?
<pagnol>
Ah right
<antoszka>
iqubic: lisp supports any notation you tell it to use, but usually you'll use the built-in one, which is mostly prefixy
<pagnol>
What are they about?
<iqubic>
Even for mathematical operators? You only get prefix notation? Like how do you compare numbers?
<Shinmera>
pagnol: Nothing lispy, that's for sure.
<antoszka>
iqubic: (< 4 5) => T
<knobo>
hmmm. It's like asking permission from my parents, "May I please use the change-class, mom? Please.. Just once. Ahhh... come on! That's not fair.. Ok, then. thanx" :P
<antoszka>
iqubic: also (< 4 5 7 10) => T, try that in infix notation :)
dented42 has quit [Client Quit]
<iqubic>
"4 < 5 && 5 < 7 && 7 < 10"
<iqubic>
Wow, that is ugly.
<Shinmera>
antoszka: (< 7) => T, try THAT in infix :^)
<iqubic>
How does that work Shinmera?
<antoszka>
Yeah, or those (*) and (+).
ikki has joined #lisp
<pagnol>
antoszka, ICON supports that
eivarv has joined #lisp
<Shinmera>
iqubic: By being specified to work
<iqubic>
Wait, (+ foo) returns the value of foo?
<antoszka>
I'm totally not suggesting lisps are the only languages that support zero-argument arithmetic functions.
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
<iqubic>
Yes, but with zero argument arithmetic operations you get the identity.
<iqubic>
So I assume (+) and (*) are defined as folds?
<aeth>
iqubic: (+ foo) returns the value of foo if foo is a number, (- foo) negates the value of foo. (* foo) also returns the value of the number. (/ foo) gives the same result as (/ 1 foo)
<antoszka>
As Shinmera said it's a matter of specification (and convention, too).
<iqubic>
Yeah, it's called mapcar.
<antoszka>
iqubic: Many.
<aeth>
- and / are trickier because they don't have a 0-value form and their 1-value form is less expected than + and *
<antoszka>
Including mapcar.
<iqubic>
Does lisp have any way to fold over a list of values?
<aeth>
reduce
<iqubic>
I don't understand what the rest and key args do there though.
<antoszka>
iqubic: The lambda list specification is rather rich in Common Lisp it might take a while to sink into.
<iqubic>
What is the lambda list specification?
<iqubic>
I'm talking about not understanding the &rest and &key args of reduce.
<antoszka>
Ah, those.
<antoszka>
In particular.
<aeth>
iqubic: map is probably more useful than mapcar because it works on any sequence and can return any sequence, e.g.: (map 'string (lambda (c) (code-char (- (char-code c) 1))) "Ifmmp-!xpsme\"")
stux|RC-only has quit [Remote host closed the connection]
<aeth>
sequences are, by default, 1D arrays or lists made from conses
Ven`` has joined #lisp
<aeth>
this does eliminate a lot of interesting options, particularly with lists
<aeth>
(strings are just 1D arrays that only hold type character)
<iqubic>
I really need to find a good lisp tutorial to work from.
<aeth>
(characters are a type that can be converted to/from a number with char-code/code-char; that's implementation-specific, but the ASCII range is probably portable over every currently-alive implementation)
<aeth>
The weaknesses here are different character encodings (fortunately, Unicode has mostly won) and different types of sequences (e.g. doubly linked lists, typed lists, lazy lists, etc.)
dented42 has quit [Client Quit]
<iqubic>
What kind of sequence does sbcl use as the default?
<aeth>
there is no default for make-sequence, you have to give the result type, like with map
<aeth>
1D arrays (vectors) and lists are just too different
dented42 has joined #lisp
josemanuel has quit [Quit: leaving]
<aeth>
You'd use vector or make-array for the first category and list or make-list for the second, with string and make-string as unnecessary but useful (you can just make-array with a :element-type 'character instead)
ikki has quit [Ping timeout: 240 seconds]
<antoszka>
iqubic: The “typical” sequences you'll get to deal with in CL would probably be lists (obviously), strings and 1-or-more dimensional arrays.
<aeth>
Code that works on all sequences will probably have two completely different implementations, one for vectors and one for lists. It might have more than two if it wants to be very efficient, e.g. implementations of map probably have many versions
<aeth>
With sequences and numbers, type information can make your code very efficient because if the compiler knows the type, it can skip runtime dispatch based on type.
<aeth>
antoszka: Unfortunately, multi-dimensional arrays aren't sequences. A lot of the time treating them as sequences would actually be useful.
<pagnol>
phoe, I'm pretty stoked about the lisp-binary library currently
<antoszka>
aeth: True.
<antoszka>
I made a mental shortcut here.
<aeth>
Multidimensional arrays and multiple return values are neglected in the standard. Any code that uses either heavily is probably going to reinvent a lot of the same macros and functions.
fikka has quit [Ping timeout: 246 seconds]
<_death>
aeth: you can use displaced arrays
<aeth>
_death: (map 'matrix (lambda (x) (* x 1)) some-matrix) would have been so much better than the many ways you can currently work around that limitation. Although the actual flat order is possibly implementation-dependent, so it would mostly be useful for pure functions on one 2D array.
<_death>
if you want array operations, there are libraries for that already
cgay has joined #lisp
mishoo has quit [Ping timeout: 240 seconds]
<aeth>
I know. About half of my utility library is making 2D arrays easier to work with.
<_death>
lisp is raw material, the job of a programmer is to work with that
wigust- has joined #lisp
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wigust has quit [Ping timeout: 246 seconds]
milanj_ has joined #lisp
warweasle has quit [Quit: Leaving]
milanj has quit [Ping timeout: 248 seconds]
damke_ has quit [Ping timeout: 264 seconds]
__main__ has quit [Read error: Connection reset by peer]
damke_ has joined #lisp
_main_ has joined #lisp
_main_ has quit [Read error: Connection reset by peer]
wigust- has quit [Ping timeout: 248 seconds]
_main_ has joined #lisp
shifty has quit [Ping timeout: 240 seconds]
fikka has joined #lisp
_main_ has quit [Read error: Connection reset by peer]
fikka has quit [Ping timeout: 268 seconds]
knobo has quit [Ping timeout: 240 seconds]
epony has quit [Quit: QUIT]
eminhi has quit [Quit: leaving]
epony has joined #lisp
__main__ has joined #lisp
<pagnol>
I have a byte vector and would like to get a stream as though I had used with-open-file and (unsigned-byte 8) as element-type
<pagnol>
is there something I can use?
<Xach>
pagnol: flexi-streams can do it.
<_death>
flexi-streams has a with-input-from-sequence
<pjb>
pagnol: notice that it is much much faster to use aref…
<Shinmera>
Flexi-streams is kinda slow
<pjb>
I can't understand how people who use sbcl and specialized vectors "for speed" are the same who use flexi-streams…
<_death>
80-20 rule?
<pagnol>
I'm messing around with the lisp-binary library and unless I missed something, then the function read-binary only takes streams
<pagnol>
my data doesn't arrive as a stream though
fikka has joined #lisp
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
moei has quit [Quit: Leaving...]
<aeth>
pagnol: You can define a custom stream with trivial-gray-streams. All you would need to do is inherit from fundamental-binary-output-stream and/or fundamental-binary-input-stream and define the proper methods
Kaisyu has joined #lisp
<pagnol>
aha
<aeth>
Just store your array in a slot in the new class
<pjb>
what about lisp-binary:wrap-in-bit-stream ?
<pagnol>
I encountered 'gray stream' somewhere today...
<_death>
you could hack flexi-streams to support sharing so it doesn't need to subseq.. if it's still as according to my notes from years ago
epony has quit [Quit: re-installing os.]
dented42 has joined #lisp
<pagnol>
ah, wrap-in-bit-stream might do it?
<pagnol>
I'll give it a shot
<pjb>
Well, no. It only takes streams.
<aeth>
Making a stream with trivial-gray-streams is very concise. Your implementation will probably be < 30 lines.
red-dot has quit [Quit: Going offline, see ya! (www.adiirc.com)]
<pagnol>
I was using with-wrapped-in-bit-stream for byte-streams before
<aeth>
binary streams are the easier ones (character streams are the harder ones)
Achylles has joined #lisp
<pjb>
Perhaps you can extend lisp-binary::bit-stream ?
fikka has quit [Ping timeout: 240 seconds]
<pagnol>
I'll try to get it to work with flex-stream and worry about performance later
red-dot has joined #lisp
warweasle has joined #lisp
<pagnol>
now I get an error from flexi-streams saying my sequence can't be decoded using utf-8... why the heck is it even trying to do that?
pierpa has joined #lisp
<_death>
pagnol: you didn't read the manual?
eivarv has quit [Quit: Sleep]
dented42 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fikka has joined #lisp
dented42 has joined #lisp
iqubic has quit [Remote host closed the connection]
fikka has quit [Ping timeout: 246 seconds]
epony has joined #lisp
igemnace has quit [Read error: Connection reset by peer]