Using apl_in_the_shell which makes the APL language command line friendly.
Calculate the total distance between two lists of location IDs by sorting both lists and summing the absolute differences between paired elements.
| torusVowels←{ | |
| v← ⎕av ⍝ vector of chars (that we index into) | |
| c← v⍳⍵ ⍝ c as in cipher text (using indexes instead of chars) | |
| m←c∊v⍳'aeiou' ⍝ mask of vowels | |
| v[(m\¯1⌽0~⍨m×c)+ c×~m] | |
| ⍝ ^ keep the consonants | |
| ⍝ ^ select the only vowels | |
| ⍝ ^ then do a ¯1 rotate to shift them to the right | |
| ⍝ ^ finally expand using the mask so we can recombine vowels and consonants | |
| } |
| PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
| PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
| PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |
| prefix bfo: <http://purl.obolibrary.org/obo/> | |
| prefix cco: <https://www.commoncoreontologies.org/> | |
| prefix owl: <http://www.w3.org/2002/07/owl#> | |
| select * where { | |
| ?s a owl:ObjectProperty . | |
| # ?s a owl:DatatypeProperty . | |
| # ?s a owl:Class . |
| # APL | |
| v←'RAFT DATA PLATFORM' | |
| f←1∘⌽⍤(0 0∘,)⍤(' '∘(3∧/≠)) | |
| f v | |
| 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 1 1 0 | |
| ⍉v(,⍤0)f v | |
| R A F T D A T A P L A T F O R M | |
| 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 1 1 0 |
| ⎕IO←0 | |
| m←2 3 4 3⍴⍳72 | |
| ⍝ the goal is to reproduce this numpy broadcasting behavior in APL | |
| ⍝ m/m.sum(axis=0, keepdims=True) | |
| normalize_and_keepdims←{⍵÷(⍴⍵)⍴(⍺⌷⍴⍵)/[(0⌈⍺-1)]+/[⍺]⍵} | |
| 0 normalize_and_keepdims m | |
| 0 0.02631578947 0.05 |
| @prefix : <http://example.org/pizza#> . | |
| @prefix owl: <http://www.w3.org/2002/07/owl#> . | |
| @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
| @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |
| :hasTopping a owl:ObjectProperty . | |
| :VegetablePizza a owl:Class ; | |
| owl:equivalentClass [ |
| # using https://github.com/justin2004/apl_in_the_shell | |
| justin@parens:~/Downloads$ curl "https://en.wikipedia.org/w/api.php?action=query&prop=extracts&explaintext&format=json&titles=St._Louis" | jq '.query.pages[].extract' | apl '{a←{⍺,≢⍵}⌸⎕C∊⍵⋄a⌷⍨⊂⍒⌽a}' - | |
| 1956 | |
| e 1119 | |
| t 915 | |
| i 844 | |
| s 781 | |
| a 735 |
| { | |
| "openapi": "3.0.3", | |
| "info": { | |
| "title": "News API", | |
| "version": "1.0.0", | |
| "description": "Simple OpenAPI spec for /everything endpoint" | |
| }, | |
| "servers": [ | |
| { | |
| "url": "https://newsapi.org" |
| name | height | |
|---|---|---|
| bob | 213 | |
| fred | 41 |
Using apl_in_the_shell which makes the APL language command line friendly.
Calculate the total distance between two lists of location IDs by sorting both lists and summing the absolute differences between paired elements.
| SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |
| optional {?p ^(wikibase:claim|wikibase:directClaim|wikibase:statementProperty|wikibase:qualifierValue|wikibase:qualifier) ?pEntity} |