freenode/#lisp - IRC Chatlog
Search
22:44:27
didi
It's a little brittle. I wrote a version of ~D that also accepts strings as arguments to use with ~/.
22:48:14
pjb
~D already accepts strings. ~A is left align, and ~D is right align: (format nil "~5A ~:*~5D" "Foo") #| --> "Foo Foo" |#
22:51:35
pjb
But strangely (well, not really), only clisp implements padchar with ~D correctly for non-integers: (format nil "~5,,,'*A ~:*~5,'>D" "Foo") #| --> "Foo** Foo" |# "Foo** >>Foo" in clisp.
0:01:50
gendl
Hi, how do we feel about the :iterate system? (from Jonathan Amsterdam; available in Quicklisp from repository maintained by Attila Lendvai on gitlab.common-lisp.net)?
0:02:49
gendl
I am with a customer who is dealing with converting a bunch of old code using a proprietary ICAD iteration construct called `let-streams'
0:03:33
gendl
I have also been gifted a set of functions which purport to translate let-streams forms into iterate forms.
0:04:07
gendl
well, ICAD does not exist anymore, so this code must be migrated off of let-streams somehow or other.
0:04:54
gendl
The customer has also embarked on a consulting project which converted the let-streams into LOOP constructs.
0:05:10
gendl
To me, these let-streams look much more similar to iterate forms than they do to LOOP.
0:06:02
Bike
the main selling point of iterate is that it can do what loop does, but with a more regular "lisp like" syntax
0:06:51
gendl
I'm leaning toward nudging the customer in the direction of iterate, if this is something I am going to sign up to support.
0:07:12
gendl
The customer is probably going to want to tend toward sticking with something which is in the standard, if possible, though.
0:07:38
gendl
But if I can make a case that iterate is stable, well-defined, not likely to disappear or experience chaotic changes...
0:09:37
Bike
well, as far as stability goes, the cl-net page says it predates the standard, so it's not like something someone came up with on a whim five minute sago
0:10:53
gendl
they were something of competitors back in the day, though neither made it into the standard, in favor of LOOP.
0:12:21
Bike
that is kind of weird, but you can get similar weirdness from typed value accumulation in lisp
0:14:09
aeth
Where I've gotten weirdness in LOOP is an unreachable code deletion warning in SBCL for ":for foo := (bar ...)" where foo isn't used on the first iteration through the loop.
0:14:39
aeth
Since ":for foo := (bar ...)" presumably expands to ":for foo := (bar ...) :then (bar ...)" when there's no then
0:16:58
aeth
If you want no magic, use DO because that's usually pretty directly expanding into a LET over a TAGBODY with a GO when you macroexpand-1.
0:17:55
aeth
On the other hand, the magic is sometimes very useful, like collect/append (there are higher order function equivalents, but only when not collect/append is not conditional)
0:19:38
aeth
And while LOOP is normally equivalent to DO* for things like :for foo := (bar) :then (baz), there is no short :for foo := (bar) with DO*. Not having the increment step is like LOOP's :with. So it could potentially reduce a lot of duplication there
0:23:15
aeth
pillton: You might be interested in this commit because the original didn't compile in ECL: https://gitlab.com/zombie-raptor/zombie-raptor/commit/1a5148dee2a3a08eee0c30cc6d51e30dc2829641
0:23:53
aeth
("vec" is shorthand for vec3 because it's the most common vec by far in my engine. Define function just is defun with declaims/declares built in.)
0:30:17
aeth
I suspect a simplified case would look something like (defun foo (u1 u2 u3) (declare (vec u1 u2 u3)) (let ((v1 (make-vec)) (v2 (make-vec))) (declare (vec v1 v2)) (vec--into! v1 u1 u2) (vec--into! v2 u1 u3)))
0:32:02
pillton
Hmmm.. something I can evaluate without having to load anything other than specialization-store.
0:43:12
aeth
I'll have to look into it some more. (Making it standalone is much easier, I just need to macroexpand the macro that generates the defspecialization)
3:03:39
gendl
Thanks. I should read more before I ask here. I'm just playing with this old code which supposedly converts to iterate code so I was believing what it was outputting.
3:04:42
gendl
I think i might not be using the converter right. I probably have to do some package-fu to get the old let-streams operators to be recognized by the converters.
5:08:47
beizhia
Here's a question I may as well ask here: I've finally figured out why developing with Slime and the REPL is so awesome (making a little website with hunchentoot). How do I bridge the gap between that and C/Java/Ruby, where I'm used to deploying a project as a whole?
5:17:56
fiddlerwoaroof
beizhia: you write an asdf system definition and then start a fresh repl, load your system + all its dependencies and dump an image
5:20:32
fiddlerwoaroof
You can get pretty fancy with how you do it, but I often just write a little build script and run it with sbcl --load
5:20:33
fiddlerwoaroof
https://github.com/fiddlerwoaroof/dotfiles/blob/master/stumpwm.d/build/build.lisp
5:21:03
fiddlerwoaroof
Here's another example: https://github.com/fiddlerwoaroof/objc-lisp-bridge/blob/master/Makefile#L9-L11
5:22:54
beizhia
aha nice. I'll give those a deeper dive in the morning. Thanks for the example code!
5:23:40
beizhia
I still cant figure out if I'm just having a tough time with this, or if it's really quite different from everything else out there
5:24:39
fiddlerwoaroof
The only similar systems still around, as far as I know, are smalltalk systems
5:25:38
fiddlerwoaroof
You "build" an application by dumping the current state of your lisp implementation and then loading that back into the lisp implementation next time you run your app.
5:26:26
fiddlerwoaroof
It's more like the way docker containers work than the way something like Makefiles, mvn, cargo, etc. work
5:30:44
beizhia
I kinda prefer that. Feels a little more grounded in reality. I totally still feel more at home reading source files in a static typed compiled language.
5:31:50
fiddlerwoaroof
Yeah, if you really get into desigining stuff for exploration at the repl, you start missing the types less
5:32:01
beizhia
Just moved over to doing a lot of Javascript at work and honestly Lisp is helping me understand JS a lot.
5:32:30
fiddlerwoaroof
I've noticed that a lot of the practices $work promotes for designing testable code also lend themselves nicely to designing repl-friendly code
5:32:38
beizhia
I've been seeing that. Read a great article contrasting unit testing with REPL programming.
5:32:55
fiddlerwoaroof
i.e. writing small pure functions wherever possible so that you don't have to worry about io/etc.
5:33:01
beizhia
Basically, both are just the simplest way of calling a function, is what they mentioned.
5:33:26
beizhia
Ya, trying to emphasize that point with my team... We have a lot of several-hundred-liners in our code.....
5:33:41
fiddlerwoaroof
Also, don't be afraid of CLOS, I found it entirely changed my perception of what OOP means
5:34:17
beizhia
Heh, that's what this little tutorial is walking me though actually. I'm getting it. CLOS is rad.
5:34:31
fiddlerwoaroof
beizhia: if this were #js, I'd strongly recommend using ramda as the standard library of JS
5:37:04
minion
beizhia: direct your attention towards pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
5:37:29
beizhia
I have before, a couple times. I should probably hit it again though, now that I know more.
5:38:03
beizhia
This is maybe my 3rd earnest go at getting into LISP, and I think it's starting to stick.
6:04:37
aeth
In general the differences are: Scheme is (1) minimalist (and breaks compatibility so the names are often cleaner), (2) has hygienic macros, (3) has call/cc, (4) guarantees tail call optimization so tail recursion is idiomatic
6:05:13
aeth
Scheme implementations are incompatible with each other in key areas (although portable Scheme is possible to write).
6:05:50
aeth
Common Lisp culturally values portability, is more of a practical language instead of an academic one (at least traditionally), and has a huge immutable standard.
6:07:38
aeth
I think that the main practical use in modern programming style would be trivial coroutines? https://en.wikipedia.org/wiki/Coroutine#Implementations_for_Scheme
6:09:35
aeth
But I think a good distinction that hints at the early 1990s era cultural divide (practical vs. academic) is that if you're working with arrays of numbers, CL is imo much nicer than Scheme.
6:14:17
aeth
(And I wouldn't be entirely surprised if some Scheme implementation eventually extended the numeric tower to include all division algebras, not just real and complex)
6:23:32
beizhia
I can see why a scheme-type language would be nice for something like Guile, where you only want to embed as little as possible. For something on its own though, common lisp just feels much more usable.
6:24:44
fiddlerwoaroof
ACTION likes how CL feels like it could be an OS if people were willing to give it a chance
6:26:44
fiddlerwoaroof
Anyways, I put together a little demo that uses custom method combinations to define groups of HTTP server routs: https://gist.github.com/fiddlerwoaroof/2def4b081bb9ba179efcce48a204646c
6:27:31
fiddlerwoaroof
It works in Lispworks and ECL, but sbcl and ccl seem to have a bug in their implementations of define-method-combination's long form that prevents it from working there.
6:31:43
fiddlerwoaroof
And, there's also a question of whether or not my method-combination is conforming
6:47:11
beach
I just thought of a way, and it is so obvious that I am convinced that SBCL already does it in a similar way.
6:48:21
fiddlerwoaroof
I have a hazy recollection of reading a comment about this last night, but I was focusing on other things
6:50:26
aeth
fiddlerwoaroof: If beach doesn't know something about the implementation of CLOS, there's a good chance no one knows.
6:55:08
jackdaniel
I believe you don't give enough credit some prominent figures in the community (which I won't call by name to not embarass them with such praise :)
6:57:26
jackdaniel
that's not the point. there are many people who worked on existing implementations or compared them. for instance at last ELS the very topic of method combinations has popped up
6:57:55
fiddlerwoaroof
And, this isn't a question of implementation but of the interpretation of the standard
6:58:18
fiddlerwoaroof
The standard is vague about what happens when all the specifiers match but the qualifiers differ
8:39:15
heisig
mrblack: But it is not a function, it is just a symbol that is treated specially in certain macros.
8:39:43
mrblack
jackdaniel, heisig: cool, thanks... it was used in Land of Lisp but I don't think the author explains it, couldn't find. It's hard to find info about it because that's a common word. Do you have any links for it?
8:40:35
jackdaniel
use l1sp.org (the second character is "one", not small "L"), very handy for such lookups
8:40:38
mrblack
thank you, jackdaniel. this seems like a good site to bookmark. Google wasn't of much help ;)
8:41:19
jackdaniel
also I believe that duckduckgo redirects to this site when used with a special bang
8:41:48
aeth
If you make DuckDuckGo your default search engine you can just !l1sp in the URL bar in e.g. Firefox
8:42:03
mrblack
jackdaniel, aeth, great. I used Vimium, though, it lets me create commands for any search I want.
8:45:13
mrblack
is it possible to access this documentation offline like man pages, from Emacs or the command line?
8:46:52
mrblack
I see that "slime-documentation-lookup" will open the term under cursor on the web browser... it's good enough, I guess. But offline would be better
9:24:31
Xof
fiddlerwoaroof: I think you've found the two relevant paragraphs about method combinations and matching specializers / differing qualifiers
9:25:25
Xof
sbcl generally (at least historically) tends to go for outward portability -- if it uses only standard functionality and runs on sbcl, it runs on other CLs
9:25:42
Xof
so it chooses to obey the paragraph that says that what you're trying to do isn't allowed
9:26:07
Xof
however: there is an escape hole -- sbcl doesn't enforce that restriction if there is a single, wild-card method group
9:30:33
Xof
beach: sbcl optimizes make-instance in a bundle of different ways. the main way is when the initarg symbols are constant, we construct a CTOR (see src/pcl/ctor.lisp) which maps the initargs to slot locations (per-class if the class-name argument to make-instance is variable, otherwise just once), receives values for all the initarg forms that weren't compile-time constants, and allocates and initializes the instanc
9:30:52
Xof
actually I'm less sure about the "bundle of different ways"; I think I've managed to get them all into one sentence :-)
9:31:45
beach
Xof: Thanks. What if there are :AROUND methods on INITIALIZE-INSTANCE and/or on SHARED-INITIALIZE?
9:35:36
Xof
we refuse to optimize if there's a non-standard allocate-instance method, or an :around method on shared-initialize. we can cope with :around methods on initialize-instance if it calls (call-next-method) appropriately
9:38:11
Xof
welcome. This was largely Gerd Moellmann's work, when he was (I presume) bored between jobs around *gulp* 2002
10:07:48
flip214_
Can I get the current input position (in bytes) from CXML? I'd really like to create an index (tag => position, length) into a large XML file, and then do "random" IO on it.
10:35:33
beach
You say that ASLR is irrelevant to my address-space argument. I don't understand why.
10:39:29
flip214_
beach: ASLR is irrelevant for the "historical reasons", and also " does not take great care to prevent a temporary buer from overowing,