freenode/lisp - IRC Chatlog
Search
1:34:41
aeth
standard in the sense that it's in the standard, while there's no create-TAB tab completions for me
2:47:37
pjb
White_Flame: in the CL package, there's no function name prefixed by create-, but there are prefixed by make-.
3:47:12
PuercoPop
jasom: are you asking about SICL because you want to compile to JS? I remember you tried to get Eclipse CL to compile under ecmascripten
4:58:51
beach
jasom: As Bike said, you can translate HIR to basically any language. But you need a Common Lisp runtime to run it.
5:14:01
beach
jasom: The HIR to Common Lisp translator uses only a small subset of Common Lisp as its target language, because HIR is such low level. The full Common Lisp language is still available as source in order to generate the HIR.
5:36:22
beach
PuercoPope: I could use the full language if I had to, because I execute the HIR code inside a host Common Lisp system. However, the HIR instructions have a kind of natural translation to a small subset of Common Lisp. At the top level, there is a big TAGBODY where each label represents the start of a basic block.
5:37:25
beach
PuercoPope: So it's not that it has to be a subset, which is why I never bothered to define it precisely.
6:09:08
PuercoPope
beach: More than the operators the datatypes could be troublesome. CL supports for example bit-vectors, which I would think one would want to avoid having to implement in the target language
6:12:24
beach
PuercoPop: I really haven't given it any thought since the purpose of SICL is not to have a target language other than native machine code.
6:25:36
buhman
beach: I came up with https://gist.github.com/buhman/06a39c80623eb5d07ec593fd5715c221 which I think has correct behavior for all insertion cases, but I'm also not pleased with the code cleanliness
6:27:43
buhman
(node-insert) can correctly build https://upload.wikimedia.org/wikipedia/commons/e/eb/Insert_%27toast%27_into_a_Patricia_trie_with_a_split_and_a_move.png from a (make-node #f '()) root
6:54:59
didi
So I'm wondering: I have a function (FN) that consumes a static object (made of ordinary lisp objects) to produce an object. As it consumes a static object, this computation can be made during compilation. I see 3 ways of doing it: 1. define a macro that returns a computed object (defmacro mfn (x) (fn x)); 2. define a dispatch macro character that do the same thing as the macro; and 3. use #. to compute the object in read time #.(fn
7:01:13
gilberth
didi: When that is a function and should be function, I would consider a compiler macro.
7:08:04
didi
gilberth: I got the idea from languages (like Python and Racket) that define a special syntax for regular expressions.
7:08:05
gilberth
I have no idea of the nature of the arguments passed to your FN function. But a compiler macro also could bail out and say "Sorry, compiler I cannot do this at compile time, seek to invoke the function at runtime, please."
7:09:54
gilberth
As I said, I have no idea, what your function does. When it turns an external representation into some internal representation though, a reader macro would be fine. Like I used #u"http://foo.com/blah" in my URL library or #/a and #"foo" in my runes library.
7:11:56
didi
gilberth: Indeed. There is no need for secrecy. It reads a regular expression representation and returns an object that is used for matching, just list PPCRE's parse-tree.
7:16:06
gilberth
I always hesitate to define new syntax. Because it easily conflicts with other libraries and you hae issues, that you need to ensure that the read table is set up correctly for files using the stuff. These days. I was fond of reader macros 20 years ago, though.
7:18:03
gilberth
IMHO a macro like (foo (fancy-iteration (or "a" "b"))) would be fine. For completeness you could also have a FOO*, which evaluates the argument. Or: You define a FOO function, which then needs the argument quoted and go with a compiler compiler macro and ask for CONSTANTPness and bail out otherwise by returning the &whole form.
7:19:32
gilberth
Not having the option to build a FOO with an evaluated argument would be bad though. See parenscript for instance. We recently had that discussion right here.
7:20:42
didi
gilberth: Agreed. The function exists and I won't get rid of it. Like I said, I remembered the special syntax for regular expressions and thought it would be a neat optimization for constant regexps.
7:24:35
gilberth
It could be as simple as (define-compiler-macro fn (x &whole w) (if (constantp x) `(load-time-value (fn ,x)) w))
7:31:47
didi
Heh, my ignorance of load time vs. compile time vs. run time has finally showed its ugly head.
7:36:44
gilberth
didi: It will not be as easy as outlined, I justed tried it. My compiler macro goes into an infinite loop at compile time.