freenode/#lisp - IRC Chatlog
Search
18:20:29
asarch
My question was: how did Lisp do the low-level coding for its Lisp machines? With opcodes or directly with S-Expressions?
20:17:11
ricman
hello, Im a newbie with both irc and lisp, I was wondering. Is there a way in common lisp to get help about the standard library? something like (help "list")
20:21:14
ricman
Josh_2: I guess, I meant something integrated in the REPL itself but i guess that'll do
20:23:35
ricman
thanks, god that HyperSpec page is hideous. C-c C-d C-h is a repl command or some emacs shortcut?
20:25:23
_death
ricman: set your browser to eww or w3m-emacs instead of using browsers that have hideous defaults
21:45:36
fiddlerwoaroof
There's also this: https://phoe.tymoon.eu/clus/doku.php?id=cl:functions:digit-char
22:38:11
LdBeth
seok: basically a package is a data structure maps string to interned symbol objects
22:39:46
LdBeth
in such a sense shadowing is just get the same string to another different symbol so the old one cannot be accessed with the package
22:40:36
housel
http://www.gigamonkeys.com/book/programming-in-the-large-packages-and-symbols.html might be helpful
23:00:10
fiddlerwoaroof
You can use symbol-macros, I guess, but it'd be nice to be able to resolve conflicts between imports by renaming one of them inside a package
23:04:42
no-defun-allowed
Then symbol names would change between packages, which would be a bit odd.
23:05:12
no-defun-allowed
(Well, that's the point, but if you look at symbols as interned strings, then you have to wonder what string you're interning.)
23:07:27
aeth
no-defun-allowed: Depends on how you see it. The way I'd do "renaming" is to simply introduce a new concept or something, so the symbol foo:bar "refers to" baz:quux in some sense. I guess care would have to be taken because it would probably just inherit references so macros expecting the symbol baz:quux must get the symbol baz:quux instead of the "renamed" bar (i.e. foo:bar)
23:08:24
aeth
no-defun-allowed: but essentially, the object being referred to by baz:quux would now also be referred to by foo:bar, for all types of objects (functions, variables, etc.)
23:08:29
White_Flame
readtables support SET-SYNTAX-FROM-CHAR which lets you map 1 character's functionality in an "imported" readtable to a different character in your readtable, so there's some precedent for that sort of functionality
23:09:34
White_Flame
likely, the name of my-package::foo (imported from other-package:bar) would be "BAR"
23:09:55
no-defun-allowed
LdBeth: It could, but currently a symbol name is just held in the slot %name, which probably doesn't have multiple values.
23:10:14
White_Flame
the printer would probably be able to show the local name, if you're in my-package
23:10:25
aeth
White_Flame: Imo, it should have the new symbol name, and you just have to be aware that it won't work with some macros. If it's a foo it's "foo". What's inherited is the references to e.g. the functions or macros, so it's a zero-cost alias (instead of e.g. making a trivial function that just calls the old function)
23:10:34
no-defun-allowed
And I have to wonder how the printer would handle it too. Would it favour the renamed -- hey, don't read my mind please.
23:10:45
LdBeth
no-defun-allowed: cl lexicon solve this problem by implement another layer of modules system
23:11:20
White_Flame
aeth: then you're not actually importing the symbol itself, but making a new one, whose value in any namespace needs to map to the other symbol
23:11:28
fiddlerwoaroof
I wouldn't want to rename the referenced symbol, just have the reader map a certain name in the current package to the imported symbol
23:12:14
aeth
White_Flame: Right. So if new-package::foo refers to old-package:bar, then it's still the symbol new-package::foo with the symbol-name "FOO" instead of "BAR" it's just that it inherits any object referred to by old-package:bar. Ideally, keeping things in sync so a redefinition of #'old-package:bar updates #'new-package::foo
23:12:47
fiddlerwoaroof
I wouldn't want that because I don't want the new package to be "in control"
23:13:39
fiddlerwoaroof
this handles the case where I want to have both cl:+ and matrix-math:+ in my current package without package prefixes
23:15:21
aeth
I don't see what you mean. With my proposal, you'd just alias matrix-math:+ to m+ or whatever, and (m+ m1 m2) will work as expected. If symbol-name of e.g. m= is "=" instead of "M=" for matrix-math:= then you could do this: (loop with x m= 1 ...) and that's absurd
23:17:01
fiddlerwoaroof
I don't want aliasing to mess with the symbol-name because that makes the symbol-name of a symbol depend on the current set of loaded packages
23:17:48
fiddlerwoaroof
As far as your case goes, we'd either have to respecify the behavior of loop or say "don't do stupid things"
23:18:49
fiddlerwoaroof
The way loop handles its keywords is already a bit weird, I'd be fine with either requireing (loop with x := 1) or requiring that the keywords be in the cl package
23:20:49
no-defun-allowed
So, I'm using split-sequence to split a string with 100,000 lines, and Clozure is about 4x slower at splitting and I believe that's the slowest part of my program now. Is there anything I can do to split faster?
23:23:06
aeth
If e.g. split-sequence does bounds checking, then making a function with a type declaration with your exact string type (including the length) could speed things up. Or doing a length check and then turning safety off locally around the iteration (assuming that you can do that in your implementation)
23:23:39
aeth
Oh, also inlining the string-splitting function (even if it's large) would have a similar effect of removing the bounds check if done right
23:24:27
aeth
You could also just not split strings, working with :start and :end, which nearly every string/sequence function takes in, if your specific problem permits that.
23:26:16
aeth
If you're reading the string from a file or the network, you could try working in it as bytes instead of as characters, too.
23:39:39
fiddlerwoaroof
no-defun-allowed: I got tired of split-sequence being slow and implemented my own split
23:40:06
aeth
fiddlerwoaroof: a while ago or recently? split-sequence got a big rewrite based on conversations in #lisp maybe a few months ago or so. earlier this year iirc
23:40:22
no-defun-allowed
Oh, I should test cl-strings as well. The name would suggest they know some string things.
23:40:22
fiddlerwoaroof
https://github.com/fiddlerwoaroof/fwoar.lisputils/blob/master/string-utils/split.lisp
23:41:06
aeth
no-defun-allowed: eh... idk, if your main concern is performance, you often/usually need to write your own things, that's just how things go
23:41:38
fiddlerwoaroof
Anyways, at the time, I managed to split a multi-gigabyte csv file significantly faster with this than split-sequence
23:43:06
aeth
well, that's not too surprising because it's less generic (strings instead of sequences)
23:43:23
no-defun-allowed
aeth: When I did write my own reader, it ran at half the speed of split-sequence.
23:46:27
no-defun-allowed
And I would really like to avoid writing my own splitter because that would be more code I have to maintain.
0:11:15
pjb
fiddlerwoaroof: instead of renaming imports, you have define-symbol-macro; but indeed, this works only for variables.
0:38:19
pjb
there are various defalias macros. For functions, (setf (symbol-function 'foo) (symbol-function 'bar)) can be used.
2:07:32
pfdietz
(looks at cl-strings) This doesn't preserve element-type. That's very important: SBCL base strings use as little as 1/4 the space of general strings.
2:08:06
pfdietz
It would be better to implement those functions as methods that specialize on the string argument(s).
2:09:38
pfdietz
Interesting aside: the standard allows a lisp reader to produce base strings when reading string constants, if all the characters in the constant are base chars. When SBCL Is tweaked to do this, some failures occur in quicklisp. Some people assume the strings are always element-type CHARACTER.
4:46:07
loke
Question 1: WOuld you be able to put it on Quicklisp, in order for users to not have to manually download it?
4:47:04
loke
Question 2: Do you have a suggestion how to implement ranges? (similar to how Emacs implements text properties and overlays)
4:47:54
loke
I was thinking of implement a rangeusing two cursors. That would track the start/end of the range properly. However, I need an efifcient way to find all ranges that cover a given cursor position.
4:49:54
ck_
but maybe you'll want to read the discussion on that during the xemacs / gnu emacs diverging. I believe there's a balancing tree for intervals in emacs since then.
4:50:06
beach
ck_: It might be more difficult than that, given that individual cursors can change independently, and that text can be inserted and deleted anywhere.
4:51:47
LdBeth
a character with properties could also be a pair of the codepoint and a reference to the properties
4:53:11
LdBeth
I don’t think emacs does this with ranges, since text properties can be preserved even cut and paste from a buffer to another
4:54:13
loke
But the ranges are not directly accessible. The API presented to the user is simply a set of text properties per character.
4:54:25
beach
An interesting idea would be to exploit the open/closed line idea of Cluffer. Conceptually, each character would be what LdBeth suggests, namely a pair of code-point and properties. But when a line is closed, a more compact representation could be computed.
4:57:03
loke
Well, the peorperties describe things like fonts/colours/etc, as well as arbitrary other things), so there is a lot of variations.