libera/#lisp - IRC Chatlog
Search
15:33:32
Psybur
I wonder is there a lisp equivalent of wrapping things up in contexts? The closest I think ive been able to discover myself (without looking into coalton) is adding advice around functions
15:45:07
White_Flame
there's dynamic bindings, there's scopes with enter/leave mechanisms, there's packages, there's threads...
15:57:57
pjb
Psybur: there's a classic: (mapcar (function unwrap) (sort (mapcar (function wrap) list) (function lessp) :key (function key))) where the purpose of wrap is essentially to pre-compute the key, so that the function key is efficient.
15:58:30
pjb
Psybur: eg. (mapcar (function cdr) (sort (mapcar (lambda (person) (cons (compute-age person) person)) persons) (function >) :key (function car)))
15:59:30
pjb
Psybur: design patterns are not specific to any language. The only difference, is that you could write a macro in lisp:
16:03:29
White_Flame
but languages do differ in what patterns are useful or meaningful, vs their built-in facilities and idiomatic style
16:04:14
aeth
which becomes reinforcing because that's what new implementations will choose to optimize
16:04:44
aeth
so you can have 10 ways to write something, but the idiomatic way will be one of the fastest (maybe you have some unreadable, esoteric way to write it that's the absolute fastest, but that's discouraged)
16:05:29
aeth
but that also means avoiding LOOP could make your code pretty slow relative to other languages that never had it in the first place, which might have had to optimize some of the other routes
16:50:50
neirac
Is someone using https://github.com/rabbibotton/clog?, I don't seem to find how to deploy a site made in clog
17:04:24
jcowan
Psybur: If by "contexts" you mean monads and their cousins, then I have a sketch of a design at https://github.com/johnwcowan/r7rs-work/blob/master/ContextsCowan.md
17:07:04
jcowan
both of them are applicable to binary functions, whereas n-ary functions are not necessarily reductions
17:12:16
White_Flame
if you really want to be nasty, the reducing function could be stateful and handle each subsequent value differently, acting as a binary function which streams in n-ary parameters
17:15:49
White_Flame
hmm, actually the function itself doesn't need to be stateful (eg, a closure), the state can all be contained in the reduced value being passed to the next iteration. So nice & clean & still functional ;)
17:16:55
rendar
the point that generates a lot of doubts: in my little lisp parser, i have create an 'apply' which basically calls reduce *internally*, to apply + to a list of args, e.g. (+ 1 2 3 4) and it works basically, the thing is, it works with 2-ary ops, but not with unary operations like sin(), and also in lisp.. (sin 1) is correct but (sin 1 2 3) results into errors.. so why? i can specify multiple args only to 2-ary functions, and not to unary functions?
17:18:35
rendar
let remove apply from the equation, maybe i have just get the name mistaken, i'm sure lisp has a similar function internally with another name
17:21:28
rendar
wasamasa, my lisp interpreter is written in python, so i can use the python facilities to do that
17:23:36
rendar
White_Flame, ok, so in my implementation of eval i'm calling apply at the right place i guess
17:23:57
wasamasa
there is no need for applyt or functools since apply in python is just the asterisk syntax
17:24:52
White_Flame
a compiler would compile the entire form, and execute it without worrying about parameters at all
17:27:14
White_Flame
I'm not sure of what value it will be, or if I will progress more on it. But it is useful for reading cyc world files
17:27:39
prokhor__
i am trying to port a large part of the cyc db to an alternate - lets call it "reasoning environment" - myself..
17:28:39
White_Flame
you can, however, read the world files into memory, or output them as sexprs, etc
17:29:30
White_Flame
ah, ok. The actual code really isn't coming together for me in terms of its architecture. cyc's mudball development really shows
17:31:00
prokhor__
or to stuff of the japanes 'fifth generation project' i got partially running lately...
17:31:30
White_Flame
did japanese 5th gen actually create any new useful abstractions, or was it just an exercise in prolog performance?
17:33:04
prokhor__
and the parallelization part is really exciting.. i am worrying whether the expressiveness is sufficient though...
17:33:42
Shark8
Psybur, (re: wrapping contexts) -- This sounds *almost* like Ada's generics (when using IN OUT formal parameters).
17:33:57
prokhor__
https://www.airc.aist.go.jp/aitec-icot/ICOT/Museum/SOFTWARE/QUIXOTE/qxtSystem-E.html
17:34:54
prokhor__
they use sth called "guarded horn clauses" which you also can implement in prolog but its native implementation is fully parallelized..
17:38:22
Shark8
White_Flame, IIRC 5th Gen gave us some good database functionality/theory. (This is a fuzzy half-memory from back when I was in the university.)
17:38:34
prokhor__
take a look if youre interested.. those were no stupid ideas. my theory on why it didnt work in the end is, they didnt have anything like the cyc db to run on it...
17:41:15
prokhor__
my plan for the weekend is to implement those guarded horn clauses in common prolog (sth lispworks did a while ago)...
17:43:05
White_Flame
eg, run a single instantiation of a body across multiple threads to speed it up
17:46:24
White_Flame
I've mostly done coarse-grained parallelization and have gotten "good enough" core utilization
17:46:56
White_Flame
so I haven't delved too deeply into finer grained decomposition into parallelizable pieces
17:48:35
White_Flame
in 4.2, I'm guessing that the list of primes generated would never be out of order?
17:49:26
prokhor__
depends on whether you implement klic with single thread or with parallel ones...
17:51:06
White_Flame
it doesn't just have a set or bag that the threads would asynchronously deposit into
17:51:22
Shark8
prokhor__, If you're going to implement guarded Horn clauses in a parallel manner, you may want to watch these two videos: (1) https://www.infoq.com/presentations/Thinking-Parallel-Programming/ (2) https://www.youtube.com/watch?v=D7GDTZ45TRw ... #1 is parallelizing, and #2 has scheduling & dependency-management.
17:52:53
prokhor__
i thought, i will recapitulate the lecture i had on parallel computing at ETH Zurich some years ago - but i will have a look at it.
17:55:25
Shark8
White_Flame, The first video (a Guy Steele talk) has a lot on parallelization, in general; the second has a lot on the fine-grained parallelism that you can use in-general if you "squint at it" and ignore the platform-specific nature of the talk (Mill CPU).
17:56:26
White_Flame
of course, this is a different form of parallelization, not sure if it applies to individual clause parallelization in prolog style
17:58:35
White_Flame
but, that's why I have my little script to copy an adblock-free profile, run incognito on it, and wipe the profile when it exits ;)
17:58:56
prokhor__
White_Flame: aindilis just told me in the other channel, youre an expert for reactive dbs: do you see any similarities to quixote?
18:01:26
White_Flame
that's why cyc has "over 1500 inference engines!" because each is a special case hack to keep it from exploding
18:02:55
prokhor__
https://www.airc.aist.go.jp/aitec-icot/ICOT/Museum/SOFTWARE/QUIXOTE/intro/feature1.html
18:10:21
White_Flame
prokhor__: it's a sea of alus, fpus, load/store buffers, and result value buffers, connected by a big honkin crossbar, and transfers as much in parallel as it can per cycle
18:10:46
White_Flame
the logical model is that the last N computed values are still visible on a "belt" and can be freely addressed
18:11:10
Shark8
prokhor__, Not that I've found, but if I were to summarize it: a massively parallel very-long-instruction-word architecture, from the ground up, attempting to use many new designs to obtain a more efficient CPU.
18:12:07
White_Flame
it's also software defined, so any larger/smaller version of it is config parameters and rebuild
18:12:42
Shark8
prokhor__, I read about them wanting investors so they could burn it into silicon somewhere, but I have no idea where that went.
18:13:41
White_Flame
but because it's a clean-room rethink, it's a very holistic design, with every piece of it supporting each other in interesting interactions
18:27:29
prokhor__
Shark8: your hint to me has mainly to do sth with the sceduling process (in the vid around 30:00) i guess(?)
18:30:25
Shark8
prokhor__, Yes, essentially. (The caveat/"but" there being the holistic-parallelism that Guy Steele's talk builds to.) -- It's a "gut feeling" though, that the two videos together capture what you're [ultimately] aiming to do.
18:33:52
prokhor__
the idea running through my head right now(based on that talk) is to implement such a tableaux scheduler for x64, do the actual computation on GPUs via SCUDA
18:42:05
Shark8
prokhor__, I think you're not getting the Guy Steele talk: *DON'T* focus on the _HOW_,, focus on the _WHAT_. / IOW, treat it like you would an Ada TASK TYPE: Write your solution in the general manner, and allow the compiler to do the parallelization for you, typically disregarding things like Number_Of_CPUs, Number_Of_GPUs, CUDA, Open_MP, etc.
18:42:38
Shark8
prokhor__, Other IOW: Think of it first in terms of the problem-space, not in terms of the hardware-details.
18:43:29
White_Flame
but that's the goal for the user. the language/library author has to worry about how that manifests so the user doesn't see it
18:48:01
Shark8
White_Flame, Yes-ish. The reason that C is such a bitch to make portable in the non-trivial (as evidenced by the rat's-nest of #IFDEF), is precisely because the culture of C is inordinately concerned with the implementation details; OTOH, reusing the Ada example/reference, Ada is more portable because the programs model the problem-space (via the type-system), express the solution in *THAT*, and let the compiler handle the source->machine-code translation.
18:48:59
White_Flame
there are 2 steps to creating a better language: decide what the user can do (eg focus on problem not solution), and then have low-level implementation strategy of what the computer can do for the human efficiently
18:49:33
White_Flame
it's nice to desire the first, but without the 2nd thoroughly hashed out, there is not going to be a realized advantage
18:50:59
Shark8
White_Flame, To take a recent-ish example in computing, do you remeber how when multi-core CPUs were becomming popular there was a lot of hype/crisis about "having to rewrite" (at the OS/lib levels) in order to take advantage? -- Well, imagine (e.g.) Windows being written in Ada, using the TASK and TASK TYPE constructs: instead of rewriting the OS, now all you have to do is to recompile it with a multi-core aware compiler. (Actually, you might be able to get
18:50:59
Shark8
around even recompiling by replacing the Run-time library with one that's multi-core aware.)
18:51:30
White_Flame
the issue, for me, for prokhor__, is how do we create the respective "ada backend" for these user concepts
18:53:11
White_Flame
and looping back to the original question, this is why the cyc code is so tangled, because the implementation is a beast to do what its user level language intends to express
18:54:07
White_Flame
we can sing the praises of CycL expressiveness, but without the ability to tractably execute it, it's of no inferential use to us
18:56:00
White_Flame
and of course doing so in a way that doesn't leak implementation complexity or implicit search orderings etc back up into CycL, but to keep all those low level implementations transparent to the user as well
18:56:14
prokhor__
White_Flame: https://news.ycombinator.com/item?id=21781597 : he mentions, that every SW engineer at cycorp wants to write the inference engine from scratch: would you have any thoughts on that?
18:56:23
Shark8
Ah! -- That's where the Guy Steele talk comes in: you formulate your "CycL run-time" (or VM, or however-you-conceptualize-it) on what facilitates parallelism. And the Mill talk is about how to handle the dependencies (which prevent parallelism).
18:57:06
Shark8
If that makes sense. (I'll have to give a re-think on how to [try to] express the idea, if not.)
18:57:52
White_Flame
just like too many people have learned that you can't just throw your program onto a GPU, its form of parallelism is suited to particular tasks & orgarnizations
18:58:29
White_Flame
you can compile your normal CPU code into GPUs, but it'll run slower than on the CPU
18:59:44
White_Flame
prokhor__: I also don't know enough about cyc's inference to exactly reimplement it; the point of clyc was to try to learn their codebase
19:00:21
White_Flame
one big thing to explore was how they had larger-than-memory data spilled to disk
19:00:33
prokhor__
Shark8: LIsp already lets users focus on the problem, but i would like to use the freedom to "mess up" some low-level details...
19:00:44
White_Flame
apparently they don't spill anything at all. Their microtheories segment the KB, and all must still be in memory at once
19:02:19
Shark8
prokhor__, There was a really good paper on that (messing up low-level implementations)... I'm sorry I can't remember it, but it had to do with metaobjects and compilers and, IIRC, was a LISP compiler/compiler-framework.
19:03:27
White_Flame
lisp generally has all the way down to machine code generation in lisp itself, and all should be muckaroundable
19:03:53
White_Flame
although the implementation style might not have flexibility in the way you'd want to muck with
19:03:54
prokhor__
my first step btw: i have a complete description of kl1 in a low level language & intend to translate that somehow to commonlisp...
19:04:58
Shark8
White_Flame, (re: Constraints) -- Multiple: (1) not having the interface, (2) wanting/needing to use *that* implementation, (3) exploring the disk interactions of said implementation, (4) the memory interactions of the implementation, and (5) the interactions of #3 & #4.
19:07:19
White_Flame
but, again, because it has such an abstract high level input, the _back end_ and all it does is the interesting part for people working on creating new inference systems
19:08:14
prokhor__
White_Flame: isnt the main part of the stuff written in java some kind of limited lisp (subl) interpreter?
19:09:32
White_Flame
Shark8: as I mentioned, it's a learning project to see what their implementation strategies were
19:10:13
White_Flame
prokhor__: powerloom is also another start-over project from I believe Cyc people to build such a system
19:11:15
prokhor__
White_Flame: how would you automatically translate a dump of cycs db into sth else?
19:11:22
Shark8
White_Flame, So you have a X->Y translator written in Z, yes? (X: ?; Y: Java; Z: subl)
19:11:41
White_Flame
prokhor__: well, I have a sexpr output of it, then you'd have to figure out what that "something else" is :-P
19:12:14
White_Flame
Shark8: I have tools to assist in grokking the java, but reverse engineering the algorithms & intents is a human process
19:12:44
prokhor__
so do i.. i was thinking of first putting it into a db & then translate from that...
19:13:28
Shark8
White_Flame, Yes, exactly. Which is why in a rewrite you should be careful to document your problem-space, in particular, w/o the implementation details.
19:17:18
Shark8
Sure it does: it allows you to ensure that you're doing things correctly. -- I mean if you have a CSV "parser" that uses RegEx, you lose out on things like multi-line datafields (and quoted-/nested-values) precisely because of RegEx, namely its line-based nature.
19:18:43
White_Flame
as reasonable implementation strategies of the complexity of the input descriptions are not well known
19:20:39
prokhor__
https://libgen.rocks/ads.php?md5=ea63bd972d6c15ec5d06ada3161504a9&downloadname=10.1145/122296.122308
19:21:27
White_Flame
neat, I don't think I had that one, just the more current reference & tutorial material
19:29:24
Shark8
White_Flame, I'm getting a very ACE-like feel here... -- see: http://attempto.ifi.uzh.ch/site/ OR https://en.wikipedia.org/wiki/Attempto_Controlled_English
19:30:15
White_Flame
however Cyc used to have an apparently pretty good English-to-CycL generator, but for some reason dropped it
19:30:36
White_Flame
I think CycL-to-English still exists for describing things on its web interface
19:32:00
Shark8
White_Flame, ACE isn't *really* a natural language project either... it's more a constrain-the-language-so-that-sensible-queries-can-be-imparted.
19:33:10
Shark8
White_Flame, Well, yes, but you still have to have the logic-engine (or translation to logic-engine).
19:33:53
White_Flame
i do'nt know what that parenthetical statement implies, but yes, that's why i'm reverse engineering from their apache-released java version
19:34:41
White_Flame
and that's also exactly what I was saying above, is that you can construct a wonderful language that leaves the solution entirely to the machine, but the question remains how you implement it on the machine
19:35:34
Shark8
IIUC, ACE: constrained-english to logic project. / Which is where the "somewhat-related" feel comes from.
19:36:13
Shark8
Coming from the other side, I would have given it something like the Ada/SPARK prover engine(s).
19:38:08
White_Flame
the input allows many broad logics, while the intermediate is a normalized logical form that fits its inference mechanisms
19:38:18
Shark8
"The Evolution of CycL, The Cyc Representation Language"? -- Reading it now. That's where the first gut-feel of being related to ACE came from.
19:44:07
Shark8
prokhor__, Unknown ATM; I'm too unfamiliar with CycDB. // Gut-feel? Given your noting of a [previous] English-parser for the DB, quite probably.
19:44:47
Shark8
prokhor__, (Though, I haven't directly used ACE, the reading I've done on it indicates it is quite usable.)
19:46:17
Shark8
ACE? Nope. / I came across it several years ago looking into DBs and Query-langs, thought it sounded interesting.
19:47:10
prokhor__
https://libgen.rocks/ads.php?md5=86945e333d2468f0a386ea5c33324b2f&downloadname=10.1016/0004-3702(93)90095-s
19:47:57
prokhor__
i know of many attempts to implement a subset of English as a programming/query language...
19:48:07
White_Flame
Shark8: the goal of Cyc is to be able to store & use "common sense knowledge of the world", as in "Something falls when it's dropped", and "A block of iron is not sentient" etc, that we constantly assume when we make statements & descriptions
19:48:38
White_Flame
of course, not expressed in English, but having created a logical & even philosophical ontology about how to describe things
19:49:08
White_Flame
and thus it is required to store a massively broad variety of types of information
19:49:58
Shark8
White_Flame, ight. Which is precisely *WHY* I connected it to ACE: those are the sort of queries that they use to demonstrate the character of ACE.
19:51:37
prokhor__
btw: https://libgen.li/index.php?req=lenat+douglas&columns%5B%5D=t&columns%5B%5D=a&columns%5B%5D=s&columns%5B%5D=y&columns%5B%5D=p&columns%5B%5D=i&objects%5B%5D=f&objects%5B%5D=e&objects%5B%5D=s&objects%5B%5D=a&objects%5B%5D=p&objects%5B%5D=w&topics%5B%5D=l&topics%5B%5D=c&topics%5B%5D=f&topics%5B%5D=a&topics%5B%5D=m&topics%5B%5D=r&topics%5B%5D=s&res=25&filesuns=all&curtab=f&order=&ordermode=desc&filesuns=all&page=2
19:59:18
Shark8
White_Flame, prokhor__ -- The HL/EL use/interaction (in the evo. paper) seems like using multiple prover-engines in Ada/SPARK: launch them all, and when one finished, terminate the other and produce the result.
20:00:08
White_Flame
but cyc is the only system that has achieve its level of capability and scale, which makes it interesting
20:01:18
prokhor__
thats why i am eager to see what it can do combined with that 5th gen stuff (cyc being a direct reaction to it)...
20:04:09
Shark8
Hm, Microtheories/Contexts has the feel of windows/virtual-tables in SQL, with a dash of stored-procedures/triggers.
20:04:50
prokhor__
is free to look at the Cyc KB and draw inferences as it requires them. " does that mean, it is query based(though multiple queries at once)?
20:04:56
White_Flame
it's a segmentation of the universe, allowing bounding the search as well as allowing discrepancies between how different microtheories describe things
20:05:41
White_Flame
but when you write a cyc application, you're intended to integrate it with cyc,not just have it as an external program talking to it
20:06:26
White_Flame
those are all up to you to implement, they are not "reactive" in that sense, except for indexing
20:06:56
White_Flame
but it's also intended to be a model of first dumping a lot of information into it, then querying it; as opposed to constantly asserting & retracting stateful information
20:30:01
prokhor__
White_Flame, Shark8 : given i have access to that: what do your gut-feelings say? could i implement / translate the cyc db into that framework?
20:34:58
Shark8
prokhor__, (that = ACE, or ADA/SPARK?) -- ASE is [IIUC] more about the querying, Ada/SPARK's are about theorem-proving, whereas Cyc is the DB representation (?), and CyCL is the Query/manipulation language (?)... all of these are separate "modules" and, in the whole-of-the-knowledgebase holistic-sense could all work together.
20:36:06
prokhor__
Shark8: well: the cyc db is implemented in cycl (ie its "records" are written in cycl).
20:36:30
Shark8
prokhor__, So, I think the answer is 'yes'... the real question though is how hard or easy would realizing the implementation *be*?
20:42:01
prokhor__
Shark8: the main constraint is, that i have to translate the facts from s-expressions automatically i cannot handle 10^x, x > 5, manually
20:44:35
Shark8
prokhor__, The LispWorks/KnowledgeWorks link you provided means you're using (or have access to) that system?
20:47:02
Shark8
prokhor__, I see a mention of a Prolog implementation/// was that what you were going to use? (i.e. automating the equivelant of translating the 'fact' to a prolog-statement and obtaining its CLOS-object?) Or am I misunderstanding your initial thrust/approach?
20:55:53
prokhor__
White_Flame: if i have to separate between "mere" facts & rules in the db: i was thinking of considering everything which has an arity a rule - do you think , that would be a valid approach (given your experience wth the db)?
20:56:26
White_Flame
every fact (foo 1 2) is semantically equivalent to the single rule (foo 1 2) <- (true)
20:57:17
White_Flame
most systems actually handle both heads equivalently, and an empty rule body is considered <- (true), so I'm not sure it makes much of a difference
20:57:47
prokhor__
which would mean, you could write every fact in cycs db as a rule (or vice-versa)(?)
20:57:47
White_Flame
interpreting the "<- (true)" body (instead of just having a quick-path test to true) might slow things down a bit
21:01:27
prokhor__
White_Flame: maybe youll have a look at the quixote kr language/db some time (implemented in guarded horn clauses)...
21:01:49
Shark8
prokhor__, That's a solid plan; the only things that I would recommend are: (1) have your "target" for the translation [mostly] fixed, e.g. as you said separating facts & rules, so that your "structure" is consistent; (2) consider whether or not [and how much] the Cyc/CycL views should be structured into it as well; and (3) consider whether it would be useful to have a common-interface such as using facts & rules interchangeably WRT the "public" or
21:01:50
Shark8
"private"-interface (that is to say, whether it would be useful to have "implementation-hidden" objects, using a good interface to "unify" interaction).
21:02:33
White_Flame
prokhor__: it doesn't seem on the surface that GHC changes the actual syntax all that much
21:03:08
White_Flame
in terms of what you can & can't do with prolog, but I haven't looked into quixote specifically, just read through taht ghc paper
21:06:43
prokhor__
https://www.airc.aist.go.jp/aitec-icot/ICOT/Museum/SOFTWARE/QUIXOTE/introE/primer1.html
21:39:02
prokhor__
Shark8, White_Flame: thx for the discussion btw, didnt have such a good talk in a while...
21:42:49
Shark8
prokhor__, I had a good talk, too; last year I was in the middle of going down the IR rabbit-hole, thinking about several things: how it would have been better if (e.g.) WebAssembly had done a more parallel-friendly design [akin to the conclusion in the Guy Steele vid], how to design the IR to be storable/decomposable in a DB, and how to manipulate such a DB-based IR.
21:48:46
prokhor__
but the essence of that vid, imho, is like White_Flame said: the implementor has to deal with the implementation, so the user doesnt have to...
21:58:03
Shark8
prokhor__, Yes, but again with the caveat that you can make things easier on yourself; as I used in the example upthread, you could have gotten an OS to be multi-core by writing the OS using the TASK/TASK TYPE in Ada and recompiling with a multicore aware compiler, exactly by minimizing your dependence on the implementation details (via usage of the TASK/TASK TYPE constructs).
21:59:51
prokhor__
i think there is not one correct answer to that... everybody does as he is used to/suits him best...
22:00:51
Shark8
In some sense it *is* sweeping things under the rug (ie being unconcerned that the TASK *might* be compiled with only a single-core assuming compiler) and putting the onus on the compiler, but on the other hand it's (a) using high-level specification/construction, and (b) allowing the abstraction to be interpreted/realized in some other manner.
22:00:57
prokhor__
i have some vague top-level ideas of my implementations, but i also test them by thinking about specific low-level problems in those cases...
22:03:58
Shark8
prokhor__, (re: Top-down vs Bottom-up) -- I've talked with some programmers who really love Ada because you can do some nice things like Top-down design and bottom-up implementation (in this case by defining the packages, types, and [visible] subprograms [as stubs], getting a clean compile, then "backfilling" by implementing them).