Skip to content

Commit

Permalink
hdplisp-on-racket (#18): libhxl-minimum +Rossetacode ref; I think we …
Browse files Browse the repository at this point in the history
…should have some basic racket function to abstract a bit already very well HXLated datasets
  • Loading branch information
fititnt committed Apr 17, 2021
1 parent b11a3bf commit a17fedf
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 6 deletions.
19 changes: 19 additions & 0 deletions hdpl-conventions/prototype/hdpl/commune/auxilium/explanare.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#lang racket
;; NOTE: this file is just a group of examples of how to debug internal racket structures.
;; it's not really intented to be used as part of the library
;; - "explanare":
;; - explano: https://en.wiktionary.org/wiki/explano#Latin
;; - explanare: https://en.wiktionary.org/wiki/explanare#Latin
;; - "auxilium":
;; - https://en.wiktionary.org/wiki/auxilium

; (require hdpl/commune/structuram)
(require csv-reading)


;; Print each line of a file; Uses https://docs.racket-lang.org/csv-reading/index.html
; Change the "ontologia/codicem/codicem.numerum.hxl.csv"
(csv-for-each
(lambda(x)
(writeln(string-join x)))
(make-csv-reader (open-input-file "ontologia/codicem/codicem.numerum.hxl.csv")))
11 changes: 7 additions & 4 deletions hdpl-conventions/prototype/hdpl/commune/constans.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
;; - "cōnstāns"
;; - https://en.wiktionary.org/wiki/constans#Latin

(require csv-reading)
(require data-frame)
(require hdpl/commune/structuram)
(require csv-reading)
(require data-frame)
(require hdpl/commune/structuram)

;; org.ocha.vocabulary->adm0
; https://docs.google.com/spreadsheets/d/1NjSI2LaS3SqbgYc0HdD8oIb7lofGtiHgoKKATCpwVdY/edit#gid=1088874596
Expand Down Expand Up @@ -68,8 +68,11 @@

; (csv->sxml (open-input-file "ontologia/codicem/codicem.numerum.hxl.csv"))


;; https://rosettacode.org/wiki/CSV_data_manipulation#Racket

;; Example of how to print line by line an CSV
(csv-for-each
(lambda(x)
(writeln(string-join x)))
(make-csv-reader (open-input-file "ontologia/codicem/codicem.numerum.hxl.csv")))
(make-csv-reader (open-input-file "ontologia/codicem/codicem.linguam.hxl.csv")))
32 changes: 30 additions & 2 deletions hdpl-conventions/prototype/hdpl/systema/libhxl-minimum.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,38 @@
'((separator-chars #\,))))


; (define generic-csv-reader "TODO")
;; Reference example from https://rosettacode.org/wiki/CSV_data_manipulation#Racket
; #lang racket
; (require (planet neil/csv:1:=7) net/url)

; (define make-reader
; (make-csv-reader-maker
; '((separator-chars #\,)
; (strip-leading-whitespace? . #t)
; (strip-trailing-whitespace? . #t))))

; (define (all-rows port)
; (define read-row (make-reader port))
; (define head (append (read-row) '("SUM")))
; (define rows (for/list ([row (in-producer read-row '())])
; (define xs (map string->number row))
; (append row (list (~a (apply + xs))))))
; (define (->string row) (string-join row "," #:after-last "\n"))
; (string-append* (map ->string (cons head rows))))


; (define hxl-reader "TODO")

; (csv->sxml (open-input-file "ontologia/codicem/codicem.numerum.hxl.csv"))
(csv->list (open-input-file "ontologia/codicem/codicem.numerum.hxl.csv"))
(csv->list (open-input-file "ontologia/codicem/codicem.numerum.hxl.csv"))



;; Print each line of a file; Uses https://docs.racket-lang.org/csv-reading/index.html
; Change the "ontologia/codicem/codicem.numerum.hxl.csv"
(csv-for-each
(lambda(x)
(writeln(string-join x)))
(make-csv-reader (open-input-file "ontologia/codicem/codicem.numerum.hxl.csv")))

;; See https://rosettacode.org/wiki/CSV_data_manipulation#Racket

0 comments on commit a17fedf

Please sign in to comment.