• w

    Will

    2 years ago
    One high-level connection I’ve been investigating is functional programming <-> logic programming. Languages like Rust and Haskell have a Prolog-esque logic programming language in their type system via traits/typeclasses. This allows you to do some cool type-level programming (distinct from compile-time metaprogramming and partial evaluation!!), but writing raw traits is super gnarly. So I’ve been working on a language to bridge the gap: https://github.com/willcrichton/tyrade
    w
    w
    +1
    6 replies
    Copy to Clipboard
  • w

    wtaysom

    2 years ago
    What are types anyway? For the Cish person, the "type" tells you basically how many bytes there are in a thing. That's not very satisfying. Another take is that a type is sort of the collection of things that satisfies a predicate, which leads to computability and contradiction questions. Somehow I feel systems with a principal type property find a sweet spot. A principal type captures some real abstraction from the details of a program.
    w
    Duncan Cragg
    +4
    14 replies
    Copy to Clipboard
  • Nick Smith

    Nick Smith

    2 years ago
    Just to declare my own work: I'm working on a general-purpose logic programming system. My fundamental goal (life purpose?) is to remove as many unnecessary concerns on the path from ideas to implementation as I can identify, and I think logic programming offers hope for that, specifically because it's the simplest (only?) programming paradigm that doesn't immediately introduce unnecessary concerns like "call stacks" and hierarchical "data structures". Why am I using those innocent-looking concepts as examples? Because they induce a plethora of ancillary concepts and architectural patterns that have nothing to do with the problem domain itself. Call stacks demand value-shuffling, and data structures demand traversal code. There's a lot more to say, but that's a glimpse of my headspace.
    Nick Smith
    CocoaGeek
    +2
    7 replies
    Copy to Clipboard
  • Nick Smith

    Nick Smith

    2 years ago
    That said, no logic language (or system) currently exists that can act as a substitute for traditional paradigms. So I'm stuck trying to invent my own semantics, based on some of the most primal existing work (e.g. Datalog), but hugely-extended such that it can hopefully become general-purpose.
    Nick Smith
    w
    4 replies
    Copy to Clipboard
  • Nick Smith

    Nick Smith

    2 years ago
    I've been working on tackling the chicken-egg problems of semantics, syntax, compilation, and system concerns (graphics APIs in a logic language!) by doing explorations in each of these areas in a cyclical fashion over the last year or so. I haven't really built much yet, because I haven't had a full picture of what needs to be built! I'm currently working on this project full time, on my own dime.
    Nick Smith
    Prathyush
    +1
    8 replies
    Copy to Clipboard
  • c

    Chris G

    2 years ago
    What's the best logic lang for noobs? (I know datalog is teh hotness, just want to invest hours in the right place) Is there a good primer you'd recommend?
    c
    a
    +7
    23 replies
    Copy to Clipboard
  • d

    Drewverlee

    2 years ago
    I purpose that logic programming is about decoupling how information was added to a system from re-actively taking action on that information. This model is particularly important in traditional browser/front-end applications. The current front end ecosystem structures applications in terms of the DOM, but its also valuable to view But really we need tools that can view the system through either the DOM view or the Action based view. To be concrete: traditional dom view: html when event then html/action/etc... action view action when event then html/action/etc... The key to having both these views is that the system be encoded in such a way that it can read itself and produce multiple views. The closest implementation i have seen to realizing an efficient version of this is https://github.com/oakes/odoyle-rum-todo. Though it doesn't actively try to realize multiple views, the data centric approach gives me how that tools can easily read it to provide this. Here we see the action that effects the footer.
    [:what
          [::global ::all-todos all-todos]
          [::global ::showing showing]
          :then
          (let [*session (orum/prop)
                active-todos (remove :done all-todos)
                completed-todos (filter :done all-todos)
                active (count active-todos)
                completed (count completed-todos)
                filter-attrs (fn [filter-kw]
                               {:class (when (= filter-kw showing) "selected")
                                :on-click #(insert! *session ::global {::showing filter-kw})})]
            [:footer#footer
             [:span#todo-count
              [:strong active] " " (case active 1 "item" "items") " left"]
             [:ul#filters
              [:li [:a (filter-attrs :all) "All"]]
              [:li [:a (filter-attrs :active) "Active"]]
              [:li [:a (filter-attrs :completed) "Completed"]]]
             (when (pos? completed)
               [:button#clear-completed {:on-click #(run! (partial retract! *session)
                                                          (map :id completed-todos))}
                "Clear completed"])])]
    d
    Nick Smith
    2 replies
    Copy to Clipboard
  • shalabh

    shalabh

    2 years ago
    What do folks think about situational calculus? http://artint.info/html/ArtInt_335.html Specifically I'm interested in ideas and projects where this has been used in "high level programing". One example is that I specify I want to "add a message to a room". This is my goal. This requires planning, e.g. looking at the current situation I see that the message is on client, room is a database on server. Then I determine the sequence of smaller steps (send message to server, append message to db). Often we do the planning in our heads and write out the plan by hand, but can situational calculus help us use the computer to do this planning if we specify the high level goals? It could even provide multiple altenrnative plans and maybe we could choose? Have you seen examples of such use?
    shalabh
    Prathyush
    +1
    5 replies
    Copy to Clipboard
  • Nick Smith

    Nick Smith

    2 years ago
    Has anyone encountered Dyna before? The project seems to be abandoned now (hence archived link), but it's a logic language that generalises Datalog (a binary logic) to a "weighted logic". Essentially, every fact in the program can be associated with an aggregate number, rather than just "true" and "false". I'm particularly curious whether this is a good approach for providing aggregation in a logic language. Aggregation is an essential feature for writing a non-trivial logic program, but I don't like the kind of aggregation made available in Prolog and traditional Datalog extensions: they feel far too clunky. You could describe the difference as: "Datalog aggregates by combining reads" whereas "Dyna aggregates by combining writes". I'm going to deep dive into Dyna; it would be good to know if anyone here has already explored it 🙂
    Nick Smith
    2 replies
    Copy to Clipboard
  • j

    Jack Rusher

    2 years ago
    @Nick Smith IIRC, their new work is all against Dyna-R, for which there's another repo. (No time to go hunting just now.)
    j
    Nick Smith
    +1
    10 replies
    Copy to Clipboard